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 #include +#include +#include #if HAVE_GELF_H #include @@ -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 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);