Merge pull request #295099 from Qyriad/maint/autopatchelf-single-line

autoPatchelfHook: move multiline hook into a function
This commit is contained in:
Guillaume Maudoux 2024-03-18 10:17:37 +01:00 committed by GitHub
commit fb1539a8c8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -88,6 +88,7 @@ autoPatchelf() {
--extra-args "${patchelfFlagsArray[@]}" --extra-args "${patchelfFlagsArray[@]}"
} }
autoPatchelfPostFixup() {
# XXX: This should ultimately use fixupOutputHooks but we currently don't have # XXX: This should ultimately use fixupOutputHooks but we currently don't have
# a way to enforce the order. If we have $runtimeDependencies set, the setup # a way to enforce the order. If we have $runtimeDependencies set, the setup
# hook of patchelf is going to ruin everything and strip out those additional # hook of patchelf is going to ruin everything and strip out those additional
@ -96,14 +97,12 @@ autoPatchelf() {
# So what we do here is basically run in postFixup and emulate the same # So what we do here is basically run in postFixup and emulate the same
# behaviour as fixupOutputHooks because the setup hook for patchelf is run in # behaviour as fixupOutputHooks because the setup hook for patchelf is run in
# fixupOutput and the postFixup hook runs later. # fixupOutput and the postFixup hook runs later.
# if [[ -z "${dontAutoPatchelf-}" ]]; then
# shellcheck disable=SC2016
# (Expressions don't expand in single quotes, use double quotes for that.)
postFixupHooks+=('
if [ -z "${dontAutoPatchelf-}" ]; then
autoPatchelf -- $(for output in $(getAllOutputNames); do autoPatchelf -- $(for output in $(getAllOutputNames); do
[ -e "${!output}" ] || continue [ -e "${!output}" ] || continue
echo "${!output}" echo "${!output}"
done) done)
fi fi
') }
postFixupHooks+=(autoPatchelfPostFixup)