more updates from Tim Mooney
[platform/upstream/rpm.git] / autodeps / irix6.prov
1 #! /usr/bin/ksh
2
3 # Original Author: Tim Mooney (mooney@plains.nodak.edu)
4 # $Id: irix6.prov,v 1.2 1998/06/14 16:03:14 ewt Exp $
5 #
6 # This file is distributed under the terms of the GNU Public License
7 #
8 # find-provides is part of RPM, the Red Hat Package Manager.  find-provides
9 # reads a list of full pathnames (in a package) on stdin, and outputs all
10 # shared libraries provided by (contained in) the package.
11 #
12 # NOTE: I use `:' as the delimiter (by default) between the library soname
13 # and any library version info.  This is because IRIX libraries (even
14 # system libraries) have "version information" in both the soname and the
15 # internal version field, so it's important to be able to separate those
16 # fields.  If we just used `.', we wouldn't know where the soname ends and
17 # the version infromation begins.
18 #
19 #
20 # On IRIX, use `elfdump -L' to find what libraries a package provides
21 #
22 # Example `elfdump -L' output:
23 #
24 #$elfdump -L /usr/lib/libc.so
25 #
26 #
27 #/usr/lib/libc.so:
28 #
29 #  **** DYNAMIC SECTION INFORMATION ****
30 #.dynamic :
31 #[INDEX]        Tag      Value
32 #[0]    HASH     0xfa099d0
33 #[1]    STRTAB   0xfa0027c
34 #[2]    SYMTAB   0xfa10e3c
35 #[3]    STRSZ    0x9751
36 #[4]    SYMENT   0x10
37 #[5]    INIT     0
38 #[6]    FINI     0
39 #[7]    RLDVERS  0x1
40 #[8]    FLAGS    0x1411
41 #[9]    BASEADDR 0xfa00000
42 #[10]   LOCGOTNO 0x3c
43 #[11]   PROTECT  0x3c
44 #[12]   HIDDEN   0x12
45 #[13]   CNFLCTNO 0
46 #[14]   LBLISTNO 0
47 #[15]   SYMTABNO 0xd19
48 #[16]   UNREFEXT 0x8
49 #[17]   GOTSYM   0x8b3
50 #[18]   LOCAL    0x12
51 #[19]   LOCALPG  0x1
52 #[20]   LOCALPG  0x10
53 #[21]   PLTGOT   0xfb483b0
54 #[22]   RLDTXT_ADR0xfb6b580
55 #[23]   OPTIONS  0xfa000f4
56 #[24]   SONAME   libc.so.1
57 #[25]   TIMSTAMP Jun 16 18:23:15 1997   
58 #[26]   CHECKSUM 0x92321a0c
59 #[27]   IVERSION sgi1.0
60 #[28]   REL      0xfa1dfcc
61 #[29]   RELSZ    0x1988
62 #[30]   RELENT   0x8
63 #[31]   MSYM     0xfa1f954
64 #[32]   COMPCTSIZE0xc60c
65 #No Library List Section in /usr/lib/libc.so
66 #
67
68 PATH=/usr/bin:/usr/sbin
69 export PATH
70
71 for f in `cat - | xargs /usr/bin/file | egrep 'ELF.*dynamic lib' | cut -d: -f1`
72 do
73         elfdump -L $f 2>/dev/null | awk '
74
75                 BEGIN { 
76                         FS = " ";
77                         RS = "\n";
78                         OFS = "";
79
80                         # The character that should separate the soname from
81                         # the version information.  If you change this, you
82                         # should also change the same variable in the IRIX
83                         # find-requires script
84                         soname_version_delimiter=":"
85
86                         found_soname = 0;
87                         found_iversion = 0;
88                 }
89
90                 # Uncomment the next line for some debugging info.
91                 #{ print NR , ":", $0  }
92
93                 /[       ]+SONAME .*[   ]*$/ {
94                         found_soname = 1;
95                         numfields = split($0, internal_name)
96                         if (numfields == 3) {
97                                 soname = $3
98                         } else {
99                                 #
100                                 # Should never be here.
101                                 #
102                                 print "Really odd looking soname:", $0 | "cat 1>&2"
103                                 exit
104                         }
105                 }
106
107                 /[      ]+IVERSION .*[  ]*$/ {
108                         if (found_soname == 1) {
109                                 numfields = split($0, iversion)
110                                 if (numfields == 3) {
111                                         version = $3
112                                         #
113                                         # handle libraries with multiple versions, like
114                                         # 1.1:1.2.  Since they really provide both versions,
115                                         # we need to generate output for each version.
116                                         #
117                                         numfields = split(version, versions, ":")
118                                         if (numfields > 1) {
119                                                 for (i = 1; i < numfields; i++) {
120                                                         print soname, soname_version_delimiter, versions[i]
121                                                 }
122                                                 #
123                                                 # let our END routine print out the *last* version
124                                                 # provided
125                                                 #
126                                                 version = versions[numfields]
127                                         }
128                                         #
129                                         # stick a fork in us.
130                                         #
131                                         found_iversion = 1;
132                                         exit
133                                 } else {
134                                         #
135                                         # handle libraries with comments and other junk in
136                                         # the version field.  IRIX has a number of system libraries
137                                         # with whitespace and other junk in the version field!
138                                         #
139                                         # we discard the whitespace and keep the identifier after
140                                         # the # sign.
141                                         #
142                                         version = iversion[numfields]
143                                         numfields = split(version, version_junk, "#")
144                                         if (numfields > 1) {
145                                                 version = version_junk[numfields]
146                                                 found_iversion = 1;
147                                         }
148                                 }
149                         } else {
150                                 #
151                                 # found an iversion without an soname.  Is that possible?
152                                 #
153                                 print "Found version but no soname:", $0 | "cat 1>&2"
154                                 exit
155                         }
156                 }
157
158                 #
159                 # we could probably watch for some other token (like RELSZ)
160                 # that *generally* occurs later in the input than the stuff we watch
161                 # for, and exit if we see it, but it is just as easy to read all
162                 # the output, even after we have seen what we are looking for.
163                 #
164
165                 END {
166                         # Uncomment the next line for debugging info
167                         #{ print "END: NR: ", NR }
168                         if ( (found_soname == 1) && (found_iversion == 1) ) {
169                                 print soname, soname_version_delimiter, version
170                                 exit
171                         } else if (found_soname == 1) {
172                                 #
173                                 # no library version information
174                                 #
175                                 print soname
176                         }
177                         # else do nothing
178                 }
179         ' # end of awk
180 #done | sort -u
181 #comment out the previous line and uncomment the next line when debugging
182 done
183 #! /usr/bin/ksh
184
185 # Original Author: Tim Mooney (mooney@plains.nodak.edu)
186 # $Id: irix6.prov,v 1.2 1998/06/14 16:03:14 ewt Exp $
187 #
188 # This file is distributed under the terms of the GNU Public License
189 #
190 # find-provides is part of RPM, the Red Hat Package Manager.  find-provides
191 # reads a list of full pathnames (in a package) on stdin, and outputs all
192 # shared libraries provided by (contained in) the package.
193 #
194 # NOTE: I use `:' as the delimiter (by default) between the library soname
195 # and any library version info.  This is because IRIX libraries (even
196 # system libraries) have "version information" in both the soname and the
197 # internal version field, so it's important to be able to separate those
198 # fields.  If we just used `.', we wouldn't know where the soname ends and
199 # the version infromation begins.
200 #
201 #
202 # On IRIX, use `elfdump -L' to find what libraries a package provides
203 #
204 # Example `elfdump -L' output:
205 #
206 #$elfdump -L /usr/lib/libc.so
207 #
208 #
209 #/usr/lib/libc.so:
210 #
211 #  **** DYNAMIC SECTION INFORMATION ****
212 #.dynamic :
213 #[INDEX]        Tag      Value
214 #[0]    HASH     0xfa099d0
215 #[1]    STRTAB   0xfa0027c
216 #[2]    SYMTAB   0xfa10e3c
217 #[3]    STRSZ    0x9751
218 #[4]    SYMENT   0x10
219 #[5]    INIT     0
220 #[6]    FINI     0
221 #[7]    RLDVERS  0x1
222 #[8]    FLAGS    0x1411
223 #[9]    BASEADDR 0xfa00000
224 #[10]   LOCGOTNO 0x3c
225 #[11]   PROTECT  0x3c
226 #[12]   HIDDEN   0x12
227 #[13]   CNFLCTNO 0
228 #[14]   LBLISTNO 0
229 #[15]   SYMTABNO 0xd19
230 #[16]   UNREFEXT 0x8
231 #[17]   GOTSYM   0x8b3
232 #[18]   LOCAL    0x12
233 #[19]   LOCALPG  0x1
234 #[20]   LOCALPG  0x10
235 #[21]   PLTGOT   0xfb483b0
236 #[22]   RLDTXT_ADR0xfb6b580
237 #[23]   OPTIONS  0xfa000f4
238 #[24]   SONAME   libc.so.1
239 #[25]   TIMSTAMP Jun 16 18:23:15 1997   
240 #[26]   CHECKSUM 0x92321a0c
241 #[27]   IVERSION sgi1.0
242 #[28]   REL      0xfa1dfcc
243 #[29]   RELSZ    0x1988
244 #[30]   RELENT   0x8
245 #[31]   MSYM     0xfa1f954
246 #[32]   COMPCTSIZE0xc60c
247 #No Library List Section in /usr/lib/libc.so
248 #
249
250 PATH=/usr/bin:/usr/sbin
251 export PATH
252
253 for f in `cat - | xargs /usr/bin/file | egrep 'ELF.*dynamic lib' | cut -d: -f1`
254 do
255         elfdump -L $f 2>/dev/null | awk '
256
257                 BEGIN { 
258                         FS = " ";
259                         RS = "\n";
260                         OFS = "";
261
262                         # The character that should separate the soname from
263                         # the version information.  If you change this, you
264                         # should also change the same variable in the IRIX
265                         # find-requires script
266                         soname_version_delimiter=":"
267
268                         found_soname = 0;
269                         found_iversion = 0;
270                 }
271
272                 # Uncomment the next line for some debugging info.
273                 #{ print NR , ":", $0  }
274
275                 /[       ]+SONAME .*[   ]*$/ {
276                         found_soname = 1;
277                         numfields = split($0, internal_name)
278                         if (numfields == 3) {
279                                 soname = $3
280                         } else {
281                                 #
282                                 # Should never be here.
283                                 #
284                                 print "Really odd looking soname:", $0 | "cat 1>&2"
285                                 exit
286                         }
287                 }
288
289                 /[      ]+IVERSION .*[  ]*$/ {
290                         if (found_soname == 1) {
291                                 numfields = split($0, iversion)
292                                 if (numfields == 3) {
293                                         version = $3
294                                         #
295                                         # handle libraries with multiple versions, like
296                                         # 1.1:1.2.  Since they really provide both versions,
297                                         # we need to generate output for each version.
298                                         #
299                                         numfields = split(version, versions, ":")
300                                         if (numfields > 1) {
301                                                 for (i = 1; i < numfields; i++) {
302                                                         print soname, soname_version_delimiter, versions[i]
303                                                 }
304                                                 #
305                                                 # let our END routine print out the *last* version
306                                                 # provided
307                                                 #
308                                                 version = versions[numfields]
309                                         }
310                                         #
311                                         # stick a fork in us.
312                                         #
313                                         found_iversion = 1;
314                                         exit
315                                 } else {
316                                         #
317                                         # handle libraries with comments and other junk in
318                                         # the version field.  IRIX has a number of system libraries
319                                         # with whitespace and other junk in the version field!
320                                         #
321                                         # we discard the whitespace and keep the identifier after
322                                         # the # sign.
323                                         #
324                                         version = iversion[numfields]
325                                         numfields = split(version, version_junk, "#")
326                                         if (numfields > 1) {
327                                                 version = version_junk[numfields]
328                                                 found_iversion = 1;
329                                         }
330                                 }
331                         } else {
332                                 #
333                                 # found an iversion without an soname.  Is that possible?
334                                 #
335                                 print "Found version but no soname:", $0 | "cat 1>&2"
336                                 exit
337                         }
338                 }
339
340                 #
341                 # we could probably watch for some other token (like RELSZ)
342                 # that *generally* occurs later in the input than the stuff we watch
343                 # for, and exit if we see it, but it is just as easy to read all
344                 # the output, even after we have seen what we are looking for.
345                 #
346
347                 END {
348                         # Uncomment the next line for debugging info
349                         #{ print "END: NR: ", NR }
350                         if ( (found_soname == 1) && (found_iversion == 1) ) {
351                                 print soname, soname_version_delimiter, version
352                                 exit
353                         } else if (found_soname == 1) {
354                                 #
355                                 # no library version information
356                                 #
357                                 print soname
358                         }
359                         # else do nothing
360                 }
361         ' # end of awk
362 #done | sort -u
363 #comment out the previous line and uncomment the next line when debugging
364 done