33776899d72530a84a67eb5fb48f00acecd14893
[platform/upstream/rpm.git] / scripts / find-debuginfo.sh
1 #!/bin/sh
2 #find-debuginfo.sh - automagically generate debug info and file list
3 #for inclusion in an rpm spec file.
4
5 LISTFILE=debugfiles.list
6
7 # Strip ELF binaries
8 for f in `find $RPM_BUILD_ROOT -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) -exec file {} \; | \
9         sed -n -e 's/^\(.*\):[  ]*ELF.*, not stripped/\1/p'`; do
10         BASEDIR=`dirname $f | sed -n -e "s#^$RPM_BUILD_ROOT#/#p"`
11         OUTPUTDIR=${RPM_BUILD_ROOT}/usr/lib/debug${BASEDIR}
12         mkdir -p ${OUTPUTDIR}
13         echo extracting debug info from $f
14         striptofile -g -u -o $OUTPUTDIR $f || :
15 done
16
17 find ${RPM_BUILD_ROOT}/usr/lib/debug -type f | sed -n -e "s#^$RPM_BUILD_ROOT#/#p" > $LISTFILE