- Drop most of the script-based dependency generation bits

- Use rpmdeps to generate any "normal" dependencies even for the
  kernel module stuff, drop all other unnecessary duplication
  like elf, libtool and pkgconfig deps.
This commit is contained in:
Panu Matilainen 2014-04-10 15:20:54 +03:00
parent 43629272a8
commit 2cbbbb322e
7 changed files with 8 additions and 252 deletions

View File

@ -8,67 +8,12 @@ then
package_name="$1" package_name="$1"
fi fi
[ -z "$OBJDUMP" ] && OBJDUMP=objdump
filelist=`sed "s/['\"]/\\\&/g"` filelist=`sed "s/['\"]/\\\&/g"`
solist=$(echo $filelist | grep "\\.so" | grep -v "^/lib/ld.so" | \
xargs file -L 2>/dev/null | grep "ELF.*shared object" | cut -d: -f1)
pythonlist=
tcllist=
#
# --- Alpha does not mark 64bit dependencies
case `uname -m` in
alpha*) mark64="" ;;
*) mark64="()(64bit)" ;;
esac
#
# --- Library sonames and weak symbol versions (from glibc).
for f in $solist; do
soname=$(objdump -p $f | awk '/SONAME/ {print $2}')
lib64=`if file -L $f 2>/dev/null | \
grep "ELF 64-bit" >/dev/null; then echo "$mark64"; fi`
if [ "$soname" != "" ]; then
if [ ! -L $f ]; then
echo $soname$lib64
objdump -p $f | awk '
BEGIN { START=0 ; }
/Version definitions:/ { START=1; }
/^[0-9]/ && (START==1) { print $4; }
/^$/ { START=0; }
' | \
grep -v $soname | \
while read symbol ; do
echo "$soname($symbol)`echo $lib64 | sed 's/()//'`"
done
fi
else
echo ${f##*/}$lib64
fi
done | sort -u
#
# --- Perl modules.
[ -x /usr/lib/rpm/perl.prov ] &&
echo $filelist | tr '[:blank:]' \\n | grep '\.pm$' | /usr/lib/rpm/perl.prov | sort -u
#
# --- Python modules.
[ -x /usr/lib/rpm/redhat/python.prov -a -n "$pythonlist" ] &&
echo $pythonlist | tr '[:blank:]' \\n | /usr/lib/rpm/redhat/python.prov | sort -u
#
# --- Tcl modules.
[ -x /usr/lib/rpm/redhat/tcl.prov -a -n "$tcllist" ] &&
echo $tcllist | tr '[:blank:]' \\n | /usr/lib/rpm/redhat/tcl.prov | sort -u
# #
# --- libtool # --- libtool
[ -x /usr/lib/rpm/redhat/find-provides.libtool ] && [ -x /usr/lib/rpm/rpmdeps -a -n "$filelist" ] &&
echo $filelist | tr '[:blank:]' \\n | /usr/lib/rpm/redhat/find-provides.libtool | sort -u echo $filelist | tr '[:blank:]' \\n | /usr/lib/rpm/rpmdeps --provides
# #
# --- any other extra find-provides scripts # --- any other extra find-provides scripts
@ -78,11 +23,6 @@ do
(echo $filelist | tr '[:blank:]' \\n | $i | sort -u) (echo $filelist | tr '[:blank:]' \\n | $i | sort -u)
done done
#
# --- pkgconfig
[ -x /usr/lib/rpm/redhat/find-provides.pkgconfig ] &&
echo $filelist | tr '[:blank:]' \\n | /usr/lib/rpm/redhat/find-provides.pkgconfig | sort -u
# #
# --- Kernel module imported symbols # --- Kernel module imported symbols
# #

View File

@ -1,10 +0,0 @@
#!/bin/sh
while read possible ; do
case "$possible" in
*.la)
if grep -iq '^# Generated by ltmain.sh' "$possible" 2> /dev/null ; then
echo "libtool($possible)"
fi
;;
esac
done

View File

@ -1,22 +0,0 @@
#!/bin/bash
pkgconfig=${1:-/usr/bin/pkg-config}
test -x $pkgconfig || exit 0
while read filename ; do
case "${filename}" in
*.pc)
# Assume that this file doesn't contain useful information.
needs_pkgconfig=false
# Query the dependencies of the package.
$pkgconfig --print-provides "$filename" 2> /dev/null | while read n r v ; do
# We have a dependency. Make a note that we need the pkgconfig
# tool for this package.
echo "pkgconfig($n)" "$r" "$v"
needs_pkgconfig=true
done
# The dependency on the pkgconfig package itself.
if $needs_pkgconfig ; then
echo pkgconfig
fi
;;
esac
done

View File

@ -7,131 +7,10 @@
ulimit -c 0 ulimit -c 0
#
# --- Set needed to 0 for traditional find-requires behavior.
needed=1
if [ X"$1" = Xldd ]; then
needed=0
elif [ X"$1" = Xobjdump ]; then
needed=1
fi
[ -z "$OBJDUMP" ] && OBJDUMP=objdump
#
# --- Grab the file manifest and classify files.
#filelist=`sed "s/['\"]/\\\&/g"`
filelist=`sed "s/[]['\"*?{}]/\\\\\&/g"` filelist=`sed "s/[]['\"*?{}]/\\\\\&/g"`
exelist=`echo $filelist | xargs -r file | egrep -v ":.* (commands|script) " | \
grep ":.*executable" | cut -d: -f1`
scriptlist=`echo $filelist | xargs -r file | \
egrep ":.* (commands|script) " | cut -d: -f1`
liblist=`echo $filelist | xargs -r file | \
grep ":.*shared object" | cut -d : -f1`
interplist= [ -x /usr/lib/rpm/rpmdeps -a -n "$filelist" ] && \
perllist= echo $filelist | tr '[:blank:]' \\n | /usr/lib/rpm/rpmdeps --requires
pythonlist=
tcllist=
#
# --- Alpha does not mark 64bit dependencies
case `uname -m` in
alpha*) mark64="" ;;
*) mark64="()(64bit)" ;;
esac
if [ "$needed" -eq 0 ]; then
#
# --- Executable dependency sonames.
for f in $exelist; do
[ -r $f -a -x $f ] || continue
lib64=`if file -L $f 2>/dev/null | \
grep "ELF 64-bit" >/dev/null; then echo "$mark64"; fi`
ldd $f | awk '/=>/ {
if ($1 !~ /libNoVersion.so/ && $1 !~ /4[um]lib.so/ && $1 !~ /libredhat-kernel.so/) {
gsub(/'\''"/,"\\&",$1);
printf "%s'$lib64'\n", $1
}
}'
done | xargs -r -n 1 basename | sort -u
#
# --- Library dependency sonames.
for f in $liblist; do
[ -r $f ] || continue
lib64=`if file -L $f 2>/dev/null | \
grep "ELF 64-bit" >/dev/null; then echo "$mark64"; fi`
ldd $f | awk '/=>/ {
if ($1 !~ /libNoVersion.so/ && $1 !~ /4[um]lib.so/ && $1 !~ /libredhat-kernel.so/) {
gsub(/'\''"/,"\\&",$1);
printf "%s'$lib64'\n", $1
}
}'
done | xargs -r -n 1 basename | sort -u
fi
#
# --- Script interpreters.
for f in $scriptlist; do
[ -r $f -a -x $f ] || continue
interp=`head -n 1 $f | sed -e 's/^\#\![ ]*//' | cut -d" " -f1`
interplist="$interplist $interp"
case $interp in
*/perl) perllist="$perllist $f" ;;
esac
done
[ -n "$interplist" ] && { echo "$interplist" | tr '[:blank:]' \\n | sort -u ; }
#
# --- Add perl module files to perllist.
for f in $filelist; do
[ -r $f -a "${f%.pm}" != "${f}" ] && perllist="$perllist $f"
done
#
# --- Weak symbol versions (from glibc).
[ -n "$mark64" ] && mark64="(64bit)"
for f in $liblist $exelist ; do
[ -r $f ] || continue
lib64=`if file -L $f 2>/dev/null | \
grep "ELF 64-bit" >/dev/null; then echo "$mark64"; fi`
$OBJDUMP -p $f | awk 'BEGIN { START=0; LIBNAME=""; needed='$needed'; }
/^$/ { START=0; }
/^Dynamic Section:$/ { START=1; }
(START==1) && /NEEDED/ {
if (needed) {
if ("'$lib64'" != "") {
sub(/$/, "()'$lib64'", $2) ;
}
print $2 ;
}
}
(START==2) && /^[A-Za-z]/ { START=3; }
/^Version References:$/ { START=2; }
(START==2) && /required from/ {
sub(/:/, "", $3);
LIBNAME=$3;
}
(START==2) && (LIBNAME!="") && ($4!="") {
print LIBNAME "(" $4 ")'$lib64'";
}
'
done | sort -u
#
# --- Perl modules.
[ -x /usr/lib/rpm/perl.req -a -n "$perllist" ] && \
echo $perllist | tr '[:blank:]' \\n | /usr/lib/rpm/perl.req | sort -u
#
# --- Python modules.
[ -x /usr/lib/rpm/redhat/python.req -a -n "$pythonlist" ] && \
echo $pythonlist | tr '[:blank:]' \\n | /usr/lib/rpm/redhat/python.req | sort -u
#
# --- Tcl modules.
[ -x /usr/lib/rpm/redhat/tcl.req -a -n "$tcllist" ] && \
echo $tcllist | tr '[:blank:]' \\n | /usr/lib/rpm/redhat/tcl.req | sort -u
# #
# --- Kernel module imported symbols # --- Kernel module imported symbols

View File

@ -1,15 +0,0 @@
#!/bin/sh
while read possible ; do
case "$possible" in
*.la)
for dep in `grep ^dependency_libs= "$possible" 2> /dev/null | \
sed -r -e "s,^dependency_libs='(.*)',\1,g"` ; do
case "$dep" in
/*.la)
echo "libtool($dep)"
;;
esac
done
;;
esac
done

View File

@ -1,11 +0,0 @@
#!/bin/bash
pkgconfig=${1:-/usr/bin/pkg-config}
test -x $pkgconfig || exit 0
while read filename ; do
case "${filename}" in
*.pc)
$pkgconfig --print-requires --print-requires-private "$filename" 2> /dev/null | while read n r v ; do
echo "pkgconfig($n)" "$r" "$v"
done
esac
done

View File

@ -6,7 +6,7 @@
Summary: Red Hat specific rpm configuration files Summary: Red Hat specific rpm configuration files
Name: redhat-rpm-config Name: redhat-rpm-config
Version: 14 Version: 15
Release: 1%{?dist} Release: 1%{?dist}
# No version specified. # No version specified.
License: GPL+ License: GPL+
@ -49,12 +49,8 @@ Source207: brp-strip-static-archive
# Dependency generator scripts (deprecated) # Dependency generator scripts (deprecated)
Source300: find-provides Source300: find-provides
Source301: find-provides.ksyms Source301: find-provides.ksyms
Source302: find-provides.libtool
Source303: find-provides.pkgconfig
Source304: find-requires Source304: find-requires
Source305: find-requires.ksyms Source305: find-requires.ksyms
Source306: find-requires.libtool
Source307: find-requires.pkgconfig
Source308: firmware.prov Source308: firmware.prov
Source309: modalias.prov Source309: modalias.prov
@ -127,11 +123,7 @@ install -p -m 644 -t %{buildroot}%{_rpmconfigdir}/macros.d macros.*
%{rrcdir}/rpmsort %{rrcdir}/rpmsort
%{rrcdir}/symset-table %{rrcdir}/symset-table
%{rrcdir}/find-provides %{rrcdir}/find-provides
%{rrcdir}/find-provides.libtool
%{rrcdir}/find-provides.pkgconfig
%{rrcdir}/find-requires %{rrcdir}/find-requires
%{rrcdir}/find-requires.libtool
%{rrcdir}/find-requires.pkgconfig
%{rrcdir}/find-provides.ksyms %{rrcdir}/find-provides.ksyms
%{rrcdir}/find-requires.ksyms %{rrcdir}/find-requires.ksyms
%{rrcdir}/find-provides.d/firmware.prov %{rrcdir}/find-provides.d/firmware.prov
@ -139,6 +131,9 @@ install -p -m 644 -t %{buildroot}%{_rpmconfigdir}/macros.d macros.*
%{_rpmconfigdir}/macros.d/macros.kmp %{_rpmconfigdir}/macros.d/macros.kmp
%changelog %changelog
* Thu Apr 10 2014 Panu Matilainen <pmatilai@redhat.com> - 15-1
- Drop most of the script-based dependency generation bits
* Tue Apr 08 2014 Panu Matilainen <pmatilai@redhat.com> - 14-1 * Tue Apr 08 2014 Panu Matilainen <pmatilai@redhat.com> - 14-1
- Add Mono path macros (#1070936) - Add Mono path macros (#1070936)
- Allow opting out of config.{guess,sub} replacement hack (#991613) - Allow opting out of config.{guess,sub} replacement hack (#991613)