From: Jacek Konieczny Date: Fri, 16 Jan 2004 13:51:50 +0000 (+0000) Subject: - all _noauto* macro support, require-packages-with-required-capabilities support... X-Git-Tag: auto/ac/rpm-4_3-0_20040107_4~3 X-Git-Url: http://git.pld-linux.org/?p=packages%2Frpm.git;a=commitdiff_plain;h=2dec5531dda60c32b4ba367da2f26dadec8c85dd - all _noauto* macro support, require-packages-with-required-capabilities support into one "rpm-pld-autodep" patch - %{_noautoreq} and %{_noautoprov} for dependencies generated by helpers Changed files: rpm-find_required_pkgs_on_build.patch -> 1.4 rpm-noautoreqprovfiles.patch -> 1.3 --- diff --git a/rpm-find_required_pkgs_on_build.patch b/rpm-find_required_pkgs_on_build.patch deleted file mode 100644 index eb2114c..0000000 --- a/rpm-find_required_pkgs_on_build.patch +++ /dev/null @@ -1,138 +0,0 @@ -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); diff --git a/rpm-noautoreqprovfiles.patch b/rpm-noautoreqprovfiles.patch deleted file mode 100644 index c4b0155..0000000 --- a/rpm-noautoreqprovfiles.patch +++ /dev/null @@ -1,241 +0,0 @@ -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 /* getOutputFrom() */ -+#include - - #include - #include -@@ -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;jfn[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;jfn[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@*/