+++ /dev/null
-diff -durN rpm-4.3.orig/build/rpmfc.c rpm-4.3/build/rpmfc.c
---- rpm-4.3.orig/build/rpmfc.c 2004-01-04 13:53:29.000000000 +0100
-+++ rpm-4.3/build/rpmfc.c 2004-01-04 15:13:18.227262716 +0100
-@@ -9,6 +9,8 @@
- #define _RPMDS_INTERNAL
- #include <rpmds.h>
- #include <rpmfi.h>
-+#include <rpmts.h>
-+#include <rpmdb.h>
-
- #if HAVE_GELF_H
- #include <gelf.h>
-@@ -1058,6 +1060,116 @@
- { NULL, 0 }
- };
-
-+int rpmfcFindRequiredPackages(rpmfc fc)
-+{
-+ rpmts ts=NULL;
-+ const char * s;
-+ char * se;
-+ rpmds ds;
-+ const char * N;
-+ const char * EVR;
-+ int_32 Flags;
-+ unsigned char deptype;
-+ int nddict;
-+ int previx;
-+ unsigned int val;
-+ int dix;
-+ int ix;
-+ int i;
-+ int j;
-+ int xx;
-+ int r;
-+ const char * hname;
-+ rpmdbMatchIterator it;
-+ Header hdr;
-+ ARGV_t noautoreqdep=NULL;
-+ int noautoreqdep_c;
-+
-+ s=rpmExpand("%{_noautoreqdep}",NULL);
-+ if (s) {
-+ poptParseArgvString(s,&noautoreqdep_c,(const char ***)&noautoreqdep);
-+ s = _free(s);
-+ }
-+ if (noautoreqdep==NULL) noautoreqdep_c=0;
-+
-+ ts = rpmtsCreate(); /* XXX ts created in main() should be used */
-+
-+ rpmMessage(RPMMESS_NORMAL, "Searching for required packages....\n");
-+
-+ nddict = argvCount(fc->ddict);
-+ previx = -1;
-+ for (i = 0; i < nddict; i++) {
-+ s = fc->ddict[i];
-+
-+ /* Parse out (file#,deptype,N,EVR,Flags) */
-+ ix = strtol(s, &se, 10);
-+ assert(se != NULL);
-+ deptype = *se++;
-+ se++;
-+ N = se;
-+ while (*se && *se != ' ')
-+ se++;
-+ *se++ = '\0';
-+ EVR = se;
-+ while (*se && *se != ' ')
-+ se++;
-+ *se++ = '\0';
-+ Flags = strtol(se, NULL, 16);
-+
-+ if (deptype!='R') continue;
-+
-+ rpmMessage(RPMMESS_DEBUG, "#%i requires: %s,%s,%i\n",ix,N,EVR,Flags);
-+ if (EVR && EVR[0]) {
-+ rpmMessage(RPMMESS_DEBUG, "skipping #%i require\n");
-+ continue;
-+ }
-+ for(j=0;j<noautoreqdep_c;j++)
-+ if (fnmatch(noautoreqdep[j],N,0)==0) {
-+ rpmMessage(RPMMESS_NORMAL,
-+ "skipping %s requirement processing (matches noautoreqdep pattern: %s)\n",
-+ N,noautoreqdep[j]);
-+ break;
-+ }
-+ if (j<noautoreqdep_c) continue;
-+ if (N[0]=='/') {
-+ rpmMessage(RPMMESS_DEBUG, "skipping #%i require (is file requirement)\n");
-+ continue;
-+ }
-+ it=rpmtsInitIterator(ts, RPMTAG_PROVIDENAME, N, 0);
-+ if (!it) {
-+ rpmMessage(RPMMESS_DEBUG, "%s -> not found\n",N);
-+ continue;
-+ }
-+ rpmMessage(RPMMESS_DEBUG, "Iterator: %p\n",it);
-+ if (rpmdbGetIteratorCount(it)>1) {
-+ rpmMessage(RPMMESS_DEBUG, "%s -> multiple (skipping)\n",N);
-+ rpmdbFreeIterator(it);
-+ continue;
-+ }
-+ hdr=rpmdbNextIterator(it);
-+ assert(hdr!=NULL);
-+ r=rpmHeaderGetEntry(hdr,RPMTAG_NAME,NULL,(void **)&hname, NULL);
-+ assert(r<2);
-+ if (!strcmp(hname,N)) {
-+ rpmMessage(RPMMESS_DEBUG, "%s -> %s (skipping)\n",N,hname);
-+ rpmdbFreeIterator(it);
-+ continue;
-+ }
-+
-+ rpmMessage(RPMMESS_DEBUG, "%s -> %s\n",N,hname);
-+
-+ ds = rpmdsSingle(RPMTAG_REQUIRENAME, hname, "", RPMSENSE_FIND_REQUIRES);
-+ xx = rpmdsMerge(&fc->requires, ds);
-+ ds = rpmdsFree(ds);
-+
-+ rpmdbFreeIterator(it);
-+ }
-+
-+ noautoreqdep=_free(noautoreqdep);
-+ ts = rpmtsFree(ts);
-+ return 0;
-+}
-+
- int rpmfcApply(rpmfc fc)
- {
- rpmfcApplyTbl fcat;
-@@ -1086,6 +1198,8 @@
- }
- }
-
-+ rpmfcFindRequiredPackages(fc);
-+
- /*@-boundswrite@*/
- /* Generate per-file indices into package dependencies. */
- nddict = argvCount(fc->ddict);
+++ /dev/null
-diff -dur rpm-4.3.orig/build/rpmfc.c rpm-4.3/build/rpmfc.c
---- rpm-4.3.orig/build/rpmfc.c 2004-01-11 15:51:47.000000000 +0100
-+++ rpm-4.3/build/rpmfc.c 2004-01-11 16:18:57.129541284 +0100
-@@ -1,6 +1,7 @@
- #include "system.h"
-
- #include <signal.h> /* getOutputFrom() */
-+#include <fnmatch.h>
-
- #include <rpmbuild.h>
- #include <argv.h>
-@@ -639,9 +640,11 @@
- /**
- * Extract script dependencies.
- * @param fc file classifier
-+ * @param findprov 1 to enable provides
-+ * @param findreq 1 to enable requires
- * @return 0 on success
- */
--static int rpmfcSCRIPT(rpmfc fc)
-+static int rpmfcSCRIPT(rpmfc fc,int findprov,int findreq)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies fc, rpmGlobalMacroContext, fileSystem, internalState @*/
- {
-@@ -693,7 +696,7 @@
- *se = '\0';
- se++;
-
-- if (is_executable) {
-+ if (is_executable && findreq) {
- /* Add to package requires. */
- ds = rpmdsSingle(RPMTAG_REQUIRENAME, s, "", RPMSENSE_FIND_REQUIRES);
- xx = rpmdsMerge(&fc->requires, ds);
-@@ -720,19 +723,22 @@
- (void) fclose(fp);
-
- if (fc->fcolor->vals[fc->ix] & RPMFC_PERL) {
-- if (fc->fcolor->vals[fc->ix] & RPMFC_MODULE)
-+ if (findprov && fc->fcolor->vals[fc->ix] & RPMFC_MODULE)
- xx = rpmfcHelper(fc, 'P', "perl");
-- if (is_executable || (fc->fcolor->vals[fc->ix] & RPMFC_MODULE))
-+ if (findreq && (is_executable || (fc->fcolor->vals[fc->ix] & RPMFC_MODULE)))
- xx = rpmfcHelper(fc, 'R', "perl");
- }
- if (fc->fcolor->vals[fc->ix] & RPMFC_PYTHON) {
-- xx = rpmfcHelper(fc, 'P', "python");
-- if (is_executable)
-+ if (findprov)
-+ xx = rpmfcHelper(fc, 'P', "python");
-+ if (findreq && is_executable)
- xx = rpmfcHelper(fc, 'R', "python");
- }
- if (fc->fcolor->vals[fc->ix] & RPMFC_PHP) {
-+ if (findprov)
- xx = rpmfcHelper(fc, 'P', "php");
-- xx = rpmfcHelper(fc, 'R', "php");
-+ if (findreq)
-+ xx = rpmfcHelper(fc, 'R', "php");
- }
-
- return 0;
-@@ -741,9 +747,11 @@
- /**
- * Extract Elf dependencies.
- * @param fc file classifier
-+ * @param findprov 1 to enable provides
-+ * @param findreq 1 to enable requires
- * @return 0 on success
- */
--static int rpmfcELF(rpmfc fc)
-+static int rpmfcELF(rpmfc fc,int findprov,int findreq)
- /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies fc, rpmGlobalMacroContext, fileSystem, internalState @*/
- {
-@@ -855,17 +863,19 @@
- t = stpcpy(t, "(64bit)");
- #endif
- t++;
-+
-+ if (findprov) {
-+ /* Add to package provides. */
-+ ds = rpmdsSingle(RPMTAG_PROVIDES,
-+ buf, "", RPMSENSE_FIND_PROVIDES);
-+ xx = rpmdsMerge(&fc->provides, ds);
-
-- /* Add to package provides. */
-- ds = rpmdsSingle(RPMTAG_PROVIDES,
-- buf, "", RPMSENSE_FIND_PROVIDES);
-- xx = rpmdsMerge(&fc->provides, ds);
--
-- /* Add to file dependencies. */
-- xx = rpmfcSaveArg(&fc->ddict,
-- rpmfcFileDep(t, fc->ix, ds));
-+ /* Add to file dependencies. */
-+ xx = rpmfcSaveArg(&fc->ddict,
-+ rpmfcFileDep(t, fc->ix, ds));
-
-- ds = rpmdsFree(ds);
-+ ds = rpmdsFree(ds);
-+ }
- }
- auxoffset += aux->vda_next;
- }
-@@ -916,15 +926,17 @@
- #endif
- t++;
-
-- /* Add to package dependencies. */
-- ds = rpmdsSingle(RPMTAG_REQUIRENAME,
-- buf, "", RPMSENSE_FIND_REQUIRES);
-- xx = rpmdsMerge(&fc->requires, ds);
-+ if (findreq) {
-+ /* Add to package dependencies. */
-+ ds = rpmdsSingle(RPMTAG_REQUIRENAME,
-+ buf, "", RPMSENSE_FIND_REQUIRES);
-+ xx = rpmdsMerge(&fc->requires, ds);
-
-- /* Add to file dependencies. */
-- xx = rpmfcSaveArg(&fc->ddict,
-- rpmfcFileDep(t, fc->ix, ds));
-- ds = rpmdsFree(ds);
-+ /* Add to file dependencies. */
-+ xx = rpmfcSaveArg(&fc->ddict,
-+ rpmfcFileDep(t, fc->ix, ds));
-+ ds = rpmdsFree(ds);
-+ }
- }
- auxoffset += aux->vna_next;
- }
-@@ -949,6 +961,7 @@
- /* Files with executable bit set only. */
- if (fc->skipReq || !(st->st_mode & (S_IXUSR|S_IXGRP|S_IXOTH)))
- /*@innercontinue@*/ continue;
-+ if (!findreq) continue;
- /* Add to package requires. */
- depsp = &fc->requires;
- tagN = RPMTAG_REQUIRENAME;
-@@ -961,6 +974,7 @@
- /* Add to package provides. */
- if (fc->skipProv)
- /*@innercontinue@*/ continue;
-+ if (!findprov) continue;
- depsp = &fc->provides;
- tagN = RPMTAG_PROVIDENAME;
- dsContext = RPMSENSE_FIND_PROVIDES;
-@@ -999,7 +1013,7 @@
- /*@=branchstate =uniondef @*/
-
- /* For DSO's, provide the basename of the file if DT_SONAME not found. */
-- if (!fc->skipProv && isDSO && !gotSONAME) {
-+ if (findprov && !fc->skipProv && isDSO && !gotSONAME) {
- depsp = &fc->provides;
- tagN = RPMTAG_PROVIDENAME;
- dsContext = RPMSENSE_FIND_PROVIDES;
-@@ -1047,7 +1061,7 @@
- }
-
- typedef struct rpmfcApplyTbl_s {
-- int (*func) (rpmfc fc);
-+ int (*func) (rpmfc fc,int findprov,int findreq);
- int colormask;
- } * rpmfcApplyTbl;
-
-@@ -1088,7 +1102,7 @@
- s=rpmExpand("%{_noautoreqdep}",NULL);
- if (s) {
- poptParseArgvString(s,&noautoreqdep_c,(const char ***)&noautoreqdep);
-- s = _free(s);
-+ s = _free(s);
- }
- if (noautoreqdep==NULL) noautoreqdep_c=0;
-
-@@ -1187,6 +1201,31 @@
- int ix;
- int i;
- int xx;
-+ int j;
-+ int findprov;
-+ int findreq;
-+ ARGV_t noautoreqfiles=NULL;
-+ int noautoreqfiles_c;
-+ ARGV_t noautoprovfiles=NULL;
-+ int noautoprovfiles_c;
-+ const char *buildroot;
-+ int buildroot_l;
-+
-+ buildroot=rpmExpand("%{buildroot}",NULL);
-+ buildroot_l=strlen(buildroot);
-+
-+ s=rpmExpand("%{_noautoreqfiles}",NULL);
-+ if (s) {
-+ poptParseArgvString(s,&noautoreqfiles_c,(const char ***)&noautoreqfiles);
-+ s = _free(s);
-+ }
-+ if (noautoreqfiles==NULL) noautoreqfiles_c=0;
-+ s=rpmExpand("%{_noautoprovfiles}",NULL);
-+ if (s) {
-+ poptParseArgvString(s,&noautoprovfiles_c,(const char ***)&noautoprovfiles);
-+ s = _free(s);
-+ }
-+ if (noautoprovfiles==NULL) noautoprovfiles_c=0;
-
- /* Generate package and per-file dependencies. */
- for (fc->ix = 0; fc->fn[fc->ix] != NULL; fc->ix++) {
-@@ -1194,10 +1233,35 @@
- for (fcat = rpmfcApplyTable; fcat->func != NULL; fcat++) {
- if (!(fc->fcolor->vals[fc->ix] & fcat->colormask))
- /*@innercontinue@*/ continue;
-- xx = (*fcat->func) (fc);
-+ findprov=1;
-+ findreq=1;
-+ if (strncmp(fc->fn[fc->ix],buildroot,buildroot_l)==0) {/* sanity check */
-+ for(j=0;j<noautoprovfiles_c;j++) {
-+ if (fnmatch(noautoprovfiles[j],fc->fn[fc->ix]+buildroot_l,0)==0) {
-+ rpmMessage(RPMMESS_NORMAL,
-+ "skipping %s provides detection (matches noautoprovfiles pattern: %s)\n",
-+ fc->fn[fc->ix],noautoprovfiles[j]);
-+ findprov=0;
-+ break;
-+ }
-+ }
-+ for(j=0;j<noautoreqfiles_c;j++) {
-+ if (fnmatch(noautoreqfiles[j],fc->fn[fc->ix]+buildroot_l,0)==0) {
-+ rpmMessage(RPMMESS_NORMAL,
-+ "skipping %s requires detection (matches noautoreqfiles pattern: %s)\n",
-+ fc->fn[fc->ix],noautoreqfiles[j]);
-+ findreq=0;
-+ break;
-+ }
-+ }
-+ }
-+ xx = (*fcat->func) (fc,findprov,findreq);
- }
- }
-
-+ noautoreqfiles=_free(noautoreqfiles);
-+ noautoprovfiles=_free(noautoprovfiles);
-+
- rpmfcFindRequiredPackages(fc);
-
- /*@-boundswrite@*/