~ubuntu-branches/ubuntu/edgy/rpm/edgy

« back to all changes in this revision

Viewing changes to autodeps/hpux.req

  • Committer: Bazaar Package Importer
  • Author(s): Joey Hess
  • Date: 2002-01-22 20:56:57 UTC
  • Revision ID: james.westby@ubuntu.com-20020122205657-l74j50mr9z8ofcl5
Tags: upstream-4.0.3
ImportĀ upstreamĀ versionĀ 4.0.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /usr/bin/ksh
 
2
 
 
3
# Original Author: Tim Mooney <mooney@golem.phys.ndsu.NoDak.edu>
 
4
# $Id: hpux.req,v 1.5.10.1 2000/12/02 16:49:17 jbj Exp $
 
5
#
 
6
# This file is distributed under the terms of the GNU Public License
 
7
#
 
8
# find-requires is part of RPM, the Red Hat Package Manager.  find-requires
 
9
# reads a list of full pathnames (in a package) on stdin, and outputs all
 
10
# shared libraries the package requires to run correctly.
 
11
#
 
12
# On HP-UX, use `chatr' to find the library dependencies for an executable
 
13
#
 
14
# Example chatr output:
 
15
#
 
16
#$chatr /usr/bin/chatr
 
17
#/usr/bin/chatr: 
 
18
#         shared executable 
 
19
#         shared library dynamic path search:
 
20
#             SHLIB_PATH     disabled  second 
 
21
#             embedded path  disabled  first  Not Defined
 
22
#         internal name:
 
23
#             chatr
 
24
#         shared library list:
 
25
#             dynamic   /usr/lib/libc.1
 
26
#         shared library binding:
 
27
#             deferred 
 
28
#         static branch prediction disabled
 
29
#         kernel assisted branch predictionenabled
 
30
#         lazy swap allocationdisabled
 
31
#         text segment lockingdisabled
 
32
#         data segment lockingdisabled
 
33
#         data page size: 4K
 
34
#         instruction page size: 4K
 
35
 
 
36
PATH=/usr/bin:/usr/sbin:/sbin:/usr/ccs/bin
 
37
export PATH
 
38
 
 
39
#
 
40
# TVM: Marc Stephenson (marc@austin.ibm.com) points out we run things
 
41
# like `file', et. al. and expect the output to be what we see in the
 
42
# C/POSIX locale.  Make sure it is so.
 
43
#
 
44
LANG=C
 
45
export LANG
 
46
 
 
47
IFS=""
 
48
while read f
 
49
do
 
50
        # uncomment the next line if debugging
 
51
        # echo "### processing $f"
 
52
 
 
53
        #
 
54
        # Only run the file command once per file:
 
55
        #
 
56
        file_output=`file $f`
 
57
 
 
58
        #
 
59
        # First, check to see if it's a script, and try figure out what
 
60
        # intpreter it requires.  This is more work on HP-UX, since `file'
 
61
        # doesn't tell us what interpreter the script uses, or even if it
 
62
        # really is a script.
 
63
        #
 
64
        is_shell_script=`od -N 2 -t c $f 2>/dev/null | grep '0000000    #   !'`
 
65
        if test X"$is_shell_script" != X ; then
 
66
                #
 
67
                # it's a shell script.  Now figure out what interpreter it needs
 
68
                # Look at me!  I'm good with sed.  ;-)
 
69
                interp=`head -1 $f | sed -e 's/^#! \{0,1\}\([^  ]*\).*$/\1/'`
 
70
                if test X"$interp" != X ; then
 
71
                        echo "$interp"
 
72
                        #
 
73
                        # We've found what we need for this file.  Skip back to the
 
74
                        # top of the loop.  This saves me an `else' and another indent
 
75
                        # level!  ;-)
 
76
                        continue
 
77
                fi
 
78
        fi
 
79
        
 
80
        #
 
81
        # The `else' is implied here by the `continue' above
 
82
        #
 
83
 
 
84
        #
 
85
        # Is it a shared library?
 
86
        #
 
87
        maybe_shared_lib=`echo "$file_output" | egrep '(executable|library)'`
 
88
        if test X"$maybe_shared_lib" != X ; then
 
89
                chatr $f 2>/dev/null \
 
90
                | awk '
 
91
 
 
92
                #
 
93
                # For you non-awk-ers, no single quotes in comments -- the shell
 
94
                # sees them and things get hosed.
 
95
                #
 
96
 
 
97
                BEGIN { 
 
98
                        in_shlib_list = 0;
 
99
                        FS = " ";
 
100
                        RS = "\n";
 
101
                }
 
102
 
 
103
                # uncomment the next line for debugging information
 
104
                #{ print NR, ": ", $0 }
 
105
 
 
106
 
 
107
                in_shlib_list == 1 && /dynamic[         ]+[\/\.]/ {
 
108
                
 
109
                        # split the line on "/" and print out the last element
 
110
                        numfields = split($0,fields,"/")
 
111
                        print fields[numfields]
 
112
 
 
113
                }
 
114
 
 
115
                /^ +shared library list: *$/ {
 
116
                        in_shlib_list = 1
 
117
                }
 
118
 
 
119
                /^ +shared library binding: *$/ {
 
120
                        exit
 
121
                }
 
122
                ' # end of awk
 
123
        fi # end of shared library if.
 
124
done | sort -u
 
125
#comment out the previous line and uncomment the next one if debugging.
 
126
#done