3 # Original Author: Tim Mooney (mooney@plains.nodak.edu)
4 # This file is distributed under the terms of the GNU Public License
6 # find-provides is part of RPM, the RedHat Package Manager. find-provides
7 # reads a list of full pathnames (in a package) on stdin, and outputs all
8 # shared libraries provided by (contained in) the package.
11 # On Digital Unix (OSF1), use `odump -D' to find what libraries a package
14 # Example `odump -D' output:
16 #$odump -D /usr/shlib/libc.so
21 # ***DYNAMIC SECTION***
31 # TIME_STAMP: (0x34a82daa) Mon Dec 29 17:09:30 1997
33 # ICHECKSUM: 0x5e955f9b
37 # HASH: 0x000003ff800a82e0
38 # STRTAB: 0x000003ff8008aad0
39 # SYMTAB: 0x000003ff80094ab0
40 # MSYM: 0x000003ff800842c0
43 # PLTGOT: 0x000003ffc008f240
45 # BASE_ADDRESS: 0x000003ff80080000
49 # REL: 0x000003ff80080700
51 # INIT: 0x000003ff8019c520
52 # FINI: 0x000003ff8019c570
58 odump -D $f 2>/dev/null | awk '
69 # Uncomment the next line for some debugging info.
70 #{ print NR , ":", $0 }
72 /^[ ]+SONAME: .*[ ]*$/ {
74 numfields = split($0, internal_name)
78 # we should probably check to see if the soname ends with
79 # a number (indicating that it contains versioning info,
80 # possibly in addition to the versioning info in the versions
81 # field) and generate a warning here. Shared libraries should
82 # not be built with version info in the soname on Digital Unix.
86 # Should never be here.
88 print "Really odd looking soname:", $0 | "cat 1>&2"
93 /^[ ]+IVERSION: .*[ ]*$/ {
94 if (found_soname == 1) {
95 numfields = split($0, iversion)
99 # handle libraries with multiple versions, like
100 # 1.1:1.2. Since they really provide both versions,
101 # we need to generate output for each version.
103 numfields = split(version, versions, ":")
105 for (i = 1; i < numfields; i++) {
106 print soname, ".", versions[i]
109 # let our END routine print out the *last* version
112 version = versions[numfields]
115 # stick a fork in us.
121 # Should never be here.
123 print "Odd looking library version:", $0 | "cat 1>&2"
128 # found an iversion without an soname. Is that possible?
130 print "Found version but no soname:", $0 | "cat 1>&2"
136 # we could probably watch for some other token (like RLD_VERSION)
137 # that *generally* occurs later in the input than the stuff we watch
138 # for, and exit if we see it, but it is just as easy to read all
139 # the output, even after we have seen what we are looking for.
143 # Uncomment the next line for debugging info
144 #{ print "END: NR: ", NR }
145 if ( (found_soname == 1) && (found_iversion == 1) ) {
146 print soname, ".", version
148 } else if (found_soname == 1) {
150 # no library version information
158 #comment out the previous line and uncomment the next line when debugging