--- /dev/null
+#! /usr/bin/ksh
+
+# Original Author: Tim Mooney (mooney@plains.nodak.edu)
+# This file is distributed under the terms of the GNU Public License
+#
+# find-provides is part of RPM, the RedHat Package Manager. find-provides
+# reads a list of full pathnames (in a package) on stdin, and outputs all
+# shared libraries provided by (contained in) the package.
+#
+#
+# On Digital Unix (OSF1), use `odump -D' to find what libraries a package
+# provides
+#
+# Example `odump -D' output:
+#
+#$odump -D /usr/shlib/libc.so
+#
+#
+#
+#
+# ***DYNAMIC SECTION***
+# Tag Value
+#
+#/usr/shlib/libc.so:
+# UNREFEXTNO: 14.
+# LOCAL_GOTNO: 521.
+# GOTSYM: 2205.
+# LOCAL_GOTNO: 1606.
+# GOTSYM: 3289.
+# SONAME: libc.so
+# TIME_STAMP: (0x34a82daa) Mon Dec 29 17:09:30 1997
+#
+# ICHECKSUM: 0x5e955f9b
+# IVERSION: osf.1
+# CONFLICTNO: 0.
+# RLD_VERSION: 2.
+# HASH: 0x000003ff800a82e0
+# STRTAB: 0x000003ff8008aad0
+# SYMTAB: 0x000003ff80094ab0
+# MSYM: 0x000003ff800842c0
+# STRSZ: 40922.
+# SYMENT: 24.
+# PLTGOT: 0x000003ffc008f240
+# SYMTABNO: 3330.
+# BASE_ADDRESS: 0x000003ff80080000
+# HIPAGENO: 0.
+# RELSZ: 15296.
+# RELENT: 16.
+# REL: 0x000003ff80080700
+# LIBLISTNO: 0.
+# INIT: 0x000003ff8019c520
+# FINI: 0x000003ff8019c570
+# FLAGS: 0x00000001
+#
+
+for f in `cat -`
+do
+ odump -D $f 2>/dev/null | awk '
+
+ BEGIN {
+ FS = " ";
+ RS = "\n";
+ OFS = "";
+
+ found_soname = 0;
+ found_iversion = 0;
+ }
+
+ # Uncomment the next line for some debugging info.
+ #{ print NR , ":", $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.
+ #
+ } 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, ".", versions[i]
+ }
+ #
+ # let our END routine print out the *last* version
+ # provided
+ #
+ version = versions[numfields]
+ }
+ #
+ # stick a fork in us.
+ #
+ found_iversion = 1;
+ exit
+ } else {
+ #
+ # Should never be here.
+ #
+ print "Odd looking library version:", $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.
+ #
+
+ END {
+ # Uncomment the next line for debugging info
+ #{ print "END: NR: ", NR }
+ if ( (found_soname == 1) && (found_iversion == 1) ) {
+ print soname, ".", version
+ exit
+ } else if (found_soname == 1) {
+ #
+ # no library version information
+ #
+ print soname
+ }
+ # else do nothing
+ }
+ ' # end of awk
+done | sort -u
+#comment out the previous line and uncomment the next line when debugging
+#done
--- /dev/null
+#! /usr/bin/ksh
+
+# Original Author: Tim Mooney (mooney@plains.nodak.edu)
+# This file is distributed under the terms of the GNU Public License
+#
+# find-requires is part of RPM, the RedHat Package Manager. find-requires
+# reads a list of full pathnames (in a package) on stdin, and outputs all
+# shared libraries the package requires to execute.
+#
+# On Digital Unix (OSF1), use `odump -Dl' to find the library dependencies
+# for an executable. `odump -D' does most of what we need, but it doesn't
+# give us library version information, so you must use `odump -Dl'
+#
+# Example `odump -Dl' output:
+#
+#$odump -Dl /usr/bin/X11/xterm
+#
+#
+#
+#
+# ***LIBRARY LIST SECTION***
+# Name Time-Stamp CheckSum Flags Version
+#/usr/bin/X11/xterm:
+# libXaw.so Dec 9 00:15:35 1997 0x285006d0 0 6.0
+# libXmu.so Dec 9 00:13:36 1997 0x3bf3a33d 0
+# libXt.so Dec 9 00:12:18 1997 0x10dd9a17 0
+# libSM.so Dec 9 00:08:11 1997 0xb64c7082 0
+# libICE.so Dec 9 00:07:52 1997 0x1199be32 0
+# libXext.so Dec 9 00:08:51 1997 0xafcb84d5 0
+# libX11.so Dec 9 00:06:05 1997 0xaa1bf091 0
+# libc.so Dec 8 18:41:11 1997 0x5e955f9b 0 osf.1
+
+
+# TVM: it might be better to re-write this so that `file' isn't used, since
+# it can all be done with `odump', but this works.
+#
+filelist=`sed "s/['\"]/\\\&/g" | xargs file | grep executable | cut -d: -f1`
+
+for f in $filelist
+do
+ odump -Dl $f 2>/dev/null | awk '
+
+ #
+ # For you non-awk-ers, no single quotes in comments -- the shell
+ # sees them and things get hosed.
+ #
+
+ BEGIN {
+ seen_program_name = 0;
+ FS = " ";
+ RS = "\n";
+ OFS=""
+ }
+
+ # uncomment the next line for debugging information
+ #{ print "Got input:", $0 }
+
+ seen_program_name == 1 && $0 !~ /^$/ {
+
+ # uncomment for debugging information
+ #print "found shared library: $0"
+
+ # get the library name (field 1) and the library version (field 8)
+ # if present.
+ numfields = split($0,fields)
+ if (numfields == 7) {
+ print fields[1]
+ } else if (numfields == 8) {
+ #
+ # Note that if a library contains a number as the last
+ # part of the soname *and* it contains version information,
+ # we have a problem because it is impossible to tell where
+ # the soname ends and the version info begins. Digital Unix
+ # shared libraries should *not* be built with any version info
+ # in the soname. That info should be in the version field
+ # only.
+ # If we used a separator character of a - or something else,
+ # instead of a ., we would not have this problem.
+ #
+ print fields[1], ".", fields[8]
+ }
+ }
+
+ /^.*: *$/ {
+ seen_program_name = 1
+ #
+ # uncomment the next line for debugging information
+ #print "found the program name: $1"
+ }
+
+ ' # end of awk
+done | sort -u