Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/jcsda/spack-stack into f…
Browse files Browse the repository at this point in the history
…eature/unpin_update_common_packages_PLUS_cylc
  • Loading branch information
climbfuji committed Jan 8, 2025
2 parents 9e180cc + 94d1afb commit 0c87803
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions util/get_version_list.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

# Gets list of versions from active or specified environment and prints a
# wiki-formatted table to be inserted into the spack-stack wiki.
# Only reports packages directly used by *-env metapackages.
# Uses SPACK_ENV by default to derive list of installed packages.
# The entire output can be copied and pasted into the wiki page at
# https://github.com/JCSDA/spack-stack/wiki/Package-versions
# noting that <SITE> should be replaced by the appropriate site name.

# Usage:
# $ . setup.sh
# $ ./util/get_version_list.sh envs/unified-dev

# Alex Richert, Jan 2025

set -e

if [ -z $SPACK_ENV ]; then
export SPACK_ENV=$1
fi

export SPACK_STACK_DIR=${SPACK_STACK_DIR:-$(realpath ${SPACK_ENV}/../..)}
spackstackver=$(echo $SPACK_STACK_DIR | grep -oP "/\Kspack-stack-[^/]+")
echo "# $spackstackver"
# Determine which packages to report versions of by looking at -env packages
envmetapkgs=$(grep -Po '(-) \K[^\s]+-env' ${SPACK_STACK_DIR}/configs/templates/unified-dev/spack.yaml | grep '-env$' | sort | uniq)
secondarymetapkgs=$(for p in $envmetapkgs ; do spack dependencies $p ; done | grep '-env$' | sort | uniq)
metapkgs=$(echo -e "${envmetapkgs}\n${secondarymetapkgs}")
deplist=$(for p in $metapkgs ; do spack dependencies $p ; done | grep -v '-env$' | sort | uniq)
installedlist=$(spack find --format '{name}')
pkgstoreport=$(echo "$installedlist" | grep -xf <(echo "$deplist"))
listfortable=$(spack find --format '| {name} | {version} |' $pkgstoreport)
echo -e "| Package_name | Version |\n| --- | --- |\n$listfortable" | column -t | sed 's:Package_name:Package name:'
echo
echo "_Versions taken from <SITE>:${SPACK_ENV}_"

0 comments on commit 0c87803

Please sign in to comment.