diff options
author | jbj <devnull@localhost> | 1999-09-30 00:22:15 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 1999-09-30 00:22:15 +0000 |
commit | 960b02877875443801bfca622330623fcb4d73e8 (patch) | |
tree | 95b2da6adfd6f1cfc7917d8edf5d5951802dc887 /autodeps | |
parent | ff01ced80f6811c940da2e098873f3dc3233c083 (diff) | |
download | rpm-960b02877875443801bfca622330623fcb4d73e8.tar.gz rpm-960b02877875443801bfca622330623fcb4d73e8.tar.bz2 rpm-960b02877875443801bfca622330623fcb4d73e8.zip |
new find req/prov scripts for non-linux platforms (Tim Mooney).
CVS patchset: 3351
CVS date: 1999/09/30 00:22:15
Diffstat (limited to 'autodeps')
-rw-r--r-- | autodeps/hpux.prov | 14 | ||||
-rw-r--r-- | autodeps/hpux.req | 57 | ||||
-rw-r--r-- | autodeps/irix6.prov | 31 | ||||
-rw-r--r-- | autodeps/irix6.req | 60 | ||||
-rw-r--r-- | autodeps/osf.prov | 191 | ||||
-rw-r--r-- | autodeps/osf.req | 34 |
6 files changed, 247 insertions, 140 deletions
diff --git a/autodeps/hpux.prov b/autodeps/hpux.prov index 8619813c1..2a8331b34 100644 --- a/autodeps/hpux.prov +++ b/autodeps/hpux.prov @@ -1,9 +1,9 @@ #! /usr/bin/ksh # Original Author: Tim Mooney (mooney@plains.nodak.edu) -# $Id: hpux.prov,v 1.4 1999/08/04 18:07:18 jbj Exp $ +# $Id: hpux.prov,v 1.5 1999/09/30 00:22:15 jbj Exp $ # -# This file is distributed under the terms of the GNU General Public License +# This file is distributed under the terms of the GNU Public License # # find-provides is part of RPM, the Red Hat Package Manager. find-provides # reads a list of full pathnames (in a package) on stdin, and outputs all @@ -37,9 +37,15 @@ PATH=/usr/bin:/usr/sbin:/usr/ccs/bin export PATH -for f in `cat -` +# +# TVM: use `while read ...' instead of `for f in ...', because there may +# be too many files to stuff into one shell variable. +# +IFS="" +while read f do - chatr $f 2>/dev/null | awk ' + chatr $f 2>/dev/null \ + | awk ' BEGIN { FS = " "; diff --git a/autodeps/hpux.req b/autodeps/hpux.req index f9d7e5d88..8539d76e7 100644 --- a/autodeps/hpux.req +++ b/autodeps/hpux.req @@ -1,9 +1,9 @@ #! /usr/bin/ksh # Original Author: Tim Mooney (mooney@plains.nodak.edu) -# $Id: hpux.req,v 1.4 1999/08/04 18:07:18 jbj Exp $ +# $Id: hpux.req,v 1.5 1999/09/30 00:22:15 jbj Exp $ # -# This file is distributed under the terms of the GNU General Public License +# This file is distributed under the terms of the GNU Public License # # find-requires is part of RPM, the Red Hat Package Manager. find-requires # reads a list of full pathnames (in a package) on stdin, and outputs all @@ -36,20 +36,50 @@ PATH=/usr/bin:/usr/sbin:/sbin:/usr/ccs/bin export PATH -# -# TVM: it might be better to re-write this so that `file' isn't used, since -# it can all be done with `chatr' (note the second line of chatr output tells -# whether it's a shared executable or not), but this works. -# -filelist=`sed "s/['\"]/\\\&/g" | xargs file | egrep '(executable|library)' \ - | cut -d: -f1` - -for f in $filelist +IFS="" +while read f do # uncomment the next line if debugging # echo "### processing $f" - chatr $f 2>/dev/null | awk ' + # + # Only run the file command once per file: + # + file_output=`file $f` + + # + # First, check to see if it's a script, and try figure out what + # intpreter it requires. This is more work on HP-UX, since `file' + # doesn't tell us what interpreter the script uses, or even if it + # really is a script. + # + is_shell_script=`od -N 2 -t c $f 2>/dev/null | grep '0000000 # !'` + if test X"$is_shell_script" != X ; then + # + # it's a shell script. Now figure out what interpreter it needs + # Look at me! I'm good with sed. ;-) + interp=`head -1 $f | sed -e 's/^#! \{0,1\}\([^ ]*\).*$/\1/'` + if test X"$interp" != X ; then + echo "$interp" + # + # We've found what we need for this file. Skip back to the + # top of the loop. This saves me an `else' and another indent + # level! ;-) + continue + fi + fi + + # + # The `else' is implied here by the `continue' above + # + + # + # Is it a shared library? + # + maybe_shared_lib=`echo "$file_output" | egrep '(executable|library)'` + if test X"$maybe_shared_lib" != X ; then + chatr $f 2>/dev/null \ + | awk ' # # For you non-awk-ers, no single quotes in comments -- the shell @@ -81,7 +111,8 @@ do /^ +shared library binding: *$/ { exit } - ' # end of awk + ' # end of awk + fi # end of shared library if. done | sort -u #comment out the previous line and uncomment the next one if debugging. #done diff --git a/autodeps/irix6.prov b/autodeps/irix6.prov index c95afb50a..a3a3b36b5 100644 --- a/autodeps/irix6.prov +++ b/autodeps/irix6.prov @@ -1,9 +1,9 @@ #! /usr/bin/ksh # Original Author: Tim Mooney (mooney@plains.nodak.edu) -# $Id: irix6.prov,v 1.4 1999/08/04 18:07:18 jbj Exp $ +# $Id: irix6.prov,v 1.5 1999/09/30 00:22:15 jbj Exp $ # -# This file is distributed under the terms of the GNU General Public License +# This file is distributed under the terms of the GNU Public License # # find-provides is part of RPM, the Red Hat Package Manager. find-provides # reads a list of full pathnames (in a package) on stdin, and outputs all @@ -68,9 +68,19 @@ PATH=/usr/bin:/usr/sbin export PATH -for f in `cat - | xargs /usr/bin/file | egrep 'ELF.*dynamic lib' | cut -d: -f1` +# +# Use `while read ...' instead of `for f in ...', because there may be too +# many files to stuff into one shell variable. +# +IFS="" +while read f do - elfdump -L $f 2>/dev/null | awk ' + # + # If it's a shared library, run elfdump on it. + # + maybe_shared_lib=`file $f | egrep 'ELF.*dynamic lib'` + if test X"$maybe_shared_lib" != X ; then + elfdump -L $f 2>/dev/null | awk ' BEGIN { FS = " "; @@ -168,15 +178,18 @@ do if ( (found_soname == 1) && (found_iversion == 1) ) { print soname, soname_version_delimiter, version exit - } else if (found_soname == 1) { + } else if ( (found_soname == 1) && (found_iversion == 0) ) { # - # no library version information + # no library version information *BUT* any programs linked + # against this library will pick up a dependency on version 0 + # of this library, so we output that. # - print soname + print soname, soname_version_delimiter, 0 } # else do nothing } ' # end of awk -#done | sort -u + fi # end of the 'if test X"$maybe_shared_lib != X ; then' clause +done | sort -u #comment out the previous line and uncomment the next line when debugging -done +#done diff --git a/autodeps/irix6.req b/autodeps/irix6.req index e62bb63cc..cd280e869 100644 --- a/autodeps/irix6.req +++ b/autodeps/irix6.req @@ -1,9 +1,9 @@ #! /usr/bin/ksh # Original Author: Tim Mooney (mooney@plains.nodak.edu) -# $Id: irix6.req,v 1.4 1999/08/04 18:07:18 jbj Exp $ +# $Id: irix6.req,v 1.5 1999/09/30 00:22:15 jbj Exp $ # -# This file is distributed under the terms of the GNU General Public License +# This file is distributed under the terms of the GNU Public License # # find-requires is part of RPM, the Red Hat Package Manager. find-requires # reads a list of full pathnames (in a package) on stdin, and outputs all @@ -48,22 +48,55 @@ PATH=/usr/bin:/usr/sbin export PATH -filelist=`cat -` - # -# Handle scripts first +# TVM: switch to using `while read ...' instead of `for f in ...', because +# packages with a large number of files could be too big for one shell +# variable to hold. # -for f in `echo $filelist | xargs file | grep 'script text' | cut -d: -f 2 \ - | awk '{ print $1 }'` +IFS="" +while read f do - print $f -done | sort -u + + # + # Uncomment the next line for additional debugging: + #echo "read ->$f<-" + # + # Only run file once per file: + # + file_output=`file $f` -for f in `echo $filelist | xargs file | egrep 'executable|lib' | cut -d: -f1` -do - #echo "Working on $f" - elfdump -Dl $f 2>/dev/null | awk ' + # + # Handle scripts first + # + is_shell_script=`echo "$file_output" | grep 'script text' | \ + cut -d: -f 2 | awk '{ print $1 }'` + + # + # If it's a script... + # + if test X"$is_shell_script" != X ; then + echo "$is_shell_script" + # + # use `continue' to skip back up to the top of the loop. We've + # already done as much as we need to, and this saves me from having + # to have an else, and another indent level... ;-) + # + continue + fi + + # + # the `else' is implied here, since we used `continue' in the test above + # + + # + # It might be a shared library. + # + maybe_shared_lib=`echo "$file_output" | egrep 'executable|lib'` + if test X"$maybe_shared_lib" != X ; then + + elfdump -Dl $f 2>/dev/null \ + | awk ' # # For you non-awk-ers, no single quotes in comments -- the shell @@ -118,6 +151,7 @@ do } ' # end of awk + fi done | sort -u # comment out the previous line and uncomment the next when debugging #done diff --git a/autodeps/osf.prov b/autodeps/osf.prov index f1150d523..1f0bf2a56 100644 --- a/autodeps/osf.prov +++ b/autodeps/osf.prov @@ -1,9 +1,9 @@ #! /usr/bin/ksh # Original Author: Tim Mooney (mooney@plains.nodak.edu) -# $Id: osf.prov,v 1.2 1998/05/29 16:34:27 mooney Exp mooney $ +# $Id: osf.prov,v 1.4 1999/08/21 23:23:12 mooney Exp $ # -# This file is distributed under the terms of the GNU General Public License +# This file is distributed under the terms of the GNU Public License # # find-provides is part of RPM, the Red Hat Package Manager. find-provides # reads a list of full pathnames (in a package) on stdin, and outputs all @@ -58,119 +58,132 @@ PATH=/usr/bin:/usr/sbin:/sbin:/usr/ccs/bin export PATH -for f in `cat - | xargs file | egrep 'COFF.*shared library' | cut -d: -f1` +# +# Use `while read ...' instead of a `for f in ...', because there may +# be too many files to stuff into one shell variable. +# +IFS="" +while read f do - odump -D $f 2>/dev/null | awk ' - - BEGIN { - FS = " "; - RS = "\n"; - OFS = ""; - found_soname = 0; - found_iversion = 0; + # + # if it's a shared library, run odump on it. + # + maybe_shared_lib=`file $f | egrep 'COFF.*shared library'` + if test X"$maybe_shared_lib" != X ; then + odump -D $f 2>/dev/null | awk ' - # - # what character should be used to separate the soname from any - # version info? Using a . is actually a bad idea, since some - # free/3rd party libraries may be built so that the library - # soname may have version info in it too. If we use . as the - # separator, it may not be possible to tell where the soname - # ends and the internal version info begins. It might be - # better to use a - or a : here. If you do so, be sure to - # change this setting in find-requires, too. - # - soname_version_delimiter="."; - } + BEGIN { + FS = " "; + RS = "\n"; + OFS = ""; - # Uncomment the next line for some debugging info. - #{ print NR , ":", $0 } + found_soname = 0; + found_iversion = 0; - /^[ ]+SONAME: .*[ ]*$/ { - found_soname = 1; - numfields = split($0, internal_name) - if (numfields == 2) { - soname = $2 # - # we should probably check to see if the soname ends with - # a number (indicating that it contains versioning info, - # possibly in addition to the versioning info in the versions - # field) and generate a warning here. Shared libraries should - # not be built with version info in the soname on Digital Unix. + # what character should be used to separate the soname from any + # version info? Using a . is actually a bad idea, since some + # free/3rd party libraries may be built so that the library + # soname may have version info in it too. If we use . as the + # separator, it may not be possible to tell where the soname + # ends and the internal version info begins. It might be + # better to use a - or a : here. If you do so, be sure to + # change this setting in find-requires, too. # - } else { - # - # Should never be here. - # - print "Really odd looking soname:", $0 | "cat 1>&2" - exit + soname_version_delimiter="."; } - } - /^[ ]+IVERSION: .*[ ]*$/ { - if (found_soname == 1) { - numfields = split($0, iversion) + # Uncomment the next line for some debugging info. + #{ print NR , ":", $0 } + + /^[ ]+SONAME: .*[ ]*$/ { + found_soname = 1; + numfields = split($0, internal_name) if (numfields == 2) { - version = $2 + soname = $2 # - # handle libraries with multiple versions, like - # 1.1:1.2. Since they really provide both versions, - # we need to generate output for each version. + # we should probably check to see if the soname ends with + # a number (indicating that it contains versioning info, + # possibly in addition to the versioning info in the + # versions field) and generate a warning here. Shared + # libraries should not be built with version info in + # the soname on Digital Unix. # - numfields = split(version, versions, ":") - if (numfields > 1) { - for (i = 1; i < numfields; i++) { + } else { + # + # Should never be here. + # + print "Really odd looking soname:", $0 | "cat 1>&2" + exit + } + } + + /^[ ]+IVERSION: .*[ ]*$/ { + if (found_soname == 1) { + numfields = split($0, iversion) + if (numfields == 2) { + version = $2 + # + # handle libraries with multiple versions, like + # 1.1:1.2. Since they really provide both versions, + # we need to generate output for each version. + # + numfields = split(version, versions, ":") + if (numfields > 1) { + for (i = 1; i < numfields; i++) { print soname, soname_version_delimiter, versions[i] + } + # + # let our END routine print out the *last* version + # provided + # + version = versions[numfields] } # - # let our END routine print out the *last* version - # provided + # stick a fork in us. + # + found_iversion = 1; + exit + } else { + # + # Should never be here. # - version = versions[numfields] + print "Odd looking library version:", $0 | "cat 1>&2" + exit } - # - # stick a fork in us. - # - found_iversion = 1; - exit } else { # - # Should never be here. + # found an iversion without an soname. Is that possible? # - print "Odd looking library version:", $0 | "cat 1>&2" + print "Found version but no soname:", $0 | "cat 1>&2" exit } - } else { - # - # found an iversion without an soname. Is that possible? - # - print "Found version but no soname:", $0 | "cat 1>&2" - exit } - } - # - # we could probably watch for some other token (like RLD_VERSION) - # that *generally* occurs later in the input than the stuff we watch - # for, and exit if we see it, but it is just as easy to read all - # the output, even after we have seen what we are looking for. - # + # + # we could probably watch for some other token (like RLD_VERSION) + # that *generally* occurs later in the input than the stuff we watch + # for, and exit if we see it, but it is just as easy to read all + # the output, even after we have seen what we are looking for. + # - END { - # Uncomment the next line for debugging info - #{ print "END: NR: ", NR } - if ( (found_soname == 1) && (found_iversion == 1) ) { - print soname, soname_version_delimiter, version - exit - } else if (found_soname == 1) { - # - # no library version information - # - print soname + END { + # Uncomment the next line for debugging info + #{ print "END: NR: ", NR } + if ( (found_soname == 1) && (found_iversion == 1) ) { + print soname, soname_version_delimiter, version + exit + } else if (found_soname == 1) { + # + # no library version information + # + print soname + } + # else do nothing } - # else do nothing - } - ' # end of awk + ' # end of awk + fi done | sort -u #comment out the previous line and uncomment the next line when debugging #done diff --git a/autodeps/osf.req b/autodeps/osf.req index 08fe13fa6..73abf5c75 100644 --- a/autodeps/osf.req +++ b/autodeps/osf.req @@ -1,7 +1,7 @@ #! /usr/bin/ksh # Original Author: Tim Mooney (mooney@plains.nodak.edu) -# $Id: osf.req,v 1.6 1999/09/07 19:53:10 jbj Exp $ +# $Id: osf.req,v 1.7 1999/09/30 00:22:15 jbj Exp $ # # This file is distributed under the terms of the GNU Public License # @@ -60,21 +60,32 @@ do cut -d: -f 2 | awk '{ print $1 }'` # - # it's a script + # If it's a script... # if test X"$is_shell_script" != X ; then - echo $is_shell_script - - else - + echo "$is_shell_script" # - # it might be a shared library. + # use `continue' to skip back up to the top of the loop. + # We have already done as much as we need to for this + # file, and this saves me from having to have an else, + # and another indent level... ;-) # + continue + fi + + # + # The `else' here is implied by the `continue' above... + # + + # + # it might be a shared library. + # - maybe_shared_lib=`echo "$file_output" | grep 'executable'` - if test X"$maybe_shared_lib" != X ; then + maybe_shared_lib=`echo "$file_output" | grep 'executable'` + if test X"$maybe_shared_lib" != X ; then - odump -Dl $f 2>/dev/null | awk ' + odump -Dl $f 2>/dev/null \ + | awk ' # # For you non-awk-ers, no single quotes in comments -- the shell @@ -136,8 +147,7 @@ do #print "found the program name: ", $1 } - ' # end of awk - fi + ' # end of awk fi done | sort -u # comment out the previous line and uncomment the next when debugging |