From b22093da35bf468374976ac3b2b779919ad78609 Mon Sep 17 00:00:00 2001 From: Marc Mengel Date: Tue, 4 Jun 2024 16:48:47 -0500 Subject: [PATCH 01/26] adding draft of customize script --- bin/new_customize | 57 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100755 bin/new_customize diff --git a/bin/new_customize b/bin/new_customize new file mode 100755 index 0000000..2e0e39f --- /dev/null +++ b/bin/new_customize @@ -0,0 +1,57 @@ +#!/bin/sh + +# +# new_customize -- customize an upstream spack instance with fermi customizations +# + + +add_fermi_submodules() { + + # + # Add git submodules we want in our distribution. + # + # This: + # * puts our platform specific configs in the linux subdirectory, + # * puts our spack extension packages where the above configs say they are + # * adds recipe repositories we want + # * we could add a macos or other os specialization as well... + # + + while read dir repo + do + git submodule add --depth 2 $repo $dir + done < setup-env.sh + : > setup-env.csh + while read var val + do + echo setenv $var $val >> setup-env.csh + echo export $var=$val >> setup-env.sh + done <> setup-env.csh + echo source $PWD/share/spack/setups.sh >> setup-env.sh +} + +add_fermi_submodules +add_fermi_setups From ed4ce92668680919ac18664dfa465e141abfdd0b Mon Sep 17 00:00:00 2001 From: Marc Mengel Date: Fri, 7 Jun 2024 09:31:00 -0500 Subject: [PATCH 02/26] artdaq repo as well --- bin/new_customize | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/bin/new_customize b/bin/new_customize index 2e0e39f..cb55559 100755 --- a/bin/new_customize +++ b/bin/new_customize @@ -19,15 +19,17 @@ add_fermi_submodules() { while read dir repo do - git submodule add --depth 2 $repo $dir + git submodule add -f $repo $dir done < setup-env.sh - : > setup-env.csh while read var val do - echo setenv $var $val >> setup-env.csh - echo export $var=$val >> setup-env.sh + echo setenv $var $val >> share/spack/setup-env.csh + echo export $var=$val >> share/spack/setup-env.sh done <> setup-env.csh - echo source $PWD/share/spack/setups.sh >> setup-env.sh } add_fermi_submodules From b2d2779356e186f88ab87db49bb42299d62c5fab Mon Sep 17 00:00:00 2001 From: Marc Mengel Date: Fri, 7 Jun 2024 15:28:36 -0500 Subject: [PATCH 03/26] sigh --- bin/new_customize | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/new_customize b/bin/new_customize index cb55559..fc0aef4 100755 --- a/bin/new_customize +++ b/bin/new_customize @@ -24,7 +24,8 @@ add_fermi_submodules() { etc/spack/linux https://github.com/marcmengel/fermi-etc-spack-linux.git var/spack/extensions/spack-installdir https://github.com/marcmengel/spack-installdir.git var/spack/extensions/spack-subspack https://github.com/marcmengel/spack-subspack.git - var/spack/extensions/spack-linuxexternas https://github.com/marcmengel/spack-linuxexternals.git + var/spack/extensions/spack-linuxexternals https://github.com/marcmengel/spack-linuxexternals.git + var/spack/extensions/spack-localbuildcache https://github.com/marcmengel/spack-localbuildcache.git var/spack/extensions/spack-mpd https://github.com/knoepfel/spack-mpd.git var/spack/repos/fnal_art https://github.com/fnalSSI/fnal_art.git var/spack/repos/nusofthep-spack-recipes https://github.com/NuSoftHEP/nusofthep-spack-recipes.git From 597cad958bfc90ce40d3011ee6b23a47e33f535d Mon Sep 17 00:00:00 2001 From: Marc Mengel Date: Thu, 25 Jul 2024 10:28:22 -0500 Subject: [PATCH 04/26] first round of new make_spack --- bin/make_spack | 349 +++++++++------------------------------------- bin/new_customize | 3 +- 2 files changed, 71 insertions(+), 281 deletions(-) mode change 100755 => 100644 bin/make_spack diff --git a/bin/make_spack b/bin/make_spack old mode 100755 new mode 100644 index ec394fd..b7ce6a0 --- a/bin/make_spack +++ b/bin/make_spack @@ -1,214 +1,73 @@ #!/bin/bash - -spackbindir=`echo $0 | sed -e 's;make_spack;;' ` -case x$spackbindir in -x/*) ;; -x*) spackbindir="$PWD/$spackbindir" -esac - # -# binary cache to use +# Script to make a Fermi-ized spack repository # -binary_cache=https://spack-cache-1.fnal.gov/binaries/ -binary_cache_bak=https://scisoft.fnal.gov/scisoft/spack-mirror/ -install_latest() { - pkg="$1" - if $use_buildcache - then - hash_pkg_ver=`spack -k buildcache list --long --allarch "$pkg $plat" | tail -1` - echo "make_spack: info: latest $pkg is $hash_pkg_ver" - hash=`echo $hash_pkg_ver | sed -e 's/ .*//'` - spack -k buildcache install -o -m "/$hash" - else - spack -k install "$pkg $plat" - fi +clone_repos() { + + while read ddir branch repo + do + git clone -b $branch --depth $depth $repo $ddir + done <> $dir/share/spack/setup-env.csh + echo export $var=$val >> $dir/share/spack/setup-env.sh + done <> $cf - fi -} - -bootstrap_spack() { - # bootstrap_patchelf - find_compilers - if echo $spack_release | grep rollout > /dev/null - then - install_latest environment-modules - install_latest lmod - fi - if $minimal - then - : +do_padding() { + if $padding; then + echo "turning on padding." + spack config --scope=site add config:install_tree:padded_length:255 else - install_latest py-machotools - fi - os=`spack arch --operating-system` - test -d $SPACK_ROOT/etc/spack/${os} || mkdir $SPACK_ROOT/etc/spack/${os} - if $query_packages - then - make_packages_yaml $SPACK_ROOT - else - spack_version="$(spack --version)" - if [ "$spack_version" '>' "0.20.0" ] - then - sd="$(spack arch --platform)/" - else - sd="" - fi - echo "Installing stock packages.yaml in $SPACK_ROOT/etc/spack/${sd}${os}" - mkdir -p "$SPACK_ROOT/etc/spack/${sd}${os}" && - cp -v "$spackbindir/../templates/packages.yaml.${os}" \ - "$SPACK_ROOT/etc/spack/${sd}${os}/packages.yaml" + spack config --scope=site rm config:install_tree:padded_length fi } -add_recipe_repos() { - git clone https://github.com/FNALssi/fnal_art.git $SPACK_ROOT/var/spack/repos/fnal_art - spack repo add --scope=site $SPACK_ROOT/var/spack/repos/fnal_art - - git clone https://github.com/marcmengel/scd_recipes.git $SPACK_ROOT/var/spack/repos/scd_recipes - spack repo add --scope=site $SPACK_ROOT/var/spack/repos/scd_recipes - - for rv in $repovers - do - IFS=":$IFS" set $rv - r=$1; v=$2 - echo "checking out version $v in repository $r" - (cd $SPACK_ROOT/var/spack/repos/$r && git checkout $v) - done - -# spack repo create $SPACK_ROOT/var/spack/repos/ups_to_spack -# spack repo add --scope=site $SPACK_ROOT/var/spack/repos/ups_to_spack +query_packages() { + if $query_packages; then + osstr=$(spack arch -o) + spack linuxexternals --scope=linux/$osstr + fi } -create_spack() { - d=`dirname $SPACK_ROOT` - b=`basename $SPACK_ROOT` - mkdir -p $d - if cd $d - then - case "$spack_root" in - *github.com*) args="--depth 4" ;; - *) args="";; - esac - git clone $args --depth 2 -b $spack_release $spack_repo $b - - if cd $b - then - echo "make_spack: INFO: running: $add_config" - eval "$add_config" - spack config --scope=site update --yes-to-all config - case $spack_release in - rollout*|0.1[67]*) ;; - *) if $padding; then - echo "turning on padding." - spack config --scope=site add config:install_tree:padded_length:255 - else - spack config --scope=site rm config:install_tree:padded_length - fi - extra=.new - ;; - esac - export plat="target=`uname -i` os=`spack arch --operating-system`" - spack mirror add --scope site fnal $binary_cache - spack mirror add --scope site scisoft $binary_cache_bak - spack gpg list - # sometimes the buildcache keys doesn't work, so try - # a second timde if it fails? - spack buildcache keys --install --trust --force || - spack buildcache keys --install --trust --force - spack gpg list - - add_recipe_repos - - if $upgrading - then - spack reindex - else - bootstrap_spack - fi - else - echo "echo make_spack: ERROR: Unable to git clone $spack_repo as $b" >&2 - echo "FAILED" - exit 1 - fi - else - echo "make_spack: ERROR: Unable to make/change directories to $d" >&2 - echo "FAILED" - exit 1 - fi -} - -make_absolute() { - case x$1 in - x.) echo $PWD;; - x./*) echo $PWD/$1;; - x/*) echo $1;; - *) echo $PWD/$1;; - esac -} - -# -# where to git clone spack from, and what branch/release -# -#spack_repo=https://cdcvs.fnal.gov/projects/spack-infrastructure-spack - -usage(){ +usage() { echo "Usage: $0 [options] -[utp] /base/directory" echo " options:" echo " --upgrade" @@ -216,6 +75,7 @@ usage(){ echo " --query-packages" echo " --spack_release ver" echo " --spack_repo url" + echo " --depth n" echo " --minimal" echo " -u fermi 'unified' layout" echo " -t fermi 'traditional' layout" @@ -225,7 +85,7 @@ usage(){ echo "" echo " make a spack instance with given layout" echo " --query-packages turns on running make_packages_yaml (slow)" - echo " --depth is passed to git clone for spack" + echo " --depth is passed to git clone calls (default 1)" exit 1 } @@ -244,6 +104,7 @@ parse_args() { query_packages=false repovers="" verbose=false + depth=1 origargs="$*" if x=$(getopt --longoptions help,depth,with_padding,upgrade,spack_release:,minimal,no_buildcache,repover,spack_repo:,query-packages --options mptuv -- "$@") @@ -257,8 +118,9 @@ parse_args() { while echo x$1 | grep x- > /dev/null do case "x$1" in + x--depth) depth=$2; shift;; x--with_padding) padding=true; shift ;; - x--upgrade) upgrading=true; shift;; + x--upgrade) echo "Deprecated option --upgrade ignored"; shift;; x--spack_release) spack_release=$2; shift; shift ;; x--spack_repo) spack_repo=$2; shift; shift;; x--minimal) minimal=true; shift ;; @@ -266,10 +128,10 @@ parse_args() { x--help) usage; exit;; x--no_buildcache) use_buildcache=false; shift;; x--repover) repovers="$repovers $2"; shift; shift;; - x-u) layout=unified; shift;; - x-t) layout=traditional; shift;; - x-p) layout=plain; shift;; - x-m) minimal=true; shift;; + x-u) echo "Deprecated option -u ignored"; shift;; + x-t) echo "Deprecated option -t ignored"; shift;; + x-p) echo "Deprecated option -p is now default" ; shift;; + x-m) echo "Deprecated option -m ignored"; shift;; x-v) verbose=true; shift;; x--) shift; break;; esac @@ -291,84 +153,11 @@ parse_args() { main() { parse_args "$@" - export SPACK_DISABLE_LOCAL_CONFIG=true - - case $spack_release in - rollout*|0.1[67]*) extra="";; - *) extra=".new";; - esac - - case $layout in - plain) - echo "make_spack: INFO: Setting up for plain spack in $dir..." - export SPACK_ROOT=`make_absolute $dir` - mkdir -p "$SPACK_ROOT" - if [ ! -d "$SPACK_ROOT" -o ! -w "$SPACK_ROOT" ] - then - echo "make_spack: ERROR: Unable to make writable directory '$SPACK_ROOT'" >&2 - echo "FAILED" >&2 - exit 1 - fi - ;; - traditional) - echo "make_spack: INFO: setting up for traditional ups layout under $dir" - do_setup_env=true - dir=`make_absolute "$dir"` - mkdir -p "$dir" - if [ ! -d "$dir" -o ! -w "$dir" ] - then - echo "make_spack: ERROR: Unable to make writable directory '$dir'" >&2 - echo "FAILED" >&2 - exit 1 - fi - export SPACK_ROOT=$dir/prd/spack/$spack_release/NULL - - export add_config="spack config --scope site add -f $spackbindir/../templates/config.yaml.traditional${extra}" - add_config="$add_config; spack config --scope site add -f $spackbindir/../templates/modules.yaml.unified" - ;; - unified) - echo "make_spack: INFO: setting up for unified layout under $dir" - do_setup_env=true - dir=`make_absolute "$dir"` - mkdir -p "$dir" - if [ ! -d "$dir" -o ! -w "$dir" ] - then - echo "make_spack: ERROR: Unable to make writable directory '$dir'" >&2 - echo "FAILED" >&2 - exit 1 - fi - export SPACK_ROOT=$dir/spack/$spack_release/NULL - - export add_config="spack config --scope site add -f $spackbindir/../templates/config.yaml.unified${extra}" - add_config="$add_config; spack config --scope site add -f $spackbindir/../templates/modules.yaml.unified" - ;; - esac - - export PATH=$SPACK_ROOT/bin:$PATH - create_spack - - if [ -n "$dir" ] && [ -d "$dir/spack" ]; then - rm -f $dir/spack/current - ln -s $dir/spack/$spack_release $dir/spack/current - fi - - # save setup-env creation/update till the end so if we're upgrading and it - # dies, we don't change it until the end. - - if [ -n "$do_setup_env" ]; then - - echo > $dir/setup-env.sh - echo "export SPACK_SKIP_MODULES=true" >> $dir/setup-env.sh - echo "export SPACK_DISABLE_LOCAL_CONFIG=true" >> $dir/setup-env.sh - echo ". $SPACK_ROOT/share/spack/setup-env.sh" >> $dir/setup-env.sh - - - echo > $dir/setup-env.csh - echo "setenv SPACK_SKIP_MODULES true" >> $dir/setup-env.csh - echo "setenv SPACK_DISABLE_LOCAL_CONFIG true" >> $dir/setup-env.csh - echo "source $SPACK_ROOT/share/spack/setup-env.csh" >> $dir/setup-env.csh - - mkdir -p $dir/tmp/bootstrap - fi + cd $parent + clone_repos + add_fermi_setups + do_padding + query_packages } + main "$@" diff --git a/bin/new_customize b/bin/new_customize index fc0aef4..c93c6bd 100755 --- a/bin/new_customize +++ b/bin/new_customize @@ -22,11 +22,12 @@ add_fermi_submodules() { git submodule add -f $repo $dir done < Date: Thu, 25 Jul 2024 12:59:53 -0500 Subject: [PATCH 05/26] set default versions for branch --- bin/bootstrap | 6 ++++-- bin/make_spack | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/bin/bootstrap b/bin/bootstrap index 3670ecf..63987b9 100755 --- a/bin/bootstrap +++ b/bin/bootstrap @@ -17,8 +17,10 @@ usage: bootstrap [options] [dest_dir] EOF } # note, other scripts pull these values for defaults -default_fermi_spack_tools_version=main -default_spack_version=fnal-develop +#default_fermi_spack_tools_version=main +#default_spack_version=fnal-develop +default_fermi_spack_tools_version=new_make_spack +default_spack_version=v0.21.0-fermi default_spack_repo=https://github.com/FNALssi/spack.git default_fermi_spack_tools_repo=https://github.com/FNALssi/fermi-spack-tools.git diff --git a/bin/make_spack b/bin/make_spack index b7ce6a0..9d12e22 100644 --- a/bin/make_spack +++ b/bin/make_spack @@ -3,6 +3,13 @@ # # Script to make a Fermi-ized spack repository # +find_ourselves() { + spackbindir=`echo $0 | sed -e 's;make_spack;;' ` + case x$spackbindir in + x/*) ;; + x*) spackbindir="$PWD/$spackbindir" + esac +} clone_repos() { @@ -11,11 +18,12 @@ clone_repos() { git clone -b $branch --depth $depth $repo $ddir done < Date: Thu, 25 Jul 2024 13:43:05 -0500 Subject: [PATCH 06/26] permissions --- bin/make_spack | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 bin/make_spack diff --git a/bin/make_spack b/bin/make_spack old mode 100644 new mode 100755 From 31a76b6fc51586a95d326fa6dd47eea56295d913 Mon Sep 17 00:00:00 2001 From: Marc Mengel Date: Thu, 25 Jul 2024 13:45:43 -0500 Subject: [PATCH 07/26] allow -v and --verbose --- bin/make_spack | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/make_spack b/bin/make_spack index 9d12e22..1e80ec2 100755 --- a/bin/make_spack +++ b/bin/make_spack @@ -115,7 +115,7 @@ parse_args() { depth=1 origargs="$*" - if x=$(getopt --longoptions help,depth,with_padding,upgrade,spack_release:,minimal,no_buildcache,repover,spack_repo:,query-packages --options mptuv -- "$@") + if x=$(getopt --longoptions help,depth,with_padding,upgrade,spack_release:,minimal,no_buildcache,repover,spack_repo:,query-packages,verbose --options mptuv -- "$@") then eval set : $x shift @@ -136,11 +136,11 @@ parse_args() { x--help) usage; exit;; x--no_buildcache) use_buildcache=false; shift;; x--repover) repovers="$repovers $2"; shift; shift;; + x-v|x--verbose) verbose=true; shift;; x-u) echo "Deprecated option -u ignored"; shift;; x-t) echo "Deprecated option -t ignored"; shift;; x-p) echo "Deprecated option -p is now default" ; shift;; x-m) echo "Deprecated option -m ignored"; shift;; - x-v) verbose=true; shift;; x--) shift; break;; esac done From 9cfbdaa170af6bf9ad6186b7e0de8428ae5e412d Mon Sep 17 00:00:00 2001 From: Marc Mengel Date: Thu, 25 Jul 2024 14:20:22 -0500 Subject: [PATCH 08/26] sigh --- bin/bootstrap | 2 +- bin/make_spack | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/bootstrap b/bin/bootstrap index 63987b9..7200d41 100755 --- a/bin/bootstrap +++ b/bin/bootstrap @@ -124,7 +124,7 @@ main() { PATH=$dest/fermi-spack-tools/$ver/NULL/bin:$PATH message "Setting up with make_spack" - make_spack --verbose $query_packages --spack_release $spack_version --spack_repo $spack_repo $with_padding --minimal -u $dest + sh -x $dest/fermi-spack-tools/$ver/NULL/bin/make_spack --verbose $query_packages --spack_release $spack_version --spack_repo $spack_repo $with_padding --minimal -u $dest message "Finding compilers" source $dest/setup-env.sh diff --git a/bin/make_spack b/bin/make_spack index 1e80ec2..b356309 100755 --- a/bin/make_spack +++ b/bin/make_spack @@ -4,7 +4,7 @@ # Script to make a Fermi-ized spack repository # find_ourselves() { - spackbindir=`echo $0 | sed -e 's;make_spack;;' ` + spackbindir=`echo $0 | sed -e 's;make_spack$;;' ` case x$spackbindir in x/*) ;; x*) spackbindir="$PWD/$spackbindir" @@ -29,7 +29,7 @@ clone_repos() { $dir/var/spack/repos/fnal_art main https://github.com/fnalSSI/fnal_art.git $dir/var/spack/repos/nusofthep-spack-recipes main https://github.com/NuSoftHEP/nusofthep-spack-recipes.git $dir/var/spack/repos/larsoft-spack-recipes main https://github.com/LArSoft/larsoft-spack-recipes.git - $dir/var/spack/repos/artdaq-spack main https://github.com/art-daq/artdaq-spack.git + $dir/var/spack/repos/artdaq-spack develop https://github.com/art-daq/artdaq-spack.git EOF } From c578b3d0fc6c648d83b4385363198921be1af90f Mon Sep 17 00:00:00 2001 From: Marc Mengel Date: Thu, 25 Jul 2024 14:53:55 -0500 Subject: [PATCH 09/26] sigh --- bin/bootstrap | 10 +++++----- bin/make_spack | 7 ++----- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/bin/bootstrap b/bin/bootstrap index 7200d41..92cf9b8 100755 --- a/bin/bootstrap +++ b/bin/bootstrap @@ -115,23 +115,23 @@ main() { parse_args "$@" detail_log - mkdir -p $dest/fermi-spack-tools/$ver + mkdir -p $dest/../fermi-spack-tools cd $dest message "Cloning FNALssi fermi-spack-tools repository" - git clone -b $ver $fermi_spack_tools_repo fermi-spack-tools/$ver/NULL/ + git clone -b $ver $fermi_spack_tools_repo ../fermi-spack-tools - PATH=$dest/fermi-spack-tools/$ver/NULL/bin:$PATH + PATH=$dest/../fermi-spack-tools/bin:$PATH message "Setting up with make_spack" - sh -x $dest/fermi-spack-tools/$ver/NULL/bin/make_spack --verbose $query_packages --spack_release $spack_version --spack_repo $spack_repo $with_padding --minimal -u $dest + sh -x $dest/../fermi-spack-tools/bin/make_spack --verbose $query_packages --spack_release $spack_version --spack_repo $spack_repo $with_padding --minimal -u $dest message "Finding compilers" source $dest/setup-env.sh spack compiler find --scope=site - cd $dest/fermi-spack-tools/$ver/NULL && bin/declare_simple fermi-spack-tools $ver + spack install fermi-spack-tools check_bootstrap } diff --git a/bin/make_spack b/bin/make_spack index b356309..bd81bd9 100755 --- a/bin/make_spack +++ b/bin/make_spack @@ -41,11 +41,8 @@ add_fermi_setups() { # * set SPACK environment variables we want # - ( - cd $dir - ln -s share/spack/setup-env.sh setup-env.sh - ln -s share/spack/setup-env.csh setup-env.csh - ) + echo source $dir/share/spack/setup-env.sh > $dir/setup-env.sh + echo source $dir/share/spack/setup-env.csh > $dir/setup-env.csh while read var val do From e32fe99525b284932708c70733d6f3d08ed43c96 Mon Sep 17 00:00:00 2001 From: Marc Mengel Date: Thu, 25 Jul 2024 15:43:47 -0500 Subject: [PATCH 10/26] more tweaks --- bin/bootstrap | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/bootstrap b/bin/bootstrap index 92cf9b8..956ecc0 100755 --- a/bin/bootstrap +++ b/bin/bootstrap @@ -126,11 +126,18 @@ main() { message "Setting up with make_spack" sh -x $dest/../fermi-spack-tools/bin/make_spack --verbose $query_packages --spack_release $spack_version --spack_repo $spack_repo $with_padding --minimal -u $dest - message "Finding compilers" + message "Setting up new instance" + source $dest/setup-env.sh + message "Finding compilers" + spack compiler find --scope=site + message "Bootstrapping..." + spack bootstrap now + + message "installing fermi-spack-tools..." spack install fermi-spack-tools check_bootstrap From a6b4395f598d76b0c14456e2916f52ee83eeaf6c Mon Sep 17 00:00:00 2001 From: Marc Mengel Date: Thu, 25 Jul 2024 15:50:40 -0500 Subject: [PATCH 11/26] sigh --- bin/bootstrap | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/bin/bootstrap b/bin/bootstrap index 956ecc0..77d6930 100755 --- a/bin/bootstrap +++ b/bin/bootstrap @@ -115,16 +115,19 @@ main() { parse_args "$@" detail_log - mkdir -p $dest/../fermi-spack-tools + mkdir -p $dest cd $dest + + message "Cloning FNALssi fermi-spack-tools repository" - git clone -b $ver $fermi_spack_tools_repo ../fermi-spack-tools + fst=/tmp/fst$$ + git clone -b $ver $fermi_spack_tools_repo $fst - PATH=$dest/../fermi-spack-tools/bin:$PATH + PATH=$fst/bin:$PATH message "Setting up with make_spack" - sh -x $dest/../fermi-spack-tools/bin/make_spack --verbose $query_packages --spack_release $spack_version --spack_repo $spack_repo $with_padding --minimal -u $dest + sh -x $fst/bin/make_spack --verbose $query_packages --spack_release $spack_version --spack_repo $spack_repo $with_padding --minimal -u $dest message "Setting up new instance" @@ -141,6 +144,9 @@ main() { spack install fermi-spack-tools check_bootstrap + + # cleanup + rm -rf $fst & } main "$@" From 91f64fefb2eb54bf4bd25a5b8f30f722f7a1e8ad Mon Sep 17 00:00:00 2001 From: Marc Mengel Date: Thu, 25 Jul 2024 16:25:13 -0500 Subject: [PATCH 12/26] sigh --- bin/make_spack | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/make_spack b/bin/make_spack index bd81bd9..f1e0fdc 100755 --- a/bin/make_spack +++ b/bin/make_spack @@ -26,7 +26,7 @@ clone_repos() { $dir/var/spack/extensions/spack-subspack main https://github.com/marcmengel/spack-subspack.git $dir/var/spack/extensions/spack-mpd main https://github.com/knoepfel/spack-mpd.git $dir/var/spack/extensions/spack-subspack main https://github.com/marcmengel/spack-subspack.git - $dir/var/spack/repos/fnal_art main https://github.com/fnalSSI/fnal_art.git + $dir/var/spack/repos/fnal_art develop https://github.com/fnalSSI/fnal_art.git $dir/var/spack/repos/nusofthep-spack-recipes main https://github.com/NuSoftHEP/nusofthep-spack-recipes.git $dir/var/spack/repos/larsoft-spack-recipes main https://github.com/LArSoft/larsoft-spack-recipes.git $dir/var/spack/repos/artdaq-spack develop https://github.com/art-daq/artdaq-spack.git @@ -155,6 +155,12 @@ parse_args() { fi } +do_spack_bootstrap() { + osstr=$(spack arch -o) + spack bootstrap root $dest/.bootstrap.$osstr + spack bootstrap now +} + main() { : starting: $* @@ -164,6 +170,7 @@ main() { clone_repos add_fermi_setups do_padding + do_spack_bootstrap query_packages } From 77acb2463f8bdb74bd6835484f03922ecc0bc71b Mon Sep 17 00:00:00 2001 From: Marc Mengel Date: Thu, 25 Jul 2024 16:31:23 -0500 Subject: [PATCH 13/26] speling --- bin/make_spack | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/make_spack b/bin/make_spack index f1e0fdc..545974e 100755 --- a/bin/make_spack +++ b/bin/make_spack @@ -157,7 +157,7 @@ parse_args() { do_spack_bootstrap() { osstr=$(spack arch -o) - spack bootstrap root $dest/.bootstrap.$osstr + spack bootstrap root $dir/.bootstrap.$osstr spack bootstrap now } From d8f93e6b65d2692521ebde4b79aa11bd8d34cca1 Mon Sep 17 00:00:00 2001 From: Marc Mengel Date: Thu, 25 Jul 2024 16:36:30 -0500 Subject: [PATCH 14/26] one more recipe repo --- bin/make_spack | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/make_spack b/bin/make_spack index 545974e..7e95ef4 100755 --- a/bin/make_spack +++ b/bin/make_spack @@ -27,6 +27,7 @@ clone_repos() { $dir/var/spack/extensions/spack-mpd main https://github.com/knoepfel/spack-mpd.git $dir/var/spack/extensions/spack-subspack main https://github.com/marcmengel/spack-subspack.git $dir/var/spack/repos/fnal_art develop https://github.com/fnalSSI/fnal_art.git + $dir/var/spack/repos/scd_recipes main https://github.com/marcmenge/scd_recipes.git $dir/var/spack/repos/nusofthep-spack-recipes main https://github.com/NuSoftHEP/nusofthep-spack-recipes.git $dir/var/spack/repos/larsoft-spack-recipes main https://github.com/LArSoft/larsoft-spack-recipes.git $dir/var/spack/repos/artdaq-spack develop https://github.com/art-daq/artdaq-spack.git From 91a365b985116aab57f869276f1d18969b872d76 Mon Sep 17 00:00:00 2001 From: Marc Mengel Date: Thu, 25 Jul 2024 16:46:04 -0500 Subject: [PATCH 15/26] speling --- bin/make_spack | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/make_spack b/bin/make_spack index 7e95ef4..f12b0bd 100755 --- a/bin/make_spack +++ b/bin/make_spack @@ -27,7 +27,7 @@ clone_repos() { $dir/var/spack/extensions/spack-mpd main https://github.com/knoepfel/spack-mpd.git $dir/var/spack/extensions/spack-subspack main https://github.com/marcmengel/spack-subspack.git $dir/var/spack/repos/fnal_art develop https://github.com/fnalSSI/fnal_art.git - $dir/var/spack/repos/scd_recipes main https://github.com/marcmenge/scd_recipes.git + $dir/var/spack/repos/scd_recipes main https://github.com/marcmengel/scd_recipes.git $dir/var/spack/repos/nusofthep-spack-recipes main https://github.com/NuSoftHEP/nusofthep-spack-recipes.git $dir/var/spack/repos/larsoft-spack-recipes main https://github.com/LArSoft/larsoft-spack-recipes.git $dir/var/spack/repos/artdaq-spack develop https://github.com/art-daq/artdaq-spack.git From dedd31bb773f0a742eb08401612c780d05771afa Mon Sep 17 00:00:00 2001 From: Marc Mengel Date: Thu, 25 Jul 2024 16:54:57 -0500 Subject: [PATCH 16/26] branch name --- bin/make_spack | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/make_spack b/bin/make_spack index f12b0bd..c25a32b 100755 --- a/bin/make_spack +++ b/bin/make_spack @@ -27,7 +27,7 @@ clone_repos() { $dir/var/spack/extensions/spack-mpd main https://github.com/knoepfel/spack-mpd.git $dir/var/spack/extensions/spack-subspack main https://github.com/marcmengel/spack-subspack.git $dir/var/spack/repos/fnal_art develop https://github.com/fnalSSI/fnal_art.git - $dir/var/spack/repos/scd_recipes main https://github.com/marcmengel/scd_recipes.git + $dir/var/spack/repos/scd_recipes master https://github.com/marcmengel/scd_recipes.git $dir/var/spack/repos/nusofthep-spack-recipes main https://github.com/NuSoftHEP/nusofthep-spack-recipes.git $dir/var/spack/repos/larsoft-spack-recipes main https://github.com/LArSoft/larsoft-spack-recipes.git $dir/var/spack/repos/artdaq-spack develop https://github.com/art-daq/artdaq-spack.git From 4ce789839ada6bc6e207e16ae74ed9976cbd0e7b Mon Sep 17 00:00:00 2001 From: Marc Mengel Date: Thu, 25 Jul 2024 17:21:03 -0500 Subject: [PATCH 17/26] all in --- bin/bootstrap | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/bootstrap b/bin/bootstrap index 77d6930..794d406 100755 --- a/bin/bootstrap +++ b/bin/bootstrap @@ -141,7 +141,8 @@ main() { spack bootstrap now message "installing fermi-spack-tools..." - spack install fermi-spack-tools + pyspec=$(spack config get packages | grep python | grep spec: | sed -e 's/ - spec://') + spack install fermi-spack-tools ^$pyspec check_bootstrap From 07ece0550326bb768de9525a1641473b521c7efd Mon Sep 17 00:00:00 2001 From: Marc Mengel Date: Wed, 7 Aug 2024 13:36:48 -0500 Subject: [PATCH 18/26] capitzlization --- bin/bootstrap | 2 +- bin/make_spack | 2 +- bin/new_customize | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/bootstrap b/bin/bootstrap index 794d406..b32ccb1 100755 --- a/bin/bootstrap +++ b/bin/bootstrap @@ -20,7 +20,7 @@ EOF #default_fermi_spack_tools_version=main #default_spack_version=fnal-develop default_fermi_spack_tools_version=new_make_spack -default_spack_version=v0.21.0-fermi +default_spack_version=v0.22.0-fermi default_spack_repo=https://github.com/FNALssi/spack.git default_fermi_spack_tools_repo=https://github.com/FNALssi/fermi-spack-tools.git diff --git a/bin/make_spack b/bin/make_spack index c25a32b..2e52ab6 100755 --- a/bin/make_spack +++ b/bin/make_spack @@ -26,7 +26,7 @@ clone_repos() { $dir/var/spack/extensions/spack-subspack main https://github.com/marcmengel/spack-subspack.git $dir/var/spack/extensions/spack-mpd main https://github.com/knoepfel/spack-mpd.git $dir/var/spack/extensions/spack-subspack main https://github.com/marcmengel/spack-subspack.git - $dir/var/spack/repos/fnal_art develop https://github.com/fnalSSI/fnal_art.git + $dir/var/spack/repos/fnal_art develop https://github.com/FNALssi/fnal_art.git $dir/var/spack/repos/scd_recipes master https://github.com/marcmengel/scd_recipes.git $dir/var/spack/repos/nusofthep-spack-recipes main https://github.com/NuSoftHEP/nusofthep-spack-recipes.git $dir/var/spack/repos/larsoft-spack-recipes main https://github.com/LArSoft/larsoft-spack-recipes.git diff --git a/bin/new_customize b/bin/new_customize index c93c6bd..ed9c71d 100755 --- a/bin/new_customize +++ b/bin/new_customize @@ -28,7 +28,7 @@ add_fermi_submodules() { var/spack/extensions/spack-localbuildcache https://github.com/marcmengel/spack-localbuildcache.git var/spack/extensions/spack-mpd https://github.com/knoepfel/spack-mpd.git var/spack/extensions/spack-subspack https://github.com/marcmengel/spack-subspack.git - var/spack/repos/fnal_art https://github.com/fnalSSI/fnal_art.git + var/spack/repos/fnal_art https://github.com/FNALssi/fnal_art.git var/spack/repos/nusofthep-spack-recipes https://github.com/NuSoftHEP/nusofthep-spack-recipes.git var/spack/repos/larsoft-spack-recipes https://github.com/LArSoft/larsoft-spack-recipes.git var/spack/repos/artdaq-spack https://github.com/art-daq/artdaq-spack.git From 373f8244d678fd1bc6a863224d900b8c8c0af733 Mon Sep 17 00:00:00 2001 From: Marc Mengel Date: Wed, 7 Aug 2024 13:42:36 -0500 Subject: [PATCH 19/26] if destination isn't specified, default to /scratch/mengel/co/github/fermi-spack-tools/bin/spack --- bin/bootstrap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/bootstrap b/bin/bootstrap index b32ccb1..0835e46 100755 --- a/bin/bootstrap +++ b/bin/bootstrap @@ -54,7 +54,7 @@ parse_args() { x--) shift; break;; esac done - dest=${1:-$PWD} + dest=${1:-$PWD/spack} } detail_log() { From 7d78b5399778f3acae1c78649580fc66d91e0b42 Mon Sep 17 00:00:00 2001 From: Marc Mengel Date: Wed, 7 Aug 2024 13:52:25 -0500 Subject: [PATCH 20/26] add fetching buildcache keys --- bin/bootstrap | 5 +++++ bin/make_spack | 1 + 2 files changed, 6 insertions(+) diff --git a/bin/bootstrap b/bin/bootstrap index 0835e46..55d0ac2 100755 --- a/bin/bootstrap +++ b/bin/bootstrap @@ -55,6 +55,11 @@ parse_args() { esac done dest=${1:-$PWD/spack} + if [ -d $dest ] + then + echo "FAIL: Destination directory $d already exists. " >&2 + exit 1 + fi } detail_log() { diff --git a/bin/make_spack b/bin/make_spack index 2e52ab6..a8896d1 100755 --- a/bin/make_spack +++ b/bin/make_spack @@ -160,6 +160,7 @@ do_spack_bootstrap() { osstr=$(spack arch -o) spack bootstrap root $dir/.bootstrap.$osstr spack bootstrap now + spack buildcache keys --install --force --trust } main() { From 72baeb0d68db507835923ece3b4924e6db0d9d4d Mon Sep 17 00:00:00 2001 From: Marc Mengel Date: Wed, 7 Aug 2024 14:20:44 -0500 Subject: [PATCH 21/26] update logfile size estimate --- bin/bootstrap | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/bin/bootstrap b/bin/bootstrap index 55d0ac2..7f204ed 100755 --- a/bin/bootstrap +++ b/bin/bootstrap @@ -103,7 +103,7 @@ stop_monitor() { message() { stop_monitor echo $* >&3 - start_monitor $logfile 458 + start_monitor $logfile 255 } check_bootstrap() { @@ -142,9 +142,6 @@ main() { spack compiler find --scope=site - message "Bootstrapping..." - spack bootstrap now - message "installing fermi-spack-tools..." pyspec=$(spack config get packages | grep python | grep spec: | sed -e 's/ - spec://') spack install fermi-spack-tools ^$pyspec From 49289067e1c7b7ef213a7c1f0c6a6587940440ed Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Wed, 14 Aug 2024 14:18:54 -0500 Subject: [PATCH 22/26] Add site/ to scope for linuxexternals --- bin/make_spack | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/make_spack b/bin/make_spack index a8896d1..f74321d 100755 --- a/bin/make_spack +++ b/bin/make_spack @@ -69,7 +69,7 @@ do_padding() { query_packages() { if $query_packages; then osstr=$(spack arch -o) - spack linuxexternals --scope=linux/$osstr + spack linuxexternals --scope=site/linux/$osstr fi } From 1fb8fd3cb5929b7317b6801f125c4d28334c0d70 Mon Sep 17 00:00:00 2001 From: Marc Mengel Date: Wed, 14 Aug 2024 16:40:17 -0500 Subject: [PATCH 23/26] Bug report from Patrick Gartung --- bin/make_spack | 2 +- bin/new_customize | 57 ------------------------------------------ bin/update_git_modules | 10 ++++++++ 3 files changed, 11 insertions(+), 58 deletions(-) delete mode 100755 bin/new_customize create mode 100644 bin/update_git_modules diff --git a/bin/make_spack b/bin/make_spack index a8896d1..f74321d 100755 --- a/bin/make_spack +++ b/bin/make_spack @@ -69,7 +69,7 @@ do_padding() { query_packages() { if $query_packages; then osstr=$(spack arch -o) - spack linuxexternals --scope=linux/$osstr + spack linuxexternals --scope=site/linux/$osstr fi } diff --git a/bin/new_customize b/bin/new_customize deleted file mode 100755 index ed9c71d..0000000 --- a/bin/new_customize +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh - -# -# new_customize -- customize an upstream spack instance with fermi customizations -# - - -add_fermi_submodules() { - - # - # Add git submodules we want in our distribution. - # - # This: - # * puts our platform specific configs in the linux subdirectory, - # * puts our spack extension packages where the above configs say they are - # * adds recipe repositories we want - # * we could add a macos or other os specialization as well... - # - - while read dir repo - do - git submodule add -f $repo $dir - done <> share/spack/setup-env.csh - echo export $var=$val >> share/spack/setup-env.sh - done < Date: Sun, 18 Aug 2024 11:40:14 -0500 Subject: [PATCH 24/26] Use x86_64_v2 --- templates/packages.yaml.almalinux9 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/packages.yaml.almalinux9 b/templates/packages.yaml.almalinux9 index 3b01677..f1c3140 100644 --- a/templates/packages.yaml.almalinux9 +++ b/templates/packages.yaml.almalinux9 @@ -6,7 +6,7 @@ packages: - gcc - clang target: - - x86_64_v3 + - x86_64_v2 providers: pkgconfig:: - pkg-config @@ -176,7 +176,7 @@ packages: hwloc: require: - one_of: - - "target=x86_64_v3" + - "target=x86_64_v2" - one_of: - "%gcc@11" - "%clang@15.0.7" @@ -202,7 +202,7 @@ packages: libpciaccess: require: - one_of: - - "target=x86_64_v3" + - "target=x86_64_v2" - one_of: - "%gcc@11" - "%clang@15.0.7" From 0e62ed1985dfbe557d7782f6dc055d3d4457aa4b Mon Sep 17 00:00:00 2001 From: Marc Mengel Date: Mon, 19 Aug 2024 10:34:08 -0500 Subject: [PATCH 25/26] trying to resolve conflicts.. --- bin/make_spack | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/make_spack b/bin/make_spack index f74321d..d8cc770 100755 --- a/bin/make_spack +++ b/bin/make_spack @@ -83,9 +83,10 @@ usage() { echo " --spack_repo url" echo " --depth n" echo " --minimal" - echo " -u fermi 'unified' layout" - echo " -t fermi 'traditional' layout" - echo " -p plain spack default layout" + echo " --verbose" + echo " -u fermi 'unified' layout (deprecated)" + echo " -t fermi 'traditional' layout (deprecated)" + echo " -p plain spack default layout (default)" echo " -m minimal setup" echo " -v verbose flag" echo "" From 46235414b6321feb8fb6d70d32653307aa0b3e99 Mon Sep 17 00:00:00 2001 From: Chris Green Date: Mon, 19 Aug 2024 12:25:20 -0500 Subject: [PATCH 26/26] Make prefix-finding robust against uninstalled build dependencies --- bin/build-spack-env.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/bin/build-spack-env.sh b/bin/build-spack-env.sh index b344fa1..513a189 100755 --- a/bin/build-spack-env.sh +++ b/bin/build-spack-env.sh @@ -786,16 +786,23 @@ _maybe_cache_binaries() { # avoid unnecessary overhead. { cat > "$TMP/location_cmds.py" <<\EOF -import spack.cmd import spack.environment +import spack.store + +all_hashes = spack.environment.active_environment().all_hashes() + + +def print_prefix_for_hash(spec, hash): + matching_specs = spack.store.STORE.db.query(hash, hashes=all_hashes, installed=True) + if len(matching_specs) == 1: + print(spec, matching_specs[0].prefix) -env = spack.environment.active_environment() EOF } || _die "I/O error writing to $TMP/location_cmds.py" for hash in ${hashes_to_cache_tmp[*]:+"${hashes_to_cache_tmp[@]}"}; do _report $DEBUG_4 "scheduling location lookup of $hash" - echo 'print("'"$hash"'", spack.cmd.disambiguate_spec("'"/${hash//*\///}"'", env, False).prefix)' >> "$TMP/location_cmds.py" + echo 'print_prefix_for_hash("'"$hash"'", "'"/${hash//*\///}"'")' >> "$TMP/location_cmds.py" done || _die "I/O error writing to $TMP/location_cmds.py" local hashes_to_cache=(