diff options
Diffstat (limited to 'lib/actions')
-rw-r--r-- | lib/actions/dist.bash | 9 | ||||
-rw-r--r-- | lib/actions/fetch.bash | 22 | ||||
-rw-r--r-- | lib/actions/install.bash | 19 |
3 files changed, 34 insertions, 16 deletions
diff --git a/lib/actions/dist.bash b/lib/actions/dist.bash index 3b06b4f..5da5e49 100644 --- a/lib/actions/dist.bash +++ b/lib/actions/dist.bash @@ -11,7 +11,7 @@ action() { info "Creating distribution contents at $WORKDIR" - cd -- "$BASEDIR" + chgdir "$BASEDIR" # Include files from this project for file in $(git ls-files) @@ -26,7 +26,7 @@ action() { done # Add a MANIFEST.txt - cd -- "$WORKDIR" + chgdir "$WORKDIR" find . > MANIFEST.txt # Tar it all up into a distribution tarball @@ -35,10 +35,13 @@ action() { local tarball="$BASEDIR/dist/rakudo-star-$version.tar.gz" mkdir -p -- "$(dirname "$tarball")" - cd -- "$BASEDIR/tmp" + chgdir "$BASEDIR/tmp" tar czf "$tarball" "rakudo-star-$version" + # TODO: Create checksums + # TODO: Create PGP signature + info "Distribution tarball available at $tarball" } diff --git a/lib/actions/fetch.bash b/lib/actions/fetch.bash index c489608..2b932be 100644 --- a/lib/actions/fetch.bash +++ b/lib/actions/fetch.bash @@ -1,6 +1,6 @@ #!/usr/bin/env bash -RSTAR_DEPS_BIN=( +RSTAR_DEPS_BIN+=( awk curl git @@ -20,22 +20,26 @@ action() { mkdir -p "$BASEDIR/dist/src/modules" # Download all modules available over http - list_modules "http" | while read -r name proto url prefix + list_modules "http" | while read -r name _ url prefix do download_module_http "$name" "$url" "$prefix" done # Download all modules available over git - list_modules "git" | while read -r name proto url ref + list_modules "git" | while read -r name _ url ref do download_module_git "$name" "$url" "$ref" done } download_core() { - local version="$(config_etc_kv "dist_$1.txt" "version")" - local source="$(echo "$(config_etc_kv "dist_$1.txt" "url")" | sed "s/%s/$version/g")" - local destination="$BASEDIR/dist/src/core/$1-$version" + local version + 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")" + destination="$BASEDIR/dist/src/core/$1-$version" if [[ -d $destination ]] then @@ -76,6 +80,8 @@ download_module_http() { local url=$2 local prefix=$3 local destination="$BASEDIR/dist/src/modules/$name" + local tarball + local extracted if [[ -d "$destination" ]] then @@ -83,8 +89,8 @@ download_module_http() { return 0 fi - local tarball="$(fetch "$url")" - local extracted="$(tempdir)" + tarball="$(fetch "$url")" + extracted="$(tmpdir)" notice "Extracting $tarball into $extracted" tar xzf "$tarball" -C "$extracted" diff --git a/lib/actions/install.bash b/lib/actions/install.bash index 30b88dd..b2faefd 100644 --- a/lib/actions/install.bash +++ b/lib/actions/install.bash @@ -14,12 +14,15 @@ RSTAR_DEPS_PERL+=( action() { local OPTIND + local prefix_absolute + local modules while getopts ":b:p:" opt do case "$opt" in b) RSTAR_BACKEND=$OPTARG ;; p) RSTAR_PREFIX=$OPTARG ;; + *) emerg "Invalid option specified: $opt" ;; esac done @@ -27,7 +30,7 @@ action() { # TODO: Check if binaries are available mkdir -p -- "$RSTAR_PREFIX" - local prefix_absolute="$(CDPATH="" cd -- "$RSTAR_PREFIX" && pwd -P)" + prefix_absolute="$(CDPATH="" cd -- "$RSTAR_PREFIX" && pwd -P)" info "Installing Raku in $prefix_absolute" @@ -45,8 +48,11 @@ action() { # Install community modules failed_modules=() + modules="$(tmpfile)" - for module in $(awk '/^[^#]/ {print $1}' "$BASEDIR/etc/modules.txt") + awk '/^[^#]/ {print $1}' "$BASEDIR/etc/modules.txt" > "$modules" + + while read -r module do info "Installing $module" @@ -54,10 +60,10 @@ action() { && continue failed_modules+=("$module") - done + done < "$modules" # Show a list of all modules that failed to install - if [[ $failed_modules ]] + if [[ ${failed_modules[*]} ]] then crit "The following modules failed to install:" @@ -68,6 +74,7 @@ action() { fi # Friendly message + # TODO: Add information on the time it took" info "Rakudo Star has been installed into $prefix_absolute!" info "You may need to add the following paths to your \$PATH:" info " $prefix_absolute/bin" @@ -113,7 +120,9 @@ build_rakudo() { build_prepare() { local source="$1" - local destination="$(tempdir)" + local destination + + destination="$(tmpdir)" notice "Using $destination as working directory" |