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@gentoo.org>
This commit is contained in:
William Hubbs 2025-02-20 12:05:07 -06:00
parent eeb882771d
commit 037dca29a9
No known key found for this signature in database
GPG Key ID: DFDDE1809F0F9344

View File

@ -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}"