diff options
author | jbj <devnull@localhost> | 2001-03-03 18:49:09 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2001-03-03 18:49:09 +0000 |
commit | 597bf30f9ff72dc93b17d10901467336aa724ef6 (patch) | |
tree | 01444bb76687c08929b5e308fea07d2bf3bc7f11 /autodeps | |
parent | 665c365a12630dc0e2a9a5f6f005bc8b84b6868b (diff) | |
download | librpm-tizen-597bf30f9ff72dc93b17d10901467336aa724ef6.tar.gz librpm-tizen-597bf30f9ff72dc93b17d10901467336aa724ef6.tar.bz2 librpm-tizen-597bf30f9ff72dc93b17d10901467336aa724ef6.zip |
find-{provies,requires} with AIX5 support.
CVS patchset: 4601
CVS date: 2001/03/03 18:49:09
Diffstat (limited to 'autodeps')
-rw-r--r-- | autodeps/aix.prov | 78 | ||||
-rwxr-xr-x | autodeps/aix.req | 171 |
2 files changed, 249 insertions, 0 deletions
diff --git a/autodeps/aix.prov b/autodeps/aix.prov new file mode 100644 index 000000000..2fab0d0ab --- /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 | egrep "^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 000000000..e8503b3bb --- /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 + |