--- /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 13:54:54.860259000 +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,97 @@
+ { 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 xx;
++ int r;
++ const char * hname;
++ rpmdbMatchIterator it;
++ Header hdr;
++
++ 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;
++ }
++ 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_NORMAL, "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);
++ }
++
++ ts = rpmtsFree(ts);
++ return 0;
++}
++
+ int rpmfcApply(rpmfc fc)
+ {
+ rpmfcApplyTbl fcat;
+@@ -1086,6 +1179,8 @@
+ }
+ }
+
++ rpmfcFindRequiredPackages(fc);
++
+ /*@-boundswrite@*/
+ /* Generate per-file indices into package dependencies. */
+ nddict = argvCount(fc->ddict);