From e055dc0e64693782e5d98ffa90780ad57c855aa2 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Tue, 13 Dec 2022 23:44:13 +0100 Subject: Use file paths/urls correctly (#34452) The main issue that's fixed is that Spack passes paths (as strings) to functions that require urls. That wasn't an issue on unix, since there you can simply concatenate `file://` and `path` and all is good, but on Windows that gives invalid file urls. Also on Unix, Spack would not deal with uri encoding like x%20y for file paths. It also removes Spack's custom url.parse function, which had its own incorrect interpretation of file urls, taking file://x/y to mean the relative path x/y instead of hostname=x and path=/y. Also it automatically interpolated variables, which is surprising for a function that parses URLs. Instead of all sorts of ad-hoc `if windows: fix_broken_file_url` this PR adds two helper functions around Python's own path2url and reverse. Also fixes a bug where some `spack buildcache` commands used `-d` as a flag to mean `--mirror-url` requiring a URL, and others `--directory`, requiring a path. It is now the latter consistently. --- share/spack/spack-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'share') diff --git a/share/spack/spack-completion.bash b/share/spack/spack-completion.bash index 604468aaeb..028ec16bee 100755 --- a/share/spack/spack-completion.bash +++ b/share/spack/spack-completion.bash @@ -556,7 +556,7 @@ _spack_buildcache_sync() { } _spack_buildcache_update_index() { - SPACK_COMPREPLY="-h --help -d --mirror-url -k --keys" + SPACK_COMPREPLY="-h --help -d --directory -m --mirror-name --mirror-url -k --keys" } _spack_cd() { -- cgit v1.2.3-70-g09d2