summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorHarmen Stoppels <harmenstoppels@gmail.com>2023-01-16 19:14:41 +0100
committerGitHub <noreply@github.com>2023-01-16 10:14:41 -0800
commit3489cc0a9b76837f0613d698815cb24f0eace07c (patch)
tree71c34b43136659c8ea87f4dd6ff57aa51b397a2b /share
parent9a25e21da85afd36dab208f7d228a0c9d52fc68f (diff)
downloadspack-3489cc0a9b76837f0613d698815cb24f0eace07c.tar.gz
spack-3489cc0a9b76837f0613d698815cb24f0eace07c.tar.bz2
spack-3489cc0a9b76837f0613d698815cb24f0eace07c.tar.xz
spack-3489cc0a9b76837f0613d698815cb24f0eace07c.zip
Refer to mirrors by name, path, or url (#34891)
With this change we get the invariant that `mirror.fetch_url` and `mirror.push_url` return valid URLs, even when the backing config file is actually using (relative) paths with potentially `$spack` and `$env` like variables. Secondly it avoids expanding mirror path / URLs too early, so if I say `spack mirror add name ./path`, it stays `./path` in my config. When it's retrieved through MirrorCollection() we exand it to say `file://<env dir>/path` if `./path` was set in an environment scope. Thirdly, the interface is simplified for the relevant buildcache commands, so it's more like `git push`: ``` spack buildcache create [mirror] [specs...] ``` `mirror` is either a mirror name, a path, or a URL. Resolving the relevant mirror goes as follows: - If it contains either / or \ it is used as an anonymous mirror with path or url. - Otherwise, it's interpreted as a named mirror, which must exist. This helps to guard against typos, e.g. typing `my-mirror` when there is no such named mirror now errors with: ``` $ spack -e . buildcache create my-mirror ==> Error: no mirror named "my-mirror". Did you mean ./my-mirror? ``` instead of creating a directory in the current working directory. I think this is reasonable, as the alternative (requiring that a local dir exists) feels a bit pendantic in the general case -- spack is happy to create the build cache dir when needed, saving a `mkdir`. The old (now deprecated) format will still be available in Spack 0.20, but is scheduled to be removed in 0.21: ``` spack buildcache create (--directory | --mirror-url | --mirror-name) [specs...] ``` This PR also touches `tmp_scope` in tests, because it didn't really work for me, since spack fixes the possible --scope values once and for all across tests, so tests failed when run out of order.
Diffstat (limited to 'share')
-rwxr-xr-xshare/spack/spack-completion.bash16
1 files changed, 13 insertions, 3 deletions
diff --git a/share/spack/spack-completion.bash b/share/spack/spack-completion.bash
index 8d1bd8ce98..18c6975d69 100755
--- a/share/spack/spack-completion.bash
+++ b/share/spack/spack-completion.bash
@@ -500,7 +500,7 @@ _spack_buildcache_create() {
then
SPACK_COMPREPLY="-h --help -r --rel -f --force -u --unsigned -a --allow-root -k --key -d --directory -m --mirror-name --mirror-url --rebuild-index --spec-file --only"
else
- _all_packages
+ _mirrors
fi
}
@@ -552,11 +552,21 @@ _spack_buildcache_save_specfile() {
}
_spack_buildcache_sync() {
- SPACK_COMPREPLY="-h --help --manifest-glob --src-directory --src-mirror-name --src-mirror-url --dest-directory --dest-mirror-name --dest-mirror-url"
+ if $list_options
+ then
+ SPACK_COMPREPLY="-h --help --manifest-glob --src-directory --src-mirror-name --src-mirror-url --dest-directory --dest-mirror-name --dest-mirror-url"
+ else
+ SPACK_COMPREPLY=""
+ fi
}
_spack_buildcache_update_index() {
- SPACK_COMPREPLY="-h --help -d --directory -m --mirror-name --mirror-url -k --keys"
+ if $list_options
+ then
+ SPACK_COMPREPLY="-h --help -d --directory -m --mirror-name --mirror-url -k --keys"
+ else
+ _mirrors
+ fi
}
_spack_cd() {