binary caching: skip check if old and new paths are identical (#8281)

Fixes #8217

Trying to relocate a distribution when the new and old paths are
equal leads to failure, because the test that ensures that no
unrelocated bits are left over always fails. As an example, this
occurs if a user installs a package, generates a binary with it
using 'spack buildcache', uninstalls it, and then attempts to
reinstall into the same spack installation using the generated
binary package.

This updates the relocation check to accept the presence of the
old prefix in binaries if the package is being reinstalled into
its original location.
This commit is contained in:
George Hartzell 2018-05-31 16:01:32 -07:00 committed by scheibelp
parent 59633d5c95
commit a6867d5cd5

View File

@ -355,6 +355,7 @@ def relocate_binary(path_names, old_dir, new_dir, allow_root):
rpaths, deps, idpath,
new_rpaths, new_deps, new_idpath)
if (not allow_root and
old_dir != new_dir and
strings_contains_installroot(path_name, old_dir)):
raise InstallRootStringException(path_name, old_dir)
@ -373,6 +374,7 @@ def relocate_binary(path_names, old_dir, new_dir, allow_root):
old_dir, new_dir)
modify_elf_object(path_name, new_rpaths)
if (not allow_root and
old_dir != new_dir and
strings_contains_installroot(path_name, old_dir)):
raise InstallRootStringException(path_name, old_dir)
else: