Skip to content

Instantly share code, notes, and snippets.

@d3v-null
Last active May 23, 2024 09:13
Show Gist options
  • Save d3v-null/be671f420803c9fa70e1ba6d86bc6a16 to your computer and use it in GitHub Desktop.
Save d3v-null/be671f420803c9fa70e1ba6d86bc6a16 to your computer and use it in GitHub Desktop.
install modern rust versions on ancient spack
export SPACK_FUTURE_VER=0.20.0
export PACKAGES="rust"
# doesn't work:
# export SPACK_FUTURE_VER=0.21.0
# export PACKAGES="rust rust-bootstrap"
for package in $PACKAGES; do
cd ${MYSOFTWARE}/setonix/2023.08/spack_repo/packages/
rm -rf $package
mkdir -p $package
cd $package
wget https://raw.githubusercontent.com/spack/spack/v${SPACK_FUTURE_VER}/var/spack/repos/builtin/packages/${package}/package.py
sed -i '/maintainers/d' package.py
done
# calculate checksums with
# export version=1.70.0
# echo src $version $(curl -s https://static.rust-lang.org/dist/rustc-${version}-src.tar.gz | sha256sum | cut -f1)
# for target in x86_64-unknown-linux-gnu powerpc64le-unknown-linux-gnu aarch64-unknown-linux-gnu x86_64-apple-darwin aarch64-apple-darwin; do
# echo bootstrap $target $(curl -s https://static.rust-lang.org/dist/rust-${version}-${target}.tar.gz | sha256sum | cut -f1 )
# done
cat > /tmp/rust_bootstrap.txt << EOF
"1.70.0": {
"x86_64-unknown-linux-gnu": "8499c0b034dd881cd9a880c44021632422a28dc23d7a81ca0a97b04652245982",
"powerpc64le-unknown-linux-gnu": "ba8cb5e3078b1bc7c6b27ab53cfa3af14001728db9a047d0bdf29b8f05a4db34",
"aarch64-unknown-linux-gnu": "3aa012fc4d9d5f17ca30af41f87e1c2aacdac46b51adc5213e7614797c6fd24c",
"x86_64-apple-darwin": "e5819fdbfc7f1a4d5d82cb4c3b7662250748450b45a585433bfb75648bc45547",
"aarch64-apple-darwin": "75cbc356a06c9b2daf6b9249febda0f0c46df2a427f7cc8467c7edbd44636e53",
},
EOF
# append the above lines after the line ` rust_releases = {`
sed -i '/rust_releases = {/r /tmp/rust_bootstrap.txt' ${MYSOFTWARE}/setonix/2023.08/spack_repo/packages/rust/package.py
# append the line `version("1.70.0", sha256="b2bfae000b7a5040e4ec4bbc50a09f21548190cb7570b0ed77358368413bd27c")` above the line `version("1.65.0", sha256="5828bb67f677eabf8c384020582b0ce7af884e1c84389484f7f8d00dd82c0038")`
sed -i '/version("1.65.0"/i \ version("1.70.0", sha256="b2bfae000b7a5040e4ec4bbc50a09f21548190cb7570b0ed77358368413bd27c")' ${MYSOFTWARE}/setonix/2023.08/spack_repo/packages/rust/package.py
module load spack/0.19.0
spack env activate --temp -p
spack add rust@1.70.0
spack install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment