remove sequential filter in binary relo (#33608)

Currently there's a slow sequential step in binary relocation where all
strings of a binary are collected, with rpaths removed, and then
filtered for the old install root.

This is completely unnecessary, and also incorrect, since we replace
more than just the old install root in the prefix to prefix mapping. And
in fact the prefix to prefix mapping is parallel, and a single pass. So
even as an optimization, this filter makes no sense anymore.

Therefor we remove it
This commit is contained in:
Harmen Stoppels 2022-10-31 10:41:59 +01:00 committed by GitHub
parent 616d5a89d4
commit 1ab888cdc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1644,27 +1644,15 @@ def is_backup_file(file):
old_prefix,
new_prefix,
)
# Relocate links to the new install prefix
links = [link for link in buildinfo.get("relocate_links", [])]
relocate.relocate_links(links, old_layout_root, old_prefix, new_prefix)
# Relocate links to the new install prefix
links = [link for link in buildinfo.get("relocate_links", [])]
relocate.relocate_links(links, old_layout_root, old_prefix, new_prefix)
# For all buildcaches
# relocate the install prefixes in text files including dependencies
relocate.unsafe_relocate_text(text_names, prefix_to_prefix_text)
paths_to_relocate = [old_prefix, old_layout_root]
paths_to_relocate.extend(prefix_to_hash.keys())
files_to_relocate = list(
filter(
lambda pathname: not relocate.file_is_relocatable(
pathname, paths_to_relocate=paths_to_relocate
),
map(
lambda filename: os.path.join(workdir, filename),
buildinfo["relocate_binaries"],
),
)
)
# relocate the install prefixes in binary files including dependencies
relocate.unsafe_relocate_text_bin(files_to_relocate, prefix_to_prefix_bin)