diff options
Diffstat (limited to 'autodeps')
-rw-r--r-- | autodeps/aix.prov | 78 | ||||
-rwxr-xr-x | autodeps/aix.req | 171 | ||||
-rw-r--r-- | autodeps/aix4.prov | 189 | ||||
-rw-r--r-- | autodeps/aix4.req | 99 | ||||
-rw-r--r-- | autodeps/amigaos.prov | 3 | ||||
-rw-r--r-- | autodeps/amigaos.req | 3 | ||||
-rw-r--r-- | autodeps/darwin.prov | 21 | ||||
-rw-r--r-- | autodeps/darwin.req | 26 | ||||
-rw-r--r-- | autodeps/freebsd.prov | 9 | ||||
-rw-r--r-- | autodeps/freebsd.req | 22 | ||||
-rw-r--r-- | autodeps/freebsdelf.prov | 9 | ||||
-rw-r--r-- | autodeps/freebsdelf.req | 46 | ||||
-rw-r--r-- | autodeps/hpux.prov | 175 | ||||
-rw-r--r-- | autodeps/hpux.req | 126 | ||||
-rw-r--r-- | autodeps/irix6.prov | 201 | ||||
-rw-r--r-- | autodeps/irix6.req | 164 | ||||
-rw-r--r-- | autodeps/linux.prov | 61 | ||||
-rw-r--r-- | autodeps/linux.req | 136 | ||||
-rw-r--r-- | autodeps/mint.prov | 5 | ||||
-rw-r--r-- | autodeps/mint.req | 5 | ||||
-rw-r--r-- | autodeps/none | 3 | ||||
-rw-r--r-- | autodeps/openbsd.prov | 9 | ||||
-rw-r--r-- | autodeps/openbsd.req | 22 | ||||
-rw-r--r-- | autodeps/osf.prov | 188 | ||||
-rw-r--r-- | autodeps/osf.req | 142 | ||||
-rw-r--r-- | autodeps/solaris.prov | 14 | ||||
-rw-r--r-- | autodeps/solaris.req | 16 |
27 files changed, 1943 insertions, 0 deletions
diff --git a/autodeps/aix.prov b/autodeps/aix.prov new file mode 100644 index 0000000..6f7c8bd --- /dev/null +++ b/autodeps/aix.prov @@ -0,0 +1,78 @@ +#! /usr/bin/ksh + +# Original Author: Ralph Goers(rgoer@Candle.Com) +# Borrowed heavily from Tim Mooney's HP version. +# This file is distributed under the terms of the GNU General 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 run correctly. +# + +find_prov_ia64() +{ + # On AIX for IA64, use the file command to find shared modules + # + # Example file output: + # + #$file /usr/lib/ia64l32/libc.so + #/usr/lib/ia64l32/libc.so: ELF 32-bit LSB version 1 AIX shared obj IA-64 + # + # + # + + # Search for shared objects - the file command on AIX for IA64 reports + # shared objects + sed -e "s/['\"]/\\\&/g" -e "s/$/\//g" | LANG=C xargs file | grep -e ":.*shared obj" | cut -d: -f1 | sed "s/\/$//g" | xargs -i basename {} | sort -u +} + +find_prov_power() +{ + # + # Example dump output: + # + #$dump -H /usr/bin/dump + # + #/usr/bin/dump: + # + # ***Loader Section*** + # Loader Header Information + #VERSION# #SYMtableENT #RELOCent LENidSTR + #0x00000001 0x00000021 0x0000006c 0x0000002f + # + ##IMPfilID OFFidSTR LENstrTBL OFFstrTBL + #0x00000002 0x00000848 0x00000049 0x00000877 + # + # + # ***Import File Strings*** + #INDEX PATH BASE MEMBER + #0 /usr/lib:/lib:/usr/lpp/xlC/lib + #1 libc.a shr.o + + # + # + + # Search executables, archives, and symlinks to those types for shared + # objects + sed -e "s/['\"]/\\\&/g" -e "s/$/\//g" | LANG=C xargs file | grep -e ":.*executable" -e ":.*archive" | cut -d: -f1 | sed "s/\/$//g" | + + # Use the verbose version of dump to find the sharable objects + while read f + do + LANG=C /usr/bin/dump -ov $f/ 2>/dev/null | grep -E "^Flags.*SHROBJ|:$" | + awk 'match($1,":$") { member=$1 } + !match($1,":$") {print member} ' + done | sed -e 's/:$//' -e 's/\/\[/\(/g' -e 's/\]/)/g' | xargs -i basename {} | + sort -u +} + +PATH=/usr/bin + +machinetype=`uname -m` +if [[ $machinetype = "ia64" ]] +then + find_prov_ia64 +else + find_prov_power +fi + diff --git a/autodeps/aix.req b/autodeps/aix.req new file mode 100755 index 0000000..e8503b3 --- /dev/null +++ b/autodeps/aix.req @@ -0,0 +1,171 @@ +#! /usr/bin/ksh + +# Original Author: Ralph Goers(rgoer@Candle.Com) +# Borrowed heavily from Tim Mooney's HP version. +# This file is distributed under the terms of the GNU General 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 run correctly. +# + +find_req_power () +{ + # On AIX Power, use `dump -H' to find the library dependencies + # for an executable + # + # Example dump output: + # + #$dump -H /usr/bin/dump + # + #/usr/bin/dump: + # + # ***Loader Section*** + # Loader Header Information + #VERSION# #SYMtableENT #RELOCent LENidSTR + #0x00000001 0x00000021 0x0000006c 0x0000002f + # + ##IMPfilID OFFidSTR LENstrTBL OFFstrTBL + #0x00000002 0x00000848 0x00000049 0x00000877 + # + # + # ***Import File Strings*** + #INDEX PATH BASE MEMBER + #0 /usr/lib:/lib:/usr/lpp/xlC/lib + #1 libc.a shr.o + + # + # + + while read f + do + # Find the required symbols in executables and the required shells in + # scripts + LANG=C /usr/bin/file $f | /usr/bin/grep -q -e ":.*shell script" + + if [ $? -ne 0 ] # Use dump to examine executables + then + LANG=C /usr/bin/dump -H $f 2>/dev/null | awk ' + + # + # Since this entire awk script is enclosed in single quotes, + # you need to be careful to not use single quotes, even in awk + # comments, if you modify this script. + # + + BEGIN { + in_shlib_list = 0; + in_file_strings = 0; + FS = " "; + RS = "\n"; + } + + in_shlib_list == 1 && /^$/ { + in_shlib_list = 0; + in_file_strings = 0; + } + + in_shlib_list == 1 { + pos = index($2, "/") + numfields = split($0, fields, " ") + + if (pos == 0) { + namevar = 2 + } + else { + namevar = 3 + } + if (namevar < numfields) { + printf("%s(%s)\n", fields[namevar], fields[namevar+1]) + } + else { + if ((fields[namevar] != ".") && (fields[namevar] != "..")) { + print fields[namevar] + } + } + } + + in_file_strings == 1 && $1 == "0" { + in_shlib_list = 1 + } + + /\*Import File Strings\*/ { + in_file_strings = 1 + } + ' # end of awk + else # shell scripts + if [ -x $f ]; then + /usr/bin/head -1 $f | /usr/bin/sed -e 's/^\#\![ ]*//' | /usr/bin/cut -d" " -f1 + fi + fi + done | sort -u +} + +find_req_ia64 () +{ + # On AIX IA64, use `dump -Lv' to find the library dependencies + # for an executable + # + # Example dump output: + # + #$dump -Lv /usr/bin/dump + # + # + #/usr/bin/dump: + # + # **** DYNAMIC SECTION INFORMATION **** + #[INDEX] Tag Value + # + #.dynamic: + #[1] NEEDED libC.so.1 + #[2] NEEDED libelf.so + #[3] NEEDED /usr/lib/ia64l32/libc.so.1 + #[4] INIT 0x1001d6c0 + #[5] FINI 0x1001d700 + #[6] HASH 0x1000011c + #[7] STRTAB 0x10000914 + #[8] SYMTAB 0x10000364 + #[9] STRSZ 0x3dd + #[10] SYMENT 0x10 + #[11] PLTGOT 0x20018994 + #[12] PLT_RESERVE 0x20018a00 + #[13] PLTSZ 0x1c0 + #[14] PLTREL REL + #[15] JMPREL 0x100024bc + #[16] REL 0x10000cf4 + #[17] RELSZ 0x17c8 + #[18] RELENT 0x8 + # + # + + while read f + do + # Find the required symbols in executables and the required shells in + # scripts + LANG=C /usr/bin/file $f | /usr/bin/grep -q -e ":.*shell script" + + if [ $? -ne 0 ] # Use dump to examine executables + then + LANG=C /usr/bin/dump -Lv $f 2>/dev/null | \ + awk '$2=="NEEDED" {print $3}' | xargs -i basename {} + + else # Extract the exec module from shell scripts + if [ -x $f ]; then + head -1 $f | sed -e 's/^\#\![ ]*//' | cut -d" " -f1 + fi + fi + done | sort -u +} + +machinetype=`uname -m` +if [[ $machinetype = "ia64" ]] +then + /usr/bin/sed "s/['\"]/\\\&/g" | LANG=C /usr/bin/xargs /usr/bin/file | \ + /usr/bin/grep -e ":.*executable" -e ":.*archive" -e ":.*shell script" | /usr/bin/cut -d: -f1 | + find_req_ia64 +else + /usr/bin/sed "s/['\"]/\\\&/g" | LANG=C /usr/bin/xargs /usr/bin/file | \ + /usr/bin/grep -e ":.*executable" -e ":.*archive" -e ":.*shell script" | /usr/bin/cut -d: -f1 | + find_req_power +fi + diff --git a/autodeps/aix4.prov b/autodeps/aix4.prov new file mode 100644 index 0000000..59637a7 --- /dev/null +++ b/autodeps/aix4.prov @@ -0,0 +1,189 @@ +#! /usr/bin/ksh + +# Current Maintainer: Tim Mooney <mooney@golem.phys.ndsu.NoDak.edu> +# +# Original Author: Ralph Goers(rgoer@Candle.Com) +# Borrowed heavily from H10 version created by Tim Mooney. +# 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 AIX, use `dump -o' to find what the library provides, if anything. +# +# +# Ralph's comments: +# +# Executables are skipped because, by convention, shared libraries +# which are not dynamically loaded are packaged as archives. Also, +# it is impossible to tell the difference between an executable +# program and a dynamically loaded shared library. +# +# Because archives can contain any number of things, including +# apparently, multiple shared libraries, dependencies in archives +# will be specified as file[member]. Any member in an archive which +# has a loader section will be listed as provided. +# +# Tim's (subsequent) comments: +# +# Based on discussions on the rpm-list in mid-March of 2000, I've modified +# the copy of find-provides that Ralph provided me to use `dump -o' instead +# of `dump -H', and I've followed Brandon S. Allbery's suggestions and modified +# the awk script to look for a modtype of `RE', which is what constitutes a +# shared member of a library. Just like everything else on AIX, libraries are +# weird. :-| +# +# I've followed Ralph's convention of generating provides in the form of +# `filebasename(member-object)' *if* there is a member object, or just +# `filebasename' if there isn't (such as in the case of certain perl modules, +# locally built shared libraries, etc.). +# +# Example dump output: +# +#$dump -o /usr/lpp/X11/lib/R6/libX11.a +# +#/usr/lpp/X11/lib/R6/libX11.a[shr4.o]: +# +# ***Object Module Header*** +## Sections Symbol Ptr # Symbols Opt Hdr Len Flags +# 4 0x00126c28 14557 72 0x3002 +#Timestamp = 920377624 +#Magic = 0x1df +# +# ***Optional Header*** +#Tsize Dsize Bsize Tstart Dstart +#0x000bcc20 0x00024bd4 0x00000e0c 0x00000000 0x00000000 +# +#SNloader SNentry SNtext SNtoc SNdata +#0x0004 0x0000 0x0001 0x0002 0x0002 +# +#TXTalign DATAalign TOC vstamp entry +#0x0005 0x0003 0x00023d74 0x0001 0xffffffff +# +#maxSTACK maxDATA SNbss magic modtype +#0x00000000 0x00000000 0x0003 0x010b RE +# +#/usr/lpp/X11/lib/R6/libX11.a[shr4net.o]: +# +# ***Object Module Header*** +## Sections Symbol Ptr # Symbols Opt Hdr Len Flags +# 7 0x000006fb 22 72 0x3002 +#Timestamp = 774732998 +#Magic = 0x1df +# +# ***Optional Header*** +#Tsize Dsize Bsize Tstart Dstart +#0x00000084 0x00000088 0x00000000 0x00000200 0x00000000 +# +#SNloader SNentry SNtext SNtoc SNdata +#0x0007 0x0000 0x0002 0x0004 0x0004 +# +#TXTalign DATAalign TOC vstamp entry +#0x0002 0x0003 0x00000080 0x0001 0xffffffff +# +#maxSTACK maxDATA SNbss magic modtype +#0x00000000 0x00000000 0x0005 0x010b RE + +PATH=/usr/bin:/usr/ccs/bin +export PATH + +# +# TVM: Marc Stephenson (marc@austin.ibm.com) points out we run things +# like `file', et. al. and expect the output to be what we see in the +# C/POSIX locale. Make sure it is so. +# +LANG=C +export LANG + +# +# TVM: Because AIX libraries don't have the equivalent of a SONAME, if you do +# +# ln -s /usr/lib/libc.a /tmp/libmy_libc_link.a +# +# and then link your program with `-L/tmp -lmy_libc_link', that's the name +# that will be recorded as the BASE in the Import File Strings area. +# This means we need to include "symbolic link" in the list of files to check +# out. +# +filelist=`sed "s/['\"]/\\\&/g" | xargs file \ + | grep -E 'archive|executable|symbolic link' | cut -d: -f1` + +for f in $filelist +do + # + # Uncomment the next line for some additional debugging info: + #echo "Checking $f" + dump -o $f 2>/dev/null | awk ' + + # TVM: be careful to not use any single quotes, even in comments, + # since this entire awk script is enclosed in single quotes. + + BEGIN { + FS = " "; + RS = "\n"; + # our flag to indicate we found a filename[membername] or + # filename. + found_file_or_member = 0 + # our flag to indicate we found the modtype tag. If so, + # we want to look for RE on the next line. + found_modtype = 0 + # + # number of times gsub substituted, used twice below + nsub = 0 + } + + # Uncomment the next line for some debugging info. + # { print NR , ":", $0 } + + found_modtype == 1 && found_file_or_member == 1 { + + if ( $0 ~ / RE/ ) { + # we have seen a filename, we have seen a modtype line, and now + # we know that the modtype is RE. Print out the member name. + # + # Note that member names generally look like foo[bar.o], and + # since the RPM standard has become to use parens, we will + # translate the [ and ] into ( and ) in the output stream. + # awk on AIX 4 has sub() and gsub(), so we can use them to do + # it. If this script is adapted for use on some other platform + # make sure that awk on that platform has sub/gsub. If not, + # you will need to postprocess the output stream (probably before + # the sort -u) with tr or sed. + nsub = gsub(/\[/, "(", member) + if ( nsub > 1 ) { + print "substituted too many times for [:", member | "cat 1>&2" + } + nsub = gsub(/\]/, ")", member) + if ( nsub > 1 ) { + print "substituted too many times for ]:", member | "cat 1>&2" + } + print member + } + # In any case, reset our flags to zero, to indicate we are done + # with this member, so we are ready to handle additional members + # if needed. + found_file_or_member = 0 + found_modtype = 0 + } + + found_file_or_member == 1 && /magic *modtype/ { + # we have seen a filename, and now we have seen the modtype + # line. Set the found_modtype flag. The next line of input + # will be caught by the rule above, and we will print out + # the member if the modtype is RE. + found_modtype = 1 + } + + /:$/ { + numfields = split($0,fields, "/") + # chop off the trailing colon + fieldlen = length(fields[numfields])-1 + member= substr(fields[numfields], 1, fieldlen) + # Set the flat to indicate we found a file or a file(member). + found_file_or_member = 1 + } + ' # end of awk +done | sort -u +#comment out the previous line and uncomment the next line when debugging +#done diff --git a/autodeps/aix4.req b/autodeps/aix4.req new file mode 100644 index 0000000..79e988b --- /dev/null +++ b/autodeps/aix4.req @@ -0,0 +1,99 @@ +#! /usr/bin/ksh +# +# Current Maintainer: Tim Mooney <mooney@golem.phys.ndsu.NoDak.edu> +# Original Author: Ralph Goers(rgoer@Candle.Com) +# +# 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 run correctly. +# +# On AIX, use `dump -H' to find the library dependencies for an executable +# +# Example dump output: +# +#$dump -H /usr/bin/dump +# +#/usr/bin/dump: +# +# ***Loader Section*** +# Loader Header Information +#VERSION# #SYMtableENT #RELOCent LENidSTR +#0x00000001 0x00000021 0x0000006c 0x0000002f +# +##IMPfilID OFFidSTR LENstrTBL OFFstrTBL +#0x00000002 0x00000848 0x00000049 0x00000877 +# +# +# ***Import File Strings*** +#INDEX PATH BASE MEMBER +#0 /usr/lib:/lib:/usr/lpp/xlC/lib +#1 libc.a shr.o +# +# + +PATH=/usr/bin:/usr/ccs/bin +export PATH + +# +# TVM: Marc Stephenson (marc@austin.ibm.com) points out we run things +# like `file', et. al. and expect the output to be what we see in the +# C/POSIX locale. Make sure it is so. +# +LANG=C +export LANG + +filelist=`sed "s/['\"]/\\\&/g" | xargs file \ + | grep -E '^.*:.*(executable |archive )' | cut -d: -f1` + +for f in $filelist +do + dump -H $f 2>/dev/null | awk ' + + # + # Since this entire awk script is enclosed in single quotes, + # you need to be careful to not use single quotes, even in awk + # comments, if you modify this script. + # + + BEGIN { + in_shlib_list = 0; + in_file_strings = 0; + FS = " "; + RS = "\n"; + } + + in_shlib_list == 1 && /^$/ { + in_shlib_list = 0; + in_file_strings = 0; + } + + in_shlib_list == 1 { + pos = index($2, "/") + numfields = split($0, fields, " ") + + if (pos == 0) { + namevar = 2 + } + else { + namevar = 3 + } + if (namevar < numfields) { + printf("%s(%s)\n", fields[namevar], fields[namevar+1]) + } + else { + print fields[namevar] + } + } + + in_file_strings == 1 && $1 == "0" { + in_shlib_list = 1 + } + + /\*Import File Strings\*/ { + in_file_strings = 1 + } + + ' # end of awk +done | sort -u diff --git a/autodeps/amigaos.prov b/autodeps/amigaos.prov new file mode 100644 index 0000000..87ad08f --- /dev/null +++ b/autodeps/amigaos.prov @@ -0,0 +1,3 @@ +#!/bin/sh + +cat > /dev/null diff --git a/autodeps/amigaos.req b/autodeps/amigaos.req new file mode 100644 index 0000000..87ad08f --- /dev/null +++ b/autodeps/amigaos.req @@ -0,0 +1,3 @@ +#!/bin/sh + +cat > /dev/null diff --git a/autodeps/darwin.prov b/autodeps/darwin.prov new file mode 100644 index 0000000..b068912 --- /dev/null +++ b/autodeps/darwin.prov @@ -0,0 +1,21 @@ +#!/bin/bash +# ---------------------------------------------------------- +# find-provides for Darwin/MacOSX +# ---------------------------------------------------------- +# This script reads filenames from STDIN and outputs any relevant provides +# information that needs to be included in the package. + +filelist=$(sed -n -e '/\.dylib/p' -e '/\.so/p' -e '/\.bundle/p' | sort | uniq | xargs file -L 2>/dev/null | grep "Mach-O.*\(ppc\|i386\)" | cut -d: -f1) + +for f in $filelist; do + libname=$(basename $f | sed -e 's;\..*;;') + soname=$(otool -l $f | grep $libname | awk '/ name/ {print $2}') + + if [ "$soname" != "" ]; then + if [ ! -L $f ]; then + basename $soname + fi + else + echo ${f##*/} + fi +done | sort -u diff --git a/autodeps/darwin.req b/autodeps/darwin.req new file mode 100644 index 0000000..e571710 --- /dev/null +++ b/autodeps/darwin.req @@ -0,0 +1,26 @@ +#!/bin/sh +# ---------------------------------------------------------------- +# find-requires for Darwin/MacOSX +# ---------------------------------------------------------------- +ulimit -c 0 + +filelist=`sed "s/['\"]/\\\&/g"` +exelist=`echo $filelist | xargs file | grep -F Mach-O | cut -d: -f1 ` +scriptlist=`echo $filelist | xargs file | grep -E ":.* (commands|script) " | cut -d: -f1 ` + +for f in $exelist; do + if [ -x $f ]; then + otool -L $f \ + | awk '/^\t/ { print }' \ + | sed -n -e '/ (compatibility version .* current version .*)/p' \ + | sed -e 's/ (compatibility version .* current version .*)//' + fi +done | sort -u | sed "s/['\"]/\\\&/g" | xargs -n 1 basename | sort -u + +for f in $scriptlist; do + if [ -x $f ]; then + head -1 $f | sed -e 's/^\#\![ ]*//' \ + | sed -n -e '/^\/bin/!p' | sed -n -e '/^\/usr\/bin/!p' | uniq \ + | cut -d" " -f1 + fi +done diff --git a/autodeps/freebsd.prov b/autodeps/freebsd.prov new file mode 100644 index 0000000..cf00d4f --- /dev/null +++ b/autodeps/freebsd.prov @@ -0,0 +1,9 @@ +#!/bin/sh +# ---------------------------------------------------------- +# find-provides for FreeBSD-2.2.x +# ---------------------------------------------------------- +filelist=$(grep "\\.so" | grep -v "^/lib/ld.so" | xargs file -L 2>/dev/null | grep "FreeBSD.*shared" | cut -d: -f1) + +for f in $filelist; do + echo ${f##*/} +done | sort -u diff --git a/autodeps/freebsd.req b/autodeps/freebsd.req new file mode 100644 index 0000000..9a1e0f4 --- /dev/null +++ b/autodeps/freebsd.req @@ -0,0 +1,22 @@ +#!/bin/sh +# ---------------------------------------------------------------- +# find-requires for FreeBSD-2.2.x +# how do we know what is required by a.out shared libraries? +# ---------------------------------------------------------------- +ulimit -c 0 + +filelist=`sed "s/['\"]/\\\&/g"` +exelist=`echo $filelist | xargs file | grep -F executable | cut -d: -f1 ` +scriptlist=`echo $filelist | xargs file | grep -E ":.* (commands|script) " | cut -d: -f1 ` + +for f in $exelist; do + if [ -x $f ]; then + ldd $f | /usr/bin/awk '/=>/&&!/not found/ { print $3 }' + fi +done | sort -u | sed "s/['\"]/\\\&/g" | xargs -n 1 basename | sort -u + +for f in $scriptlist; do + if [ -x $f ]; then + head -1 $f | sed -e 's/^\#\![ ]*//' | cut -d" " -f1 + fi +done | sort -u diff --git a/autodeps/freebsdelf.prov b/autodeps/freebsdelf.prov new file mode 100644 index 0000000..df7d829 --- /dev/null +++ b/autodeps/freebsdelf.prov @@ -0,0 +1,9 @@ +#!/bin/sh +# ---------------------------------------------------------- +# find-provides for FreeBSD >= 3.3 +# ---------------------------------------------------------- +filelist=$(grep "\\.so" | grep -v "^/lib/ld.so" | xargs file -L 2>/dev/null | grep "ELF.*shared" | cut -d: -f1) + +for f in $filelist; do + echo ${f##*/} +done | sort -u diff --git a/autodeps/freebsdelf.req b/autodeps/freebsdelf.req new file mode 100644 index 0000000..dde04c5 --- /dev/null +++ b/autodeps/freebsdelf.req @@ -0,0 +1,46 @@ +#!/bin/sh + +# note this works for both a.out and ELF executables +# it also auto-generates requirment lines for shell scripts + +ulimit -c 0 + +filelist=`sed "s/['\"]/\\\&/g"` +exelist=`if test "x$filelist" != x; then echo $filelist | xargs file | grep ":.*executable" | cut -d: -f1; fi` +scriptlist=`if test "x$filelist" != x; then echo $filelist | xargs file | grep -E ":.* (commands|script) " | cut -d: -f1; fi` +liblist=`if test "x$filelist" != x; then echo $filelist | xargs file | grep ":.*shared object" | cut -d : -f1; fi` + +LDDLIST=`for f in $exelist; do + if [ -x $f ]; then + ldd $f | awk '/=>/ { print $1 }' + fi +done | sort -u | sed "s/['\"]/\\\&/g"` +if test "x$LDDLIST" != x; then + echo $LDDLIST | xargs -n 1 basename | grep -v 'libNoVersion.so' | sort -u +fi + +LDDLIST=`for f in $liblist; do + ldd $f | awk '/=>/ { print $1 }' +done | sort -u | sed "s/['\"]/\\\&/g"` +if test "x$LDDLIST" != x; then + echo $LDDLIST | xargs -n 1 basename | grep -v 'libNoVersion.so' | sort -u +fi + +for f in $scriptlist; do + if [ -x $f ]; then + head -1 $f | sed -e 's/^\#\![ ]*//' | cut -d" " -f1 + fi +done | sort -u + +for f in $liblist $exelist ; do + objdump -p $f | awk ' + BEGIN { START=0; LIBNAME=""; } + /Version References:/ { START=1; } + /required from/ && (START==1) { + sub(/:/, "", $3); + LIBNAME=$3; + } + (START==1) && (LIBNAME!="") && ($4~/^GLIBC_*/) { print LIBNAME "(" $4 ")"; } + /^$/ { START=0; } + ' +done | sort -u diff --git a/autodeps/hpux.prov b/autodeps/hpux.prov new file mode 100644 index 0000000..9fd4ce6 --- /dev/null +++ b/autodeps/hpux.prov @@ -0,0 +1,175 @@ +#! /usr/bin/ksh + +# Original Author: Tim Mooney <mooney@golem.phys.ndsu.NoDak.edu> +# $Id: hpux.prov,v 1.8 2001/09/15 13:49:11 jbj Exp $ +# +# 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 +# shared libraries provided by (contained in) the package. +# +# +# On HP-UX, use `chatr' to find what libraries a package provides +# +# Example chatr output: +# +#$chatr /usr/lib/libc.sl +# +#/usr/lib/libc.sl: +# shared library +# shared library dynamic path search: +# SHLIB_PATH disabled second +# embedded path disabled first Not Defined +# internal name: +# libc.1 +# shared library list: +# dynamic /usr/lib/libdld.1 +# static branch prediction disabled +# kernel assisted branch predictionenabled +# lazy swap allocationdisabled +# text segment lockingdisabled +# data segment lockingdisabled +# data page size: 4K +# instruction page size: 4K +# + +# +# Implementation notes: some of the system libraries are built without an +# `internal name' (HP-UX's equivalent to a SONAME), so I need to track what +# chatr outputs as its first line. We'll use the basename of that line in +# the event of no internal name. +# + +PATH=/usr/bin:/usr/sbin:/usr/ccs/bin +export PATH + +# +# TVM: Marc Stephenson (marc@austin.ibm.com) points out we run things +# like `file', et. al. and expect the output to be what we see in the +# C/POSIX locale. Make sure it is so. +# +LANG=C +export LANG + +# +# 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 + # It's possible that I should be testing to make sure that the file + # we're trying isn't a symlink, and skipping it if it is, because of + # the possible odd situation where we could have a link to a library + # with no internal name. This would need more investigation, though. + chatr $f 2>/dev/null \ + | awk ' + + BEGIN { + FS = " "; + RS = "\n"; + + # This flag signfies that we have seen the internal name: + # marker. Once we see that, we set the flag to 1. The next + # line we read should contain the library internal name, the + # SOM equivalent of an soname. At that point we set the flag + # found_internal_name to 1 and exit + # the main body of the awk script, going through the END + in_internal_name = 0; + + # + # We have seen the internal name: section (yet)? + # + found_internal_name = 0; + + # + # assume it is a shared library, until record 2 proves us wrong. + # + isa_shared_library = 1; + } + + # Uncomment the next line for some debugging info. + #{ print NR , ":", $0 } + + # + # save the first line in case there is no internal name built + # into this object. + # + NR == 1 { + my_name = $0 + opened_something = 1; + } + + # + # Check the second line (record). Clear the flag if it is not a + # shared library. + # + NR == 2 && $0 !~ /^[ ]+shared library[ ]*$/ { + # It is not a shared library. Bow out early + isa_shared_library = 0; + exit + } + + in_internal_name == 1 { + + # We found the library internal name. If it does not contain + # a path, print it. At least a couple of the system libraries + # have a full path as the internal name (this is probably a bug). + + if ( $0 ~ /\// ) { + numfields = split($0, internal_name, "/") + print internal_name[numfields] + } else { + print $1 + } + + # + # Set a flag for the EXIT section, to indicate that we found + # an internal name + # + found_internal_name = 1; + in_internal_name = 0 + exit + } + + # + # we have hit the internal name section. Set the flag. The next + # line should be what we are looking for. + # + /^ +internal name: *$/ { + in_internal_name = 1 + } + + END { + # Uncomment the next line for debugging info + #{ print "END: NR: ", NR } + if ( (isa_shared_library == 0) || (NR < 2) ) { + # both of these indicate error conditions, for which we + # should not generate any output. + exit; + } else { + if (found_internal_name == 1) { + exit; + } else { + # + # chop the : off the end of the line + # + colon = index(my_name, ":") + colon = colon - 1 + temp = substr(my_name, 1, colon) + # + # get the basename + # + numfields = split(temp, basename, "/") + # Uncomment the next line for debugging info + #print "In END:", numfields, ":", temp + print basename[numfields] + exit + } + } + } + ' # end of awk +done | sort -u +#comment out the previous line and uncomment the next line when debugging +#done diff --git a/autodeps/hpux.req b/autodeps/hpux.req new file mode 100644 index 0000000..ab72900 --- /dev/null +++ b/autodeps/hpux.req @@ -0,0 +1,126 @@ +#! /usr/bin/ksh + +# Original Author: Tim Mooney <mooney@golem.phys.ndsu.NoDak.edu> +# $Id: hpux.req,v 1.7 2001/09/15 13:49:11 jbj Exp $ +# +# 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 +# shared libraries the package requires to run correctly. +# +# On HP-UX, use `chatr' to find the library dependencies for an executable +# +# Example chatr output: +# +#$chatr /usr/bin/chatr +#/usr/bin/chatr: +# shared executable +# shared library dynamic path search: +# SHLIB_PATH disabled second +# embedded path disabled first Not Defined +# internal name: +# chatr +# shared library list: +# dynamic /usr/lib/libc.1 +# shared library binding: +# deferred +# static branch prediction disabled +# kernel assisted branch predictionenabled +# lazy swap allocationdisabled +# text segment lockingdisabled +# data segment lockingdisabled +# data page size: 4K +# instruction page size: 4K + +PATH=/usr/bin:/usr/sbin:/sbin:/usr/ccs/bin +export PATH + +# +# TVM: Marc Stephenson (marc@austin.ibm.com) points out we run things +# like `file', et. al. and expect the output to be what we see in the +# C/POSIX locale. Make sure it is so. +# +LANG=C +export LANG + +IFS="" +while read f +do + # uncomment the next line if debugging + # echo "### processing $f" + + # + # 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" | grep -E '(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 + # sees them and things get hosed. + # + + BEGIN { + in_shlib_list = 0; + FS = " "; + RS = "\n"; + } + + # uncomment the next line for debugging information + #{ print NR, ": ", $0 } + + + in_shlib_list == 1 && /dynamic[ ]+[\/\.]/ { + + # split the line on "/" and print out the last element + numfields = split($0,fields,"/") + print fields[numfields] + + } + + /^ +shared library list: *$/ { + in_shlib_list = 1 + } + + /^ +shared library binding: *$/ { + exit + } + ' # 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 new file mode 100644 index 0000000..87ee4e1 --- /dev/null +++ b/autodeps/irix6.prov @@ -0,0 +1,201 @@ +#! /usr/bin/ksh + +# Original Author: Tim Mooney <mooney@golem.phys.ndsu.NoDak.edu> +# $Id: irix6.prov,v 1.7 2001/09/15 13:49:11 jbj Exp $ +# +# 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 +# shared libraries provided by (contained in) the package. +# +# NOTE: IRIX libraries (even system libraries) have "version information" +# in both the soname and the internal version field, so it's important to +# be able to separate the soname and internal version fields. As has +# become the case on other platforms, the soname/iversion delimiters have +# become the `(' and `)' characters. +# +# On IRIX, use `elfdump -L' to find what libraries a package provides +# +# Example `elfdump -L' output: +# +#$elfdump -L /usr/lib/libc.so +# +# +#/usr/lib/libc.so: +# +# **** DYNAMIC SECTION INFORMATION **** +#.dynamic : +#[INDEX] Tag Value +#[0] HASH 0xfa099d0 +#[1] STRTAB 0xfa0027c +#[2] SYMTAB 0xfa10e3c +#[3] STRSZ 0x9751 +#[4] SYMENT 0x10 +#[5] INIT 0 +#[6] FINI 0 +#[7] RLDVERS 0x1 +#[8] FLAGS 0x1411 +#[9] BASEADDR 0xfa00000 +#[10] LOCGOTNO 0x3c +#[11] PROTECT 0x3c +#[12] HIDDEN 0x12 +#[13] CNFLCTNO 0 +#[14] LBLISTNO 0 +#[15] SYMTABNO 0xd19 +#[16] UNREFEXT 0x8 +#[17] GOTSYM 0x8b3 +#[18] LOCAL 0x12 +#[19] LOCALPG 0x1 +#[20] LOCALPG 0x10 +#[21] PLTGOT 0xfb483b0 +#[22] RLDTXT_ADR0xfb6b580 +#[23] OPTIONS 0xfa000f4 +#[24] SONAME libc.so.1 +#[25] TIMSTAMP Jun 16 18:23:15 1997 +#[26] CHECKSUM 0x92321a0c +#[27] IVERSION sgi1.0 +#[28] REL 0xfa1dfcc +#[29] RELSZ 0x1988 +#[30] RELENT 0x8 +#[31] MSYM 0xfa1f954 +#[32] COMPCTSIZE0xc60c +#No Library List Section in /usr/lib/libc.so +# + +PATH=/usr/bin:/usr/sbin +export PATH + +# +# TVM: Marc Stephenson (marc@austin.ibm.com) points out we run things +# like `file', et. al. and expect the output to be what we see in the +# C/POSIX locale. Make sure it is so. +# +LANG=C +export LANG + +# +# 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 + # + # If it's a shared library, run elfdump on it. + # + maybe_shared_lib=`file $f | grep -E 'ELF.*dynamic lib'` + if test X"$maybe_shared_lib" != X ; then + elfdump -L $f 2>/dev/null | awk ' + + # + # Since this entire awk script is enclosed in single quotes, + # you need to be careful to not use single quotes, even in awk + # comments, if you modify this script. + # + + 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 == 3) { + soname = $3 + } 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 == 3) { + version = $3 + # + # 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 { + # + # handle libraries with comments and other junk in + # the version field. IRIX has a number of system libraries + # with whitespace and other junk in the version field! + # + # we discard the whitespace and keep the identifier after + # the # sign. + # + version = iversion[numfields] + numfields = split(version, version_junk, "#") + if (numfields > 1) { + version = version_junk[numfields] + found_iversion = 1; + } + } + } 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 RELSZ) + # 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) && (found_iversion == 0) ) { + # + # 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, "(", 0, ")" + } + # else do nothing + } + ' # end of awk + 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 diff --git a/autodeps/irix6.req b/autodeps/irix6.req new file mode 100644 index 0000000..72442ac --- /dev/null +++ b/autodeps/irix6.req @@ -0,0 +1,164 @@ +#! /usr/bin/ksh + +# Original Author: Tim Mooney <mooney@golem.phys.ndsu.NoDak.edu> +# $Id: irix6.req,v 1.7 2001/09/15 13:49:11 jbj Exp $ +# +# 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 +# shared libraries the package requires to execute. +# +# NOTE: IRIX libraries (even system libraries) have "version information" +# in both the soname and the internal version field, so it's important to +# be able to separate the soname and internal version fields. As has +# become the case on other platforms, the soname/iversion delimiters have +# become the `(' and `)' characters. +# +# On IRIX, use `elfdump -Dl' to find what libraries are required by +# an executable. `elfdump -L' does what we need too, but it gives us more +# than we really need. +# +# Example `elfdump -Dl' output: +# +#$elfdump -Dl /usr/bin/X11/xterm +# +# +# +#/usr/bin/X11/xterm: +# +# **** MIPS LIBLIST INFORMATION **** +#.liblist : +#[INDEX] Timestamp Checksum Flags Name Version +#[1] Nov 23 15:39:02 1997 0x4da65893 ----- libXaw.so.2 sgi2.0 +#[2] Nov 23 15:39:02 1997 0x414eece6 ----- libXmu.so sgi1.0 +#[3] Nov 23 15:39:02 1997 0x6f314e69 ----- libXt.so sgi1.0 +#[4] Nov 23 15:39:02 1997 0xcbe81fff ----- libXext.so sgi1.0 +#[5] Nov 23 15:39:02 1997 0x89ae8e98 ----- libX11.so.1 sgi1.0 +#[6] Oct 27 01:00:29 1997 0x99b27890 ----- libcurses.so sgi1.0 +#[7] Jun 16 18:23:15 1997 0x92321a0c ----- libc.so.1 sgi1.0 +# + +# +# TVM: it might be better to re-write this so that `file' isn't used, since +# it can all be done with `elfdump', but this works. +# + +PATH=/usr/bin:/usr/sbin +export PATH + +# +# TVM: Marc Stephenson (marc@austin.ibm.com) points out we run things +# like `file', et. al. and expect the output to be what we see in the +# C/POSIX locale. Make sure it is so. +# +LANG=C +export LANG + +# +# 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. +# +IFS="" +while read f +do + + # + # Uncomment the next line for additional debugging: + #echo "read ->$f<-" + + # + # Only run file once per file: + # + file_output=`file $f` + + # + # 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" | grep -E 'executable|lib'` + if test X"$maybe_shared_lib" != X ; then + + elfdump -Dl $f 2>/dev/null \ + | awk ' + + # + # Since this entire awk script is enclosed in single quotes, + # you need to be careful to not use single quotes, even in awk + # comments, if you modify this script. + # + + BEGIN { + found_column_headers = 0; + FS = " "; + RS = "\n"; + OFS=""; + } + + # uncomment the next line for debugging information + #{ print "Saw input:", $0 } + + found_column_headers == 1 && $0 !~ /^$/ { + + # get the library name (field 15) and the library version (field 16) + # if present. + numfields = split($0,fields) + if (numfields == 8) { + print fields[8] + } else if (numfields == 9) { + # + print fields[8], "(", fields[9], ")" + } else if (numfields > 9) { + # + # SGI has this annoying habit of putting comments, complete + # with whitespace, in their library IVERSION field. Yuck. + # + # Handle libraries like this gracefully. + # + verfields = split(fields[NF], junk, "#") + if (verfields == 2) { + print fields[8], "(", junk[2], ")" + } else if (verfields > 2) { + print fields[8], "(", junk[verfields], ")" + } else { + print "Cannot find version:", fields[numfields] | "cat 2>&1" + } + } + } + + /^\[INDEX\].Timestamp.*Checksum.*Flags.*Name.*Version$/ { + # we better start paying attention now. + found_column_headers = 1 + # + # uncomment the next line for debugging information + #print "found the column headers: ", $0 + } + + ' # end of awk + fi +done | sort -u +# comment out the previous line and uncomment the next when debugging +#done diff --git a/autodeps/linux.prov b/autodeps/linux.prov new file mode 100644 index 0000000..8547dc3 --- /dev/null +++ b/autodeps/linux.prov @@ -0,0 +1,61 @@ +#!/bin/bash + +# This script reads filenames from STDIN and outputs any relevant provides +# information that needs to be included in the package. + +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) +pythonlist= +tcllist= + +# +# --- Alpha does not mark 64bit dependencies +case `uname -m` in + alpha*) mark64="" ;; + *) mark64="()(64bit)" ;; +esac + +# +# --- Library sonames and weak symbol versions (from glibc). +for f in $solist; do + soname=$(objdump -p $f | awk '/SONAME/ {print $2}') + + 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 + else + echo ${f##*/}$lib64 + fi +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 + +# +# --- Python modules. +[ -x /usr/lib/rpm/python.prov -a -n "$pythonlist" ] && + echo $pythonlist | tr '[:blank:]' \\n | /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 + +exit 0 diff --git a/autodeps/linux.req b/autodeps/linux.req new file mode 100644 index 0000000..b9a8f99 --- /dev/null +++ b/autodeps/linux.req @@ -0,0 +1,136 @@ +#!/bin/bash + +# +# Auto-generate requirements for executables (both ELF and a.out) and library +# sonames, script interpreters, and perl modules. +# + +ulimit -c 0 + +# +# --- Set needed to 0 for traditional find-requires behavior. +needed=1 +if [ X"$1" = Xldd ]; then + needed=0 +elif [ X"$1" = Xobjdump ]; then + needed=1 +fi + +# +# --- Grab the file manifest and classify files. +#filelist=`sed "s/['\"]/\\\&/g"` +filelist=`sed "s/[]['\"*?{}]/\\\\\&/g"` +exelist=`echo $filelist | xargs -r file | \ + grep -Ev ":.* (commands|script)[, ]" | \ + grep ":.*executable" | cut -d: -f1` +scriptlist=`echo $filelist | xargs -r file | \ + grep -E ":.* (commands|script)[, ]" | cut -d: -f1` +liblist=`echo $filelist | xargs -r file | \ + grep ":.*shared object" | cut -d : -f1` + +interplist= +perllist= +pythonlist= +tcllist= + +# +# --- Alpha does not mark 64bit dependencies +case `uname -m` in + alpha*) mark64="" ;; + *) mark64="()(64bit)" ;; +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 | \ + 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/) { + gsub(/'\''"/,"\\&",$1); + printf "%s'$lib64'\n", $1 + } + }' + done | xargs -r -n 1 basename | sort -u + +# +# --- Library dependency sonames. + 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/) { + gsub(/'\''"/,"\\&",$1); + printf "%s'$lib64'\n", $1 + } + }' + done | xargs -r -n 1 basename | sort -u +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" + case $interp in + */perl) perllist="$perllist $f" ;; + esac +done +[ -n "$interplist" ] && { echo "$interplist" | tr '[:blank:]' \\n | sort -u ; } + +# +# --- Add perl module files to perllist. +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 | \ + grep "ELF 64-bit" >/dev/null; then echo "$mark64"; fi` + objdump -p $f | awk 'BEGIN { START=0; LIBNAME=""; needed='$needed'; } + /^$/ { START=0; } + /^Dynamic Section:$/ { START=1; } + (START==1) && /NEEDED/ { + if (needed) { + if ("'$lib64'" != "") { + sub(/$/, "()'$lib64'", $2) ; + } + print $2 ; + } + } + (START==2) && /^[A-Za-z]/ { START=3; } + /^Version References:$/ { START=2; } + (START==2) && /required from/ { + sub(/:/, "", $3); + LIBNAME=$3; + } + (START==2) && (LIBNAME!="") && ($4!="") && (($4~/^GLIBC_*/) || ($4~/^GCC_*/)) { + print LIBNAME "(" $4 ")'$lib64'"; + } + ' +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 + +# +# --- Python modules. +[ -x /usr/lib/rpm/python.req -a -n "$pythonlist" ] && \ + echo $pythonlist | tr '[:blank:]' \\n | /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 + +exit 0 diff --git a/autodeps/mint.prov b/autodeps/mint.prov new file mode 100644 index 0000000..a752f8f --- /dev/null +++ b/autodeps/mint.prov @@ -0,0 +1,5 @@ +#!/bin/sh +# +# No shared libs on MiNT yet, sigh. + +echo > /dev/null diff --git a/autodeps/mint.req b/autodeps/mint.req new file mode 100644 index 0000000..a752f8f --- /dev/null +++ b/autodeps/mint.req @@ -0,0 +1,5 @@ +#!/bin/sh +# +# No shared libs on MiNT yet, sigh. + +echo > /dev/null diff --git a/autodeps/none b/autodeps/none new file mode 100644 index 0000000..87ad08f --- /dev/null +++ b/autodeps/none @@ -0,0 +1,3 @@ +#!/bin/sh + +cat > /dev/null diff --git a/autodeps/openbsd.prov b/autodeps/openbsd.prov new file mode 100644 index 0000000..1e7b06e --- /dev/null +++ b/autodeps/openbsd.prov @@ -0,0 +1,9 @@ +#!/bin/sh +# ---------------------------------------------------------- +# find-provides for OpenBSD-2.5 +# ---------------------------------------------------------- +filelist=$(grep "\\.so" | grep -v "^/lib/ld.so" | xargs file -L 2>/dev/null | grep "OpenBSD.*shared" | cut -d: -f1) + +for f in $filelist; do + echo ${f##*/} +done | sort -u diff --git a/autodeps/openbsd.req b/autodeps/openbsd.req new file mode 100644 index 0000000..ec3bac7 --- /dev/null +++ b/autodeps/openbsd.req @@ -0,0 +1,22 @@ +#!/bin/sh +# ---------------------------------------------------------------- +# find-requires for OpenBSD-2.2.x +# how do we know what is required by a.out shared libraries? +# ---------------------------------------------------------------- +ulimit -c 0 + +filelist=`sed "s/['\"]/\\\&/g"` +exelist=`echo $filelist | xargs file | grep -F executable | cut -d: -f1 ` +scriptlist=`echo $filelist | xargs file | grep -E ":.* (commands|script) " | cut -d: -f1 ` + +for f in $exelist; do + if [ -x $f ]; then + ldd $f | /usr/bin/awk '/\=\>/&&!/not found/ { print $3 }' + fi +done | sort -u | sed "s/['\"]/\\\&/g" | xargs -n 1 basename | sort -u + +for f in $scriptlist; do + if [ -x $f ]; then + head -1 $f | sed -e 's/^\#\![ ]*//' | cut -d" " -f1 + fi +done | sort -u diff --git a/autodeps/osf.prov b/autodeps/osf.prov new file mode 100644 index 0000000..6b54133 --- /dev/null +++ b/autodeps/osf.prov @@ -0,0 +1,188 @@ +#! /usr/bin/ksh + +# Original Author: Tim Mooney <mooney@golem.phys.ndsu.NoDak.edu> +# $Id: osf.prov,v 1.7 2000/10/31 20:47:23 mooney Exp $ +# +# 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 +# shared libraries provided by (contained in) the package. +# +# +# On Digital/Tru64 Unix (OSF1), use `odump -D' to find what libraries a +# package provides. Note that Tru64 Unix 5.x and later come with `ldd', +# but sticking with `odump' works with versions of the OS back to at least +# 3.x, so it's the preferred method. +# +# 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 +# + +PATH=/usr/bin:/usr/sbin:/sbin:/usr/ccs/bin +export PATH + +# +# TVM: Marc Stephenson (marc@austin.ibm.com) points out we run things +# like `file', et. al. and expect the output to be what we see in the +# C/POSIX locale. Make sure it is so. +# +LANG=C +export LANG + +# +# 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 + + # + # if it's a shared library, run odump on it. + # + maybe_shared_lib=`file $f | grep -E 'COFF.*shared library'` + if test X"$maybe_shared_lib" != X ; then + 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/Tru64 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 + 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 new file mode 100644 index 0000000..39d00c3 --- /dev/null +++ b/autodeps/osf.req @@ -0,0 +1,142 @@ +#! /usr/bin/ksh + +# Original Author: Tim Mooney <mooney@golem.phys.ndsu.NoDak.edu> +# $Id: osf.req,v 1.9 2001/09/15 13:49:11 jbj Exp $ +# +# 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 +# shared libraries the package requires to execute. +# +# On Digital/Tru64 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'. Note that Tru64 5.x and on have `ldd', but this works just +# as well, and works on older versions of the OS. +# +# 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 + +PATH=/usr/bin:/usr/sbin:/sbin:/usr/ccs/bin +export PATH + +# +# TVM: Marc Stephenson (marc@austin.ibm.com) points out we run things +# like `file', et. al. and expect the output to be what we see in the +# C/POSIX locale. Make sure it is so. +# +LANG=C +export LANG + +# +# 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. +# +IFS="" +while read f +do + + # + # Uncomment the next line for addtional debugging: + # echo "read ->$f<-" + + # + # Only run file once per file: + # + file_output=`file $f` + + # + # handle shell scripts first + # + is_shell_script=`echo "$file_output" | grep 'shell script' | \ + 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 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 + + odump -Dl $f 2>/dev/null \ + | awk ' + + # + # Since this entire awk script is enclosed in single quotes, + # you need to be careful to not use single quotes, even in awk + # comments, if you modify this script. + # + + BEGIN { + found_program_name = 0; + FS = " "; + RS = "\n"; + OFS=""; + } + + # uncomment the next line for debugging information + #{ print "Saw input:", $0 } + + found_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) { + print fields[1], "(", fields[8], ")" + } + } + + /^.*: *$/ { + found_program_name = 1 + # + # uncomment the next line for debugging information + #print "found the program name: ", $1 + } + + ' # end of awk + fi +done | sort -u +# comment out the previous line and uncomment the next when debugging +# done diff --git a/autodeps/solaris.prov b/autodeps/solaris.prov new file mode 100644 index 0000000..6e0fe9f --- /dev/null +++ b/autodeps/solaris.prov @@ -0,0 +1,14 @@ +#!/bin/sh + +# This script reads filenames from STDIN and outputs any relevant provides +# information that needs to be included in the package. + +PATH=/usr/bin:/usr/ccs/bin:/usr/sbin:/sbin +export PATH + +filelist=`grep "lib.*\\.so" | xargs /usr/ucb/file -L 2>/dev/null |\ + grep "ELF.*dynamic lib" | cut -d: -f1 | sort -u` +for I in $filelist; do + basename $I +done + diff --git a/autodeps/solaris.req b/autodeps/solaris.req new file mode 100644 index 0000000..05e4024 --- /dev/null +++ b/autodeps/solaris.req @@ -0,0 +1,16 @@ +#!/bin/sh + +# note this works for both a.out and ELF executables + +PATH=/usr/bin:/usr/ccs/bin:/usr/sbin:/sbin +export PATH + +ulimit -c 0 + +filelist=`sed "s/['\"]/\\\&/g"` +[ -z "$filelist" ] && exit #emulate -r option for xargs + +for f in `echo $filelist | xargs file | grep -F executable | cut -d: -f1`; do + ldd $f 2>/dev/null | awk '/\=\>/ { print $1 }' +done | sort -u | sed "s/['\"]/\\\&/g" | xargs -n 1 basename | sort -u + |