]>
Commit | Line | Data |
---|---|---|
4bdd0c9c JB |
1 | --- rpm-4.3/build/rpmfc.c.orig Wed May 19 11:30:29 2004 |
2 | +++ rpm-4.3/build/rpmfc.c Wed May 19 17:03:01 2004 | |
5f8c53f0 JK |
3 | @@ -1,6 +1,7 @@ |
4 | #include "system.h" | |
5 | ||
6 | #include <signal.h> /* getOutputFrom() */ | |
7 | +#include <regex.h> | |
8 | ||
9 | #include <rpmbuild.h> | |
10 | #include <argv.h> | |
11 | @@ -9,6 +10,8 @@ | |
12 | #define _RPMDS_INTERNAL | |
13 | #include <rpmds.h> | |
14 | #include <rpmfi.h> | |
15 | +#include <rpmts.h> | |
16 | +#include <rpmdb.h> | |
17 | ||
18 | #if HAVE_GELF_H | |
19 | #include <gelf.h> | |
4bdd0c9c | 20 | @@ -301,14 +304,83 @@ |
5f8c53f0 JK |
21 | return buf; |
22 | }; | |
23 | ||
4bdd0c9c | 24 | +static regex_t * rpmfcExpandRegexps(const char * str,int *count){ |
5f8c53f0 JK |
25 | + int i,j,r; |
26 | + const char *s; | |
27 | + ARGV_t patterns=NULL; | |
28 | + regex_t *compiled=NULL; | |
29 | + | |
30 | + s=rpmExpand(str,NULL); | |
31 | + if (s) { | |
32 | + poptParseArgvString(s,count,(const char ***)&patterns); | |
33 | + s = _free(s); | |
34 | + } | |
35 | + if (patterns==NULL){ | |
36 | + *count=0; | |
37 | + return NULL; | |
38 | + } | |
39 | + if (*count==0){ | |
40 | + _free(patterns); | |
41 | + return NULL; | |
42 | + } | |
43 | + | |
44 | + compiled=malloc(sizeof(regex_t)*(*count)); | |
45 | + j=0; | |
46 | + for(i=0;i<*count;i++){ | |
47 | + r=regcomp(&compiled[j],patterns[i],REG_NOSUB); | |
48 | + if (r==0) j++; | |
49 | + else { | |
50 | + rpmMessage(RPMMESS_NORMAL, | |
d327d730 JB |
51 | + _("Compilation of regular expresion '%s'" |
52 | + " (expanded from '%s') failed. Skipping it.\n"), | |
5f8c53f0 JK |
53 | + patterns[i],str); |
54 | + } | |
55 | + } | |
56 | + patterns=_free(patterns); | |
57 | + if (j==0) { | |
58 | + compiled=_free(compiled); | |
59 | + *count=0; | |
60 | + return NULL; | |
61 | + } | |
62 | + *count=j; | |
63 | + return compiled; | |
64 | +} | |
65 | + | |
4bdd0c9c JB |
66 | +static int rpmfcMatchRegexps(regex_t *regexps, int count, const char *str, char deptype) |
67 | +{ | |
68 | + int j; | |
69 | + for(j = 0; j < count; j++) { | |
70 | + rpmMessage(RPMMESS_DEBUG, | |
71 | + _("Checking %c: '%s' against _noauto expr. #%i\n"), deptype, str, j); | |
72 | + if (!regexec(®exps[j], str, 0, NULL, 0)) { | |
73 | + rpmMessage(RPMMESS_NORMAL, | |
74 | + _("Skipping %c: '%s' as it matches _noauto expr. #%i\n"), deptype, str, j); | |
75 | + return 1; | |
76 | + } | |
77 | + } | |
78 | + return 0; | |
79 | +} | |
80 | + | |
81 | +static regex_t * rpmfcFreeRegexps(regex_t *regexps,int count){ | |
5f8c53f0 JK |
82 | + int i; |
83 | + | |
84 | + if (regexps) | |
85 | + for(i=0;i<count;i++) | |
86 | + regfree(®exps[i]); | |
87 | + return _free(regexps); | |
88 | +} | |
89 | + | |
90 | /** | |
91 | * Run per-interpreter dependency helper. | |
92 | * @param fc file classifier | |
4bdd0c9c JB |
93 | * @param deptype 'P' == Provides:, 'R' == Requires:, helper |
94 | * @param nsdep class name for interpreter (e.g. "perl") | |
95 | + * @param noauto _noauto* regexps | |
96 | + * @param noauto_c # of _noauto* regexps | |
97 | * @return 0 on success | |
98 | */ | |
99 | -static int rpmfcHelper(rpmfc fc, unsigned char deptype, const char * nsdep) | |
100 | +static int rpmfcHelper(rpmfc fc, unsigned char deptype, const char * nsdep, | |
101 | + regex_t * noauto, int noauto_c) | |
102 | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ | |
103 | /*@modifies fc, rpmGlobalMacroContext, fileSystem, internalState @*/ | |
104 | { | |
105 | @@ -394,6 +466,8 @@ | |
5f8c53f0 JK |
106 | } |
107 | /*@=branchstate@*/ | |
108 | ||
4bdd0c9c JB |
109 | + if(rpmfcMatchRegexps(noauto, noauto_c, N, deptype)) |
110 | + continue; | |
5f8c53f0 JK |
111 | |
112 | /* Add tracking dependency for versioned Provides: */ | |
113 | if (!fc->tracked && deptype == 'P' && *EVR != '\0') { | |
4bdd0c9c | 114 | @@ -637,9 +711,16 @@ |
5f8c53f0 JK |
115 | /** |
116 | * Extract script dependencies. | |
117 | * @param fc file classifier | |
118 | + * @param findprov 1 to enable provides | |
119 | + * @param findreq 1 to enable requires | |
4bdd0c9c JB |
120 | + * @param noautoprov _noautoprov regexps |
121 | + * @param noautoprov_c # of _noautoprov regexps | |
122 | + * @param noautoreq _noautoreq regexps | |
123 | + * @param noautoreq_c # of _noautoreq regexps | |
5f8c53f0 JK |
124 | * @return 0 on success |
125 | */ | |
126 | -static int rpmfcSCRIPT(rpmfc fc) | |
4bdd0c9c JB |
127 | +static int rpmfcSCRIPT(rpmfc fc, int findprov, int findreq, |
128 | + regex_t *noautoprov, int noautoprov_c, regex_t *noautoreq, int noautoreq_c) | |
5f8c53f0 JK |
129 | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ |
130 | /*@modifies fc, rpmGlobalMacroContext, fileSystem, internalState @*/ | |
131 | { | |
4bdd0c9c | 132 | @@ -691,7 +772,7 @@ |
5f8c53f0 JK |
133 | *se = '\0'; |
134 | se++; | |
135 | ||
136 | - if (is_executable) { | |
4bdd0c9c | 137 | + if (is_executable && findreq && !rpmfcMatchRegexps(noautoreq, noautoreq_c, s, 'R')) { |
5f8c53f0 JK |
138 | /* Add to package requires. */ |
139 | ds = rpmdsSingle(RPMTAG_REQUIRENAME, s, "", RPMSENSE_FIND_REQUIRES); | |
140 | xx = rpmdsMerge(&fc->requires, ds); | |
777cf177 | 141 | @@ -718,21 +799,22 @@ |
5f8c53f0 JK |
142 | (void) fclose(fp); |
143 | ||
144 | if (fc->fcolor->vals[fc->ix] & RPMFC_PERL) { | |
145 | - if (fc->fcolor->vals[fc->ix] & RPMFC_MODULE) | |
4bdd0c9c | 146 | - xx = rpmfcHelper(fc, 'P', "perl"); |
5f8c53f0 | 147 | - if (is_executable || (fc->fcolor->vals[fc->ix] & RPMFC_MODULE)) |
4bdd0c9c JB |
148 | - xx = rpmfcHelper(fc, 'R', "perl"); |
149 | + if (findprov && fc->fcolor->vals[fc->ix] & RPMFC_MODULE) | |
150 | + xx = rpmfcHelper(fc, 'P', "perl", noautoprov, noautoprov_c); | |
5f8c53f0 | 151 | + if (findreq && (is_executable || (fc->fcolor->vals[fc->ix] & RPMFC_MODULE))) |
4bdd0c9c | 152 | + xx = rpmfcHelper(fc, 'R', "perl", noautoreq, noautoreq_c); |
5f8c53f0 JK |
153 | } |
154 | if (fc->fcolor->vals[fc->ix] & RPMFC_PYTHON) { | |
155 | - xx = rpmfcHelper(fc, 'P', "python"); | |
777cf177 | 156 | -#ifdef NOTYET |
5f8c53f0 | 157 | - if (is_executable) |
777cf177 | 158 | -#endif |
4bdd0c9c | 159 | - xx = rpmfcHelper(fc, 'R', "python"); |
5f8c53f0 | 160 | + if (findprov) |
4bdd0c9c | 161 | + xx = rpmfcHelper(fc, 'P', "python", noautoprov, noautoprov_c); |
c57ba8ec | 162 | + if (findreq) |
4bdd0c9c | 163 | + xx = rpmfcHelper(fc, 'R', "python", noautoreq, noautoreq_c); |
5f8c53f0 JK |
164 | } |
165 | if (fc->fcolor->vals[fc->ix] & RPMFC_PHP) { | |
4bdd0c9c | 166 | - xx = rpmfcHelper(fc, 'P', "php"); |
5f8c53f0 | 167 | - xx = rpmfcHelper(fc, 'R', "php"); |
4bdd0c9c JB |
168 | + if (findprov) |
169 | + xx = rpmfcHelper(fc, 'P', "php", noautoprov, noautoprov_c); | |
5f8c53f0 | 170 | + if (findreq) |
4bdd0c9c | 171 | + xx = rpmfcHelper(fc, 'R', "php", noautoreq, noautoreq_c); |
5f8c53f0 JK |
172 | } |
173 | ||
174 | return 0; | |
4bdd0c9c | 175 | @@ -739,9 +823,16 @@ |
5f8c53f0 JK |
176 | /** |
177 | * Extract Elf dependencies. | |
178 | * @param fc file classifier | |
179 | + * @param findprov 1 to enable provides | |
180 | + * @param findreq 1 to enable requires | |
4bdd0c9c JB |
181 | + * @param noautoprov _noautoprov regexps |
182 | + * @param noautoprov_c # of _noautoprov regexps | |
183 | + * @param noautoreq _noautoreq regexps | |
184 | + * @param noautoreq_c # of _noautoreq regexps | |
5f8c53f0 JK |
185 | * @return 0 on success |
186 | */ | |
187 | -static int rpmfcELF(rpmfc fc) | |
4bdd0c9c JB |
188 | +static int rpmfcELF(rpmfc fc, int findprov, int findreq, |
189 | + regex_t *noautoprov, int noautoprov_c, regex_t *noautoreq, int noautoreq_c) | |
5f8c53f0 JK |
190 | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ |
191 | /*@modifies fc, rpmGlobalMacroContext, fileSystem, internalState @*/ | |
192 | { | |
4bdd0c9c JB |
193 | @@ -844,26 +935,31 @@ |
194 | && !(filter_GLIBC_PRIVATE != 0 | |
195 | && !strcmp(s, "GLIBC_PRIVATE"))) | |
196 | { | |
197 | + int doauto; | |
198 | + | |
199 | buf[0] = '\0'; | |
200 | t = buf; | |
201 | t = stpcpy( stpcpy( stpcpy( stpcpy(t, soname), "("), s), ")"); | |
202 | ||
203 | + doauto = findprov && !rpmfcMatchRegexps(noautoprov, noautoprov_c, buf, 'P'); | |
204 | #if !defined(__alpha__) | |
205 | if (isElf64) | |
5f8c53f0 JK |
206 | t = stpcpy(t, "(64bit)"); |
207 | #endif | |
208 | t++; | |
209 | + | |
4bdd0c9c | 210 | + if (doauto) { |
5f8c53f0 JK |
211 | + /* Add to package provides. */ |
212 | + ds = rpmdsSingle(RPMTAG_PROVIDES, | |
213 | + buf, "", RPMSENSE_FIND_PROVIDES); | |
214 | + xx = rpmdsMerge(&fc->provides, ds); | |
4bdd0c9c JB |
215 | + |
216 | + /* Add to file dependencies. */ | |
217 | + xx = rpmfcSaveArg(&fc->ddict, | |
218 | + rpmfcFileDep(t, fc->ix, ds)); | |
5f8c53f0 JK |
219 | |
220 | - /* Add to package provides. */ | |
221 | - ds = rpmdsSingle(RPMTAG_PROVIDES, | |
222 | - buf, "", RPMSENSE_FIND_PROVIDES); | |
223 | - xx = rpmdsMerge(&fc->provides, ds); | |
224 | - | |
225 | - /* Add to file dependencies. */ | |
226 | - xx = rpmfcSaveArg(&fc->ddict, | |
227 | - rpmfcFileDep(t, fc->ix, ds)); | |
4bdd0c9c | 228 | - |
5f8c53f0 JK |
229 | - ds = rpmdsFree(ds); |
230 | + ds = rpmdsFree(ds); | |
231 | + } | |
232 | } | |
233 | auxoffset += aux->vda_next; | |
234 | } | |
4bdd0c9c JB |
235 | @@ -904,25 +1000,30 @@ |
236 | && !(filter_GLIBC_PRIVATE != 0 | |
237 | && !strcmp(s, "GLIBC_PRIVATE"))) | |
238 | { | |
239 | + int doauto; | |
240 | + | |
241 | buf[0] = '\0'; | |
242 | t = buf; | |
243 | t = stpcpy( stpcpy( stpcpy( stpcpy(t, soname), "("), s), ")"); | |
244 | ||
245 | + doauto = findreq && !rpmfcMatchRegexps(noautoreq, noautoreq_c, buf, 'R'); | |
246 | #if !defined(__alpha__) | |
247 | if (isElf64) | |
248 | t = stpcpy(t, "(64bit)"); | |
5f8c53f0 JK |
249 | #endif |
250 | t++; | |
251 | ||
252 | - /* Add to package dependencies. */ | |
253 | - ds = rpmdsSingle(RPMTAG_REQUIRENAME, | |
254 | - buf, "", RPMSENSE_FIND_REQUIRES); | |
255 | - xx = rpmdsMerge(&fc->requires, ds); | |
4bdd0c9c | 256 | - |
5f8c53f0 JK |
257 | - /* Add to file dependencies. */ |
258 | - xx = rpmfcSaveArg(&fc->ddict, | |
259 | - rpmfcFileDep(t, fc->ix, ds)); | |
260 | - ds = rpmdsFree(ds); | |
4bdd0c9c JB |
261 | + if (doauto) { |
262 | + /* Add to package dependencies. */ | |
263 | + ds = rpmdsSingle(RPMTAG_REQUIRENAME, | |
264 | + buf, "", RPMSENSE_FIND_REQUIRES); | |
265 | + xx = rpmdsMerge(&fc->requires, ds); | |
266 | + | |
5f8c53f0 JK |
267 | + /* Add to file dependencies. */ |
268 | + xx = rpmfcSaveArg(&fc->ddict, | |
269 | + rpmfcFileDep(t, fc->ix, ds)); | |
270 | + ds = rpmdsFree(ds); | |
271 | + } | |
272 | } | |
273 | auxoffset += aux->vna_next; | |
274 | } | |
4bdd0c9c | 275 | @@ -947,23 +1048,30 @@ |
5f8c53f0 JK |
276 | /* Files with executable bit set only. */ |
277 | if (fc->skipReq || !(st->st_mode & (S_IXUSR|S_IXGRP|S_IXOTH))) | |
278 | /*@innercontinue@*/ continue; | |
4bdd0c9c JB |
279 | + if (!findreq) |
280 | + continue; | |
5f8c53f0 JK |
281 | /* Add to package requires. */ |
282 | depsp = &fc->requires; | |
283 | tagN = RPMTAG_REQUIRENAME; | |
4bdd0c9c JB |
284 | dsContext = RPMSENSE_FIND_REQUIRES; |
285 | s = elf_strptr(elf, shdr->sh_link, dyn->d_un.d_val); | |
286 | assert(s != NULL); | |
287 | + if(rpmfcMatchRegexps(noautoreq, noautoreq_c, s, 'R')) | |
288 | + continue; | |
289 | /*@switchbreak@*/ break; | |
290 | case DT_SONAME: | |
291 | gotSONAME = 1; | |
5f8c53f0 JK |
292 | /* Add to package provides. */ |
293 | if (fc->skipProv) | |
294 | /*@innercontinue@*/ continue; | |
295 | + if (!findprov) continue; | |
296 | depsp = &fc->provides; | |
297 | tagN = RPMTAG_PROVIDENAME; | |
298 | dsContext = RPMSENSE_FIND_PROVIDES; | |
4bdd0c9c JB |
299 | s = elf_strptr(elf, shdr->sh_link, dyn->d_un.d_val); |
300 | assert(s != NULL); | |
301 | + if(rpmfcMatchRegexps(noautoprov, noautoprov_c, s, 'P')) | |
302 | + continue; | |
303 | /*@switchbreak@*/ break; | |
304 | } | |
305 | if (s == NULL) | |
306 | @@ -997,7 +1105,7 @@ | |
5f8c53f0 JK |
307 | /*@=branchstate =uniondef @*/ |
308 | ||
309 | /* For DSO's, provide the basename of the file if DT_SONAME not found. */ | |
0579a272 AM |
310 | - if (!fc->skipProv && isDSO && !gotDEBUG && !gotSONAME) { |
311 | + if (findprov && !fc->skipProv && isDSO && !gotDEBUG && !gotSONAME) { | |
5f8c53f0 JK |
312 | depsp = &fc->provides; |
313 | tagN = RPMTAG_PROVIDENAME; | |
314 | dsContext = RPMSENSE_FIND_PROVIDES; | |
4bdd0c9c JB |
315 | @@ -1015,6 +1123,8 @@ |
316 | t = stpcpy(t, s); | |
317 | /*@=nullpass@*/ | |
318 | ||
319 | + if(!rpmfcMatchRegexps(noautoprov, noautoprov_c, buf, 'P')) { | |
320 | + | |
321 | #if !defined(__alpha__) | |
322 | if (isElf64) | |
323 | t = stpcpy(t, "()(64bit)"); | |
324 | @@ -1032,6 +1142,7 @@ | |
325 | /*@=boundswrite@*/ | |
326 | ||
327 | ds = rpmdsFree(ds); | |
328 | + } | |
329 | } | |
330 | ||
331 | exit: | |
332 | @@ -1045,7 +1156,8 @@ | |
5f8c53f0 JK |
333 | } |
334 | ||
335 | typedef struct rpmfcApplyTbl_s { | |
336 | - int (*func) (rpmfc fc); | |
4bdd0c9c JB |
337 | + int (*func) (rpmfc fc, int findprov, int findreq, |
338 | + regex_t *noautoprov, int noautoprov_c, regex_t *noautoreq, int noautoreq_c); | |
5f8c53f0 JK |
339 | int colormask; |
340 | } * rpmfcApplyTbl; | |
341 | ||
4bdd0c9c | 342 | @@ -1058,6 +1170,109 @@ |
5f8c53f0 JK |
343 | { NULL, 0 } |
344 | }; | |
345 | ||
4bdd0c9c | 346 | +static int rpmfcFindRequiredPackages(rpmfc fc) |
5f8c53f0 JK |
347 | +{ |
348 | + rpmts ts=NULL; | |
349 | + const char * s; | |
350 | + char * se; | |
351 | + rpmds ds; | |
352 | + const char * N; | |
353 | + const char * EVR; | |
354 | + int_32 Flags; | |
355 | + unsigned char deptype; | |
356 | + int nddict; | |
357 | + int previx; | |
358 | + int ix; | |
359 | + int i; | |
360 | + int j; | |
361 | + int xx; | |
362 | + int r; | |
363 | + const char * hname; | |
364 | + rpmdbMatchIterator it; | |
365 | + Header hdr; | |
366 | + regex_t *noautoreqdep; | |
367 | + int noautoreqdep_c; | |
368 | + | |
7ce4c2db | 369 | + noautoreqdep=rpmfcExpandRegexps("%{__noautoreqdep}", &noautoreqdep_c); |
5f8c53f0 JK |
370 | + |
371 | + ts = rpmtsCreate(); /* XXX ts created in main() should be used */ | |
372 | + | |
d327d730 | 373 | + rpmMessage(RPMMESS_NORMAL, _("Searching for required packages....\n")); |
5f8c53f0 JK |
374 | + |
375 | + nddict = argvCount(fc->ddict); | |
376 | + previx = -1; | |
377 | + for (i = 0; i < nddict; i++) { | |
378 | + s = fc->ddict[i]; | |
379 | + | |
380 | + /* Parse out (file#,deptype,N,EVR,Flags) */ | |
381 | + ix = strtol(s, &se, 10); | |
382 | + assert(se != NULL); | |
383 | + deptype = *se++; | |
384 | + se++; | |
385 | + N = se; | |
386 | + while (*se && *se != ' ') | |
387 | + se++; | |
388 | + *se++ = '\0'; | |
389 | + EVR = se; | |
390 | + while (*se && *se != ' ') | |
391 | + se++; | |
392 | + *se++ = '\0'; | |
393 | + Flags = strtol(se, NULL, 16); | |
394 | + | |
395 | + if (deptype!='R') continue; | |
396 | + | |
d327d730 | 397 | + rpmMessage(RPMMESS_DEBUG, _("#%i requires: %s,%s,%i\n"),ix,N,EVR,Flags); |
5f8c53f0 | 398 | + if (EVR && EVR[0]) { |
d327d730 | 399 | + rpmMessage(RPMMESS_DEBUG, _("skipping #%i require\n")); |
5f8c53f0 JK |
400 | + continue; |
401 | + } | |
402 | + for(j=0;j<noautoreqdep_c;j++) | |
403 | + if (!regexec(&noautoreqdep[j],N,0,NULL,0)) { | |
404 | + rpmMessage(RPMMESS_NORMAL, | |
d327d730 JB |
405 | + _("skipping %s requirement processing" |
406 | + " (matches noautoreqdep pattern #%i)\n"),N,j); | |
5f8c53f0 JK |
407 | + break; |
408 | + } | |
409 | + if (j<noautoreqdep_c) continue; | |
410 | + if (N[0]=='/') { | |
d327d730 | 411 | + rpmMessage(RPMMESS_DEBUG, _("skipping #%i require (is file requirement)\n")); |
5f8c53f0 JK |
412 | + continue; |
413 | + } | |
414 | + it=rpmtsInitIterator(ts, RPMTAG_PROVIDENAME, N, 0); | |
415 | + if (!it) { | |
d327d730 | 416 | + rpmMessage(RPMMESS_DEBUG, _("%s -> not found\n"),N); |
5f8c53f0 JK |
417 | + continue; |
418 | + } | |
d327d730 | 419 | + rpmMessage(RPMMESS_DEBUG, _("Iterator: %p\n"),it); |
5f8c53f0 | 420 | + if (rpmdbGetIteratorCount(it)>1) { |
d327d730 | 421 | + rpmMessage(RPMMESS_DEBUG, _("%s -> multiple (skipping)\n"),N); |
5f8c53f0 JK |
422 | + rpmdbFreeIterator(it); |
423 | + continue; | |
424 | + } | |
425 | + hdr=rpmdbNextIterator(it); | |
426 | + assert(hdr!=NULL); | |
427 | + r=rpmHeaderGetEntry(hdr,RPMTAG_NAME,NULL,(void **)&hname, NULL); | |
428 | + assert(r<2); | |
429 | + if (!strcmp(hname,N)) { | |
d327d730 | 430 | + rpmMessage(RPMMESS_DEBUG, _("%s -> %s (skipping)\n"),N,hname); |
5f8c53f0 JK |
431 | + rpmdbFreeIterator(it); |
432 | + continue; | |
433 | + } | |
434 | + | |
435 | + rpmMessage(RPMMESS_DEBUG, "%s -> %s\n",N,hname); | |
436 | + | |
437 | + ds = rpmdsSingle(RPMTAG_REQUIRENAME, hname, "", RPMSENSE_FIND_REQUIRES); | |
438 | + xx = rpmdsMerge(&fc->requires, ds); | |
439 | + ds = rpmdsFree(ds); | |
440 | + | |
441 | + rpmdbFreeIterator(it); | |
442 | + } | |
443 | + | |
444 | + noautoreqdep=rpmfcFreeRegexps(noautoreqdep,noautoreqdep_c); | |
445 | + ts = rpmtsFree(ts); | |
446 | + return 0; | |
447 | +} | |
448 | + | |
449 | int rpmfcApply(rpmfc fc) | |
450 | { | |
451 | rpmfcApplyTbl fcat; | |
4bdd0c9c | 452 | @@ -1075,6 +1290,29 @@ |
5f8c53f0 JK |
453 | int ix; |
454 | int i; | |
455 | int xx; | |
456 | + int j; | |
457 | + int findprov; | |
458 | + int findreq; | |
4bdd0c9c | 459 | + regex_t *noautoprovfiles = NULL; |
5f8c53f0 | 460 | + int noautoprovfiles_c; |
4bdd0c9c JB |
461 | + regex_t *noautoreqfiles = NULL; |
462 | + int noautoreqfiles_c; | |
463 | + regex_t *noautoprov = NULL; | |
464 | + int noautoprov_c; | |
465 | + regex_t *noautoreq = NULL; | |
466 | + int noautoreq_c; | |
5f8c53f0 JK |
467 | + const char *buildroot; |
468 | + int buildroot_l; | |
469 | + | |
4bdd0c9c JB |
470 | + buildroot = rpmExpand("%{buildroot}",NULL); |
471 | + buildroot_l = strlen(buildroot); | |
5f8c53f0 | 472 | + |
7ce4c2db JB |
473 | + noautoprovfiles = rpmfcExpandRegexps("%{__noautoprovfiles}", &noautoprovfiles_c); |
474 | + noautoreqfiles = rpmfcExpandRegexps("%{__noautoreqfiles}", &noautoreqfiles_c); | |
475 | + noautoprov = rpmfcExpandRegexps("%{__noautoprov}", &noautoprov_c); | |
476 | + noautoreq = rpmfcExpandRegexps("%{__noautoreq}", &noautoreq_c); | |
477 | + rpmMessage(RPMMESS_DEBUG, _("%i _noautoprov patterns.\n"), noautoprov_c); | |
478 | + rpmMessage(RPMMESS_DEBUG, _("%i _noautoreq patterns.\n"), noautoreq_c); | |
5f8c53f0 JK |
479 | |
480 | /* Generate package and per-file dependencies. */ | |
481 | for (fc->ix = 0; fc->fn[fc->ix] != NULL; fc->ix++) { | |
4bdd0c9c | 482 | @@ -1082,10 +1320,44 @@ |
5f8c53f0 JK |
483 | for (fcat = rpmfcApplyTable; fcat->func != NULL; fcat++) { |
484 | if (!(fc->fcolor->vals[fc->ix] & fcat->colormask)) | |
485 | /*@innercontinue@*/ continue; | |
486 | - xx = (*fcat->func) (fc); | |
4bdd0c9c JB |
487 | + findprov = 1; |
488 | + findreq = 1; | |
5f8c53f0 | 489 | + if (strncmp(fc->fn[fc->ix],buildroot,buildroot_l)==0) {/* sanity check */ |
4bdd0c9c | 490 | + for(j = 0; j < noautoprovfiles_c; j++) { |
5f8c53f0 | 491 | + if (!regexec(&noautoprovfiles[j], |
4bdd0c9c JB |
492 | + fc->fn[fc->ix] + buildroot_l, 0, NULL, 0)) { |
493 | + rpmMessage(RPMMESS_NORMAL, | |
d327d730 JB |
494 | + _("skipping %s provides detection" |
495 | + " (matches noautoprovfiles pattern #%i)\n"), | |
4bdd0c9c JB |
496 | + fc->fn[fc->ix], j); |
497 | + findprov = 0; | |
5f8c53f0 JK |
498 | + break; |
499 | + } | |
500 | + } | |
4bdd0c9c | 501 | + for(j = 0; j < noautoreqfiles_c; j++) { |
5f8c53f0 | 502 | + if (!regexec(&noautoreqfiles[j], |
4bdd0c9c JB |
503 | + fc->fn[fc->ix] + buildroot_l, 0, NULL, 0)) { |
504 | + rpmMessage(RPMMESS_NORMAL, | |
d327d730 JB |
505 | + _("skipping %s requires detection" |
506 | + " (matches noautoreqfiles pattern #%i)\n"), | |
4bdd0c9c JB |
507 | + fc->fn[fc->ix], j); |
508 | + findreq = 0; | |
5f8c53f0 JK |
509 | + break; |
510 | + } | |
511 | + } | |
512 | + } | |
4bdd0c9c JB |
513 | + xx = (*fcat->func) (fc, findprov, findreq, |
514 | + noautoprov, noautoprov_c, noautoreq, noautoreq_c); | |
5f8c53f0 JK |
515 | } |
516 | } | |
517 | ||
7ce4c2db JB |
518 | + noautoprovfiles = rpmfcFreeRegexps(noautoprovfiles, noautoprovfiles_c); |
519 | + noautoreqfiles = rpmfcFreeRegexps(noautoreqfiles, noautoreqfiles_c); | |
4bdd0c9c JB |
520 | + noautoprov = rpmfcFreeRegexps(noautoprov, noautoprov_c); |
521 | + noautoreq = rpmfcFreeRegexps(noautoreq, noautoreq_c); | |
8e52eb7d | 522 | +#ifdef AUTODEP_PKGNAMES /* define to use package names in R */ |
7ce4c2db JB |
523 | + rpmfcFindRequiredPackages(fc); |
524 | +#endif | |
5f8c53f0 JK |
525 | /*@-boundswrite@*/ |
526 | /* Generate per-file indices into package dependencies. */ | |
527 | nddict = argvCount(fc->ddict); | |
d327d730 JB |
528 | --- rpm-4.3/po/POTFILES.in.orig 2004-01-04 03:13:02.000000000 +0100 |
529 | +++ rpm-4.3/po/POTFILES.in 2004-02-01 21:05:50.567248776 +0100 | |
530 | @@ -22,6 +22,7 @@ | |
531 | build/parseSpec.c | |
532 | build/poptBT.c | |
533 | build/reqprov.c | |
534 | +build/rpmfc.c | |
535 | build/spec.c | |
536 | lib/cpio.c | |
537 | lib/depends.c | |
538 | --- rpm-4.3/po/pl.po.orig 2004-02-01 20:53:10.000000000 +0100 | |
539 | +++ rpm-4.3/po/pl.po 2004-02-01 21:20:36.532561576 +0100 | |
540 | @@ -1295,6 +1295,127 @@ | |
541 | msgid "lookup i18N strings in specfile catalog" | |
542 | msgstr "wyszukaj wpisy I18N w katalogu pliku spec" | |
543 | ||
544 | +#: build/rpmfc.c:94 | |
545 | +#, c-format | |
546 | +msgid "\texecv(%s) pid %d\n" | |
547 | +msgstr "\texecv(%s) pid %d\n" | |
548 | + | |
549 | +#. XXX this error message is probably not seen. | |
550 | +#: build/rpmfc.c:100 | |
551 | +#, c-format | |
552 | +msgid "Couldn't exec %s: %s\n" | |
553 |