]> git.pld-linux.org Git - packages/rpm.git/blame - rpm-noautoreqprovfiles.patch
- obsoleted
[packages/rpm.git] / rpm-noautoreqprovfiles.patch
CommitLineData
9123f215
JK
1diff -durN rpm-4.3.orig/build/rpmfc.c rpm-4.3/build/rpmfc.c
2--- rpm-4.3.orig/build/rpmfc.c 2004-01-04 16:05:16.000000000 +0100
3+++ rpm-4.3/build/rpmfc.c 2004-01-04 17:48:35.453302966 +0100
4@@ -1,6 +1,7 @@
5 #include "system.h"
6
7 #include <signal.h> /* getOutputFrom() */
8+#include <fnmatch.h>
9
10 #include <rpmbuild.h>
11 #include <argv.h>
12@@ -639,9 +640,11 @@
13 /**
14 * Extract script dependencies.
15 * @param fc file classifier
16+ * @param findprov 1 to enable provides
17+ * @param findreq 1 to enable requires
18 * @return 0 on success
19 */
20-static int rpmfcSCRIPT(rpmfc fc)
21+static int rpmfcSCRIPT(rpmfc fc,int findprov,int findreq)
22 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
23 /*@modifies fc, rpmGlobalMacroContext, fileSystem, internalState @*/
24 {
25@@ -693,7 +696,7 @@
26 *se = '\0';
27 se++;
28
29- if (is_executable) {
30+ if (is_executable && findreq) {
31 /* Add to package requires. */
32 ds = rpmdsSingle(RPMTAG_REQUIRENAME, s, "", RPMSENSE_FIND_REQUIRES);
33 xx = rpmdsMerge(&fc->requires, ds);
34@@ -720,19 +723,22 @@
35 (void) fclose(fp);
36
37 if (fc->fcolor->vals[fc->ix] & RPMFC_PERL) {
38- if (fc->fcolor->vals[fc->ix] & RPMFC_MODULE)
39+ if (findprov && fc->fcolor->vals[fc->ix] & RPMFC_MODULE)
40 xx = rpmfcHelper(fc, 'P', "perl");
41- if (is_executable || (fc->fcolor->vals[fc->ix] & RPMFC_MODULE))
42+ if (findreq && (is_executable || (fc->fcolor->vals[fc->ix] & RPMFC_MODULE)))
43 xx = rpmfcHelper(fc, 'R', "perl");
44 }
45 if (fc->fcolor->vals[fc->ix] & RPMFC_PYTHON) {
46- xx = rpmfcHelper(fc, 'P', "python");
47- if (is_executable)
48+ if (findprov)
49+ xx = rpmfcHelper(fc, 'P', "python");
50+ if (findreq && is_executable)
51 xx = rpmfcHelper(fc, 'R', "python");
52 }
53 if (fc->fcolor->vals[fc->ix] & RPMFC_PHP) {
54+ if (findprov)
55 xx = rpmfcHelper(fc, 'P', "php");
56- xx = rpmfcHelper(fc, 'R', "php");
57+ if (findreq)
58+ xx = rpmfcHelper(fc, 'R', "php");
59 }
60
61 return 0;
62@@ -741,9 +747,11 @@
63 /**
64 * Extract Elf dependencies.
65 * @param fc file classifier
66+ * @param findprov 1 to enable provides
67+ * @param findreq 1 to enable requires
68 * @return 0 on success
69 */
70-static int rpmfcELF(rpmfc fc)
71+static int rpmfcELF(rpmfc fc,int findprov,int findreq)
72 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
73 /*@modifies fc, rpmGlobalMacroContext, fileSystem, internalState @*/
74 {
75@@ -855,17 +863,19 @@
76 t = stpcpy(t, "(64bit)");
77 #endif
78 t++;
79+
80+ if (findprov) {
81+ /* Add to package provides. */
82+ ds = rpmdsSingle(RPMTAG_PROVIDES,
83+ buf, "", RPMSENSE_FIND_PROVIDES);
84+ xx = rpmdsMerge(&fc->provides, ds);
85
86- /* Add to package provides. */
87- ds = rpmdsSingle(RPMTAG_PROVIDES,
88- buf, "", RPMSENSE_FIND_PROVIDES);
89- xx = rpmdsMerge(&fc->provides, ds);
90-
91- /* Add to file dependencies. */
92- xx = rpmfcSaveArg(&fc->ddict,
93- rpmfcFileDep(t, fc->ix, ds));
94+ /* Add to file dependencies. */
95+ xx = rpmfcSaveArg(&fc->ddict,
96+ rpmfcFileDep(t, fc->ix, ds));
97
98- ds = rpmdsFree(ds);
99+ ds = rpmdsFree(ds);
100+ }
101 }
102 auxoffset += aux->vda_next;
103 }
104@@ -916,15 +926,17 @@
105 #endif
106 t++;
107
108- /* Add to package dependencies. */
109- ds = rpmdsSingle(RPMTAG_REQUIRENAME,
110- buf, "", RPMSENSE_FIND_REQUIRES);
111- xx = rpmdsMerge(&fc->requires, ds);
112+ if (findreq) {
113+ /* Add to package dependencies. */
114+ ds = rpmdsSingle(RPMTAG_REQUIRENAME,
115+ buf, "", RPMSENSE_FIND_REQUIRES);
116+ xx = rpmdsMerge(&fc->requires, ds);
117
118- /* Add to file dependencies. */
119- xx = rpmfcSaveArg(&fc->ddict,
120- rpmfcFileDep(t, fc->ix, ds));
121- ds = rpmdsFree(ds);
122+ /* Add to file dependencies. */
123+ xx = rpmfcSaveArg(&fc->ddict,
124+ rpmfcFileDep(t, fc->ix, ds));
125+ ds = rpmdsFree(ds);
126+ }
127 }
128 auxoffset += aux->vna_next;
129 }
130@@ -949,6 +961,7 @@
131 /* Files with executable bit set only. */
132 if (fc->skipReq || !(st->st_mode & (S_IXUSR|S_IXGRP|S_IXOTH)))
133 /*@innercontinue@*/ continue;
134+ if (!findreq) continue;
135 /* Add to package requires. */
136 depsp = &fc->requires;
137 tagN = RPMTAG_REQUIRENAME;
138@@ -961,6 +974,7 @@
139 /* Add to package provides. */
140 if (fc->skipProv)
141 /*@innercontinue@*/ continue;
142+ if (!findprov) continue;
143 depsp = &fc->provides;
144 tagN = RPMTAG_PROVIDENAME;
145 dsContext = RPMSENSE_FIND_PROVIDES;
146@@ -999,7 +1013,7 @@
147 /*@=branchstate =uniondef @*/
148
149 /* For DSO's, provide the basename of the file if DT_SONAME not found. */
150- if (!fc->skipProv && isDSO && !gotSONAME) {
151+ if (findprov && !fc->skipProv && isDSO && !gotSONAME) {
152 depsp = &fc->provides;
153 tagN = RPMTAG_PROVIDENAME;
154 dsContext = RPMSENSE_FIND_PROVIDES;
155@@ -1047,7 +1061,7 @@
156 }
157
158 typedef struct rpmfcApplyTbl_s {
159- int (*func) (rpmfc fc);
160+ int (*func) (rpmfc fc,int findprov,int findreq);
161 int colormask;
162 } * rpmfcApplyTbl;
163
164@@ -1187,6 +1201,27 @@
165 int ix;
166 int i;
167 int xx;
168+ int j;
169+ int findprov;
170+ int findreq;
171+ ARGV_t noautoreqfiles=NULL;
172+ int noautoreqfiles_c;
173+ ARGV_t noautoprovfiles=NULL;
174+ int noautoprovfiles_c;
175+
176+ s=rpmExpand("%{buildroot}%{_noautoreqfiles}",NULL);
177+ if (s) {
178+ poptParseArgvString(s,&noautoreqfiles_c,(const char ***)&noautoreqfiles);
179+ s = _free(s);
180+ }
181+ if (noautoreqfiles==NULL) noautoreqfiles_c=0;
182+
183+ s=rpmExpand("%{buildroot}%{_noautoprovfiles}",NULL);
184+ if (s) {
185+ poptParseArgvString(s,&noautoprovfiles_c,(const char ***)&noautoprovfiles);
186+ s = _free(s);
187+ }
188+ if (noautoprovfiles==NULL) noautoprovfiles_c=0;
189
190 /* Generate package and per-file dependencies. */
191 for (fc->ix = 0; fc->fn[fc->ix] != NULL; fc->ix++) {
192@@ -1194,10 +1229,33 @@
193 for (fcat = rpmfcApplyTable; fcat->func != NULL; fcat++) {
194 if (!(fc->fcolor->vals[fc->ix] & fcat->colormask))
195 /*@innercontinue@*/ continue;
196- xx = (*fcat->func) (fc);
197+ findprov=1;
198+ for(j=0;j<noautoprovfiles_c;j++) {
199+ if (fnmatch(noautoprovfiles[j],fc->fn[fc->ix],0)==0) {
200+ rpmMessage(RPMMESS_NORMAL,
201+ "skipping %s provides detection (matches noautoprovfiles pattern: %s)\n",
202+ fc->fn[fc->ix],noautoprovfiles[j]);
203+ findprov=0;
204+ break;
205+ }
206+ }
207+ findreq=1;
208+ for(j=0;j<noautoreqfiles_c;j++) {
209+ if (fnmatch(noautoreqfiles[j],fc->fn[fc->ix],0)==0) {
210+ rpmMessage(RPMMESS_NORMAL,
211+ "skipping %s requires detection (matches noautoreqfiles pattern: %s)\n",
212+ fc->fn[fc->ix],noautoreqfiles[j]);
213+ findreq=0;
214+ break;
215+ }
216+ }
217+ xx = (*fcat->func) (fc,findprov,findreq);
218 }
219 }
220
221+ noautoreqfiles=_free(noautoreqfiles);
222+ noautoprovfiles=_free(noautoprovfiles);
223+
224 rpmfcFindRequiredPackages(fc);
225
226 /*@-boundswrite@*/
This page took 0.056299 seconds and 4 git commands to generate.