ACCESS-NRI / spack-packages

Spack package repository maintained by ACCESS-NRI
Apache License 2.0
4 stars 4 forks source link

Allow branch-specific logic in SPDs to also apply to tags with a certain 'shape' #111

Closed CodeGat closed 1 month ago

CodeGat commented 1 month ago

In the cases of mom5 and oasis3-mct, we currently have branch-specific (specifically, access-esm1.5) logic. This means that for the deployment of ACCESS-ESM1.5 via the spack.yaml (see here), we must use the branch version (such as @access-esm1.5). For example: https://github.com/ACCESS-NRI/ACCESS-ESM1.5/pull/5/files#diff-e8582e74fa156f4e5729a850e52b24f2fde2d815c2c9c360f88c4cf90db851abR12-R14

However, this branch version is not specific enough for the purposes of editing the spack.yaml in a PR, as it simply points to the HEAD of said branch, which will change based on the time that a spack.yaml is deployed. This would mean that PRs would essentially be unchanged (maybe putting a comment in saying what commit was at HEAD at that point in time). We currently use tags instead of branches for this purpose (for example, @git.2024.05.12), since they are a specific point in time.

Is it possible to have this branch-based logic that includes these tags? In terms of tags, we currently have mom5 with tags on master like 2023.11.09, 2023.10.26. For tags on the access-esm1.5 branch, we can have tags that prefix the branch name, like access-esm1.5_2024.05.11. Would it be possible to have something like (apologies for not knowing the intricacies of SPD when(...) logic):

if '@access-esm1.5' or '@git.access-esm1.5_*' then
  do access-esm1.5-specific logic for mom5 SPD
else
  do regular mom5 SPD logic
fi
harshula commented 1 month ago

The reason for the above requirement is because we have two installation methods: 1) spack install mom5@access-esm1.5 2) via spack.yaml, ideally we want to be able to do:

spack:
  packages:
    mom5:
      require:
        - '@git.access-esm1.5_2024.05.21'
penguian commented 1 month ago

I have started working on the issue at the 111-apply-branch-specific-logic-to-some-tags branch and have come to the realization that we don't need to change the SPDs at all. Instead, change the spec syntax from @tag to @tag=version. See https://spack.readthedocs.io/en/latest/basic_usage.html#git-versions

For example:

spack install mom5@git.access-esm1.5_2024.05.24=access-esm1.5^oasis3-mct@git.access-esm1.5_2024.05.24=access-esm1.5%intel@19.0.5.281 arch=linux-rocky8-x86_64

That way you specify both the exact Git tag that you want, and the exact version that you need. The SPD can just continue to use logic based on the version. How's that sound?

penguian commented 1 month ago

That changes the second installation method to:

spack:
  packages:
    mom5:
      require:
        - '@git.access-esm1.5_2024.05.21=access-esm1.5'
penguian commented 1 month ago

Closing, since this issue doesn't require a code change in this repository.