Skip to content

Commit

Permalink
Switch from perl-build to perl-install, which doesn't require perl
Browse files Browse the repository at this point in the history
  • Loading branch information
merrilymeredith committed Jan 10, 2022
1 parent 8e5332d commit 54311ea
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
10 changes: 5 additions & 5 deletions bin/install
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ install_perl() {
echoerr "For a list of available versions, see \`asdf list-all perl\`."
exit 1
fi
install_or_update_perl_build
install_or_update_perl_install

local build_args=("-j${concurrency}" -Dusethreads)
local build_args=("-j=${concurrency}" -Dusethreads)
if is_development_version "$version"; then
build_args+=(-Dusedevel --symlink-devel-executables)
fi
echo "perl-build ${build_args[@]} $version $install_path"
$(perl_build_path) "${build_args[@]}" "$version" "$install_path"
echo "perl-install ${build_args[@]} $version $install_path"
$(perl_install_bin) "${build_args[@]}" "$version" "$install_path"
}

install_cpanm() {
Expand Down Expand Up @@ -75,7 +75,7 @@ is_development_version() {
return 0
}

ensure_perl_build_installed
ensure_perl_install_installed
install_perl "$ASDF_INSTALL_TYPE" "$ASDF_INSTALL_VERSION" "$ASDF_INSTALL_PATH"
install_cpanm "$ASDF_INSTALL_PATH"
install_default_perl_modules
4 changes: 2 additions & 2 deletions bin/list-all
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
source "$(dirname "$0")/utils.sh"

list_all() {
install_or_update_perl_build
$(perl_build_path) --definitions | tac | tr '\n' ' '
install_or_update_perl_install
$(perl_install_bin) --list-all | tac | tr '\n' ' '
}

list_all
36 changes: 18 additions & 18 deletions bin/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,32 @@ echoerr() {
printf "\033[0;31m%s\033[0m" "$1" >&2
}

ensure_perl_build_installed() {
if [ ! -f "$(perl_build_path)" ]; then
download_perl_build
ensure_perl_install_installed() {
if [ ! -f "$(perl_install_bin)" ]; then
download_perl_install
fi
}

download_perl_build() {
echo "Downloading perl-build..." >&2
local perl_build_url="https://github.com/tokuhirom/Perl-Build.git"
git clone --depth 1 $perl_build_url "$(perl_build_checkout)"
download_perl_install() {
echo "Downloading perl-install..." >&2
local perl_install_url="https://github.com/skaji/perl-install.git"
git clone --depth 1 $perl_install_url "$(perl_install_checkout)"
}

perl_build_checkout() {
echo "$(dirname $(dirname $0))/perl-build"
perl_install_checkout() {
echo "$(dirname $(dirname $0))/perl-install"
}

perl_build_path() {
echo "$(perl_build_checkout)/bin/perl-build"
perl_install_bin() {
echo "$(perl_install_checkout)/perl-install"
}

update_perl_build() {
cd "$(perl_build_checkout)" && git fetch && git reset --hard origin/master > /dev/null 2>&1
update_perl_install() {
cd "$(perl_install_checkout)" && git fetch && git reset --hard origin/HEAD > /dev/null 2>&1
}

update_timestamp_path() {
echo "$(perl_build_checkout)/.git/FETCH_HEAD"
echo "$(perl_install_checkout)/.git/FETCH_HEAD"
}

should_update() {
Expand All @@ -45,10 +45,10 @@ should_update() {
[ $invalidated_at -lt $current_timestamp ]
}

install_or_update_perl_build() {
if [ ! -f "$(perl_build_path)" ]; then
download_perl_build
install_or_update_perl_install() {
if [ ! -f "$(perl_install_bin)" ]; then
download_perl_install
elif should_update; then
update_perl_build
update_perl_install
fi
}

0 comments on commit 54311ea

Please sign in to comment.