Some (probably SUSE specific) changes to linux.prov and linux.req Index: autodeps/linux.prov =================================================================== --- autodeps/linux.prov.orig +++ autodeps/linux.prov @@ -2,60 +2,72 @@ # This script reads filenames from STDIN and outputs any relevant provides # information that needs to be included in the package. +IFS=$'\n' +filelist=($(cat)) -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) +solist=($(printf "%s\n" "${filelist[@]}" | grep "\\.so" | grep -v "^/lib/ld.so" | \ + tr '\n' '\0' | xargs -0 -r file -L | grep "ELF.*shared object" | \ + cut -d: -f1)) pythonlist= tcllist= +monolist=($(printf "%s\n" "${filelist[@]}" | egrep "\\.(exe|dll)\$")) # # --- Alpha does not mark 64bit dependencies case `uname -m` in - alpha*) mark64="" ;; - *) mark64="()(64bit)" ;; + alpha*) mark64=false ;; + *) mark64=true ;; esac # # --- Library sonames and weak symbol versions (from glibc). -for f in $solist; do - soname=$(objdump -p $f | awk '/SONAME/ {print $2}') +for f in "${solist[@]}"; do + soname=$(objdump -p "$f" | awk '/SONAME/ {print $2}') + [ -n "$soname" -a -L "$f" ] && continue + [ -z "$soname" ] && soname="${f##*/}" - 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 + if $mark64 && file -L "$f" 2>/dev/null | grep "ELF 64-bit" >/dev/null; then + lib64="()(64bit)" slib64="(64bit)" else - echo ${f##*/}$lib64 + lib64= slib64= fi + echo "$soname$lib64" + objdump -p "$f" | awk ' + BEGIN { START=0 ; } + /Version definitions:/ { START=1; } + /^[0-9]/ && (START==1) { print $4; } + /^$/ { START=0; } + ' | \ + while read symbol ; do + echo "$soname($symbol)$slib64" + done 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 + printf "%s\n" "${filelist[@]}" | grep '\.pm$' | /usr/lib/rpm/perl.prov | sort -u # # --- Python modules. [ -x /usr/lib/rpm/python.prov -a -n "$pythonlist" ] && - echo $pythonlist | tr '[:blank:]' \\n | /usr/lib/rpm/python.prov | sort -u + printf "%s\n" "${pythonlist[@]}" | /usr/lib/rpm/python.prov | sort -u # # --- Tcl modules. [ -x /usr/lib/rpm/tcl.prov -a -n "$tcllist" ] && - echo $tcllist | tr '[:blank:]' \\n | /usr/lib/rpm/tcl.prov | sort -u + printf "%s\n" "${tcllist[@]}" | /usr/lib/rpm/tcl.prov | sort -u + +# +# --- Mono exes/dlls +: ${MONO_PREFIX=/usr} +if [ -x $MONO_PREFIX/bin/mono -a -n "$monolist" ] ; then + printf "%s\n" "${monolist[@]}" | MONO_PATH=$MONO_PREFIX/lib${MONO_PATH:+:$MONO_PATH} prefix=$MONO_PREFIX $MONO_PREFIX/bin/mono-find-provides || echo "WARNING: MONO RPM PROVIDES WERE NOT GENERATED FOR THIS BUILD!!" 1>&2 +fi + +# +# --- Kernel module exported symbols +[ -x /usr/lib/rpm/find-provides.ksyms ] && + printf "%s\n" "${filelist[@]}" | /usr/lib/rpm/find-provides.ksyms "$@" exit 0 Index: autodeps/linux.req =================================================================== --- autodeps/linux.req.orig +++ autodeps/linux.req @@ -19,18 +19,22 @@ fi # # --- Grab the file manifest and classify files. #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= -perllist= -pythonlist= -tcllist= +#filelist=`sed "s/[]['\"*?{}]/\\\\\&/g"` +IFS=$'\n' +filelist=($(grep -Ev '/usr/doc/|/usr/share/doc/')) +exelist=($(printf "%s\0" "${filelist[@]}" | xargs -0 -r file | \ + egrep -v ":.* (commands|script) " | \ + grep ":.*executable" | cut -d: -f1)) +scriptlist=($(printf "%s\0" "${filelist[@]}" | xargs -0 -r file | \ + egrep ":.* (commands|script) " | cut -d: -f1)) +liblist=($(printf "%s\0" "${filelist[@]}" | xargs -0 -r file | \ + grep ":.*shared object" | cut -d : -f1)) + +interplist=() +perllist=() +pythonlist=() +tcllist=() +monolist=($(printf "%s\n" "${filelist[@]}" | egrep "\\.(exe|dll)(\\.config)?\$")) # # --- Alpha does not mark 64bit dependencies @@ -42,12 +46,12 @@ 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 | \ + 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/) { + ldd "$f" | awk '/=>/ { + if ($1 !~ /libNoVersion.so/ && $1 !~ /4[um]lib.so/ && $1 !~ /linux-gate.so/) { gsub(/'\''"/,"\\&",$1); printf "%s'$lib64'\n", $1 } @@ -56,12 +60,12 @@ if [ "$needed" -eq 0 ]; then # # --- Library dependency sonames. - for f in $liblist; do - [ -r $f ] || continue - lib64=`if file -L $f 2>/dev/null | \ + 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/) { + ldd "$f" | awk '/=>/ { + if ($1 !~ /libNoVersion.so/ && $1 !~ /4[um]lib.so/ && $1 !~ /linux-gate.so/) { gsub(/'\''"/,"\\&",$1); printf "%s'$lib64'\n", $1 } @@ -71,30 +75,30 @@ 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" +for f in "${scriptlist[@]}"; do + [ -r "$f" -a -x "$f" ] || continue + interp=`head -n 1 "$f" | sed -ne 's/^\#\![ ]*//p' | cut -d" " -f1` + interplist=("${interplist[@]}" "$interp") case $interp in - */perl) perllist="$perllist $f" ;; + */perl) perllist=("${perllist[@]}" "$f") ;; esac done -[ -n "$interplist" ] && { echo "$interplist" | tr '[:blank:]' \\n | sort -u ; } +[ -n "$interplist" ] && { printf "%s\n" "${interplist[@]}" | sort -u ; } # # --- Add perl module files to perllist. -for f in $filelist; do - [ -r $f -a "${f%.pm}" != "${f}" ] && perllist="$perllist $f" +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 | \ +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'; } + objdump -p "$f" | awk 'BEGIN { START=0; LIBNAME=""; needed='$needed'; } /^$/ { START=0; } /^Dynamic Section:$/ { START=1; } (START==1) && /NEEDED/ { @@ -111,7 +115,7 @@ for f in $liblist $exelist ; do sub(/:/, "", $3); LIBNAME=$3; } - (START==2) && (LIBNAME!="") && ($4!="") && (($4~/^GLIBC_*/) || ($4~/^GCC_*/)) { + (START==2) && (LIBNAME!="") && ($4!="") { print LIBNAME "(" $4 ")'$lib64'"; } ' @@ -119,17 +123,29 @@ 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 +#[ -x /usr/lib/rpm/perl.req -a -n "$perllist" ] && \ +# printf "%s\n" "${perllist[@]}" | /usr/lib/rpm/perl.req | sort -u # # --- Python modules. [ -x /usr/lib/rpm/python.req -a -n "$pythonlist" ] && \ - echo $pythonlist | tr '[:blank:]' \\n | /usr/lib/rpm/python.req | sort -u + printf "%s\n" "${pythonlist[@]}" | /usr/lib/rpm/python.req | sort -u # # --- Tcl modules. [ -x /usr/lib/rpm/tcl.req -a -n "$tcllist" ] && \ - echo $tcllist | tr '[:blank:]' \\n | /usr/lib/rpm/tcl.req | sort -u + printf "%s\n" "${tcllist[@]}" | /usr/lib/rpm/tcl.req | sort -u + +# +# --- Mono exes/dlls +: ${MONO_PREFIX=/usr} +if [ -x $MONO_PREFIX/bin/mono -a -n "$monolist" ] ; then + printf "%s\n" "${monolist[@]}" | MONO_PATH=$MONO_PREFIX/lib${MONO_PATH:+:$MONO_PATH} prefix=$MONO_PREFIX $MONO_PREFIX/bin/mono-find-requires || echo "WARNING: MONO RPM REQUIRES WERE NOT GENERATED FOR THIS BUILD!!" 1>&2 +fi + +# +# --- Kernel module imported symbols +[ -x ${0%/*}/find-requires.ksyms ] && + printf "%s\n" "${filelist[@]}" | ${0%/*}/find-requires.ksyms "$@" exit 0