This is an automated email from the ASF dual-hosted git repository. not-in-ldap pushed a commit to branch coldtom/strip-rules in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit e7beb2927b851c39c3c6fbe62bb3d58953b22080 Author: Thomas Coldrick <[email protected]> AuthorDate: Thu Oct 4 11:52:15 2018 +0100 Upstream freedesktop-sdk strip rules Adds a modified version of the freedesktop-sdk `strip-binaries` to buildstream default `project.conf`. We implemented a few changes to the current default, but the main change is to fix a bug due to permissions. The modifications I made to the freedesktop-sdk commands as they are at present are as follows: * Remove debugedit rules to include source debugging * Add a switch to allow failing on error, rather than this being the default behaviour. These changes mean that we should now have a sensible default for a wide variety of users. --- buildstream/data/projectconfig.yaml | 49 +++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/buildstream/data/projectconfig.yaml b/buildstream/data/projectconfig.yaml index 4d2ccc6..701a930 100644 --- a/buildstream/data/projectconfig.yaml +++ b/buildstream/data/projectconfig.yaml @@ -51,23 +51,40 @@ variables: --remove-section=.comment --remove-section=.note --strip-unneeded + # Causes strip-binaries to fail on error if set to true + fatal-strip: "false" + # Generic implementation for stripping debugging symbols strip-binaries: | - - cd "%{install-root}" && find -type f \ - '(' -perm -111 -o -name '*.so*' \ - -o -name '*.cmxs' -o -name '*.node' ')' \ - -exec sh -ec \ - 'read -n4 hdr <"$1" # check for elf header - if [ "$hdr" != "$(printf \\x7fELF)" ]; then - exit 0 - fi - debugfile="%{install-root}%{debugdir}/$1" - mkdir -p "$(dirname "$debugfile")" - objcopy %{objcopy-extract-args} "$1" "$debugfile" - chmod 644 "$debugfile" - strip %{strip-args} "$1" - objcopy %{objcopy-link-args} "$debugfile" "$1"' - {} ';' + find "%{install-root}" -type f \ + '(' -perm -111 -o -name '*.so*' \ + -o -name '*.cmxs' -o -name '*.node' ')' \ + -print0 | while read -r -d $'\0' file; do + read -n4 hdr <"${file}" || continue # check for elf header + if [ "$hdr" != "$(printf \\x7fELF)" ]; then + continue + fi + if objdump -j .gnu_debuglink -s "${file}" &>/dev/null; then + continue + fi + case "${file}" in + "%{install-root}%{debugdir}/"*) + continue + ;; + *) + ;; + esac + realpath="$(realpath -s --relative-to="%{install-root}" "${file}")" + debugfile="%{install-root}%{debugdir}/${realpath}.debug" + mkdir -p "$(dirname "$debugfile")" + objcopy %{objcopy-extract-args} "${file}" "$debugfile" + chmod 644 "$debugfile" + mode="$(stat -c 0%a "${file}")" + [ -w "${file}" ] || chmod +w "${file}" + strip %{strip-args} "${file}" || %{fatal-strip} + objcopy %{objcopy-link-args} "$debugfile" "${file}" + chmod "${mode}" "${file}" + done # Generic implementation for reproducible python builds fix-pyc-timestamps: | @@ -191,4 +208,4 @@ shell: command: [ 'sh', '-i' ] remote-execution: - url: "" \ No newline at end of file + url: ""
