summaryrefslogtreecommitdiff
path: root/bin/spack.ps1
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2024-08-02 13:38:14 -0500
committerGitHub <noreply@github.com>2024-08-02 13:38:14 -0500
commit425bba2f1ace61fc7a4b3a7100bd3997debfef44 (patch)
tree1de94b6cd56ca6f66249edcd11981380ebd65bed /bin/spack.ps1
parenta2cbc46dbc1a7ba3799d44c04c57060e80cd2180 (diff)
downloadspack-425bba2f1ace61fc7a4b3a7100bd3997debfef44.tar.gz
spack-425bba2f1ace61fc7a4b3a7100bd3997debfef44.tar.bz2
spack-425bba2f1ace61fc7a4b3a7100bd3997debfef44.tar.xz
spack-425bba2f1ace61fc7a4b3a7100bd3997debfef44.zip
Allow spec queries by `namespace` (#45416)
* Allow spec queries by `namespace` Spack specs have "namespaces" that indicate what package repository they come from, but there has not been a way to use the spec syntax to match one. You can say things like this: ```console spack find builtin.zlib spack find myrepo.zlib ``` But, because namespaces are written as a dot-separated prefix on the name, you can't say "find me all specs in namespace myrepo". The syntax doesn't allow it. This PR allows you to specify anonymous specs with namespaces on the CLI. Specifically you can do queries like this: ```console spack find namespace=builtin spack find namespace=myrepo ``` You can use this anywhere else you use spec syntax, e.g. in a config file to separate installations based on what repo they came from: ```yaml spack: config: install_tree: root: $spack/opt/spack projections: namespace=myrepo: "myrepo_special_path/{name}-{hash}" namespace=builtin: "builtin/{name}-{hash}" ``` This PR adds a special `namespace_if_anonymous` attribute to specs, which returns the `namespace` if the spec has no name, otherwise it returns `None`. This allows us to print the namespace for anonymous specs but to continue hiding it for most views, as we've done so far. This is implemented as a special case, but it's one that already exists, along with `platform`, `os`, `target`, etc. This also reserves existing special case names for variants so that users cannot define them in their package files. This change is potentially breaking, but I do not think it will be common. There are no builtin packages with a variant called `namespace`, and defining `os`, `target`, or `platform` as a variant would've likely caused other problems if they were already being used. Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
Diffstat (limited to 'bin/spack.ps1')
0 files changed, 0 insertions, 0 deletions