aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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