You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by no...@apache.org on 2020/12/29 12:38:53 UTC

[buildstream] branch coldtom/strip-rules created (now c31cb89)

This is an automated email from the ASF dual-hosted git repository.

not-in-ldap pushed a change to branch coldtom/strip-rules
in repository https://gitbox.apache.org/repos/asf/buildstream.git.


      at c31cb89  Update cache key tests

This branch includes the following new commits:

     new e7beb29  Upstream freedesktop-sdk strip rules
     new c31cb89  Update cache key tests

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[buildstream] 02/02: Update cache key tests

Posted by no...@apache.org.
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 c31cb89a39a6f838a93cf338731a037893d6498d
Author: Thomas Coldrick <ot...@gmail.com>
AuthorDate: Thu Oct 4 11:52:54 2018 +0100

    Update cache key tests
---
 tests/cachekey/project/elements/build1.expected | 2 +-
 tests/cachekey/project/elements/build2.expected | 2 +-
 tests/cachekey/project/target.expected          | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/cachekey/project/elements/build1.expected b/tests/cachekey/project/elements/build1.expected
index 42d0261..e9d7a4a 100644
--- a/tests/cachekey/project/elements/build1.expected
+++ b/tests/cachekey/project/elements/build1.expected
@@ -1 +1 @@
-dd5e29baefb84f68eb4abac3a1befc332077ec4c97bb2572e57f3ca98ba46707
\ No newline at end of file
+c8beac45697ce777d63ff356d7af430f718ee78264bb2b6a41ebddf4f6aeed53
\ No newline at end of file
diff --git a/tests/cachekey/project/elements/build2.expected b/tests/cachekey/project/elements/build2.expected
index cc20260..8835a0b 100644
--- a/tests/cachekey/project/elements/build2.expected
+++ b/tests/cachekey/project/elements/build2.expected
@@ -1 +1 @@
-99d80454cce44645597c885800edf0bf254d1c3606d869f2ccdd5043ec7685cb
\ No newline at end of file
+7ba21f3a594318d9138befa4ecdb11169b791074efc44edf6729667f7e024ca4
\ No newline at end of file
diff --git a/tests/cachekey/project/target.expected b/tests/cachekey/project/target.expected
index 70dcca3..ab822d5 100644
--- a/tests/cachekey/project/target.expected
+++ b/tests/cachekey/project/target.expected
@@ -1 +1 @@
-29a1252ec30dd6ae73c772381f0eb417e3874c75710d08be819f5715dcaa942b
\ No newline at end of file
+363201be403127a4e24ac079f0390e90cd80953c91ab6b26b60985d51c4d2e91
\ No newline at end of file


[buildstream] 01/02: Upstream freedesktop-sdk strip rules

Posted by no...@apache.org.
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 <ot...@gmail.com>
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: ""