From c87fad5fc02cc8a611a25bae5618c1dd6d651a52 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 28 Apr 2017 20:39:42 +0200 Subject: Adjust to handle standard version in toolchain --- buildos | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/buildos b/buildos index 7c7822e..dcdde65 100755 --- a/buildos +++ b/buildos @@ -479,28 +479,32 @@ function toolchain_fetch () # return 1 fi - # Extract the version. + # Extract the version and derive a predictable name link. # tv="$(toolchain_value "$tp" toolchain_ver)" if [ -z "$tv" ]; then - tv="$(sed -n -re 's/build2-toolchain-(.+)\.tar.*/\1/p' <<<"$f")" + tv="$(sed -n -re 's/^build2-toolchain-(.+)\.tar.*/\1/p' <<<"$f")" if [ -z "$tv" ]; then info "unable to extract toolchain version from '$f'" return 1 fi - declare -g "${tp}toolchain_ver=$tv" - info "toolchain version $tv" + + l="$(sed -n -re "s/^(.+)-$tv(.*)$/\1\2/p" <<<"$f")" # Use full version. + + # Strip snapshot. + # + tv="$(sed -n -re 's/^([^.]+\.[^.]+\.[^-]+(-[ab]\.[^.+]+)?).*/\1/p' <<<"$tv")" + + declare -g "${tp}toolchain_ver=$tv" echo "$tv" >"$tr/version" + else + l="$(sed -n -re "s/^(.+)-$tv(.*)$/\1\2/p" <<<"$f")" fi - # Derive a predictable name link. - # - l="$(sed -n -re "s/^(.+)-$tv(.*)$/\1\2/p" <<<"$f")" - if [ -z "$l" ]; then info "unable to derive predicatable name from '$f' and '$tv'" return 1 @@ -586,7 +590,7 @@ function toolchain_bootstrap () # break fi - cd "build2-toolchain-$tv" + cd "build2-toolchain-$tv"*/ # Bootstrap, stage, and install using the provided build.sh script. # @@ -596,7 +600,7 @@ function toolchain_bootstrap () # fi cd "$wd" - rm -r "build2-toolchain-$tv" + rm -r "build2-toolchain-$tv"*/ mv -T build2-toolchain-* build2-toolchain # Strip version. r=0 -- cgit v1.1