C2SM / spack-c2sm

Repository for c2sm spack config and repo files
https://c2sm.github.io/spack-c2sm/latest
MIT License
7 stars 19 forks source link

disambiguate the spec in the extract_env #257

Closed cosunae closed 2 years ago

cosunae commented 3 years ago

In the deployment script extract_env.py in order to figure out the installation path of a given spec, we simply use

Spec(args.spec).concretized()

https://github.com/C2SM/spack-c2sm/blob/9060337163626ed3763a36b2650bef3a6e416d1d/tools/osm/extract_env.py#L36 This will give back a path with a hash irrespective of whether the spec was installed or not. Typically an incomplete spec will lead to a wrong path.

The behaviour of spack location -i is actually very different. Say you installed the spec: cosmo@5.09a.mch1.1.p1%pgi@20.4 real_type=float cosmo_target=gpu +pollen +eccodes +production +claw +verbose +cppdycore ~debug +set_version

but now you are executing the script with an incomplete spec cosmo@5.09a.mch1.1.p1%pgi@20.4 real_type=float cosmo_target=gpu +pollen +eccodes +production +claw +verbose +cppdycore ~debug

spack location is not considering the default of variants. So as far as ~set_version was not installed, it will disambiguate the spec, finds the one with +set_version installed and give you that one back.

I think we should emulate this behaviour of spack location https://github.com/spack/spack/blob/8ccdcf2e843ec02a1af3d4cf72c5c68236f61e36/lib/spack/spack/cmd/location.py#L101 In the extract_env

cosunae commented 3 years ago

Additinally spack location is capable of finding packages installed upstream, while the extract_env not

cosunae commented 2 years ago

This has been solved in here: https://github.com/COSMO-ORG/cosmo/blob/3a1302552d81d0b6abbe95c04a55c13fbbdb42b9/cosmo/ACC/jenkins/deploy.py#L149