]>
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); | |
4bdd0c9c | 141 | @@ -718,19 +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"); | |
156 | - if (is_executable) | |
4bdd0c9c | 157 | - xx = rpmfcHelper(fc, 'R', "python"); |
5f8c53f0 | 158 | + if (findprov) |
4bdd0c9c | 159 | + xx = rpmfcHelper(fc, 'P', "python", noautoprov, noautoprov_c); |
5f8c53f0 | 160 | + if (findreq && is_executable) |
4bdd0c9c | 161 | + xx = rpmfcHelper(fc, 'R', "python", noautoreq, noautoreq_c); |
5f8c53f0 JK |
162 | } |
163 | if (fc->fcolor->vals[fc->ix] & RPMFC_PHP) { | |
4bdd0c9c | 164 | - xx = rpmfcHelper(fc, 'P', "php"); |
5f8c53f0 | 165 | - xx = rpmfcHelper(fc, 'R', "php"); |
4bdd0c9c JB |
166 | + if (findprov) |
167 | + xx = rpmfcHelper(fc, 'P', "php", noautoprov, noautoprov_c); | |
5f8c53f0 | 168 | + if (findreq) |
4bdd0c9c | 169 | + xx = rpmfcHelper(fc, 'R', "php", noautoreq, noautoreq_c); |
5f8c53f0 JK |
170 | } |
171 | ||
172 | return 0; | |
4bdd0c9c | 173 | @@ -739,9 +823,16 @@ |
5f8c53f0 JK |
174 | /** |
175 | * Extract Elf dependencies. | |
176 | * @param fc file classifier | |
177 | + * @param findprov 1 to enable provides | |
178 | + * @param findreq 1 to enable requires | |
4bdd0c9c JB |
179 | + * @param noautoprov _noautoprov regexps |
180 | + * @param noautoprov_c # of _noautoprov regexps | |
181 | + * @param noautoreq _noautoreq regexps | |
182 | + * @param noautoreq_c # of _noautoreq regexps | |
5f8c53f0 JK |
183 | * @return 0 on success |
184 | */ | |
185 | -static int rpmfcELF(rpmfc fc) | |
4bdd0c9c JB |
186 | +static int rpmfcELF(rpmfc fc, int findprov, int findreq, |
187 | + regex_t *noautoprov, int noautoprov_c, regex_t *noautoreq, int noautoreq_c) | |
5f8c53f0 JK |
188 | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ |
189 | /*@modifies fc, rpmGlobalMacroContext, fileSystem, internalState @*/ | |
190 | { | |
4bdd0c9c JB |
191 | @@ -844,26 +935,31 @@ |
192 | && !(filter_GLIBC_PRIVATE != 0 | |
193 | && !strcmp(s, "GLIBC_PRIVATE"))) | |
194 | { | |
195 | + int doauto; | |
196 | + | |
197 | buf[0] = '\0'; | |
198 | t = buf; | |
199 | t = stpcpy( stpcpy( stpcpy( stpcpy(t, soname), "("), s), ")"); | |
200 | ||
201 | + doauto = findprov && !rpmfcMatchRegexps(noautoprov, noautoprov_c, buf, 'P'); | |
202 | #if !defined(__alpha__) | |
203 | if (isElf64) | |
5f8c53f0 JK |
204 | t = stpcpy(t, "(64bit)"); |
205 | #endif | |
206 | t++; | |
207 | + | |
4bdd0c9c | 208 | + if (doauto) { |
5f8c53f0 JK |
209 | + /* Add to package provides. */ |
210 | + ds = rpmdsSingle(RPMTAG_PROVIDES, | |
211 | + buf, "", RPMSENSE_FIND_PROVIDES); | |
212 | + xx = rpmdsMerge(&fc->provides, ds); | |
4bdd0c9c JB |
213 | + |
214 | + /* Add to file dependencies. */ | |
215 | + xx = rpmfcSaveArg(&fc->ddict, | |
216 | + rpmfcFileDep(t, fc->ix, ds)); | |
5f8c53f0 JK |
217 | |
218 | - /* Add to package provides. */ | |
219 | - ds = rpmdsSingle(RPMTAG_PROVIDES, | |
220 | - buf, "", RPMSENSE_FIND_PROVIDES); | |
221 | - xx = rpmdsMerge(&fc->provides, ds); | |
222 | - | |
223 | - /* Add to file dependencies. */ | |
224 | - xx = rpmfcSaveArg(&fc->ddict, | |
225 | - rpmfcFileDep(t, fc->ix, ds)); | |
4bdd0c9c | 226 | - |
5f8c53f0 JK |
227 | - ds = rpmdsFree(ds); |
228 | + ds = rpmdsFree(ds); | |
229 | + } | |
230 | } | |
231 | auxoffset += aux->vda_next; | |
232 | } | |
4bdd0c9c JB |
233 | @@ -904,25 +1000,30 @@ |
234 | && !(filter_GLIBC_PRIVATE != 0 | |
235 | && !strcmp(s, "GLIBC_PRIVATE"))) | |
236 | { | |
237 | + int doauto; | |
238 | + | |
239 | buf[0] = '\0'; | |
240 | t = buf; | |
241 | t = stpcpy( stpcpy( stpcpy( stpcpy(t, soname), "("), s), ")"); | |
242 | ||
243 | + doauto = findreq && !rpmfcMatchRegexps(noautoreq, noautoreq_c, buf, 'R'); | |
244 | #if !defined(__alpha__) | |
245 | if (isElf64) | |
246 | t = stpcpy(t, "(64bit)"); | |
5f8c53f0 JK |
247 | #endif |
248 | t++; | |
249 | ||
250 | - /* Add to package dependencies. */ | |
251 | - ds = rpmdsSingle(RPMTAG_REQUIRENAME, | |
252 | - buf, "", RPMSENSE_FIND_REQUIRES); | |
253 | - xx = rpmdsMerge(&fc->requires, ds); | |
4bdd0c9c | 254 | - |
5f8c53f0 JK |
255 | - /* Add to file dependencies. */ |
256 | - xx = rpmfcSaveArg(&fc->ddict, | |
257 | - rpmfcFileDep(t, fc->ix, ds)); | |
258 | - ds = rpmdsFree(ds); | |
4bdd0c9c JB |
259 | + if (doauto) { |
260 | + /* Add to package dependencies. */ | |
261 | + ds = rpmdsSingle(RPMTAG_REQUIRENAME, | |
262 | + buf, "", RPMSENSE_FIND_REQUIRES); | |
263 | + xx = rpmdsMerge(&fc->requires, ds); | |
264 | + | |
5f8c53f0 JK |
265 | + /* Add to file dependencies. */ |
266 | + xx = rpmfcSaveArg(&fc->ddict, | |
267 | + rpmfcFileDep(t, fc->ix, ds)); | |
268 | + ds = rpmdsFree(ds); | |
269 | + } | |
270 | } | |
271 | auxoffset += aux->vna_next; | |
272 | } | |
4bdd0c9c | 273 | @@ -947,23 +1048,30 @@ |
5f8c53f0 JK |
274 | /* Files with executable bit set only. */ |
275 | if (fc->skipReq || !(st->st_mode & (S_IXUSR|S_IXGRP|S_IXOTH))) | |
276 | /*@innercontinue@*/ continue; | |
4bdd0c9c JB |
277 | + if (!findreq) |
278 | + continue; | |
5f8c53f0 JK |
279 | /* Add to package requires. */ |
280 | depsp = &fc->requires; | |
281 | tagN = RPMTAG_REQUIRENAME; | |
4bdd0c9c JB |
282 | dsContext = RPMSENSE_FIND_REQUIRES; |
283 | s = elf_strptr(elf, shdr->sh_link, dyn->d_un.d_val); | |
284 | assert(s != NULL); | |
285 | + if(rpmfcMatchRegexps(noautoreq, noautoreq_c, s, 'R')) | |
286 | + continue; | |
287 | /*@switchbreak@*/ break; | |
288 | case DT_SONAME: | |
289 | gotSONAME = 1; | |
5f8c53f0 JK |
290 | /* Add to package provides. */ |
291 | if (fc->skipProv) | |
292 | /*@innercontinue@*/ continue; | |
293 | + if (!findprov) continue; | |
294 | depsp = &fc->provides; | |
295 | tagN = RPMTAG_PROVIDENAME; | |
296 | dsContext = RPMSENSE_FIND_PROVIDES; | |
4bdd0c9c JB |
297 | s = elf_strptr(elf, shdr->sh_link, dyn->d_un.d_val); |
298 | assert(s != NULL); | |
299 | + if(rpmfcMatchRegexps(noautoprov, noautoprov_c, s, 'P')) | |
300 | + continue; | |
301 | /*@switchbreak@*/ break; | |
302 | } | |
303 | if (s == NULL) | |
304 | @@ -997,7 +1105,7 @@ | |
5f8c53f0 JK |
305 | /*@=branchstate =uniondef @*/ |
306 | ||
307 | /* For DSO's, provide the basename of the file if DT_SONAME not found. */ | |
0579a272 AM |
308 | - if (!fc->skipProv && isDSO && !gotDEBUG && !gotSONAME) { |
309 | + if (findprov && !fc->skipProv && isDSO && !gotDEBUG && !gotSONAME) { | |
5f8c53f0 JK |
310 | depsp = &fc->provides; |
311 | tagN = RPMTAG_PROVIDENAME; | |
312 | dsContext = RPMSENSE_FIND_PROVIDES; | |
4bdd0c9c JB |
313 | @@ -1015,6 +1123,8 @@ |
314 | t = stpcpy(t, s); | |
315 | /*@=nullpass@*/ | |
316 | ||
317 | + if(!rpmfcMatchRegexps(noautoprov, noautoprov_c, buf, 'P')) { | |
318 | + | |
319 | #if !defined(__alpha__) | |
320 | if (isElf64) | |
321 | t = stpcpy(t, "()(64bit)"); | |
322 | @@ -1032,6 +1142,7 @@ | |
323 | /*@=boundswrite@*/ | |
324 | ||
325 | ds = rpmdsFree(ds); | |
326 | + } | |
327 | } | |
328 | ||
329 | exit: | |
330 | @@ -1045,7 +1156,8 @@ | |
5f8c53f0 JK |
331 | } |
332 | ||
333 | typedef struct rpmfcApplyTbl_s { | |
334 | - int (*func) (rpmfc fc); | |
4bdd0c9c JB |
335 | + int (*func) (rpmfc fc, int findprov, int findreq, |
336 | + regex_t *noautoprov, int noautoprov_c, regex_t *noautoreq, int noautoreq_c); | |
5f8c53f0 JK |
337 | int colormask; |
338 | } * rpmfcApplyTbl; | |
339 | ||
4bdd0c9c | 340 | @@ -1058,6 +1170,109 @@ |
5f8c53f0 JK |
341 | { NULL, 0 } |
342 | }; | |
343 | ||
4bdd0c9c | 344 | +static int rpmfcFindRequiredPackages(rpmfc fc) |
5f8c53f0 JK |
345 | +{ |
346 | + rpmts ts=NULL; | |
347 | + const char * s; | |
348 | + char * se; | |
349 | + rpmds ds; | |
350 | + const char * N; | |
351 | + const char * EVR; | |
352 | + int_32 Flags; | |
353 | + unsigned char deptype; | |
354 | + int nddict; | |
355 | + int previx; | |
356 | + int ix; | |
357 | + int i; | |
358 | + int j; | |
359 | + int xx; | |
360 | + int r; | |
361 | + const char * hname; | |
362 | + rpmdbMatchIterator it; | |
363 | + Header hdr; | |
364 | + regex_t *noautoreqdep; | |
365 | + int noautoreqdep_c; | |
366 | + | |
7ce4c2db | 367 | + noautoreqdep=rpmfcExpandRegexps("%{__noautoreqdep}", &noautoreqdep_c); |
5f8c53f0 JK |
368 | + |
369 | + ts = rpmtsCreate(); /* XXX ts created in main() should be used */ | |
370 | + | |
d327d730 | 371 | + rpmMessage(RPMMESS_NORMAL, _("Searching for required packages....\n")); |
5f8c53f0 JK |
372 | + |
373 | + nddict = argvCount(fc->ddict); | |
374 | + previx = -1; | |
375 | + for (i = 0; i < nddict; i++) { | |
376 | + s = fc->ddict[i]; | |
377 | + | |
378 | + /* Parse out (file#,deptype,N,EVR,Flags) */ | |
379 | + ix = strtol(s, &se, 10); | |
380 | + assert(se != NULL); | |
381 | + deptype = *se++; | |
382 | + se++; | |
383 | + N = se; | |
384 | + while (*se && *se != ' ') | |
385 | + se++; | |
386 | + *se++ = '\0'; | |
387 | + EVR = se; | |
388 | + while (*se && *se != ' ') | |
389 | + se++; | |
390 | + *se++ = '\0'; | |
391 | + Flags = strtol(se, NULL, 16); | |
392 | + | |
393 | + if (deptype!='R') continue; | |
394 | + | |
d327d730 | 395 | + rpmMessage(RPMMESS_DEBUG, _("#%i requires: %s,%s,%i\n"),ix,N,EVR,Flags); |
5f8c53f0 | 396 | + if (EVR && EVR[0]) { |
d327d730 | 397 | + rpmMessage(RPMMESS_DEBUG, _("skipping #%i require\n")); |
5f8c53f0 JK |
398 | + continue; |
399 | + } | |
400 | + for(j=0;j<noautoreqdep_c;j++) | |
401 | + if (!regexec(&noautoreqdep[j],N,0,NULL,0)) { | |
402 | + rpmMessage(RPMMESS_NORMAL, | |
d327d730 JB |
403 | + _("skipping %s requirement processing" |
404 | + " (matches noautoreqdep pattern #%i)\n"),N,j); | |
5f8c53f0 JK |
405 | + break; |
406 | + } | |
407 | + if (j<noautoreqdep_c) continue; | |
408 | + if (N[0]=='/') { | |
d327d730 | 409 | + rpmMessage(RPMMESS_DEBUG, _("skipping #%i require (is file requirement)\n")); |
5f8c53f0 JK |
410 | + continue; |
411 | + } | |
412 | + it=rpmtsInitIterator(ts, RPMTAG_PROVIDENAME, N, 0); | |
413 | + if (!it) { | |
d327d730 | 414 | + rpmMessage(RPMMESS_DEBUG, _("%s -> not found\n"),N); |
5f8c53f0 JK |
415 | + continue; |
416 | + } | |
d327d730 | 417 | + rpmMessage(RPMMESS_DEBUG, _("Iterator: %p\n"),it); |
5f8c53f0 | 418 | + if (rpmdbGetIteratorCount(it)>1) { |
d327d730 | 419 | + rpmMessage(RPMMESS_DEBUG, _("%s -> multiple (skipping)\n"),N); |
5f8c53f0 JK |
420 | + rpmdbFreeIterator(it); |
421 | + continue; | |
422 | + } | |
423 | + hdr=rpmdbNextIterator(it); | |
424 | + assert(hdr!=NULL); | |
425 | + r=rpmHeaderGetEntry(hdr,RPMTAG_NAME,NULL,(void **)&hname, NULL); | |
426 | + assert(r<2); | |
427 | + if (!strcmp(hname,N)) { | |
d327d730 | 428 | + rpmMessage(RPMMESS_DEBUG, _("%s -> %s (skipping)\n"),N,hname); |
5f8c53f0 JK |
429 | + rpmdbFreeIterator(it); |
430 | + continue; | |
431 | + } | |
432 | + | |
433 | + rpmMessage(RPMMESS_DEBUG, "%s -> %s\n",N,hname); | |
434 | + | |
435 | + ds = rpmdsSingle(RPMTAG_REQUIRENAME, hname, "", RPMSENSE_FIND_REQUIRES); | |
436 | + xx = rpmdsMerge(&fc->requires, ds); | |
437 | + ds = rpmdsFree(ds); | |
438 | + | |
439 | + rpmdbFreeIterator(it); | |
440 | + } | |
441 | + | |
442 | + noautoreqdep=rpmfcFreeRegexps(noautoreqdep,noautoreqdep_c); | |
443 | + ts = rpmtsFree(ts); | |
444 | + return 0; | |
445 | +} | |
446 | + | |
447 | int rpmfcApply(rpmfc fc) | |
448 | { | |
449 | rpmfcApplyTbl fcat; | |
4bdd0c9c | 450 | @@ -1075,6 +1290,29 @@ |
5f8c53f0 JK |
451 | int ix; |
452 | int i; | |
453 | int xx; | |
454 | + int j; | |
455 | + int findprov; | |
456 | + int findreq; | |
4bdd0c9c | 457 | + regex_t *noautoprovfiles = NULL; |
5f8c53f0 | 458 | + int noautoprovfiles_c; |
4bdd0c9c JB |
459 | + regex_t *noautoreqfiles = NULL; |
460 | + int noautoreqfiles_c; | |
461 | + regex_t *noautoprov = NULL; | |
462 | + int noautoprov_c; | |
463 | + regex_t *noautoreq = NULL; | |
464 | + int noautoreq_c; | |
5f8c53f0 JK |
465 | + const char *buildroot; |
466 | + int buildroot_l; | |
467 | + | |
4bdd0c9c JB |
468 | + buildroot = rpmExpand("%{buildroot}",NULL); |
469 | + buildroot_l = strlen(buildroot); | |
5f8c53f0 | 470 | + |
7ce4c2db JB |
471 | + noautoprovfiles = rpmfcExpandRegexps("%{__noautoprovfiles}", &noautoprovfiles_c); |
472 | + noautoreqfiles = rpmfcExpandRegexps("%{__noautoreqfiles}", &noautoreqfiles_c); | |
473 | + noautoprov = rpmfcExpandRegexps("%{__noautoprov}", &noautoprov_c); | |
474 | + noautoreq = rpmfcExpandRegexps("%{__noautoreq}", &noautoreq_c); | |
475 | + rpmMessage(RPMMESS_DEBUG, _("%i _noautoprov patterns.\n"), noautoprov_c); | |
476 | + rpmMessage(RPMMESS_DEBUG, _("%i _noautoreq patterns.\n"), noautoreq_c); | |
5f8c53f0 JK |
477 | |
478 | /* Generate package and per-file dependencies. */ | |
479 | for (fc->ix = 0; fc->fn[fc->ix] != NULL; fc->ix++) { | |
4bdd0c9c | 480 | @@ -1082,10 +1320,44 @@ |
5f8c53f0 JK |
481 | for (fcat = rpmfcApplyTable; fcat->func != NULL; fcat++) { |
482 | if (!(fc->fcolor->vals[fc->ix] & fcat->colormask)) | |
483 | /*@innercontinue@*/ continue; | |
484 | - xx = (*fcat->func) (fc); | |
4bdd0c9c JB |
485 | + findprov = 1; |
486 | + findreq = 1; | |
5f8c53f0 | 487 | + if (strncmp(fc->fn[fc->ix],buildroot,buildroot_l)==0) {/* sanity check */ |
4bdd0c9c | 488 | + for(j = 0; j < noautoprovfiles_c; j++) { |
5f8c53f0 | 489 | + if (!regexec(&noautoprovfiles[j], |
4bdd0c9c JB |
490 | + fc->fn[fc->ix] + buildroot_l, 0, NULL, 0)) { |
491 | + rpmMessage(RPMMESS_NORMAL, | |
d327d730 JB |
492 | + _("skipping %s provides detection" |
493 | + " (matches noautoprovfiles pattern #%i)\n"), | |
4bdd0c9c JB |
494 | + fc->fn[fc->ix], j); |
495 | + findprov = 0; | |
5f8c53f0 JK |
496 | + break; |
497 | + } | |
498 | + } | |
4bdd0c9c | 499 | + for(j = 0; j < noautoreqfiles_c; j++) { |
5f8c53f0 | 500 | + if (!regexec(&noautoreqfiles[j], |
4bdd0c9c JB |
501 | + fc->fn[fc->ix] + buildroot_l, 0, NULL, 0)) { |
502 | + rpmMessage(RPMMESS_NORMAL, | |
d327d730 JB |
503 | + _("skipping %s requires detection" |
504 | + " (matches noautoreqfiles pattern #%i)\n"), | |
4bdd0c9c JB |
505 | + fc->fn[fc->ix], j); |
506 | + findreq = 0; | |
5f8c53f0 JK |
507 | + break; |
508 | + } | |
509 | + } | |
510 | + } | |
4bdd0c9c JB |
511 | + xx = (*fcat->func) (fc, findprov, findreq, |
512 | + noautoprov, noautoprov_c, noautoreq, noautoreq_c); | |
5f8c53f0 JK |
513 | } |
514 | } | |
515 | ||
7ce4c2db JB |
516 | + noautoprovfiles = rpmfcFreeRegexps(noautoprovfiles, noautoprovfiles_c); |
517 | + noautoreqfiles = rpmfcFreeRegexps(noautoreqfiles, noautoreqfiles_c); | |
4bdd0c9c JB |
518 | + noautoprov = rpmfcFreeRegexps(noautoprov, noautoprov_c); |
519 | + noautoreq = rpmfcFreeRegexps(noautoreq, noautoreq_c); | |
8e52eb7d | 520 | +#ifdef AUTODEP_PKGNAMES /* define to use package names in R */ |
7ce4c2db JB |
521 | + rpmfcFindRequiredPackages(fc); |
522 | +#endif | |
5f8c53f0 JK |
523 | /*@-boundswrite@*/ |
524 | /* Generate per-file indices into package dependencies. */ | |
525 | nddict = argvCount(fc->ddict); | |
d327d730 JB |
526 | --- rpm-4.3/po/POTFILES.in.orig 2004-01-04 03:13:02.000000000 +0100 |
527 | +++ rpm-4.3/po/POTFILES.in 2004-02-01 21:05:50.567248776 +0100 | |
528 | @@ -22,6 +22,7 @@ | |
529 | build/parseSpec.c | |
530 | build/poptBT.c | |
531 | build/reqprov.c | |
532 | +build/rpmfc.c | |
533 | build/spec.c | |
534 | lib/cpio.c | |
535 | lib/depends.c | |
536 | --- rpm-4.3/po/pl.po.orig 2004-02-01 20:53:10.000000000 +0100 | |
537 | +++ rpm-4.3/po/pl.po 2004-02-01 21:20:36.532561576 +0100 | |
538 | @@ -1295,6 +1295,127 @@ | |
539 | msgid "lookup i18N strings in specfile catalog" | |
540 | msgstr "wyszukaj wpisy I18N w katalogu pliku spec" | |
541 | ||
542 | +#: build/rpmfc.c:94 | |
543 | +#, c-format | |
544 | +msgid "\texecv(%s) pid %d\n" | |
545 | +msgstr "\texecv(%s) pid %d\n" | |
546 | + | |
547 | +#. XXX this error message is probably not seen. | |
548 | +#: build/rpmfc.c:100 | |
549 | +#, c-format | |
550 | +msgid "Couldn't exec %s: %s\n" | |
551 |