X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=scripts%2Ffind-debuginfo.sh;h=c73f06bf0c9432f999174a40f13c5efe11a43cb0;hb=HEAD;hp=efcc72ed2afff2f50f9b378a67beb9c376d020cd;hpb=0f8e139c29fcad0404c85eb6709f5e50db0846fc;p=platform%2Fupstream%2Frpm.git diff --git a/scripts/find-debuginfo.sh b/scripts/find-debuginfo.sh index efcc72e..aac635d 100644 --- a/scripts/find-debuginfo.sh +++ b/scripts/find-debuginfo.sh @@ -2,7 +2,7 @@ #find-debuginfo.sh - automagically generate debug info and file list #for inclusion in an rpm spec file. # -# Usage: find-debuginfo.sh [--strict-build-id] [-g] [-r] +# Usage: find-debuginfo.sh [--strict-build-id] [--strip-disable] [--strip-option] [-g] [-r] # [-o debugfiles.list] # [[-l filelist]... [-p 'pattern'] -o debuginfo.list] # [builddir] @@ -32,6 +32,12 @@ strip_r=false # Barf on missing build IDs. strict=false +# With --strip-disable arg, no strip +strip_disable=false + +# With --strip-option arg, this will be used as arg. of eu-strip +strip_option= + BUILDDIR=. out=debugfiles.list nout=0 @@ -40,6 +46,12 @@ while [ $# -gt 0 ]; do --strict-build-id) strict=true ;; + --strip-disable) + strip_disable=true + ;; + *--strip-option*) + strip_option=$(echo $1 | sed 's/--strip-option=//') + ;; -g) strip_g=true ;; @@ -95,17 +107,27 @@ debugdir="${RPM_BUILD_ROOT}/usr/lib/debug" strip_to_debug() { + local g= local r= + + if test "$strip_disable" = true ; then + exit + fi + $strip_r && r=--reloc-debug-sections + $strip_g && case "$(file -bi "$2")" in + application/x-sharedlib*) g=-g ;; + esac + case $2 in *.ko) - # don't attempt to create a minimal backtrace binary for - # kernel modules as this just causes the stripping process - # to be skipped entirely - eu-strip --remove-comment $r -f "$1" "$2" || exit - ;; + # don't attempt to create a minimal backtrace binary for + # kernel modules as this just causes the stripping process + # to be skipped entirely + eu-strip --remove-comment $r $strip_option -f "$1" "$2" || exit + ;; *) - eu-strip --remove-comment -g -f "$1" "$2" || exit + strip --remove-section=.comment $g $strip_option -o "$1" "$2" || exit esac chmod 444 "$1" || exit } @@ -142,12 +164,16 @@ debug_link() # this should correspond to what brp-symlink is doing case $t in /usr*) - link_relative "$t" "$l" "$RPM_BUILD_ROOT" - ;; + link_relative "$t" "$l" "$RPM_BUILD_ROOT" + ;; *) - mkdir -p "$(dirname "$RPM_BUILD_ROOT$l")" && \ - ln -snf "$t" "$RPM_BUILD_ROOT$l" - ;; + if [ ! -e $t ]; then + link_relative "$t" "$l" "$RPM_BUILD_ROOT" + else + mkdir -p "$(dirname "$RPM_BUILD_ROOT$l")" && \ + ln -snf "$t" "$RPM_BUILD_ROOT$l" + fi + ;; esac } @@ -313,6 +339,9 @@ while read nlinks inum f; do if test "$NO_DEBUGINFO_STRIP_DEBUG" = true ; then strip_option= fi + if test "$strip_disable" = true ; then + strip_option= + fi objcopy --add-gnu-debuglink=$debugfn -R .comment -R .GCC.command.line $strip_option $f chmod $mode $f ) || :