1 diff -dur rpm-4.3.orig/build/rpmfc.c rpm-4.3/build/rpmfc.c
2 --- rpm-4.3.orig/build/rpmfc.c 2004-01-11 15:51:47.000000000 +0100
3 +++ rpm-4.3/build/rpmfc.c 2004-01-11 16:18:57.129541284 +0100
7 #include <signal.h> /* getOutputFrom() */
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
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 @*/
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);
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");
45 if (fc->fcolor->vals[fc->ix] & RPMFC_PYTHON) {
46 - xx = rpmfcHelper(fc, 'P', "python");
49 + xx = rpmfcHelper(fc, 'P', "python");
50 + if (findreq && is_executable)
51 xx = rpmfcHelper(fc, 'R', "python");
53 if (fc->fcolor->vals[fc->ix] & RPMFC_PHP) {
55 xx = rpmfcHelper(fc, 'P', "php");
56 - xx = rpmfcHelper(fc, 'R', "php");
58 + xx = rpmfcHelper(fc, 'R', "php");
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
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 @*/
76 t = stpcpy(t, "(64bit)");
81 + /* Add to package provides. */
82 + ds = rpmdsSingle(RPMTAG_PROVIDES,
83 + buf, "", RPMSENSE_FIND_PROVIDES);
84 + xx = rpmdsMerge(&fc->provides, ds);
86 - /* Add to package provides. */
87 - ds = rpmdsSingle(RPMTAG_PROVIDES,
88 - buf, "", RPMSENSE_FIND_PROVIDES);
89 - xx = rpmdsMerge(&fc->provides, ds);
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));
102 auxoffset += aux->vda_next;
104 @@ -916,15 +926,17 @@
108 - /* Add to package dependencies. */
109 - ds = rpmdsSingle(RPMTAG_REQUIRENAME,
110 - buf, "", RPMSENSE_FIND_REQUIRES);
111 - xx = rpmdsMerge(&fc->requires, ds);
113 + /* Add to package dependencies. */
114 + ds = rpmdsSingle(RPMTAG_REQUIRENAME,
115 + buf, "", RPMSENSE_FIND_REQUIRES);
116 + xx = rpmdsMerge(&fc->requires, ds);
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);
128 auxoffset += aux->vna_next;
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;
139 /* Add to package provides. */
141 /*@innercontinue@*/ continue;
142 + if (!findprov) continue;
143 depsp = &fc->provides;
144 tagN = RPMTAG_PROVIDENAME;
145 dsContext = RPMSENSE_FIND_PROVIDES;
147 /*@=branchstate =uniondef @*/
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 @@
158 typedef struct rpmfcApplyTbl_s {
159 - int (*func) (rpmfc fc);
160 + int (*func) (rpmfc fc,int findprov,int findreq);
164 @@ -1088,7 +1102,7 @@
165 s=rpmExpand("%{_noautoreqdep}",NULL);
167 poptParseArgvString(s,&noautoreqdep_c,(const char ***)&noautoreqdep);
171 if (noautoreqdep==NULL) noautoreqdep_c=0;
173 @@ -1187,6 +1201,31 @@
180 + ARGV_t noautoreqfiles=NULL;
181 + int noautoreqfiles_c;
182 + ARGV_t noautoprovfiles=NULL;
183 + int noautoprovfiles_c;
184 + const char *buildroot;
187 + buildroot=rpmExpand("%{buildroot}",NULL);
188 + buildroot_l=strlen(buildroot);
190 + s=rpmExpand("%{_noautoreqfiles}",NULL);
192 + poptParseArgvString(s,&noautoreqfiles_c,(const char ***)&noautoreqfiles);
195 + if (noautoreqfiles==NULL) noautoreqfiles_c=0;
196 + s=rpmExpand("%{_noautoprovfiles}",NULL);
198 + poptParseArgvString(s,&noautoprovfiles_c,(const char ***)&noautoprovfiles);
201 + if (noautoprovfiles==NULL) noautoprovfiles_c=0;
203 /* Generate package and per-file dependencies. */
204 for (fc->ix = 0; fc->fn[fc->ix] != NULL; fc->ix++) {
205 @@ -1194,10 +1233,35 @@
206 for (fcat = rpmfcApplyTable; fcat->func != NULL; fcat++) {
207 if (!(fc->fcolor->vals[fc->ix] & fcat->colormask))
208 /*@innercontinue@*/ continue;
209 - xx = (*fcat->func) (fc);
212 + if (strncmp(fc->fn[fc->ix],buildroot,buildroot_l)==0) {/* sanity check */
213 + for(j=0;j<noautoprovfiles_c;j++) {
214 + if (fnmatch(noautoprovfiles[j],fc->fn[fc->ix]+buildroot_l,0)==0) {
215 + rpmMessage(RPMMESS_NORMAL,
216 + "skipping %s provides detection (matches noautoprovfiles pattern: %s)\n",
217 + fc->fn[fc->ix],noautoprovfiles[j]);
222 + for(j=0;j<noautoreqfiles_c;j++) {
223 + if (fnmatch(noautoreqfiles[j],fc->fn[fc->ix]+buildroot_l,0)==0) {
224 + rpmMessage(RPMMESS_NORMAL,
225 + "skipping %s requires detection (matches noautoreqfiles pattern: %s)\n",
226 + fc->fn[fc->ix],noautoreqfiles[j]);
232 + xx = (*fcat->func) (fc,findprov,findreq);
236 + noautoreqfiles=_free(noautoreqfiles);
237 + noautoprovfiles=_free(noautoprovfiles);
239 rpmfcFindRequiredPackages(fc);