3 # build/znc-1.8.1-2.fc33.src.rpm.rpms
4 which readelf >/dev/null
7 if [ "$rpms" = "$srcrpm" ];then
8 echo >&2 "$rpms is not *.rpms"
11 if [ "$srcrpm" != "${srcrpm%.dt5.rpm}" ];then
12 # The non-.dt5.rpm run will handle both.
15 if [ "$srcrpm" != "${srcrpm%.dt.rpm}" ];then
19 test -e $srcrpm.rpms || (echo >&2 "! $srcrpm.rpms";exit 1)
20 test -e $srcrpm.dt5.rpm.rpms || (echo >&2 "! $srcrpm.dt5.rpm.rpms";exit 1)
21 if [ -e $srcrpm.dtneeded ];then
24 test ! -e $srcrpm.rpms.d || (echo >&2 "$srcrpm.rpms.d";exit 1)
25 t=/tmp/dtneededsizerpms.$$
28 pushd $srcrpm.rpms.d >/dev/null
29 rpmsbase=../../`basename $srcrpm`
30 dwzrpms=$rpmsbase.rpms
31 dtrpms=$rpmsbase.dt5.rpm.rpms
34 if [ -z "$(find $dwzrpms $dtrpms -maxdepth 1 -type f)" ];then
42 for i in $1/*-debuginfo*.rpm;do
50 mkdir dwz;(cd dwz;extract $dwzrpms)
51 mkdir dt;(cd dt;extract $dtrpms)
52 dwzcommonname="$(find dwz/usr/lib/debug/.dwz/ -type f 2>/dev/null || :)"
53 if [ -z "$dwzcommonname" ];then
54 dwzcommonname="nodwzcommon"
57 dwzcommon="$(find "$dwzcommonname" -maxdepth 0 -printf "%s")"
58 dwzcommonname="/${dwzcommonname#dwz/}"
59 dwzcommonname2="$(echo "$dwzcommonname"|sed 's/-[^-]*-[^-]*$//')"
60 if [ "$dwzcommonname2" = "$dwzcommonname" ];then
61 echo >&2 "No VR dwzcommon suffix: $dwzcommonname"
64 dwzcommonname="$dwzcommonname2"
65 echo >>$t "$dwzcommonname isdwzcommon $dwzcommon NA"
68 for i in `find -type f -name "*.debug*"`;do
69 dwz=$(find $i -maxdepth 0 -printf "%s")
70 dt=$(find ../dt/$i -maxdepth 0 -printf "%s")
71 if readelf -WS $i 2>/dev/null|fgrep -q .gnu_debugaltlink;then
72 if [ $dwzcommon -eq 0 ];then
73 echo >&2 "Excessive .gnu_debugaltlink: $i"
77 i2="${i#./usr/lib/debug/}"
78 if [ "$i" = "$i2" ];then
79 echo >&2 "No ./usr/lib/debug/ prefix: $i"
82 i2="$(echo "$i"|sed 's/-[^-]*-[^-]*$//')"
83 if [ "$i2" = "$i" ];then
84 echo >&2" No VR suffix: $i"
88 echo "${i%.debug} $dwzcommonname $dwz $dt"|sed 's#^\./#/#' >>$t
93 mv $t $srcrpm.dtneeded