]> git.pld-linux.org Git - packages/rpm.git/blame - rpm-pld-autodep.patch
- enable (originally empty) id,it translations to get Group translations
[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
3@@ -44,6 +44,11 @@
4 StringBuf sb_python;/*!< concatenated list of python colored files. */
5 StringBuf sb_php; /*!< concatenated list of php colored files. */
6
7+ int findprov, findreq;
8+ regex_t *noautoprov;
9+ int noautoprov_c;
10+ regex_t *noautoreq;
11+ int noautoreq_c;
12 };
13
14 /**
15--- rpm-4.4.3/build/rpmfc.c.orig 2005-11-18 23:08:14.332278624 +0100
16+++ rpm-4.4.3/build/rpmfc.c 2005-11-19 00:15:40.643145872 +0100
5f8c53f0
JK
17@@ -1,6 +1,7 @@
18 #include "system.h"
19
20 #include <signal.h> /* getOutputFrom() */
21+#include <regex.h>
22
23 #include <rpmbuild.h>
24 #include <argv.h>
25@@ -9,6 +10,8 @@
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
34@@ -299,14 +302,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);
23e3bf9a 137@@ -731,42 +805,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;
23e3bf9a
JB
202@@ -794,14 +876,18 @@
203 default:
204 break;
205 case RPMTAG_PROVIDENAME:
206+ if (fc->findprov && !rpmfcMatchRegexps(fc->noautoprov, fc->noautoprov_c, ds->N[0])) {
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:
217+ if (fc->findreq && !rpmfcMatchRegexps(fc->noautoreq, fc->noautoreq_c, ds->N[0])) {
218 /* Add to package requires. */
219 rc = rpmdsMerge(&fc->requires, ds);
5f8c53f0 220
23e3bf9a 221@@ -848,6 +934,109 @@
5f8c53f0
JK
222 { NULL, 0 }
223 };
224
4bdd0c9c 225+static int rpmfcFindRequiredPackages(rpmfc fc)
5f8c53f0
JK
226+{
227+ rpmts ts=NULL;
228+ const char * s;
229+ char * se;
230+ rpmds ds;
231+ const char * N;
232+ const char * EVR;
233+ int_32 Flags;
234+ unsigned char deptype;
235+ int nddict;
236+ int previx;
237+ int ix;
238+ int i;
239+ int j;
240+ int xx;
241+ int r;
242+ const char * hname;
243+ rpmdbMatchIterator it;
244+ Header hdr;
245+ regex_t *noautoreqdep;
246+ int noautoreqdep_c;
247+
7ce4c2db 248+ noautoreqdep=rpmfcExpandRegexps("%{__noautoreqdep}", &noautoreqdep_c);
5f8c53f0
JK
249+
250+ ts = rpmtsCreate(); /* XXX ts created in main() should be used */
251+
d327d730 252+ rpmMessage(RPMMESS_NORMAL, _("Searching for required packages....\n"));
5f8c53f0
JK
253+
254+ nddict = argvCount(fc->ddict);
255+ previx = -1;
256+ for (i = 0; i < nddict; i++) {
257+ s = fc->ddict[i];
258+
259+ /* Parse out (file#,deptype,N,EVR,Flags) */
260+ ix = strtol(s, &se, 10);
261+ assert(se != NULL);
262+ deptype = *se++;
263+ se++;
264+ N = se;
265+ while (*se && *se != ' ')
266+ se++;
267+ *se++ = '\0';
268+ EVR = se;
269+ while (*se && *se != ' ')
270+ se++;
271+ *se++ = '\0';
272+ Flags = strtol(se, NULL, 16);
273+
274+ if (deptype!='R') continue;
275+
d327d730 276+ rpmMessage(RPMMESS_DEBUG, _("#%i requires: %s,%s,%i\n"),ix,N,EVR,Flags);
5f8c53f0 277+ if (EVR && EVR[0]) {
d327d730 278+ rpmMessage(RPMMESS_DEBUG, _("skipping #%i require\n"));
5f8c53f0
JK
279+ continue;
280+ }
281+ for(j=0;j<noautoreqdep_c;j++)
282+ if (!regexec(&noautoreqdep[j],N,0,NULL,0)) {
283+ rpmMessage(RPMMESS_NORMAL,
d327d730
JB
284+ _("skipping %s requirement processing"
285+ " (matches noautoreqdep pattern #%i)\n"),N,j);
5f8c53f0
JK
286+ break;
287+ }
288+ if (j<noautoreqdep_c) continue;
289+ if (N[0]=='/') {
d327d730 290+ rpmMessage(RPMMESS_DEBUG, _("skipping #%i require (is file requirement)\n"));
5f8c53f0
JK
291+ continue;
292+ }
293+ it=rpmtsInitIterator(ts, RPMTAG_PROVIDENAME, N, 0);
294+ if (!it) {
d327d730 295+ rpmMessage(RPMMESS_DEBUG, _("%s -> not found\n"),N);
5f8c53f0
JK
296+ continue;
297+ }
d327d730 298+ rpmMessage(RPMMESS_DEBUG, _("Iterator: %p\n"),it);
5f8c53f0 299+ if (rpmdbGetIteratorCount(it)>1) {
d327d730 300+ rpmMessage(RPMMESS_DEBUG, _("%s -> multiple (skipping)\n"),N);
5f8c53f0
JK
301+ rpmdbFreeIterator(it);
302+ continue;
303+ }
304+ hdr=rpmdbNextIterator(it);
305+ assert(hdr!=NULL);
306+ r=rpmHeaderGetEntry(hdr,RPMTAG_NAME,NULL,(void **)&hname, NULL);
307+ assert(r<2);
308+ if (!strcmp(hname,N)) {
d327d730 309+ rpmMessage(RPMMESS_DEBUG, _("%s -> %s (skipping)\n"),N,hname);
5f8c53f0
JK
310+ rpmdbFreeIterator(it);
311+ continue;
312+ }
313+
314+ rpmMessage(RPMMESS_DEBUG, "%s -> %s\n",N,hname);
315+
316+ ds = rpmdsSingle(RPMTAG_REQUIRENAME, hname, "", RPMSENSE_FIND_REQUIRES);
317+ xx = rpmdsMerge(&fc->requires, ds);
318+ ds = rpmdsFree(ds);
319+
320+ rpmdbFreeIterator(it);
321+ }
322+
23e3bf9a 323+ noautoreqdep = rpmfcFreeRegexps(noautoreqdep, noautoreqdep_c);
5f8c53f0
JK
324+ ts = rpmtsFree(ts);
325+ return 0;
326+}
327+
328 int rpmfcApply(rpmfc fc)
329 {
330 rpmfcApplyTbl fcat;
23e3bf9a 331@@ -865,6 +1054,26 @@
5f8c53f0
JK
332 int ix;
333 int i;
334 int xx;
335+ int j;
4bdd0c9c 336+ regex_t *noautoprovfiles = NULL;
5f8c53f0 337+ int noautoprovfiles_c;
4bdd0c9c
JB
338+ regex_t *noautoreqfiles = NULL;
339+ int noautoreqfiles_c;
5f8c53f0
JK
340+ const char *buildroot;
341+ int buildroot_l;
342+
23e3bf9a
JB
343+ fc->noautoprov = NULL;
344+ fc->noautoreq = NULL;
345+
4bdd0c9c
JB
346+ buildroot = rpmExpand("%{buildroot}",NULL);
347+ buildroot_l = strlen(buildroot);
5f8c53f0 348+
7ce4c2db
JB
349+ noautoprovfiles = rpmfcExpandRegexps("%{__noautoprovfiles}", &noautoprovfiles_c);
350+ noautoreqfiles = rpmfcExpandRegexps("%{__noautoreqfiles}", &noautoreqfiles_c);
23e3bf9a
JB
351+ fc->noautoprov = rpmfcExpandRegexps("%{__noautoprov}", &fc->noautoprov_c);
352+ fc->noautoreq = rpmfcExpandRegexps("%{__noautoreq}", &fc->noautoreq_c);
353+ rpmMessage(RPMMESS_DEBUG, _("%i _noautoprov patterns.\n"), fc->noautoprov_c);
354+ rpmMessage(RPMMESS_DEBUG, _("%i _noautoreq patterns.\n"), fc->noautoreq_c);
5f8c53f0
JK
355
356 /* Generate package and per-file dependencies. */
357 for (fc->ix = 0; fc->fn[fc->ix] != NULL; fc->ix++) {
23e3bf9a 358@@ -885,10 +1094,43 @@
5f8c53f0
JK
359 for (fcat = rpmfcApplyTable; fcat->func != NULL; fcat++) {
360 if (!(fc->fcolor->vals[fc->ix] & fcat->colormask))
361 /*@innercontinue@*/ continue;
23e3bf9a
JB
362+ fc->findprov = 1;
363+ fc->findreq = 1;
5f8c53f0 364+ if (strncmp(fc->fn[fc->ix],buildroot,buildroot_l)==0) {/* sanity check */
4bdd0c9c 365+ for(j = 0; j < noautoprovfiles_c; j++) {
5f8c53f0 366+ if (!regexec(&noautoprovfiles[j],
4bdd0c9c
JB
367+ fc->fn[fc->ix] + buildroot_l, 0, NULL, 0)) {
368+ rpmMessage(RPMMESS_NORMAL,
d327d730
JB
369+ _("skipping %s provides detection"
370+ " (matches noautoprovfiles pattern #%i)\n"),
4bdd0c9c 371+ fc->fn[fc->ix], j);
23e3bf9a 372+ fc->findprov = 0;
5f8c53f0
JK
373+ break;
374+ }
375+ }
4bdd0c9c 376+ for(j = 0; j < noautoreqfiles_c; j++) {
5f8c53f0 377+ if (!regexec(&noautoreqfiles[j],
4bdd0c9c
JB
378+ fc->fn[fc->ix] + buildroot_l, 0, NULL, 0)) {
379+ rpmMessage(RPMMESS_NORMAL,
d327d730
JB
380+ _("skipping %s requires detection"
381+ " (matches noautoreqfiles pattern #%i)\n"),
4bdd0c9c 382+ fc->fn[fc->ix], j);
23e3bf9a 383+ fc->findreq = 0;
5f8c53f0
JK
384+ break;
385+ }
386+ }
387+ }
23e3bf9a 388 xx = (*fcat->func) (fc);
5f8c53f0
JK
389 }
390 }
391
7ce4c2db
JB
392+ noautoprovfiles = rpmfcFreeRegexps(noautoprovfiles, noautoprovfiles_c);
393+ noautoreqfiles = rpmfcFreeRegexps(noautoreqfiles, noautoreqfiles_c);
23e3bf9a
JB
394+ fc->noautoprov = rpmfcFreeRegexps(fc->noautoprov, fc->noautoprov_c);
395+ fc->noautoreq = rpmfcFreeRegexps(fc->noautoreq, fc->noautoreq_c);
8e52eb7d 396+#ifdef AUTODEP_PKGNAMES /* define to use package names in R */
7ce4c2db
JB
397+ rpmfcFindRequiredPackages(fc);
398+#endif
5f8c53f0
JK
399 /*@-boundswrite@*/
400 /* Generate per-file indices into package dependencies. */
401 nddict = argvCount(fc->ddict);
d327d730
JB
402--- rpm-4.3/po/POTFILES.in.orig 2004-01-04 03:13:02.000000000 +0100
403+++ rpm-4.3/po/POTFILES.in 2004-02-01 21:05:50.567248776 +0100
404@@ -22,6 +22,7 @@
405 build/parseSpec.c
406 build/poptBT.c
407 build/reqprov.c
408+build/rpmfc.c
409 build/spec.c
410 lib/cpio.c
411 lib/depends.c
412--- rpm-4.3/po/pl.po.orig 2004-02-01 20:53:10.000000000 +0100
413+++ rpm-4.3/po/pl.po 2004-02-01 21:20:36.532561576 +0100
414@@ -1295,6 +1295,127 @@
415 msgid "lookup i18N strings in specfile catalog"
416 msgstr "wyszukaj wpisy I18N w katalogu pliku spec"
417
418+#: build/rpmfc.c:94
419+#, c-format
420+msgid "\texecv(%s) pid %d\n"
421+msgstr "\texecv(%s) pid %d\n"
422+
423+#. XXX this error message is probably not seen.
424+#: build/rpmfc.c:100
425+#, c-format
426+msgid "Couldn't exec %s: %s\n"
427