From 1a3c36278c39a275455a0a524f8a494d90f77324 Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Sun, 29 Mar 2020 17:37:01 +0200 Subject: Consolidate fetch data in fetch_core.txt --- lib/actions/clean.bash | 1 + lib/actions/dist.bash | 3 +++ lib/actions/fetch.bash | 4 ++-- lib/actions/install.bash | 20 +++++++++++--------- lib/actions/test.bash | 2 +- 5 files changed, 18 insertions(+), 12 deletions(-) (limited to 'lib/actions') diff --git a/lib/actions/clean.bash b/lib/actions/clean.bash index 0ed521d..eec2736 100644 --- a/lib/actions/clean.bash +++ b/lib/actions/clean.bash @@ -27,5 +27,6 @@ action() { if [[ $clean_src ]] then rm -fr -- "$BASEDIR/src" + rm -f -- "$BASEDIR/etc/epoch.txt" fi } diff --git a/lib/actions/dist.bash b/lib/actions/dist.bash index 137576d..434c981 100644 --- a/lib/actions/dist.bash +++ b/lib/actions/dist.bash @@ -45,6 +45,9 @@ action() { # Include the component sources dist_include "/src" + # Set the SOURCE_DATE_EPOCH for the installation phase + printf "%d\n" "$SOURCE_DATE_EPOCH" > "$WORKDIR/etc/epoch.txt" + # Add a MANIFEST.txt chgdir "$WORKDIR" touch MANIFEST.txt diff --git a/lib/actions/fetch.bash b/lib/actions/fetch.bash index 8582865..8af563f 100644 --- a/lib/actions/fetch.bash +++ b/lib/actions/fetch.bash @@ -37,8 +37,8 @@ download_core() { local source local destination - version="$(config_etc_kv "dist_$1.txt" "version")" - source="$(config_etc_kv "dist_$1.txt" "url" | sed "s/%s/$version/g")" + version="$(config_etc_kv "fetch_core.txt" "${1}_version")" + source="$(config_etc_kv "fetch_core.txt" "${1}_url" | sed "s/%s/$version/g")" destination="$BASEDIR/src/$1-$version" if [[ -d $destination ]] diff --git a/lib/actions/install.bash b/lib/actions/install.bash index 42c27f5..0295fb1 100644 --- a/lib/actions/install.bash +++ b/lib/actions/install.bash @@ -18,6 +18,7 @@ action() { local SOURCE_DATE_EPOCH local duration local init + local prefix_absolute while getopts ":b:p:" opt do @@ -32,9 +33,12 @@ action() { # Prepare environment for a reproducible install LC_ALL=C.UTF-8 - SOURCE_DATE_EPOCH="$(git log -1 --pretty=format:%at)" - debug "SOURCE_DATE_EPOCH set to $SOURCE_DATE_EPOCH" + if [[ -f "$BASEDIR/etc/epoch.txt" ]] + then + SOURCE_DATE_EPOCH="$(head -n1 "$BASEDIR/etc/epoch.txt")" + debug "SOURCE_DATE_EPOCH set to $SOURCE_DATE_EPOCH (epoch.txt)" + fi export LC_ALL export SOURCE_DATE_EPOCH @@ -49,6 +53,10 @@ action() { # on init="$(date +%s)" + # Use an absolute path when reporting about the installation path + prefix_absolute="$(CDPATH="" cd -- "$RSTAR_PREFIX" && pwd -P)" + info "Installing Raku in $prefix_absolute" + # Create the installation directory mkdir -p -- "$RSTAR_PREFIX" @@ -78,16 +86,10 @@ action() { } action_install_core() { - local prefix_absolute - - prefix_absolute="$(CDPATH="" cd -- "$RSTAR_PREFIX" && pwd -P)" - - info "Installing Raku in $prefix_absolute" - # Compile all core components for component in moarvm nqp rakudo do - VERSION="$(config_etc_kv "dist_$component.txt" "version")" \ + VERSION="$(config_etc_kv "fetch_core.txt" "${component}_version")" \ build_"$component" \ --prefix="$RSTAR_PREFIX" \ --relocatable \ diff --git a/lib/actions/test.bash b/lib/actions/test.bash index f95be96..820a689 100644 --- a/lib/actions/test.bash +++ b/lib/actions/test.bash @@ -104,7 +104,7 @@ action_test_spectest() { local source destination="$(tmpdir)" - source="$BASEDIR/src/rakudo-$(config_etc_kv "dist_rakudo.txt" "version")" + source="$BASEDIR/src/rakudo-$(config_etc_kv "fetch_core.txt" "rakudo_version")" notice "Using $destination as working directory" -- cgit v1.1