aboutsummaryrefslogtreecommitdiff
path: root/buildos
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-04-28 20:39:42 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-04-28 20:39:42 +0200
commitc87fad5fc02cc8a611a25bae5618c1dd6d651a52 (patch)
treea227626bbdc9443e32851012478d75ab7e76f9a0 /buildos
parentb8d95ec9ec9bd95740c61f79260a7f93ce455488 (diff)
Adjust to handle standard version in toolchain
Diffstat (limited to 'buildos')
-rwxr-xr-xbuildos24
1 files 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 () # <toolchain-prefix> <line>
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 () # <toolchain-name>
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 () # <toolchain-name>
fi
cd "$wd"
- rm -r "build2-toolchain-$tv"
+ rm -r "build2-toolchain-$tv"*/
mv -T build2-toolchain-* build2-toolchain # Strip version.
r=0