]> git.pld-linux.org Git - packages/rpm.git/blobdiff - rpm-pld-autodep.patch
- typo
[packages/rpm.git] / rpm-pld-autodep.patch
index 0c40a1d9b5afa4d10d4b3eeace4c95a671709a82..d39cad1d301d43db51aefa9ee0ab2d543fc16578 100644 (file)
@@ -1,23 +1,37 @@
---- rpm-4.3/build/rpmfc.c.orig Wed May 19 11:30:29 2004
-+++ rpm-4.3/build/rpmfc.c      Wed May 19 17:03:01 2004
+--- rpm-4.4.8/lib/rpmfc.h.orig 2005-11-18 23:08:14.231293000 +0100
++++ rpm-4.4.8/lib/rpmfc.h      2005-11-18 23:55:16.694214392 +0100
 @@ -1,6 +1,7 @@
- #include "system.h"
+ #ifndef _H_RPMFC_
+ #define _H_RPMFC_
  
- #include <signal.h>   /* getOutputFrom() */
 +#include <regex.h>
+ #undef        FILE_RCSID
+ #include "magic.h"
  
- #include <rpmbuild.h>
- #include <argv.h>
-@@ -9,6 +10,8 @@
+@@ -44,6 +45,11 @@
+     StringBuf sb_python;/*!< concatenated list of python colored files. */
+     StringBuf sb_php;   /*!< concatenated list of php colored files. */
++    int findprov, findreq;
++    regex_t *noautoprov;
++    int noautoprov_c;
++    regex_t *noautoreq;
++    int noautoreq_c;
+ };
+ /**
+--- rpm-4.4.8/lib/rpmfc.c.orig 2007-04-08 18:54:35.134367044 +0200
++++ rpm-4.4.8/lib/rpmfc.c      2007-04-08 19:10:18.196109070 +0200
+@@ -11,6 +11,8 @@
  #define       _RPMDS_INTERNAL
  #include <rpmds.h>
  #include <rpmfi.h>
 +#include <rpmts.h>
 +#include <rpmdb.h>
  
- #if HAVE_GELF_H
- #include <gelf.h>
-@@ -301,14 +304,83 @@
+ #include "debug.h"
+@@ -305,14 +307,83 @@
      return buf;
  };
  
        /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
        /*@modifies fc, rpmGlobalMacroContext, fileSystem, internalState @*/
  {
-@@ -394,6 +466,8 @@
+@@ -398,6 +469,8 @@
            }
  /*@=branchstate@*/
  
  
            /* Add tracking dependency for versioned Provides: */
            if (!fc->tracked && deptype == 'P' && *EVR != '\0') {
-@@ -637,9 +711,16 @@
- /**
-  * Extract script dependencies.
-  * @param fc          file classifier
-+ * @param findprov    1 to enable provides
-+ * @param findreq     1 to enable requires
-+ * @param noautoprov  _noautoprov regexps
-+ * @param noautoprov_c        # of _noautoprov regexps
-+ * @param noautoreq   _noautoreq regexps
-+ * @param noautoreq_c # of _noautoreq regexps
-  * @return            0 on success
-  */
--static int rpmfcSCRIPT(rpmfc fc)
-+static int rpmfcSCRIPT(rpmfc fc, int findprov, int findreq,
-+    regex_t *noautoprov, int noautoprov_c, regex_t *noautoreq, int noautoreq_c)
-       /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
-       /*@modifies fc, rpmGlobalMacroContext, fileSystem, internalState @*/
- {
-@@ -691,7 +772,7 @@
+@@ -710,7 +783,7 @@
        *se = '\0';
        se++;
  
 -      if (is_executable) {
-+      if (is_executable && findreq && !rpmfcMatchRegexps(noautoreq, noautoreq_c, s, 'R')) {
++      if (is_executable && fc->findreq && !rpmfcMatchRegexps(fc->noautoreq, fc->noautoreq_c, s, 'R')) {
            /* Add to package requires. */
            ds = rpmdsSingle(RPMTAG_REQUIRENAME, s, "", RPMSENSE_FIND_REQUIRES);
            xx = rpmdsMerge(&fc->requires, ds);
-@@ -718,19 +799,22 @@
+@@ -738,43 +811,51 @@
      (void) fclose(fp);
  
      if (fc->fcolor->vals[fc->ix] & RPMFC_PERL) {
 -          xx = rpmfcHelper(fc, 'P', "perl");
 -      if (is_executable || (fc->fcolor->vals[fc->ix] & RPMFC_MODULE))
 -          xx = rpmfcHelper(fc, 'R', "perl");
-+      if (findprov && fc->fcolor->vals[fc->ix] & RPMFC_MODULE)
-+          xx = rpmfcHelper(fc, 'P', "perl", noautoprov, noautoprov_c);
-+      if (findreq && (is_executable || (fc->fcolor->vals[fc->ix] & RPMFC_MODULE)))
-+          xx = rpmfcHelper(fc, 'R', "perl", noautoreq, noautoreq_c);
-     }
++      if (fc->findprov && (fc->fcolor->vals[fc->ix] & RPMFC_MODULE))
++          xx = rpmfcHelper(fc, 'P', "perl", fc->noautoprov, fc->noautoprov_c);
++      if (fc->findreq && (is_executable || (fc->fcolor->vals[fc->ix] & RPMFC_MODULE)))
++          xx = rpmfcHelper(fc, 'R', "perl", fc->noautoreq, fc->noautoreq_c);
+     } else
      if (fc->fcolor->vals[fc->ix] & RPMFC_PYTHON) {
 -      xx = rpmfcHelper(fc, 'P', "python");
--      if (is_executable)
++      if (fc->findprov)
++      xx = rpmfcHelper(fc, 'P', "python", fc->noautoprov, fc->noautoprov_c);
+ #ifdef        NOTYET
+       if (is_executable)
+ #endif
 -          xx = rpmfcHelper(fc, 'R', "python");
-+      if (findprov)
-+          xx = rpmfcHelper(fc, 'P', "python", noautoprov, noautoprov_c);
-+      if (findreq && is_executable)
-+          xx = rpmfcHelper(fc, 'R', "python", noautoreq, noautoreq_c);
-     }
++      if (fc->findreq)
++          xx = rpmfcHelper(fc, 'R', "python", fc->noautoreq, fc->noautoreq_c);
+     } else
+     if (fc->fcolor->vals[fc->ix] & RPMFC_LIBTOOL) {
+-      xx = rpmfcHelper(fc, 'P', "libtool");
++      if (fc->findprov)
++      xx = rpmfcHelper(fc, 'P', "libtool", fc->noautoprov, fc->noautoprov_c);
+ #ifdef        NOTYET
+       if (is_executable)
+ #endif
+-          xx = rpmfcHelper(fc, 'R', "libtool");
++      if (fc->findreq)
++          xx = rpmfcHelper(fc, 'R', "libtool", fc->noautoreq, fc->noautoreq_c);
+     } else
+     if (fc->fcolor->vals[fc->ix] & RPMFC_PKGCONFIG) {
+-      xx = rpmfcHelper(fc, 'P', "pkgconfig");
++      if (fc->findprov)
++      xx = rpmfcHelper(fc, 'P', "pkgconfig", fc->noautoprov, fc->noautoprov_c);
+ #ifdef        NOTYET
+       if (is_executable)
+ #endif
+-          xx = rpmfcHelper(fc, 'R', "pkgconfig");
++      if (fc->findreq)
++          xx = rpmfcHelper(fc, 'R', "pkgconfig", fc->noautoreq, fc->noautoreq_c);
+     } else
+     if (fc->fcolor->vals[fc->ix] & RPMFC_BOURNE) {
+ #ifdef        NOTYET
+       xx = rpmfcHelper(fc, 'P', "executable");
+ #endif
+-      if (is_executable)
+-          xx = rpmfcHelper(fc, 'R', "executable");
++      if (fc->findreq && is_executable)
++          xx = rpmfcHelper(fc, 'R', "executable", fc->noautoreq, fc->noautoreq_c);
+     } else
      if (fc->fcolor->vals[fc->ix] & RPMFC_PHP) {
--              xx = rpmfcHelper(fc, 'P', "php");
+-      xx = rpmfcHelper(fc, 'P', "php");
++      if (fc->findprov)
++      xx = rpmfcHelper(fc, 'P', "php", fc->noautoprov, fc->noautoprov_c);
+       /* not only executable, files run by httpd usually are not */
 -          xx = rpmfcHelper(fc, 'R', "php");
-+            if (findprov)
-+              xx = rpmfcHelper(fc, 'P', "php", noautoprov, noautoprov_c);
-+            if (findreq)
-+                xx = rpmfcHelper(fc, 'R', "php", noautoreq, noautoreq_c);
-       }
++      if (fc->findreq)
++          xx = rpmfcHelper(fc, 'R', "php", fc->noautoreq, fc->noautoreq_c);
+     }
  
      return 0;
-@@ -739,9 +823,16 @@
- /**
-  * Extract Elf dependencies.
-  * @param fc          file classifier
-+ * @param findprov    1 to enable provides
-+ * @param findreq     1 to enable requires
-+ * @param noautoprov  _noautoprov regexps
-+ * @param noautoprov_c        # of _noautoprov regexps
-+ * @param noautoreq   _noautoreq regexps
-+ * @param noautoreq_c # of _noautoreq regexps
-  * @return            0 on success
-  */
--static int rpmfcELF(rpmfc fc)
-+static int rpmfcELF(rpmfc fc, int findprov, int findreq,
-+    regex_t *noautoprov, int noautoprov_c, regex_t *noautoreq, int noautoreq_c)
-       /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
-       /*@modifies fc, rpmGlobalMacroContext, fileSystem, internalState @*/
- {
-@@ -844,26 +935,31 @@
-                        && !(filter_GLIBC_PRIVATE != 0
-                               && !strcmp(s, "GLIBC_PRIVATE")))
-                       {
-+                          int doauto;
-+
-                           buf[0] = '\0';
-                           t = buf;
-                           t = stpcpy( stpcpy( stpcpy( stpcpy(t, soname), "("), s), ")");
-+                          doauto = findprov && !rpmfcMatchRegexps(noautoprov, noautoprov_c, buf, 'P');
- #if !defined(__alpha__)
-                           if (isElf64)
-                               t = stpcpy(t, "(64bit)");
- #endif
-                           t++;
-+                            
-+                            if (doauto) {
-+                                /* 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 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));
--
--                          ds = rpmdsFree(ds);
-+                                ds = rpmdsFree(ds);
-+                            }
-                       }
-                       auxoffset += aux->vda_next;
-                   }
-@@ -904,25 +1000,30 @@
-                        && !(filter_GLIBC_PRIVATE != 0
-                               && !strcmp(s, "GLIBC_PRIVATE")))
-                       {
-+                          int doauto;
-+
-                           buf[0] = '\0';
-                           t = buf;
-                           t = stpcpy( stpcpy( stpcpy( stpcpy(t, soname), "("), s), ")");
-+                          doauto = findreq && !rpmfcMatchRegexps(noautoreq, noautoreq_c, buf, 'R');
- #if !defined(__alpha__)
-                           if (isElf64)
-                               t = stpcpy(t, "(64bit)");
- #endif
-                           t++;
+@@ -802,20 +883,26 @@
+     default:
+       break;
+     case RPMTAG_PROVIDENAME:
++      if (fc->findprov && !rpmfcMatchRegexps(fc->noautoprov, fc->noautoprov_c, ds->N[0], 'P')) {
+       /* Add to package provides. */
+       rc = rpmdsMerge(&fc->provides, ds);
  
--                          /* 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);
-+                            if (doauto) {
-+                                /* 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);
-+                            }
-                       }
-                       auxoffset += aux->vna_next;
-                   }
-@@ -947,23 +1048,30 @@
-                       /* 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;
-                       dsContext = RPMSENSE_FIND_REQUIRES;
-                       s = elf_strptr(elf, shdr->sh_link, dyn->d_un.d_val);
- assert(s != NULL);
-+                      if(rpmfcMatchRegexps(noautoreq, noautoreq_c, s, 'R'))
-+                          continue;
-                       /*@switchbreak@*/ break;
-                   case DT_SONAME:
-                       gotSONAME = 1;
-                       /* Add to package provides. */
-                       if (fc->skipProv)
-                           /*@innercontinue@*/ continue;
-+                        if (!findprov) continue;
-                       depsp = &fc->provides;
-                       tagN = RPMTAG_PROVIDENAME;
-                       dsContext = RPMSENSE_FIND_PROVIDES;
-                       s = elf_strptr(elf, shdr->sh_link, dyn->d_un.d_val);
- assert(s != NULL);
-+                      if(rpmfcMatchRegexps(noautoprov, noautoprov_c, s, 'P'))
-+                          continue;
-                       /*@switchbreak@*/ break;
-                   }
-                   if (s == NULL)
-@@ -997,7 +1105,7 @@
-     /*@=branchstate =uniondef @*/
+       /* Add to file dependencies. */
+       buf[0] = '\0';
+       rc = rpmfcSaveArg(&fc->ddict, rpmfcFileDep(buf, fc->ix, ds));
++      } else
++              rc = 0;
+       break;
+     case RPMTAG_REQUIRENAME:
++      if (fc->findreq && !rpmfcMatchRegexps(fc->noautoreq, fc->noautoreq_c, ds->N[0], 'R')) {
+       /* Add to package requires. */
+       rc = rpmdsMerge(&fc->requires, ds);
  
-     /* For DSO's, provide the basename of the file if DT_SONAME not found. */
--    if (!fc->skipProv && isDSO && !gotDEBUG && !gotSONAME) {
-+    if (findprov && !fc->skipProv && isDSO && !gotDEBUG && !gotSONAME) {
-       depsp = &fc->provides;
-       tagN = RPMTAG_PROVIDENAME;
-       dsContext = RPMSENSE_FIND_PROVIDES;
-@@ -1015,6 +1123,8 @@
-       t = stpcpy(t, s);
- /*@=nullpass@*/
-+      if(!rpmfcMatchRegexps(noautoprov, noautoprov_c, buf, 'P')) {
-+
- #if !defined(__alpha__)
-       if (isElf64)
-           t = stpcpy(t, "()(64bit)");
-@@ -1032,6 +1142,7 @@
- /*@=boundswrite@*/
-       ds = rpmdsFree(ds);
-+      }
+       /* Add to file dependencies. */
+       buf[0] = '\0';
+       rc = rpmfcSaveArg(&fc->ddict, rpmfcFileDep(buf, fc->ix, ds));
++      } else
++              rc = 0;
+       break;
      }
- exit:
-@@ -1045,7 +1156,8 @@
- }
- typedef struct rpmfcApplyTbl_s {
--    int (*func) (rpmfc fc);
-+    int (*func) (rpmfc fc, int findprov, int findreq,
-+      regex_t *noautoprov, int noautoprov_c, regex_t *noautoreq, int noautoreq_c);
-     int colormask;
- } * rpmfcApplyTbl;
-@@ -1058,6 +1170,109 @@
+     return rc;
+@@ -856,6 +943,109 @@
      { NULL, 0 }
  };
  
 +        }
 +        hdr=rpmdbNextIterator(it);
 +        assert(hdr!=NULL);
-+        r=rpmHeaderGetEntry(hdr,RPMTAG_NAME,NULL,(void **)&hname, NULL);
++        r=headerGetEntry(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);
 +    }
 +
-+    noautoreqdep=rpmfcFreeRegexps(noautoreqdep,noautoreqdep_c);
++    noautoreqdep = rpmfcFreeRegexps(noautoreqdep, noautoreqdep_c);
 +    ts = rpmtsFree(ts);
 +    return 0;
 +}
  int rpmfcApply(rpmfc fc)
  {
      rpmfcApplyTbl fcat;
-@@ -1075,6 +1290,29 @@
-     int ix;
+@@ -874,6 +1064,26 @@
      int i;
      int xx;
+     int skipping;
 +    int j;
-+    int findprov;
-+    int findreq;
 +    regex_t *noautoprovfiles = NULL;
 +    int noautoprovfiles_c;
 +    regex_t *noautoreqfiles = NULL;
 +    int noautoreqfiles_c;
-+    regex_t *noautoprov = NULL;
-+    int noautoprov_c;
-+    regex_t *noautoreq = NULL;
-+    int noautoreq_c;
 +    const char *buildroot;
 +    int buildroot_l;
 +
++    fc->noautoprov = NULL;
++    fc->noautoreq = NULL;
++
 +    buildroot = rpmExpand("%{buildroot}",NULL);
 +    buildroot_l = strlen(buildroot);
 +    
 +    noautoprovfiles = rpmfcExpandRegexps("%{__noautoprovfiles}", &noautoprovfiles_c);
 +    noautoreqfiles = rpmfcExpandRegexps("%{__noautoreqfiles}", &noautoreqfiles_c);
-+    noautoprov = rpmfcExpandRegexps("%{__noautoprov}", &noautoprov_c);
-+    noautoreq = rpmfcExpandRegexps("%{__noautoreq}", &noautoreq_c);
-+    rpmMessage(RPMMESS_DEBUG, _("%i _noautoprov patterns.\n"), noautoprov_c);
-+    rpmMessage(RPMMESS_DEBUG, _("%i _noautoreq patterns.\n"), noautoreq_c);
++    fc->noautoprov = rpmfcExpandRegexps("%{__noautoprov}", &fc->noautoprov_c);
++    fc->noautoreq = rpmfcExpandRegexps("%{__noautoreq}", &fc->noautoreq_c);
++    rpmMessage(RPMMESS_DEBUG, _("%i _noautoprov patterns.\n"), fc->noautoprov_c);
++    rpmMessage(RPMMESS_DEBUG, _("%i _noautoreq patterns.\n"), fc->noautoreq_c);
  
      /* Generate package and per-file dependencies. */
      for (fc->ix = 0; fc->fn[fc->ix] != NULL; fc->ix++) {
-@@ -1082,10 +1320,44 @@
+@@ -894,9 +1104,43 @@
        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;
++          fc->findprov = 1;
++          fc->findreq = 1;
 +          if (strncmp(fc->fn[fc->ix],buildroot,buildroot_l)==0) {/* sanity check */
-+              for(j = 0; j < noautoprovfiles_c; j++) {
-+                  if (!regexec(&noautoprovfiles[j],
-+                          fc->fn[fc->ix] + buildroot_l, 0, NULL, 0)) {
-+                      rpmMessage(RPMMESS_NORMAL,
-+                              _("skipping %s provides detection"
-+                              " (matches noautoprovfiles pattern #%i)\n"),
-+                              fc->fn[fc->ix], j);
-+                      findprov = 0;
-+                      break;
++                  for(j = 0; j < noautoprovfiles_c; j++) {
++                          if (!regexec(&noautoprovfiles[j],
++                                                  fc->fn[fc->ix] + buildroot_l, 0, NULL, 0)) {
++                                  rpmMessage(RPMMESS_NORMAL,
++                                                  _("skipping %s provides detection"
++                                                          " (matches noautoprovfiles pattern #%i)\n"),
++                                                  fc->fn[fc->ix], j);
++                                  fc->findprov = 0;
++                                  break;
++                          }
 +                  }
-+              }
-+              for(j = 0; j < noautoreqfiles_c; j++) {
-+                  if (!regexec(&noautoreqfiles[j],
-+                          fc->fn[fc->ix] + buildroot_l, 0, NULL, 0)) {
-+                      rpmMessage(RPMMESS_NORMAL,
-+                              _("skipping %s requires detection"
-+                              " (matches noautoreqfiles pattern #%i)\n"),
-+                              fc->fn[fc->ix], j);
-+                      findreq = 0;
-+                      break;
++                  for(j = 0; j < noautoreqfiles_c; j++) {
++                          if (!regexec(&noautoreqfiles[j],
++                                                  fc->fn[fc->ix] + buildroot_l, 0, NULL, 0)) {
++                                  rpmMessage(RPMMESS_NORMAL,
++                                                  _("skipping %s requires detection"
++                                                          " (matches noautoreqfiles pattern #%i)\n"),
++                                                  fc->fn[fc->ix], j);
++                                  fc->findreq = 0;
++                                  break;
++                          }
 +                  }
-+              }
 +          }
-+          xx = (*fcat->func) (fc, findprov, findreq,
-+              noautoprov, noautoprov_c, noautoreq, noautoreq_c);
++
+           xx = (*fcat->func) (fc);
        }
      }
 +    noautoprovfiles = rpmfcFreeRegexps(noautoprovfiles, noautoprovfiles_c);
 +    noautoreqfiles = rpmfcFreeRegexps(noautoreqfiles, noautoreqfiles_c);
-+    noautoprov = rpmfcFreeRegexps(noautoprov, noautoprov_c);
-+    noautoreq = rpmfcFreeRegexps(noautoreq, noautoreq_c);
++    fc->noautoprov = rpmfcFreeRegexps(fc->noautoprov, fc->noautoprov_c);
++    fc->noautoreq = rpmfcFreeRegexps(fc->noautoreq, fc->noautoreq_c);
 +#ifdef AUTODEP_PKGNAMES /* define to use package names in R */
 +    rpmfcFindRequiredPackages(fc);
 +#endif
  /*@-boundswrite@*/
      /* Generate per-file indices into package dependencies. */
-     nddict = argvCount(fc->ddict);
 --- rpm-4.3/po/POTFILES.in.orig        2004-01-04 03:13:02.000000000 +0100
 +++ rpm-4.3/po/POTFILES.in     2004-02-01 21:05:50.567248776 +0100
 @@ -22,6 +22,7 @@
  build/parseSpec.c
  build/poptBT.c
  build/reqprov.c
-+build/rpmfc.c
++lib/rpmfc.c
  build/spec.c
  lib/cpio.c
  lib/depends.c
This page took 0.058561 seconds and 4 git commands to generate.