]>
Commit | Line | Data |
---|---|---|
f01d33ee JK |
1 | diff -dur rpm-4.3.orig/build/rpmfc.c rpm-4.3/build/rpmfc.c |
2 | --- rpm-4.3.orig/build/rpmfc.c 2004-01-11 15:51:47.000000000 +0100 | |
3 | +++ rpm-4.3/build/rpmfc.c 2004-01-11 16:18:57.129541284 +0100 | |
9123f215 JK |
4 | @@ -1,6 +1,7 @@ |
5 | #include "system.h" | |
6 | ||
7 | #include <signal.h> /* getOutputFrom() */ | |
8 | +#include <fnmatch.h> | |
9 | ||
10 | #include <rpmbuild.h> | |
11 | #include <argv.h> | |
12 | @@ -639,9 +640,11 @@ | |
13 | /** | |
14 | * Extract script dependencies. | |
15 | * @param fc file classifier | |
16 | + * @param findprov 1 to enable provides | |
17 | + * @param findreq 1 to enable requires | |
18 | * @return 0 on success | |
19 | */ | |
20 | -static int rpmfcSCRIPT(rpmfc fc) | |
21 | +static int rpmfcSCRIPT(rpmfc fc,int findprov,int findreq) | |
22 | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ | |
23 | /*@modifies fc, rpmGlobalMacroContext, fileSystem, internalState @*/ | |
24 | { | |
25 | @@ -693,7 +696,7 @@ | |
26 | *se = '\0'; | |
27 | se++; | |
28 | ||
29 | - if (is_executable) { | |
30 | + if (is_executable && findreq) { | |
31 | /* Add to package requires. */ | |
32 | ds = rpmdsSingle(RPMTAG_REQUIRENAME, s, "", RPMSENSE_FIND_REQUIRES); | |
33 | xx = rpmdsMerge(&fc->requires, ds); | |
34 | @@ -720,19 +723,22 @@ | |
35 | (void) fclose(fp); | |
36 | ||
37 | if (fc->fcolor->vals[fc->ix] & RPMFC_PERL) { | |
38 | - if (fc->fcolor->vals[fc->ix] & RPMFC_MODULE) | |
39 | + if (findprov && fc->fcolor->vals[fc->ix] & RPMFC_MODULE) | |
40 | xx = rpmfcHelper(fc, 'P', "perl"); | |
41 | - if (is_executable || (fc->fcolor->vals[fc->ix] & RPMFC_MODULE)) | |
42 | + if (findreq && (is_executable || (fc->fcolor->vals[fc->ix] & RPMFC_MODULE))) | |
43 | xx = rpmfcHelper(fc, 'R', "perl"); | |
44 | } | |
45 | if (fc->fcolor->vals[fc->ix] & RPMFC_PYTHON) { | |
46 | - xx = rpmfcHelper(fc, 'P', "python"); | |
47 | - if (is_executable) | |
48 | + if (findprov) | |
49 | + xx = rpmfcHelper(fc, 'P', "python"); | |
50 | + if (findreq && is_executable) | |
51 | xx = rpmfcHelper(fc, 'R', "python"); | |
52 | } | |
53 | if (fc->fcolor->vals[fc->ix] & RPMFC_PHP) { | |
54 | + if (findprov) | |
55 | xx = rpmfcHelper(fc, 'P', "php"); | |
56 | - xx = rpmfcHelper(fc, 'R', "php"); | |
57 | + if (findreq) | |
58 | + xx = rpmfcHelper(fc, 'R', "php"); | |
59 | } | |
60 | ||
61 | return 0; | |
62 | @@ -741,9 +747,11 @@ | |
63 | /** | |
64 | * Extract Elf dependencies. | |
65 | * @param fc file classifier | |
66 | + * @param findprov 1 to enable provides | |
67 | + * @param findreq 1 to enable requires | |
68 | * @return 0 on success | |
69 | */ | |
70 | -static int rpmfcELF(rpmfc fc) | |
71 | +static int rpmfcELF(rpmfc fc,int findprov,int findreq) | |
72 | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ | |
73 | /*@modifies fc, rpmGlobalMacroContext, fileSystem, internalState @*/ | |
74 | { | |
75 | @@ -855,17 +863,19 @@ | |
76 | t = stpcpy(t, "(64bit)"); | |
77 | #endif | |
78 | t++; | |
79 | + | |
80 | + if (findprov) { | |
81 | + /* Add to package provides. */ | |
82 | + ds = rpmdsSingle(RPMTAG_PROVIDES, | |
83 | + buf, "", RPMSENSE_FIND_PROVIDES); | |
84 | + xx = rpmdsMerge(&fc->provides, ds); | |
85 | ||
86 | - /* Add to package provides. */ | |
87 | - ds = rpmdsSingle(RPMTAG_PROVIDES, | |
88 | - buf, "", RPMSENSE_FIND_PROVIDES); | |
89 | - xx = rpmdsMerge(&fc->provides, ds); | |
90 | - | |
91 | - /* Add to file dependencies. */ | |
92 | - xx = rpmfcSaveArg(&fc->ddict, | |
93 | - rpmfcFileDep(t, fc->ix, ds)); | |
94 | + /* Add to file dependencies. */ | |
95 | + xx = rpmfcSaveArg(&fc->ddict, | |
96 | + rpmfcFileDep(t, fc->ix, ds)); | |
97 | ||
98 | - ds = rpmdsFree(ds); | |
99 | + ds = rpmdsFree(ds); | |
100 | + } | |
101 | } | |
102 | auxoffset += aux->vda_next; | |
103 | } | |
104 | @@ -916,15 +926,17 @@ | |
105 | #endif | |
106 | t++; | |
107 | ||
108 | - /* Add to package dependencies. */ | |
109 | - ds = rpmdsSingle(RPMTAG_REQUIRENAME, | |
110 | - buf, "", RPMSENSE_FIND_REQUIRES); | |
111 | - xx = rpmdsMerge(&fc->requires, ds); | |
112 | + if (findreq) { | |
113 | + /* Add to package dependencies. */ | |
114 | + ds = rpmdsSingle(RPMTAG_REQUIRENAME, | |
115 | + buf, "", RPMSENSE_FIND_REQUIRES); | |
116 | + xx = rpmdsMerge(&fc->requires, ds); | |
117 | ||
118 | - /* Add to file dependencies. */ | |
119 | - xx = rpmfcSaveArg(&fc->ddict, | |
120 | - rpmfcFileDep(t, fc->ix, ds)); | |
121 | - ds = rpmdsFree(ds); | |
122 | + /* Add to file dependencies. */ | |
123 | + xx = rpmfcSaveArg(&fc->ddict, | |
124 | + rpmfcFileDep(t, fc->ix, ds)); | |
125 | + ds = rpmdsFree(ds); | |
126 | + } | |
127 | } | |
128 | auxoffset += aux->vna_next; | |
129 | } | |
130 | @@ -949,6 +961,7 @@ | |
131 | /* Files with executable bit set only. */ | |
132 | if (fc->skipReq || !(st->st_mode & (S_IXUSR|S_IXGRP|S_IXOTH))) | |
133 | /*@innercontinue@*/ continue; | |
134 | + if (!findreq) continue; | |
135 | /* Add to package requires. */ | |
136 | depsp = &fc->requires; | |
137 | tagN = RPMTAG_REQUIRENAME; | |
138 | @@ -961,6 +974,7 @@ | |
139 | /* Add to package provides. */ | |
140 | if (fc->skipProv) | |
141 | /*@innercontinue@*/ continue; | |
142 | + if (!findprov) continue; | |
143 | depsp = &fc->provides; | |
144 | tagN = RPMTAG_PROVIDENAME; | |
145 | dsContext = RPMSENSE_FIND_PROVIDES; | |
146 | @@ -999,7 +1013,7 @@ | |
147 | /*@=branchstate =uniondef @*/ | |
148 | ||
149 | /* For DSO's, provide the basename of the file if DT_SONAME not found. */ | |
150 | - if (!fc->skipProv && isDSO && !gotSONAME) { | |
151 | + if (findprov && !fc->skipProv && isDSO && !gotSONAME) { | |
152 | depsp = &fc->provides; | |
153 | tagN = RPMTAG_PROVIDENAME; | |
154 | dsContext = RPMSENSE_FIND_PROVIDES; | |
155 | @@ -1047,7 +1061,7 @@ | |
156 | } | |
157 | ||
158 | typedef struct rpmfcApplyTbl_s { | |
159 | - int (*func) (rpmfc fc); | |
160 | + int (*func) (rpmfc fc,int findprov,int findreq); | |
161 | int colormask; | |
162 | } * rpmfcApplyTbl; | |
163 | ||
f01d33ee JK |
164 | @@ -1088,7 +1102,7 @@ |
165 | s=rpmExpand("%{_noautoreqdep}",NULL); | |
166 | if (s) { | |
167 | poptParseArgvString(s,&noautoreqdep_c,(const char ***)&noautoreqdep); | |
168 | - s = _free(s); | |
169 | + s = _free(s); | |
170 | } | |
171 | if (noautoreqdep==NULL) noautoreqdep_c=0; | |
172 | ||
173 | @@ -1187,6 +1201,31 @@ | |
9123f215 JK |
174 | int ix; |
175 | int i; | |
176 | int xx; | |
177 | + int j; | |
178 | + int findprov; | |
179 | + int findreq; | |
180 | + ARGV_t noautoreqfiles=NULL; | |
181 | + int noautoreqfiles_c; | |
182 | + ARGV_t noautoprovfiles=NULL; | |
183 | + int noautoprovfiles_c; | |
f01d33ee JK |
184 | + const char *buildroot; |
185 | + int buildroot_l; | |
9123f215 | 186 | + |
f01d33ee JK |
187 | + buildroot=rpmExpand("%{buildroot}",NULL); |
188 | + buildroot_l=strlen(buildroot); | |
189 | + | |
190 | + s=rpmExpand("%{_noautoreqfiles}",NULL); | |
9123f215 JK |
191 | + if (s) { |
192 | + poptParseArgvString(s,&noautoreqfiles_c,(const char ***)&noautoreqfiles); | |
f01d33ee | 193 | + s = _free(s); |
9123f215 JK |
194 | + } |
195 | + if (noautoreqfiles==NULL) noautoreqfiles_c=0; | |
f01d33ee | 196 | + s=rpmExpand("%{_noautoprovfiles}",NULL); |
9123f215 JK |
197 | + if (s) { |
198 | + poptParseArgvString(s,&noautoprovfiles_c,(const char ***)&noautoprovfiles); | |
f01d33ee | 199 | + s = _free(s); |
9123f215 JK |
200 | + } |
201 | + if (noautoprovfiles==NULL) noautoprovfiles_c=0; | |
202 | ||
203 | /* Generate package and per-file dependencies. */ | |
204 | for (fc->ix = 0; fc->fn[fc->ix] != NULL; fc->ix++) { | |
f01d33ee | 205 | @@ -1194,10 +1233,35 @@ |
9123f215 JK |
206 | for (fcat = rpmfcApplyTable; fcat->func != NULL; fcat++) { |
207 | if (!(fc->fcolor->vals[fc->ix] & fcat->colormask)) | |
208 | /*@innercontinue@*/ continue; | |
209 | - xx = (*fcat->func) (fc); | |
210 | + findprov=1; | |
9123f215 | 211 | + findreq=1; |
f01d33ee JK |
212 | + if (strncmp(fc->fn[fc->ix],buildroot,buildroot_l)==0) {/* sanity check */ |
213 | + for(j=0;j<noautoprovfiles_c;j++) { | |
214 | + if (fnmatch(noautoprovfiles[j],fc->fn[fc->ix]+buildroot_l,0)==0) { | |
215 | + rpmMessage(RPMMESS_NORMAL, | |
216 | + "skipping %s provides detection (matches noautoprovfiles pattern: %s)\n", | |
217 | + fc->fn[fc->ix],noautoprovfiles[j]); | |
218 | + findprov=0; | |
219 | + break; | |
220 | + } | |
221 | + } | |
222 | + for(j=0;j<noautoreqfiles_c;j++) { | |
223 | + if (fnmatch(noautoreqfiles[j],fc->fn[fc->ix]+buildroot_l,0)==0) { | |
224 | + rpmMessage(RPMMESS_NORMAL, | |
225 | + "skipping %s requires detection (matches noautoreqfiles pattern: %s)\n", | |
226 | + fc->fn[fc->ix],noautoreqfiles[j]); | |
227 | + findreq=0; | |
228 | + break; | |
229 | + } | |
230 | + } | |
9123f215 JK |
231 | + } |
232 | + xx = (*fcat->func) (fc,findprov,findreq); | |
233 | } | |
234 | } | |
235 | ||
236 | + noautoreqfiles=_free(noautoreqfiles); | |
237 | + noautoprovfiles=_free(noautoprovfiles); | |
238 | + | |
239 | rpmfcFindRequiredPackages(fc); | |
240 | ||
241 | /*@-boundswrite@*/ |