diff --git a/tools/find_specs.py b/tools/find_specs.py new file mode 100644 index 000000000..4103f2906 --- /dev/null +++ b/tools/find_specs.py @@ -0,0 +1,38 @@ +#! /usr/bin/python3 + +import sys +from argparse import ArgumentParser +from spack.environment import find_environment + + +def get_parser(): + parser = ArgumentParser() + parser.add_argument("packagename") + return parser + + +def main(): + parser = get_parser() + args = parser.parse_args() + + env = find_environment(args) + if env is None: + sys.stderr.write("No environment\n") + sys.exit(1) + + reslist = [] + + for spec in env.user_specs: + s = str(spec) + if s.startswith(args.packagename + '@'): +# reslist.insert(0, s) + pass + else: + reslist.append("^" + s) + + print(" ".join(reslist)) + + +if __name__ == '__main__': + main() + diff --git a/tools/spack_dev-build.sh b/tools/spack_dev-build.sh new file mode 100644 index 000000000..7f3efb23a --- /dev/null +++ b/tools/spack_dev-build.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +if [[ -z "${SPACK_ENV}" ]]; then + echo "Activate spack environment before calling the script." + return +fi + +if [[ "$#" -ne 1 && "$#" -ne 3 ]]; then + echo "Invalid number of parameter. Expects 1 or 3 parameters." + echo " 1 parameter : print the specs in dev-build format:" + echo " usage : . ./spack_dev-build.sh package-name" + echo " example : . ./spack_dev-build.sh fairroot" + echo " 3 parameters : dev-build package in the given folder:" + echo " usage : . ./spack_dev-build.sh package-name /path/to/package/source version" + echo " example : . ./spack_dev-build.sh fairroot \$HOME/spack/FairRootDev develop+sim+examples" + return +fi + +deps=$(spack python $SPACK_ROOT/../tools/find_specs.py $1); + +if [[ "$#" -eq 1 ]]; then + echo $deps; + return +fi + +coml="spack -C ./config dev-build -j 4 -d $2 $1@$3 $deps"; + +echo $coml; + +$coml