-
Notifications
You must be signed in to change notification settings - Fork 4
AL9 Quick Install
Make a working directory, and cd into it. The ots-quick-spack-start.sh script will create several files and subdirectories in this directory.
# Get installation script
baseurl="https://raw.githubusercontent.com/art-daq/otsdaq-demo/refs/heads/develop/tools"
target=$(curl -s "$baseurl/ots-quick-spack-start.sh") # Link to actual script
curl "$baseurl/$target" -o ots-quick-spack-start.sh
chmod +x quick-spack-start.sh
./quick-spack-start.sh # get latest
wget https://github.com/art-daq/otsdaq_demo/raw/develop/tools/ots-quick-spack-start.sh --no-check-certificate
chmod +x ots-quick-spack-start.sh
# Just in case there is another installation hanging around in your bash environment
unset SPACK_ROOT
# You can install ots by itself
./ots-quick-spack-start.sh --develop # Add -w to use ssh to check out the repositories, only if you have write access!
# Alternatively, if you have local upstream products areas from other installations, add them:
# E.g. --upstream /mu2e/spack --upstream /cvmfs/fermilab.opensciencegrid.org/products/artdaq/artdaq_spack
./ots-quick-spack-start.sh --develop --upstream /mu2e/spack
At this point, you should have the ots software installed in $PWD/spack and a link to the "environment" directory at $PWD/srcs (if the srcs link is missing due to historical reasons, please create it to $PWD/spack/var/spack/environments/ots-*).
After making changes to the files there, you can spack install to make those changes active.
To add another package to the develop area:
spack add otsdaq-mu2e-trigger@v3_00_00 # Version must match installed environment (will be part of the environment directory name if you used mu2e-quick-spack-start.sh)
spack develop otsdaq-mu2e-trigger@v3_00_00
#optionally check out a particular branch
#cd srcs/otsdaq-mu2e-trigger
#git checkout develop
#cd -
spack concretize --force; spack install
To list otsdaq packages your area depends on:
spack list | grep otsdaq
To see your environment's selected version of a dependent package
cat srcs/spack.lock | sed s/\{/\\n/g | grep arch | grep <package name>
#ots_which <package name>, is equivalent if using spack_setup_ots.sh
To see versions of a package (- in name, the latest might be a good choice):
spack versions otsdaq-utilities
To see build dependencies of a package and preferred version:
spack info --all otsdaq-utilities
quick-spack-start.sh creates a setup_ots.sh script in the directory where it runs. This is a basic setup script; if you want some additional features that ots developers use, see how to copy from the otsdaq-mu2e-config repo below.
For the first compile, use the basic quick start setup to confirm no issues:
source setup_ots.sh # This will activate the Spack environment
spack install # If you've made changes to your develop packages, this will build and enable those changes
To use the otsdaq-demo repo spack setup file (which is more similar to SL7 VST setup script), to avoid errors you must setup a valid USER_DATA and ARTDAQ_DATABASE_URI. A good approach is to copy from an existing (e.g. SL7 VST) area. Contact TDAQ admins if you need support copying.
From scratch, the following should be sufficient for an empty USER_DATA and ARTDAQ_DATABASE_URI:
mkdir Data<_subsystem>; mkdir Data/ServiceData; mkdir databases<_subsystem>
cp daq-operations/CoreTableInfoNames.dat Data/ServiceData/
setup_ots.sh <subsystem> # so that UpdateOTS.sh exists and setup /scratch areas
UpdateOTS.sh --tables # will attempt to fix USER_DATA area; if UpdateOTS.sh does not exist, you may have to compile
To use the otsdaq-mu2e-config repo hwdev setup file:
cd <ots working area>
mv setup_ots.sh old.setup_ots.sh
wget https://github.com/art-daq/otsdaq_demo/raw/develop/tools/ots-quick-spack-start.sh -O setup_ots.sh --no-check-certificate
#now, from the new setup, you will have compile aliases among others:
mb #alias to incremental build
ml #alias to incremental build to less (to view result from top)
mz #alias to clean build
source setup_ots.sh # Activate your Spack environment
spack cd --env # spack cd is a useful command, see spack cd --help, but spack cd --env and spack cd -i <pkg_name> are both useful
spack develop otsdaq-mu2e@v3_01_00 # Version must match installed environment (will be part of the environment directory name if you used mu2e-quick-spack-start.sh). Package names in Spack use dashes instead of underscores, so otsdaq_mu2e_tracker should be otsdaq-mu2e-tracker in Spack.
spack concretize --force # Have Spack re-calculate the packages to install, necessary after adding packages to your environment with spack develop
spack install -j32 # Build and install the software, -j works as with make
Note Spack takes a "when in doubt, rebuild it" approach, so it will rebuild anything in the dependency tree below any packages being spack develop-ed.
Note spack develop must be used with a version that agrees with your environment, this tells the Spack system that you are asserting that the code is compatible with the rest of the environment. Mu2e packages have versions that correspond to git commits, so the entire repository is checked out when you run spack develop. After that, you can cd into the repository directory (under spack cd --env), check out branches and make other changes as desired. spack install will build the package using the source provided in the environment directory, including any changes made since the tag declared to Spack.
Note Packages in Spack use - instead of _, so mu2e_pcie_utils has become mu2e-pcie-utils in Spack environments. The list of Mu2e packages supported in Spack is here: https://github.com/Mu2e/mu2e-spack/tree/main/packages
To summarize: spack develop performs the checkout into your environment directory. This will be sym-linked to srcs in your top-level directory or can be accessed via spack cd --env. Any code changes made in that directory, including checking out branches (such as develop or personal working branches) will be build when you call spack install. Adding a new package to the develop area requires "re-concretization" using spack concretize --force, which instructs Spack to walk the dependency tree and determine what needs to be installed to satisfy the requests in spack.yaml in the environment directory.
The Spack documentation is actually fairly readable, and for using Spack commands, I'd start here: https://spack.readthedocs.io/en/latest/basic_usage.html