Skip to content

use spack find from bash to check if a spec is installed #8033

@davydden

Description

@davydden

I have a bash script which goes through a set of sepcs, installs them and runs tests. Key parts are:

spack install --keep-stage "$s"
spack cd -s "$s"
cd <build-folder>
spack env "$s" bash << EOF
ctest <parameters>
EOF

I would like to improve this by not re-installing the spec, but rather check if it's installed already, and if so, in the stage I kept outside of system temporary directories I would just do git pull to update the sources and make all -j8 to re-build.

spack find <spec> is the candidate, but I don't think it returns an error code to the bash.
Ideally it should be something like

spec_installed = <something-with-spack-find>
if [ "${spec_installed}" == "1" ]; then
  git pull
  make all
else
  spack install --keep-stage "$s"$
fi

Anyone tried to do something similar with bash?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions