summaryrefslogtreecommitdiff
path: root/packaging/autodeps.diff
blob: bbe7715a56d986ba4451105652d80505ea9a8fa9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
--- ./autodeps/linux.prov.orig	2011-07-12 11:28:13.000000000 +0000
+++ ./autodeps/linux.prov	2011-07-18 16:47:39.000000000 +0000
@@ -2,60 +2,72 @@
 
 # This script reads filenames from STDIN and outputs any relevant provides
 # information that needs to be included in the package.
+IFS=$'\n'
+filelist=($(cat))
 
-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)
+solist=($(printf "%s\n" "${filelist[@]}" | grep "\\.so" | grep -v "^/lib/ld.so" | \
+	  tr '\n' '\0' | xargs -0 -r file -L | grep "ELF.*shared object" | \
+	  cut -d: -f1))
 pythonlist=
 tcllist=
+monolist=($(printf "%s\n" "${filelist[@]}" | egrep "\\.(exe|dll)\$"))
 
 #
 # --- Alpha does not mark 64bit dependencies
 case `uname -m` in
-  alpha*)	mark64="" ;;
-  *)		mark64="()(64bit)" ;;
+  alpha*)	mark64=false ;;
+  *)		mark64=true ;;
 esac
 
 #
 # --- Library sonames and weak symbol versions (from glibc).
-for f in $solist; do
-    soname=$(objdump -p $f | awk '/SONAME/ {print $2}')
+for f in "${solist[@]}"; do
+    soname=$(objdump -p "$f" | awk '/SONAME/ {print $2}')
+    [ -n "$soname" -a -L "$f" ] && continue
+    [ -z "$soname" ] && soname="${f##*/}"
 
-    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
+    if $mark64 && file -L "$f" 2>/dev/null | grep "ELF 64-bit" >/dev/null; then
+	lib64="()(64bit)" slib64="(64bit)"
     else
-	echo ${f##*/}$lib64
+	lib64= slib64=
     fi
+    echo "$soname$lib64"
+    objdump -p "$f" | awk '
+	BEGIN { START=0 ; }
+	/Version definitions:/ { START=1; }
+	/^[0-9]/ && (START==1) { print $4; }
+	/^$/ { START=0; }
+    ' | \
+	while read symbol ; do
+	    echo "$soname($symbol)$slib64"
+	done
 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
+    printf "%s\n" "${filelist[@]}" | 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
+    printf "%s\n" "${pythonlist[@]}" | /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
+    printf "%s\n" "${tcllist[@]}" | /usr/lib/rpm/tcl.prov | sort -u
+
+#
+# --- Mono exes/dlls
+: ${MONO_PREFIX=/usr}
+if [ -x $MONO_PREFIX/bin/mono -a -n "$monolist" ] ; then
+    printf "%s\n" "${monolist[@]}" | MONO_PATH=$MONO_PREFIX/lib${MONO_PATH:+:$MONO_PATH} prefix=$MONO_PREFIX $MONO_PREFIX/bin/mono-find-provides || echo "WARNING: MONO RPM PROVIDES WERE NOT GENERATED FOR THIS BUILD!!" 1>&2
+fi
+
+#
+# --- Kernel module exported symbols
+[ -x /usr/lib/rpm/find-provides.ksyms ] &&
+    printf "%s\n" "${filelist[@]}" | /usr/lib/rpm/find-provides.ksyms "$@"
 
 exit 0
--- ./autodeps/linux.req.orig	2011-07-15 09:32:41.000000000 +0000
+++ ./autodeps/linux.req	2011-07-18 16:51:24.000000000 +0000
@@ -18,20 +18,21 @@ fi
 
 #
 # --- Grab the file manifest and classify files.
-#filelist=`sed "s/['\"]/\\\&/g"`
-filelist=`sed "s/[]['\"*?{}]/\\\\\&/g"`
-exelist=`echo $filelist | xargs -r file | \
+#filelist=`sed "s/[]['\"*?{}]/\\\\\&/g"`
+filelist=($(grep -Ev '/usr/doc/|/usr/share/doc/'))
+exelist=($(printf "%s\0" "${filelist[@]}" | xargs -0 -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`
+	grep ":.*executable" | cut -d: -f1))
+scriptlist=($(printf "%s\0" "${filelist[@]}" | xargs -0 -r file | \
+	grep -E ":.* (commands|script)[, ]" | cut -d: -f1))
+liblist=($(printf "%s\0" "${filelist[@]}" | xargs -0 -r file | \
+	grep ":.*shared object" | cut -d : -f1))
 
-interplist=
-perllist=
-pythonlist=
-tcllist=
+interplist=()
+perllist=()
+pythonlist=()
+tcllist=()
+monolist=($(printf "%s\n" "${filelist[@]}" | egrep "\\.(exe|dll)(\\.config)?\$"))
 
 #
 # --- Alpha does not mark 64bit dependencies
@@ -43,12 +44,12 @@ 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 | \
+  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/) {
+    ldd "$f" | awk '/=>/ {
+	if ($1 !~ /libNoVersion.so/ && $1 !~ /4[um]lib.so/ && $1 !~ /linux-gate.so/) {
 	    gsub(/'\''"/,"\\&",$1);
 	    printf "%s'$lib64'\n", $1
 	}
@@ -57,12 +58,12 @@ if [ "$needed" -eq 0 ]; then
 
 #
 # --- Library dependency sonames.
-  for f in $liblist; do
-    [ -r $f ] || continue
-    lib64=`if file -L $f 2>/dev/null | \
+  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/) {
+    ldd "$f" | awk '/=>/ {
+	if ($1 !~ /libNoVersion.so/ && $1 !~ /4[um]lib.so/ && $1 !~ /linux-gate.so/) {
 	    gsub(/'\''"/,"\\&",$1);
 	    printf "%s'$lib64'\n", $1
 	}
@@ -72,30 +73,30 @@ 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"
+for f in "${scriptlist[@]}"; do
+    [ -r "$f" -a -x "$f" ] || continue
+    interp=`head -n 1 "$f" | sed -ne 's/^\#\![ 	]*//p' | cut -d" " -f1`
+    interplist=("${interplist[@]}" "$interp")
     case $interp in
-    */perl)	perllist="$perllist $f" ;;
+    */perl)	perllist=("${perllist[@]}" "$f") ;;
     esac
 done
-[ -n "$interplist" ] && { echo "$interplist" | tr '[:blank:]' \\n | sort -u ; }
+[ -n "$interplist" ] && { printf "%s\n" "${interplist[@]}" | sort -u ; }
 
 #
 # --- Add perl module files to perllist.
-for f in $filelist; do
-    [ -r $f -a "${f%.pm}" != "${f}" ] && perllist="$perllist $f"
+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 | \
+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'; }
+    objdump -p "$f" | awk 'BEGIN { START=0; LIBNAME=""; needed='$needed'; }
 	/^$/ { START=0; }
 	/^Dynamic Section:$/ { START=1; }
 	(START==1) && /NEEDED/ {
@@ -112,7 +113,7 @@ for f in $liblist $exelist ; do
 	    sub(/:/, "", $3);
 	    LIBNAME=$3;
 	}
-	(START==2) && (LIBNAME!="") && ($4!="") && (($4~/^GLIBC_*/) || ($4~/^GCC_*/)) {
+	(START==2) && (LIBNAME!="") && ($4!="") {
 	    print LIBNAME "(" $4 ")'$lib64'";
 	}
     '
@@ -120,17 +121,29 @@ 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
+#[ -x /usr/lib/rpm/perl.req -a -n "$perllist" ] && \
+#    printf "%s\n" "${perllist[@]}" | /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
+    printf "%s\n" "${pythonlist[@]}" | /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
+    printf "%s\n" "${tcllist[@]}" | /usr/lib/rpm/tcl.req | sort -u
+
+#
+# --- Mono exes/dlls
+: ${MONO_PREFIX=/usr}
+if [ -x $MONO_PREFIX/bin/mono -a -n "$monolist" ] ; then
+    printf "%s\n" "${monolist[@]}" | MONO_PATH=$MONO_PREFIX/lib${MONO_PATH:+:$MONO_PATH} prefix=$MONO_PREFIX $MONO_PREFIX/bin/mono-find-requires || echo "WARNING: MONO RPM REQUIRES WERE NOT GENERATED FOR THIS BUILD!!" 1>&2
+fi
+
+#
+# --- Kernel module imported symbols
+[ -x ${0%/*}/find-requires.ksyms ] &&
+    printf "%s\n" "${filelist[@]}" | ${0%/*}/find-requires.ksyms "$@"
 
 exit 0