]> git.pld-linux.org Git - packages/rpm.git/blame - rpm-pld-autodep.patch
- invalidate nscd cache after removing user or group
[packages/rpm.git] / rpm-pld-autodep.patch
CommitLineData
23e3bf9a
JB
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
15bdd1bc
JB
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 @@
23e3bf9a
JB
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 /**
15bdd1bc
JB
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 @@
5f8c53f0
JK
26 #define _RPMDS_INTERNAL
27 #include <rpmds.h>
28 #include <rpmfi.h>
29+#include <rpmts.h>
30+#include <rpmdb.h>
31
23e3bf9a
JB
32 #include "debug.h"
33
15bdd1bc 34@@ -299,14 +301,83 @@
5f8c53f0
JK
35 return buf;
36 };
37
4bdd0c9c 38+static regex_t * rpmfcExpandRegexps(const char * str,int *count){
5f8c53f0
JK
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,
d327d730
JB
65+ _("Compilation of regular expresion '%s'"
66+ " (expanded from '%s') failed. Skipping it.\n"),
5f8c53f0
JK
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+
4bdd0c9c
JB
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(&regexps[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){
5f8c53f0
JK
96+ int i;
97+
98+ if (regexps)
99+ for(i=0;i<count;i++)
100+ regfree(&regexps[i]);
101+ return _free(regexps);
102+}
103+
104 /**
105 * Run per-interpreter dependency helper.
106 * @param fc file classifier
4bdd0c9c
JB
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 {
23e3bf9a 119@@ -392,6 +464,8 @@
5f8c53f0
JK
120 }
121 /*@=branchstate@*/
122
4bdd0c9c
JB
123+ if(rpmfcMatchRegexps(noauto, noauto_c, N, deptype))
124+ continue;
5f8c53f0
JK
125
126 /* Add tracking dependency for versioned Provides: */
127 if (!fc->tracked && deptype == 'P' && *EVR != '\0') {
23e3bf9a 128@@ -703,7 +777,7 @@
5f8c53f0
JK
129 *se = '\0';
130 se++;
131
132- if (is_executable) {
23e3bf9a 133+ if (is_executable && fc->findreq && !rpmfcMatchRegexps(fc->noautoreq, fc->noautoreq_c, s, 'R')) {
5f8c53f0
JK
134 /* Add to package requires. */
135 ds = rpmdsSingle(RPMTAG_REQUIRENAME, s, "", RPMSENSE_FIND_REQUIRES);
136 xx = rpmdsMerge(&fc->requires, ds);
15bdd1bc 137@@ -731,42 +804,50 @@
5f8c53f0
JK
138 (void) fclose(fp);
139
140 if (fc->fcolor->vals[fc->ix] & RPMFC_PERL) {
141- if (fc->fcolor->vals[fc->ix] & RPMFC_MODULE)
4bdd0c9c 142- xx = rpmfcHelper(fc, 'P', "perl");
5f8c53f0 143- if (is_executable || (fc->fcolor->vals[fc->ix] & RPMFC_MODULE))
4bdd0c9c 144- xx = rpmfcHelper(fc, 'R', "perl");
23e3bf9a
JB
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
5f8c53f0
JK
150 if (fc->fcolor->vals[fc->ix] & RPMFC_PYTHON) {
151- xx = rpmfcHelper(fc, 'P', "python");
23e3bf9a
JB
152+ if (fc->findprov)
153+ xx = rpmfcHelper(fc, 'P', "python", fc->noautoprov, fc->noautoprov_c);
154 #ifdef NOTYET
155 if (is_executable)
156 #endif
4bdd0c9c 157- xx = rpmfcHelper(fc, 'R', "python");
23e3bf9a
JB
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);
5f8c53f0
JK
191 }
192 if (fc->fcolor->vals[fc->ix] & RPMFC_PHP) {
4bdd0c9c 193- xx = rpmfcHelper(fc, 'P', "php");
5f8c53f0 194- xx = rpmfcHelper(fc, 'R', "php");
23e3bf9a
JB
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);
5f8c53f0
JK
199 }
200
201 return 0;
15bdd1bc 202@@ -794,20 +875,26 @@
23e3bf9a
JB
203 default:
204 break;
205 case RPMTAG_PROVIDENAME:
15bdd1bc 206+ if (fc->findprov && !rpmfcMatchRegexps(fc->noautoprov, fc->noautoprov_c, ds->N[0], 'P')) {
23e3bf9a
JB
207 /* Add to package provides. */
208 rc = rpmdsMerge(&fc->provides, ds);
4bdd0c9c 209
23e3bf9a
JB
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:
15bdd1bc 217+ if (fc->findreq && !rpmfcMatchRegexps(fc->noautoreq, fc->noautoreq_c, ds->N[0], 'R')) {
23e3bf9a
JB
218 /* Add to package requires. */
219 rc = rpmdsMerge(&fc->requires, ds);
5f8c53f0 220
15bdd1bc
JB
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 @@
5f8c53f0
JK
230 { NULL, 0 }
231 };
232
4bdd0c9c 233+static int rpmfcFindRequiredPackages(rpmfc fc)
5f8c53f0
JK
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+
7ce4c2db 256+ noautoreqdep=rpmfcExpandRegexps("%{__noautoreqdep}", &noautoreqdep_c);
5f8c53f0
JK
257+
258+ ts = rpmtsCreate(); /* XXX ts created in main() should be used */
259+
d327d730 260+ rpmMessage(RPMMESS_NORMAL, _("Searching for required packages....\n"));
5f8c53f0
JK
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+
d327d730 284+ rpmMessage(RPMMESS_DEBUG, _("#%i requires: %s,%s,%i\n"),ix,N,EVR,Flags);
5f8c53f0 285+ if (EVR && EVR[0]) {
d327d730 286+ rpmMessage(RPMMESS_DEBUG, _("skipping #%i require\n"));
5f8c53f0
JK
287+ continue;
288+ }
289+ for(j=0;j<noautoreqdep_c;j++)
290+ if (!regexec(&noautoreqdep[j],N,0,NULL,0)) {
291+ rpmMessage(RPMMESS_NORMAL,
d327d730
JB
292+ _("skipping %s requirement processing"
293+ " (matches noautoreqdep pattern #%i)\n"),N,j);
5f8c53f0
JK
294+ break;
295+ }
296+ if (j<noautoreqdep_c) continue;
297+ if (N[0]=='/') {
d327d730 298+ rpmMessage(RPMMESS_DEBUG, _("skipping #%i require (is file requirement)\n"));
5f8c53f0
JK
299+ continue;
300+ }
301+ it=rpmtsInitIterator(ts, RPMTAG_PROVIDENAME, N, 0);
302+ if (!it) {
d327d730 303+ rpmMessage(RPMMESS_DEBUG, _("%s -> not found\n"),N);
5f8c53f0
JK
304+ continue;
305+ }
d327d730 306+ rpmMessage(RPMMESS_DEBUG, _("Iterator: %p\n"),it);
5f8c53f0 307+ if (rpmdbGetIteratorCount(it)>1) {
d327d730 308+ rpmMessage(RPMMESS_DEBUG, _("%s -> multiple (skipping)\n"),N);
5f8c53f0
JK
309+ rpmdbFreeIterator(it);
310+ continue;
311+ }
312+ hdr=rpmdbNextIterator(it);
313+ assert(hdr!=NULL);
314+ r=rpmHeaderGetEntry(hdr,RPMTAG_NAME,NULL,(void **)&hname, NULL);
315+ assert(r<2);
316+ if (!strcmp(hname,N)) {
d327d730 317+ rpmMessage(RPMMESS_DEBUG, _("%s -> %s (skipping)\n"),N,hname);
5f8c53f0
JK
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+
23e3bf9a 331+ noautoreqdep = rpmfcFreeRegexps(noautoreqdep, noautoreqdep_c);
5f8c53f0
JK
332+ ts = rpmtsFree(ts);
333+ return 0;
334+}
335+
336 int rpmfcApply(rpmfc fc)
337 {
338 rpmfcApplyTbl fcat;
15bdd1bc 339@@ -865,6 +1055,26 @@
5f8c53f0
JK
340 int ix;
341 int i;
342 int xx;
343+ int j;
4bdd0c9c 344+ regex_t *noautoprovfiles = NULL;
5f8c53f0 345+ int noautoprovfiles_c;
4bdd0c9c
JB
346+ regex_t *noautoreqfiles = NULL;
347+ int noautoreqfiles_c;
5f8c53f0
JK
348+ const char *buildroot;
349+ int buildroot_l;
350+
23e3bf9a
JB
351+ fc->noautoprov = NULL;
352+ fc->noautoreq = NULL;
353+
4bdd0c9c
JB
354+ buildroot = rpmExpand("%{buildroot}",NULL);
355+ buildroot_l = strlen(buildroot);
5f8c53f0 356+
7ce4c2db
JB
357+ noautoprovfiles = rpmfcExpandRegexps("%{__noautoprovfiles}", &noautoprovfiles_c);
358+ noautoreqfiles = rpmfcExpandRegexps("%{__noautoreqfiles}", &noautoreqfiles_c);
23e3bf9a
JB
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);
5f8c53f0
JK
363
364 /* Generate package and per-file dependencies. */
365 for (fc->ix = 0; fc->fn[fc->ix] != NULL; fc->ix++) {
15bdd1bc 366@@ -885,10 +1095,43 @@
5f8c53f0
JK
367 for (fcat = rpmfcApplyTable; fcat->func != NULL; fcat++) {
368 if (!(fc->fcolor->vals[fc->ix] & fcat->colormask))
369 /*@innercontinue@*/ continue;
23e3bf9a
JB
370+ fc->findprov = 1;
371+ fc->findreq = 1;
5f8c53f0 372+ if (strncmp(fc->fn[fc->ix],buildroot,buildroot_l)==0) {/* sanity check */
4bdd0c9c 373+ for(j = 0; j < noautoprovfiles_c; j++) {
5f8c53f0 374+ if (!regexec(&noautoprovfiles[j],
4bdd0c9c
JB
375+ fc->fn[fc->ix] + buildroot_l, 0, NULL, 0)) {
376+ rpmMessage(RPMMESS_NORMAL,
d327d730
JB
377+ _("skipping %s provides detection"
378+ " (matches noautoprovfiles pattern #%i)\n"),
4bdd0c9c 379+ fc->fn[fc->ix], j);
23e3bf9a 380+ fc->findprov = 0;
5f8c53f0
JK
381+ break;
382+ }
383+ }
4bdd0c9c 384+ for(j = 0; j < noautoreqfiles_c; j++) {
5f8c53f0 385+ if (!regexec(&noautoreqfiles[j],
4bdd0c9c
JB
386+ fc->fn[fc->ix] + buildroot_l, 0, NULL, 0)) {
387+ rpmMessage(RPMMESS_NORMAL,
d327d730
JB
388+ _("skipping %s requires detection"
389+ " (matches noautoreqfiles pattern #%i)\n"),
4bdd0c9c 390+ fc->fn[fc->ix], j);
23e3bf9a 391+ fc->findreq = 0;
5f8c53f0
JK
392+ break;
393+ }
394+ }
395+ }
23e3bf9a 396 xx = (*fcat->func) (fc);
5f8c53f0
JK
397 }
398 }
399
7ce4c2db
JB
400+ noautoprovfiles = rpmfcFreeRegexps(noautoprovfiles, noautoprovfiles_c);
401+ noautoreqfiles = rpmfcFreeRegexps(noautoreqfiles, noautoreqfiles_c);
23e3bf9a
JB
402+ fc->noautoprov = rpmfcFreeRegexps(fc->noautoprov, fc->noautoprov_c);
403+ fc->noautoreq = rpmfcFreeRegexps(fc->noautoreq, fc->noautoreq_c);
8e52eb7d 404+#ifdef AUTODEP_PKGNAMES /* define to use package names in R */
7ce4c2db
JB
405+ rpmfcFindRequiredPackages(fc);
406+#endif
5f8c53f0
JK
407 /*@-boundswrite@*/
408 /* Generate per-file indices into package dependencies. */
409 nddict = argvCount(fc->ddict);
d327d730
JB
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