File: rpm2dynsym.sh

package info (click to toggle)
glibc 2.19-18+deb8u7
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 204,748 kB
  • sloc: ansic: 970,427; asm: 241,207; sh: 10,069; makefile: 8,476; cpp: 3,595; perl: 2,077; pascal: 1,839; awk: 1,704; yacc: 317; sed: 73
file content (36 lines) | stat: -rwxr-xr-x 1,251 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh

# This script takes rpm package files, finds *.so.N files in them,
# and runs objdump --dynamic-syms on them.  The arguments are rpm file
# names.  For each rpm, it creates an output file with the name
# "NAME-VERSION-RELEASE.ARCH.dynsym", the variable parts being extracted
# from the rpm's headers (not its file name).  Each file contains the
# collected objdump output for all the *.so.N files in the corresponding rpm.
# This can be processed with abilist.awk or sent to someone who will do that.
# This does not do a lot of error-checking, so you should always watch stderr
# and sanity-check the resulting output files.

RPM=${RPM:-rpm}
RPM2CPIO=${RPM2CPIO:-rpm2cpio}
CPIO=${CPIO:-cpio}
OBJDUMP=${OBJDUMP:-objdump}

unpackdir=/tmp/rpm2dynsym$$
trap 'rm -rf $unpackdir' 0 1 2 15

for rpm; do
  name=`$RPM -qp $rpm --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n'`
  mkdir $unpackdir || exit
  $RPM2CPIO "$rpm" | {
    cd $unpackdir
    $CPIO -i -d --no-absolute-filenames -uv '*.so.*' '*.so' 2>&1 |
    while read file b; do
      test x"$b" = x || break
      case "$file" in
      *.so.[0-9]*) $OBJDUMP --dynamic-syms $file ;;
      esac
    done
  } > $name.dynsym
  echo wrote $name.dynsym for $rpm
  rm -rf $unpackdir
done