commit: 037dca29a9ebfd9217abc98d798cd15280537251
Author: William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 20 18:05:07 2025 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu Feb 20 18:05:07 2025 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=037dca29
dev-lang/go-bootstrap/files/make-go-bootstraps: cleanups
- fix the definitions of GO_TAG and GO_VERSION
- use a shallow clone when we clone the source
- clean up the build directory as we go
- store the tarballs under the user's home directory
- remove some verbose output
- fix array expansion
Signed-off-by: William Hubbs <williamh <AT> gentoo.org>
dev-lang/go-bootstrap/files/make-go-bootstraps | 32 ++++++++++++--------------
1 file changed, 15 insertions(+), 17 deletions(-)
diff --git a/dev-lang/go-bootstrap/files/make-go-bootstraps
b/dev-lang/go-bootstrap/files/make-go-bootstraps
index 8340dbaecfd8..6ad27296b57e 100755
--- a/dev-lang/go-bootstrap/files/make-go-bootstraps
+++ b/dev-lang/go-bootstrap/files/make-go-bootstraps
@@ -31,25 +31,23 @@ go_tuples=(
solaris-amd64
)
-go_version=$(go version)
-go_version=${go_version##*go}
-go_version=${go_version%% *}
+go_tag=$(go env GOVERSION)
+go_version=${go_tag#go}
+go_repo="https://github.com/golang/go"
build_path=$(mktemp -d /tmp/go-bootstraps-XXXXXX)
-pushd "${build_path}"
-git clone https://github.com/golang/go.git
-cd go
-git checkout go"${go_version}"
-cd src
-for tuple in ${go_tuples[@]}; do
+pushd "${build_path}" > /dev/null
+git clone --depth 1 --quiet --branch "${go_tag}" "${go_repo}"
"${build_path}/go"
+for tuple in "${go_tuples[@]}"; do
printf "Building go version %s bootstrap tarball for %s\n"
"${go_version}" "${tuple}"
+ pushd go/src > /dev/null
GO386=softfloat GOOS=${tuple%%-*} GOARCH=${tuple##*-} ./bootstrap.bash
- rm -fr ../../go-${tuple}-bootstrap
+ git clean -d -f -x
+ popd > /dev/null
+ rm -fr "go-${tuple}-bootstrap"
+ mv "go-${tuple}-bootstrap.tbz" "go-bootstrap-${go_version}-${tuple}.tbz"
done
-cd ../..
rm -fr go
-for f in *tbz; do
- mv "${f}" "${f/go/go-${go_version}}"
- done
-popd
-mv "${build_path}" "${build_path%-*}"
-printf "The bootstrap tarballs are stored in %s\n" "${build_path%-*}"
+popd /dev/null
+final_path="${HOME}/go-bootstrap-${go_version}"
+mv "${build_path}" "${final_path}"
+printf "The bootstrap tarballs are stored in %s\n" "${final_path}"