[citemplates/abderrahim/post-process: 2/2] add debuginfo extraction commands



commit a3b2d727bcdddd0fb6aba1e8cac9c6f42d45a364
Author: Abderrahim Kitouni <akitouni gnome org>
Date:   Mon Jul 22 20:48:09 2019 +0100

    add debuginfo extraction commands
    
    based on the commands used by the runtime

 flatpak/flatpak_ci_initiative_v1.yml | 38 ++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
---
diff --git a/flatpak/flatpak_ci_initiative_v1.yml b/flatpak/flatpak_ci_initiative_v1.yml
index 58582b9..87236d0 100644
--- a/flatpak/flatpak_ci_initiative_v1.yml
+++ b/flatpak/flatpak_ci_initiative_v1.yml
@@ -16,6 +16,44 @@
         mv /app/share/locale/${lang} /app/share/runtime/locale/${ll}/share/; \
         ln -s ../../share/runtime/locale/${ll}/share/${lang} /app/share/locale; \
       done'
+    - |
+      flatpak build flatpak_app bash -c \
+      "find /app -type f '(' -perm -111 -o -name '*.so*' ')' -print0 | while read -r -d $'\\0' file; do \
+        read -n4 hdr < \${file} || continue; \
+        if [ \$hdr != \$(printf \\\\x7fELF) ]; then \
+          continue; \
+        fi; \
+        if objdump -j .gnu_debuglink -s \${file} &> /dev/null; then \
+          continue; \
+        fi; \
+        case \${file} in /app/lib/debug/*) \
+            continue ;; \
+        esac; \
+        debugedit -i --list-file=source-files.part --base-dir=\${PWD} 
--dest-dir=/app/lib/debug/source//${FLATPAK_MODULE} \${file} &> /dev/null; \
+        cat source-files.part >> source-files; \
+        realpath=\$(realpath -s --relative-to=/app \${file}); \
+        debugfile=/app/lib/debug/\${realpath}.debug; \
+        mkdir -p \$(dirname \${debugfile}); \
+        objcopy --only-keep-debug --compress-debug-sections \${file} \${debugfile}; \
+        chmod 644 \${debugfile}; \
+        mode=\$(stat -c 0%a \${file}); \
+        [ -w \${file} ] || chmod +w \${file}; \
+        strip --remove-section=.comment --remove-section=.note --strip-unneeded 
--remove-section=.gnu_debugaltlink \${file}; \
+        objcopy --add-gnu-debuglink \${debugfile} \${file}; \
+        chmod \${mode} \${file}; \
+      done; \
+      sort -zu < source-files | while read -r -d \$'\\0' source; do \
+        dst=/app/lib/debug/source/${FLATPAK_MODULE}/\${source}; \
+        src=\${source}; \
+        echo \${src} \${dst}; \
+        if [ -d \${src} ]; then \
+          install -m0755 -d \${dst}; \
+          continue; \
+        fi; \
+        [ -f \${src} ] || continue; \
+        install -m0644 -D \${src} \${dst}; \
+      done"
+
     - flatpak-builder --finish-only --repo=repo ${BRANCH:+--default-branch=$BRANCH} flatpak_app 
${MANIFEST_PATH}
     # Run automatic tests inside the Flatpak env
     - >


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]