-
Notifications
You must be signed in to change notification settings - Fork 2.4k
--config-scope seems to be ignored #13754
Description
Starting with commit 43b0356, configuration scopes seem to be ignored. For example, with one commit before (dc36b47):
$ cd $spack_root
$ git checkout dc36b4737d16ea4aa49daa14fb782b5ea85b60e3
$ ./bin/spack --config-scope=<some path> config blame repos
--- repos:
<some path>/repos.yaml:2 - $nevada_toolset2_root/var/nevada/spack/repo
<spack root>/etc/spack/defaults/repos.yaml:14 - $spack/var/spack/repos/builtinbut, after 43b0356 I get
$ cd $spack_root
$ git checkout develop
$ ./bin/spack --config-scope=<some path> config blame repos
--- repos:
<spack root>/etc/spack/defaults/repos.yaml:14 - $spack/var/spack/repos/builtinChecking out lib/spack/spack/relocate.py from dc36b47 seems to resolve the issue:
$ cd $spack_root
$ git co dc36b4737d16ea4aa49daa14fb782b5ea85b60e3 -- lib/spack/spack/relocate.py
$ ./bin/spack --config-scope=<some path> config blame repos
--- repos:
<some path>/repos.yaml:2 - $nevada_toolset2_root/var/nevada/spack/repo
<spack root>/etc/spack/defaults/repos.yaml:14 - $spack/var/spack/repos/builtinOne of the changes in 43b0356 is to the function signature of file_is_relocatable from
def file_is_relocatable(file):
...To
def file_is_relocatable(
file, paths_to_relocate=[spack.store.layout.root, spack.paths.prefix]):paths_to_relocate is then used in the function. Simply making the following change fixes the config scope issue for me:
def file_is_relocatable(file):
paths_to_relocate = [spack.store.layout.root, spack.paths.prefix]That said, this makes no sense to me. The function file_is_relocatable is not called when spack config blame ... is issued (tested by dropping assert 0 as the first line of file_is_relocatable). Nevertheless, the change does fix my issue.
A grep of the spack source shows:
$ cd $spack_root
$ grep -irl --include=*.py file_is_relocatable .
./lib/spack/spack/test/relocate.py
./lib/spack/spack/binary_distribution.py
./lib/spack/spack/relocate.pyand none of the calls use the paths_to_relocate argument, so the change above should be fine, and it might be best to leave mutable arguments from function signature, if possible.