]>
Commit | Line | Data |
---|---|---|
1 | --- rpm-4.4.3/build/rpmfc.h.orig 2005-11-18 23:08:14.231293000 +0100 | |
2 | +++ rpm-4.4.3/build/rpmfc.h 2005-11-18 23:55:16.694214392 +0100 | |
3 | @@ -1,6 +1,7 @@ | |
4 | #ifndef _H_RPMFC_ | |
5 | #define _H_RPMFC_ | |
6 | ||
7 | +#include <regex.h> | |
8 | #undef FILE_RCSID | |
9 | #include "magic.h" | |
10 | ||
11 | @@ -44,6 +45,11 @@ | |
12 | StringBuf sb_python;/*!< concatenated list of python colored files. */ | |
13 | StringBuf sb_php; /*!< concatenated list of php colored files. */ | |
14 | ||
15 | + int findprov, findreq; | |
16 | + regex_t *noautoprov; | |
17 | + int noautoprov_c; | |
18 | + regex_t *noautoreq; | |
19 | + int noautoreq_c; | |
20 | }; | |
21 | ||
22 | /** | |
23 | --- rpm-4.4.3/build/rpmfc.c.orig 2005-11-19 09:33:23.180067024 +0100 | |
24 | +++ rpm-4.4.3/build/rpmfc.c 2005-11-19 09:35:29.167913960 +0100 | |
25 | @@ -9,6 +9,8 @@ | |
26 | #define _RPMDS_INTERNAL | |
27 | #include <rpmds.h> | |
28 | #include <rpmfi.h> | |
29 | +#include <rpmts.h> | |
30 | +#include <rpmdb.h> | |
31 | ||
32 | #include "debug.h" | |
33 | ||
34 | @@ -299,14 +301,83 @@ | |
35 | return buf; | |
36 | }; | |
37 | ||
38 | +static regex_t * rpmfcExpandRegexps(const char * str,int *count){ | |
39 | + int i,j,r; | |
40 | + const char *s; | |
41 | + ARGV_t patterns=NULL; | |
42 | + regex_t *compiled=NULL; | |
43 | + | |
44 | + s=rpmExpand(str,NULL); | |
45 | + if (s) { | |
46 | + poptParseArgvString(s,count,(const char ***)&patterns); | |
47 | + s = _free(s); | |
48 | + } | |
49 | + if (patterns==NULL){ | |
50 | + *count=0; | |
51 | + return NULL; | |
52 | + } | |
53 | + if (*count==0){ | |
54 | + _free(patterns); | |
55 | + return NULL; | |
56 | + } | |
57 | + | |
58 | + compiled=malloc(sizeof(regex_t)*(*count)); | |
59 | + j=0; | |
60 | + for(i=0;i<*count;i++){ | |
61 | + r=regcomp(&compiled[j],patterns[i],REG_NOSUB); | |
62 | + if (r==0) j++; | |
63 | + else { | |
64 | + rpmMessage(RPMMESS_NORMAL, | |
65 | + _("Compilation of regular expresion '%s'" | |
66 | + " (expanded from '%s') failed. Skipping it.\n"), | |
67 | + patterns[i],str); | |
68 | + } | |
69 | + } | |
70 | + patterns=_free(patterns); | |
71 | + if (j==0) { | |
72 | + compiled=_free(compiled); | |
73 | + *count=0; | |
74 | + return NULL; | |
75 | + } | |
76 | + *count=j; | |
77 | + return compiled; | |
78 | +} | |
79 | + | |
80 | +static int rpmfcMatchRegexps(regex_t *regexps, int count, const char *str, char deptype) | |
81 | +{ | |
82 | + int j; | |
83 | + for(j = 0; j < count; j++) { | |
84 | + rpmMessage(RPMMESS_DEBUG, | |
85 | + _("Checking %c: '%s' against _noauto expr. #%i\n"), deptype, str, j); | |
86 | + if (!regexec(®exps[j], str, 0, NULL, 0)) { | |
87 | + rpmMessage(RPMMESS_NORMAL, | |
88 | + _("Skipping %c: '%s' as it matches _noauto expr. #%i\n"), deptype, str, j); | |
89 | + return 1; | |
90 | + } | |
91 | + } | |
92 | + return 0; | |
93 | +} | |
94 | + | |
95 | +static regex_t * rpmfcFreeRegexps(regex_t *regexps,int count){ | |
96 | + int i; | |
97 | + | |
98 | + if (regexps) | |
99 | + for(i=0;i<count;i++) | |
100 | + regfree(®exps[i]); | |
101 | + return _free(regexps); | |
102 | +} | |
103 | + | |
104 | /** | |
105 | * Run per-interpreter dependency helper. | |
106 | * @param fc file classifier | |
107 | * @param deptype 'P' == Provides:, 'R' == Requires:, helper | |
108 | * @param nsdep class name for interpreter (e.g. "perl") | |
109 | + * @param noauto _noauto* regexps | |
110 | + * @param noauto_c # of _noauto* regexps | |
111 | * @return 0 on success | |
112 | */ | |
113 | -static int rpmfcHelper(rpmfc fc, unsigned char deptype, const char * nsdep) | |
114 | +static int rpmfcHelper(rpmfc fc, unsigned char deptype, const char * nsdep, | |
115 | + regex_t * noauto, int noauto_c) | |
116 | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ | |
117 | /*@modifies fc, rpmGlobalMacroContext, fileSystem, internalState @*/ | |
118 | { | |
119 | @@ -392,6 +464,8 @@ | |
120 | } | |
121 | /*@=branchstate@*/ | |
122 | ||
123 | + if(rpmfcMatchRegexps(noauto, noauto_c, N, deptype)) | |
124 | + continue; | |
125 | ||
126 | /* Add tracking dependency for versioned Provides: */ | |
127 | if (!fc->tracked && deptype == 'P' && *EVR != '\0') { | |
128 | @@ -703,7 +777,7 @@ | |
129 | *se = '\0'; | |
130 | se++; | |
131 | ||
132 | - if (is_executable) { | |
133 | + if (is_executable && fc->findreq && !rpmfcMatchRegexps(fc->noautoreq, fc->noautoreq_c, s, 'R')) { | |
134 | /* Add to package requires. */ | |
135 | ds = rpmdsSingle(RPMTAG_REQUIRENAME, s, "", RPMSENSE_FIND_REQUIRES); | |
136 | xx = rpmdsMerge(&fc->requires, ds); | |
137 | @@ -731,42 +804,50 @@ | |
138 | (void) fclose(fp); | |
139 | ||
140 | if (fc->fcolor->vals[fc->ix] & RPMFC_PERL) { | |
141 | - if (fc->fcolor->vals[fc->ix] & RPMFC_MODULE) | |
142 | - xx = rpmfcHelper(fc, 'P', "perl"); | |
143 | - if (is_executable || (fc->fcolor->vals[fc->ix] & RPMFC_MODULE)) | |
144 | - xx = rpmfcHelper(fc, 'R', "perl"); | |
145 | + if (fc->findprov && (fc->fcolor->vals[fc->ix] & RPMFC_MODULE)) | |
146 | + xx = rpmfcHelper(fc, 'P', "perl", fc->noautoprov, fc->noautoprov_c); | |
147 | + if (fc->findreq && (is_executable || (fc->fcolor->vals[fc->ix] & RPMFC_MODULE))) | |
148 | + xx = rpmfcHelper(fc, 'R', "perl", fc->noautoreq, fc->noautoreq_c); | |
149 | } else | |
150 | if (fc->fcolor->vals[fc->ix] & RPMFC_PYTHON) { | |
151 | - xx = rpmfcHelper(fc, 'P', "python"); | |
152 | + if (fc->findprov) | |
153 | + xx = rpmfcHelper(fc, 'P', "python", fc->noautoprov, fc->noautoprov_c); | |
154 | #ifdef NOTYET | |
155 | if (is_executable) | |
156 | #endif | |
157 | - xx = rpmfcHelper(fc, 'R', "python"); | |
158 | + if (fc->findreq) | |
159 | + xx = rpmfcHelper(fc, 'R', "python", fc->noautoreq, fc->noautoreq_c); | |
160 | } else | |
161 | if (fc->fcolor->vals[fc->ix] & RPMFC_LIBTOOL) { | |
162 | - xx = rpmfcHelper(fc, 'P', "libtool"); | |
163 | + if (fc->findprov) | |
164 | + xx = rpmfcHelper(fc, 'P', "libtool", fc->noautoprov, fc->noautoprov_c); | |
165 | #ifdef NOTYET | |
166 | if (is_executable) | |
167 | #endif | |
168 | - xx = rpmfcHelper(fc, 'R', "libtool"); | |
169 | + if (fc->findreq) | |
170 | + xx = rpmfcHelper(fc, 'R', "libtool", fc->noautoreq, fc->noautoreq_c); | |
171 | } else | |
172 | if (fc->fcolor->vals[fc->ix] & RPMFC_PKGCONFIG) { | |
173 | - xx = rpmfcHelper(fc, 'P', "pkgconfig"); | |
174 | + if (fc->findprov) | |
175 | + xx = rpmfcHelper(fc, 'P', "pkgconfig", fc->noautoprov, fc->noautoprov_c); | |
176 | #ifdef NOTYET | |
177 | if (is_executable) | |
178 | #endif | |
179 | - xx = rpmfcHelper(fc, 'R', "pkgconfig"); | |
180 | + if (fc->findreq) | |
181 | + xx = rpmfcHelper(fc, 'R', "pkgconfig", fc->noautoreq, fc->noautoreq_c); | |
182 | } else | |
183 | if (fc->fcolor->vals[fc->ix] & RPMFC_BOURNE) { | |
184 | #ifdef NOTYET | |
185 | xx = rpmfcHelper(fc, 'P', "executable"); | |
186 | #endif | |
187 | - if (is_executable) | |
188 | - xx = rpmfcHelper(fc, 'R', "executable"); | |
189 | + if (fc->findreq && is_executable) | |
190 | + xx = rpmfcHelper(fc, 'R', "executable", fc->noautoreq, fc->noautoreq_c); | |
191 | } | |
192 | if (fc->fcolor->vals[fc->ix] & RPMFC_PHP) { | |
193 | - xx = rpmfcHelper(fc, 'P', "php"); | |
194 | - xx = rpmfcHelper(fc, 'R', "php"); | |
195 | + if (fc->findprov) | |
196 | + xx = rpmfcHelper(fc, 'P', "php", fc->noautoprov, fc->noautoprov_c); | |
197 | + if (fc->findreq) | |
198 | + xx = rpmfcHelper(fc, 'R', "php", fc->noautoreq, fc->noautoreq_c); | |
199 | } | |
200 | ||
201 | return 0; | |
202 | @@ -794,20 +875,26 @@ | |
203 | default: | |
204 | break; | |
205 | case RPMTAG_PROVIDENAME: | |
206 | + if (fc->findprov && !rpmfcMatchRegexps(fc->noautoprov, fc->noautoprov_c, ds->N[0], 'P')) { | |
207 | /* Add to package provides. */ | |
208 | rc = rpmdsMerge(&fc->provides, ds); | |
209 | ||
210 | /* Add to file dependencies. */ | |
211 | buf[0] = '\0'; | |
212 | rc = rpmfcSaveArg(&fc->ddict, rpmfcFileDep(buf, fc->ix, ds)); | |
213 | + } else | |
214 | + rc = 0; | |
215 | break; | |
216 | case RPMTAG_REQUIRENAME: | |
217 | + if (fc->findreq && !rpmfcMatchRegexps(fc->noautoreq, fc->noautoreq_c, ds->N[0], 'R')) { | |
218 | /* Add to package requires. */ | |
219 | rc = rpmdsMerge(&fc->requires, ds); | |
220 | ||
221 | /* Add to file dependencies. */ | |
222 | buf[0] = '\0'; | |
223 | rc = rpmfcSaveArg(&fc->ddict, rpmfcFileDep(buf, fc->ix, ds)); | |
224 | + } else | |
225 | + rc = 0; | |
226 | break; | |
227 | } | |
228 | return rc; | |
229 | @@ -848,6 +935,109 @@ | |
230 | { NULL, 0 } | |
231 | }; | |
232 | ||
233 | +static int rpmfcFindRequiredPackages(rpmfc fc) | |
234 | +{ | |
235 | + rpmts ts=NULL; | |
236 | + const char * s; | |
237 | + char * se; | |
238 | + rpmds ds; | |
239 | + const char * N; | |
240 | + const char * EVR; | |
241 | + int_32 Flags; | |
242 | + unsigned char deptype; | |
243 | + int nddict; | |
244 | + int previx; | |
245 | + int ix; | |
246 | + int i; | |
247 | + int j; | |
248 | + int xx; | |
249 | + int r; | |
250 | + const char * hname; | |
251 | + rpmdbMatchIterator it; | |
252 | + Header hdr; | |
253 | + regex_t *noautoreqdep; | |
254 | + int noautoreqdep_c; | |
255 | + | |
256 | + noautoreqdep=rpmfcExpandRegexps("%{__noautoreqdep}", &noautoreqdep_c); | |
257 | + | |
258 | + ts = rpmtsCreate(); /* XXX ts created in main() should be used */ | |
259 | + | |
260 | + rpmMessage(RPMMESS_NORMAL, _("Searching for required packages....\n")); | |
261 | + | |
262 | + nddict = argvCount(fc->ddict); | |
263 | + previx = -1; | |
264 | + for (i = 0; i < nddict; i++) { | |
265 | + s = fc->ddict[i]; | |
266 | + | |
267 | + /* Parse out (file#,deptype,N,EVR,Flags) */ | |
268 | + ix = strtol(s, &se, 10); | |
269 | + assert(se != NULL); | |
270 | + deptype = *se++; | |
271 | + se++; | |
272 | + N = se; | |
273 | + while (*se && *se != ' ') | |
274 | + se++; | |
275 | + *se++ = '\0'; | |
276 | + EVR = se; | |
277 | + while (*se && *se != ' ') | |
278 | + se++; | |
279 | + *se++ = '\0'; | |
280 | + Flags = strtol(se, NULL, 16); | |
281 | + | |
282 | + if (deptype!='R') continue; | |
283 | + | |
284 | + rpmMessage(RPMMESS_DEBUG, _("#%i requires: %s,%s,%i\n"),ix,N,EVR,Flags); | |
285 | + if (EVR && EVR[0]) { | |
286 | + rpmMessage(RPMMESS_DEBUG, _("skipping #%i require\n")); | |
287 | + continue; | |
288 | + } | |
289 | + for(j=0;j<noautoreqdep_c;j++) | |
290 | + if (!regexec(&noautoreqdep[j],N,0,NULL,0)) { | |
291 | + rpmMessage(RPMMESS_NORMAL, | |
292 | + _("skipping %s requirement processing" | |
293 | + " (matches noautoreqdep pattern #%i)\n"),N,j); | |
294 | + break; | |
295 | + } | |
296 | + if (j<noautoreqdep_c) continue; | |
297 | + if (N[0]=='/') { | |
298 | + rpmMessage(RPMMESS_DEBUG, _("skipping #%i require (is file requirement)\n")); | |
299 | + continue; | |
300 | + } | |
301 | + it=rpmtsInitIterator(ts, RPMTAG_PROVIDENAME, N, 0); | |
302 | + if (!it) { | |
303 | + rpmMessage(RPMMESS_DEBUG, _("%s -> not found\n"),N); | |
304 | + continue; | |
305 | + } | |
306 | + rpmMessage(RPMMESS_DEBUG, _("Iterator: %p\n"),it); | |
307 | + if (rpmdbGetIteratorCount(it)>1) { | |
308 | + rpmMessage(RPMMESS_DEBUG, _("%s -> multiple (skipping)\n"),N); | |
309 | + rpmdbFreeIterator(it); | |
310 | + continue; | |
311 | + } | |
312 | + hdr=rpmdbNextIterator(it); | |
313 | + assert(hdr!=NULL); | |
314 | + r=headerGetEntry(hdr,RPMTAG_NAME,NULL,(void **)&hname, NULL); | |
315 | + assert(r<2); | |
316 | + if (!strcmp(hname,N)) { | |
317 | + rpmMessage(RPMMESS_DEBUG, _("%s -> %s (skipping)\n"),N,hname); | |
318 | + rpmdbFreeIterator(it); | |
319 | + continue; | |
320 | + } | |
321 | + | |
322 | + rpmMessage(RPMMESS_DEBUG, "%s -> %s\n",N,hname); | |
323 | + | |
324 | + ds = rpmdsSingle(RPMTAG_REQUIRENAME, hname, "", RPMSENSE_FIND_REQUIRES); | |
325 | + xx = rpmdsMerge(&fc->requires, ds); | |
326 | + ds = rpmdsFree(ds); | |
327 | + | |
328 | + rpmdbFreeIterator(it); | |
329 | + } | |
330 | + | |
331 | + noautoreqdep = rpmfcFreeRegexps(noautoreqdep, noautoreqdep_c); | |
332 | + ts = rpmtsFree(ts); | |
333 | + return 0; | |
334 | +} | |
335 | + | |
336 | int rpmfcApply(rpmfc fc) | |
337 | { | |
338 | rpmfcApplyTbl fcat; | |
339 | @@ -865,6 +1055,26 @@ | |
340 | int ix; | |
341 | int i; | |
342 | int xx; | |
343 | + int j; | |
344 | + regex_t *noautoprovfiles = NULL; | |
345 | + int noautoprovfiles_c; | |
346 | + regex_t *noautoreqfiles = NULL; | |
347 | + int noautoreqfiles_c; | |
348 | + const char *buildroot; | |
349 | + int buildroot_l; | |
350 | + | |
351 | + fc->noautoprov = NULL; | |
352 | + fc->noautoreq = NULL; | |
353 | + | |
354 | + buildroot = rpmExpand("%{buildroot}",NULL); | |
355 | + buildroot_l = strlen(buildroot); | |
356 | + | |
357 | + noautoprovfiles = rpmfcExpandRegexps("%{__noautoprovfiles}", &noautoprovfiles_c); | |
358 | + noautoreqfiles = rpmfcExpandRegexps("%{__noautoreqfiles}", &noautoreqfiles_c); | |
359 | + fc->noautoprov = rpmfcExpandRegexps("%{__noautoprov}", &fc->noautoprov_c); | |
360 | + fc->noautoreq = rpmfcExpandRegexps("%{__noautoreq}", &fc->noautoreq_c); | |
361 | + rpmMessage(RPMMESS_DEBUG, _("%i _noautoprov patterns.\n"), fc->noautoprov_c); | |
362 | + rpmMessage(RPMMESS_DEBUG, _("%i _noautoreq patterns.\n"), fc->noautoreq_c); | |
363 | ||
364 | /* Generate package and per-file dependencies. */ | |
365 | for (fc->ix = 0; fc->fn[fc->ix] != NULL; fc->ix++) { | |
366 | @@ -885,10 +1095,43 @@ | |
367 | for (fcat = rpmfcApplyTable; fcat->func != NULL; fcat++) { | |
368 | if (!(fc->fcolor->vals[fc->ix] & fcat->colormask)) | |
369 | /*@innercontinue@*/ continue; | |
370 | + fc->findprov = 1; | |
371 | + fc->findreq = 1; | |
372 | + if (strncmp(fc->fn[fc->ix],buildroot,buildroot_l)==0) {/* sanity check */ | |
373 | + for(j = 0; j < noautoprovfiles_c; j++) { | |
374 | + if (!regexec(&noautoprovfiles[j], | |
375 | + fc->fn[fc->ix] + buildroot_l, 0, NULL, 0)) { | |
376 | + rpmMessage(RPMMESS_NORMAL, | |
377 | + _("skipping %s provides detection" | |
378 | + " (matches noautoprovfiles pattern #%i)\n"), | |
379 | + fc->fn[fc->ix], j); | |
380 | + fc->findprov = 0; | |
381 | + break; | |
382 | + } | |
383 | + } | |
384 | + for(j = 0; j < noautoreqfiles_c; j++) { | |
385 | + if (!regexec(&noautoreqfiles[j], | |
386 | + fc->fn[fc->ix] + buildroot_l, 0, NULL, 0)) { | |
387 | + rpmMessage(RPMMESS_NORMAL, | |
388 | + _("skipping %s requires detection" | |
389 | + " (matches noautoreqfiles pattern #%i)\n"), | |
390 | + fc->fn[fc->ix], j); | |
391 | + fc->findreq = 0; | |
392 | + break; | |
393 | + } | |
394 | + } | |
395 | + } | |
396 | xx = (*fcat->func) (fc); | |
397 | } | |
398 | } | |
399 | ||
400 | + noautoprovfiles = rpmfcFreeRegexps(noautoprovfiles, noautoprovfiles_c); | |
401 | + noautoreqfiles = rpmfcFreeRegexps(noautoreqfiles, noautoreqfiles_c); | |
402 | + fc->noautoprov = rpmfcFreeRegexps(fc->noautoprov, fc->noautoprov_c); | |
403 | + fc->noautoreq = rpmfcFreeRegexps(fc->noautoreq, fc->noautoreq_c); | |
404 | +#ifdef AUTODEP_PKGNAMES /* define to use package names in R */ | |
405 | + rpmfcFindRequiredPackages(fc); | |
406 | +#endif | |
407 | /*@-boundswrite@*/ | |
408 | /* Generate per-file indices into package dependencies. */ | |
409 | nddict = argvCount(fc->ddict); | |
410 | --- rpm-4.3/po/POTFILES.in.orig 2004-01-04 03:13:02.000000000 +0100 | |
411 | +++ rpm-4.3/po/POTFILES.in 2004-02-01 21:05:50.567248776 +0100 | |
412 | @@ -22,6 +22,7 @@ | |
413 | build/parseSpec.c | |
414 | build/poptBT.c | |
415 | build/reqprov.c | |
416 | +build/rpmfc.c | |
417 | build/spec.c | |
418 | lib/cpio.c | |
419 | lib/depends.c | |
420 | --- rpm-4.3/po/pl.po.orig 2004-02-01 20:53:10.000000000 +0100 | |
421 | +++ rpm-4.3/po/pl.po 2004-02-01 21:20:36.532561576 +0100 | |
422 | @@ -1295,6 +1295,127 @@ | |
423 | msgid "lookup i18N strings in specfile catalog" | |
424 | msgstr "wyszukaj wpisy I18N w katalogu pliku spec" | |
425 | ||
426 | +#: build/rpmfc.c:94 | |
427 | +#, c-format | |
428 | +msgid "\texecv(%s) pid %d\n" | |
429 | +msgstr "\texecv(%s) pid %d\n" | |
430 | + | |
431 | +#. XXX this error message is probably not seen. | |
432 | +#: build/rpmfc.c:100 | |
433 | +#, c-format | |
434 | +msgid "Couldn't exec %s: %s\n" | |
435 |