RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  j...@rpm5.org
  Module: rpm                              Date:   04-Apr-2009 23:57:32
  Branch: rpm-5_1                          Handle: 2009040421573101

  Modified files:           (Branch: rpm-5_1)
    rpm                     CHANGES
    rpm/lib                 rpmfc.c rpmfc.h rpmfi.h rpminstall.c rpmps.c
                            rpmps.h rpmrollback.c

  Log:
    - enable the PLD dependency filtering.
    - PLD: rpm-pld-autodep: add run-time disablers, attempt miRE's instead.
    - PLD: rpm-pld-autodep: merge and simplify. entirely dysfunctional ...

  Summary:
    Revision    Changes     Path
    1.2288.2.275+3  -0      rpm/CHANGES
    1.48.2.6    +197 -31    rpm/lib/rpmfc.c
    1.8.2.4     +16 -3      rpm/lib/rpmfc.h
    2.54.2.13   +1  -0      rpm/lib/rpmfi.h
    1.207.2.4   +23 -10     rpm/lib/rpminstall.c
    2.22.2.9    +7  -7      rpm/lib/rpmps.c
    2.18.2.6    +3  -2      rpm/lib/rpmps.h
    1.32.2.2    +1  -2      rpm/lib/rpmrollback.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.2288.2.274 -r1.2288.2.275 CHANGES
  --- rpm/CHANGES       4 Apr 2009 20:31:39 -0000       1.2288.2.274
  +++ rpm/CHANGES       4 Apr 2009 21:57:31 -0000       1.2288.2.275
  @@ -1,4 +1,7 @@
   5.1.7 -> 5.1.8:
  +    - jbj: enable the PLD dependency filtering.
  +    - jbj: PLD: rpm-pld-autodep: add run-time disablers, attempt miRE's 
instead.
  +    - jbj: PLD: rpm-pld-autodep: merge and simplify. entirely dysfunctional 
...
       - jbj: lib: start reducing random line noise, diff'ing against HEAD.
       - jbj: add prototypes to remove compiler warnings.
       - jbj: bury file actions into iosm, replace XFA_SKIPPING with a
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmfc.c
  ============================================================================
  $ cvs diff -u -r1.48.2.5 -r1.48.2.6 rpmfc.c
  --- rpm/lib/rpmfc.c   2 Apr 2009 20:43:58 -0000       1.48.2.5
  +++ rpm/lib/rpmfc.c   4 Apr 2009 21:57:31 -0000       1.48.2.6
  @@ -4,18 +4,21 @@
   
   #include <rpmio.h>
   #include <rpmcb.h>           /* XXX fnpyKey */
  +#include <rpmmg.h>
  +#include <argv.h>
  +#define      _MIRE_INTERNAL
  +#include <mire.h>
  +
   #include <rpmtag.h>
   #define      _RPMEVR_INTERNAL
   #include <rpmbuild.h>
  -#include <argv.h>
  -#include <rpmmg.h>
  -
  -#define      _RPMFC_INTERNAL
  -#include <rpmfc.h>
   
   #define      _RPMNS_INTERNAL
   #include <rpmns.h>
   
  +#define      _RPMFC_INTERNAL
  +#include <rpmfc.h>
  +
   #define      _RPMDS_INTERNAL
   #include <rpmds.h>
   #include <rpmfi.h>
  @@ -23,6 +26,12 @@
   #include "debug.h"
   
   /*...@access rpmds @*/
  +/*...@access miRE @*/
  +
  +/*...@unchecked@*/
  +static int _filter_values = 1;
  +/*...@unchecked@*/
  +static int _filter_execs = 1;
   
   /**
    */
  @@ -56,8 +65,8 @@
    */     
   /*...@null@*/
   static rpmiob getOutputFrom(/*...@null@*/ const char * dir, ARGV_t argv,
  -                        const char * writePtr, int writeBytesLeft,
  -                        int failNonZero)
  +                     const char * writePtr, size_t writeBytesLeft,
  +                     int failNonZero)
        /*...@globals h_errno, fileSystem, internalst...@*/
        /*...@modifies fileSystem, internalst...@*/
   {
  @@ -95,7 +104,7 @@
        }
        
        rpmlog(RPMLOG_DEBUG, D_("\texecv(%s) pid %d\n"),
  -                        argv[0], (unsigned)getpid());
  +                     argv[0], (unsigned)getpid());
   
        unsetenv("MALLOC_CHECK_");
        (void) execvp(argv[0], (char *const *)argv);
  @@ -122,7 +131,9 @@
       do {
        fd_set ibits, obits;
        struct timeval tv;
  -     int nfd, nbw, nbr;
  +     int nfd;
  +     ssize_t nbr;
  +     ssize_t nbw;
        int rc;
   
        done = 0;
  @@ -147,9 +158,10 @@
   
        /* Write any data to program */
        if (toProg[1] >= 0 && FD_ISSET(toProg[1], &obits)) {
  -          if (writePtr && writeBytesLeft > 0) {
  +       if (writePtr && writeBytesLeft > 0) {
            if ((nbw = write(toProg[1], writePtr,
  -                 (1024<writeBytesLeft) ? 1024 : writeBytesLeft)) < 0) {
  +                 ((size_t)1024<writeBytesLeft) ? (size_t)1024 : 
writeBytesLeft)) < 0)
  +         {
                if (errno != EAGAIN) {
                    perror("getOutputFrom()");
                    exit(EXIT_FAILURE);
  @@ -285,8 +297,8 @@
    */
   static char * rpmfcFileDep(/*...@returned@*/ char * buf, size_t ix,
                /*...@null@*/ rpmds ds)
  -     /*...@globals fileSystem, internalState @*/
  -     /*...@modifies buf, fileSystem, internalState @*/
  +     /*...@globals internalState @*/
  +     /*...@modifies buf, internalState @*/
        /*...@requires maxSet(buf) >= 0 @*/
   {
       rpmTag tagN = rpmdsTagN(ds);
  @@ -306,12 +318,82 @@
       }
   /*...@-nullpass@*/
       if (ds != NULL)
  -     sprintf(buf, "%08d%c %s %s 0x%08x", ix, deptype,
  +     sprintf(buf, "%08u%c %s %s 0x%08x", (unsigned)ix, deptype,
                rpmdsN(ds), rpmdsEVR(ds), rpmdsFlags(ds));
   /*...@=nullpass@*/
       return buf;
   };
   
  +/*...@null@*/
  +static void * rpmfcExpandRegexps(const char * str, int * nmirep)
  +     /*...@globals rpmGlobalMacroContext, h_errno, internalState @*/
  +     /*...@modifies *nmirep, rpmGlobalMacroContext, internalState @*/
  +{
  +    ARGV_t av = NULL;
  +    int ac = 0;
  +    miRE mire = NULL;
  +    int nmire = 0;
  +    const char * s;
  +    int xx;
  +    int i;
  +
  +    s = rpmExpand(str, NULL);
  +    if (s) {
  +     xx = poptParseArgvString(s, &ac, (const char ***)&av);
  +     s = _free(s);
  +    }
  +    if (ac == 0 || av == NULL || *av == NULL)
  +     goto exit;
  +
  +    for (i = 0; i < ac; i++) {
  +     xx = mireAppend(RPMMIRE_REGEX, 0, av[i], NULL, &mire, &nmire);
  +     /* XXX add REG_NOSUB? better error msg?  */
  +     if (xx) {
  +         rpmlog(RPMLOG_NOTICE, 
  +                     _("Compilation of pattern '%s'"
  +                     " (expanded from '%s') failed. Skipping ...\n"),
  +                     av[i], str);
  +         nmire--;    /* XXX does this actually skip?!? */
  +     }
  +    }
  +    if (nmire == 0)
  +     mire = mireFree(mire);
  +
  +exit:
  +    av = _free(av);
  +    if (nmirep)
  +     *nmirep = nmire;
  +    return mire;
  +}
  +
  +static int rpmfcMatchRegexps(void * mires, int nmire,
  +             const char * str, char deptype)
  +     /*...@modifies mires @*/
  +{
  +    miRE mire = mires;
  +    int xx;
  +    int i;
  +
  +    for (i = 0; i < nmire; i++) {
  +     rpmlog(RPMLOG_DEBUG, D_("Checking %c: '%s'\n"), deptype, str);
  +     if ((xx = mireRegexec(mire + i, str, 0)) < 0)
  +         continue;
  +     rpmlog(RPMLOG_NOTICE, _("Skipping %c: '%s'\n"), deptype, str);
  +     return 1;
  +    }
  +    return 0;
  +}
  +
  +/*...@null@*/
  +static void * rpmfcFreeRegexps(/*...@only@*/ void * mires, int nmire)
  +     /*...@modifies mires @*/
  +{
  +    miRE mire = mires;
  +/*...@-refcounttrans@*/
  +    return mireFreeAll(mire, nmire);
  +/*...@=refcounttrans@*/
  +}
  +
   /**
    * Run per-interpreter dependency helper.
    * @param fc         file classifier
  @@ -323,6 +405,8 @@
        /*...@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState 
@*/
        /*...@modifies fc, rpmGlobalMacroContext, fileSystem, internalState @*/
   {
  +    miRE mire = NULL;
  +    int nmire = 0;
       const char * fn = fc->fn[fc->ix];
       char buf[BUFSIZ];
       rpmiob iob_stdout = NULL;
  @@ -351,6 +435,8 @@
        depsp = &fc->provides;
        dsContext = RPMSENSE_FIND_PROVIDES;
        tagN = RPMTAG_PROVIDENAME;
  +     mire = fc->Pmires;
  +     nmire = fc->Pnmire;
        break;
       case 'R':
        if (fc->skipReq)
  @@ -359,6 +445,8 @@
        depsp = &fc->requires;
        dsContext = RPMSENSE_FIND_REQUIRES;
        tagN = RPMTAG_REQUIRENAME;
  +     mire = fc->Rmires;
  +     nmire = fc->Rnmire;
        break;
       }
       buf[sizeof(buf)-1] = '\0';
  @@ -403,6 +491,8 @@
   assert(EVR != NULL);
            }
   
  +         if (_filter_values && rpmfcMatchRegexps(mire, nmire, N, deptype))
  +             continue;
   
            /* Add tracking dependency for versioned Provides: */
            if (!fc->tracked && deptype == 'P' && *EVR != '\0') {
  @@ -436,6 +526,7 @@
   
   /**
    */
  +/*...@-nullassign@*/
   /*...@unchecked@*/ /*...@observer@*/
   static struct rpmfcTokens_s rpmfcTokens[] = {
     { "directory",             RPMFC_DIRECTORY|RPMFC_INCLUDE },
  @@ -535,6 +626,7 @@
   
     { NULL,                    RPMFC_BLACK }
   };
  +/*...@=nullassign@*/
   
   int rpmfcColoring(const char * fmstr)
   {
  @@ -651,7 +743,7 @@
       {        struct stat sb, * st = &sb;
        if (stat(fn, st) != 0)
            return -1;
  -     is_executable = (st->st_mode & (S_IXUSR|S_IXGRP|S_IXOTH));
  +     is_executable = (int)(st->st_mode & (S_IXUSR|S_IXGRP|S_IXOTH));
       }
   
       fp = fopen(fn, "r");
  @@ -685,6 +777,9 @@
        *se = '\0';
        se++;
   
  +     if (!_filter_values
  +      || (!fc->skipReq
  +       && !rpmfcMatchRegexps(fc->Rmires, fc->Rnmire, s, 'R')))
        if (is_executable) {
            /* Add to package requires. */
            ds = rpmdsSingle(RPMTAG_REQUIRENAME, s, "", RPMSENSE_FIND_REQUIRES);
  @@ -763,7 +858,6 @@
       return 0;
   }
   
  -
   /**
    * Merge provides/requires dependencies into a rpmfc container.
    * @param context    merge dependency set(s) container
  @@ -776,28 +870,39 @@
   {
       rpmfc fc = context;
       char buf[BUFSIZ];
  -    int rc = -1;
  +    int rc = 0;
   
   if (_rpmfc_debug < 0)
   fprintf(stderr, "*** rpmfcMergePR(%p, %p) %s\n", context, ds, 
tagName(rpmdsTagN(ds)));
       switch(rpmdsTagN(ds)) {
       default:
  +     rc = -1;
        break;
       case RPMTAG_PROVIDENAME:
  -     /* Add to package provides. */
  -     rc = rpmdsMerge(&fc->provides, ds);
  +     if (!_filter_values
  +      || (!fc->skipProv
  +       && !rpmfcMatchRegexps(fc->Pmires, fc->Pnmire, ds->N[0], 'P')))
  +     {
  +         /* Add to package provides. */
  +         rc = rpmdsMerge(&fc->provides, ds);
   
  -     /* Add to file dependencies. */
  -     buf[0] = '\0';
  -     rc = rpmfcSaveArg(&fc->ddict, rpmfcFileDep(buf, fc->ix, ds));
  +         /* Add to file dependencies. */
  +         buf[0] = '\0';
  +         rc = rpmfcSaveArg(&fc->ddict, rpmfcFileDep(buf, fc->ix, ds));
  +     }
        break;
       case RPMTAG_REQUIRENAME:
  -     /* Add to package requires. */
  -     rc = rpmdsMerge(&fc->requires, ds);
  +     if (!_filter_values
  +      || (!fc->skipReq
  +       && !rpmfcMatchRegexps(fc->Rmires, fc->Rnmire, ds->N[0], 'R')))
  +     {
  +         /* Add to package requires. */
  +         rc = rpmdsMerge(&fc->requires, ds);
   
  -     /* Add to file dependencies. */
  -     buf[0] = '\0';
  -     rc = rpmfcSaveArg(&fc->ddict, rpmfcFileDep(buf, fc->ix, ds));
  +         /* Add to file dependencies. */
  +         buf[0] = '\0';
  +         rc = rpmfcSaveArg(&fc->ddict, rpmfcFileDep(buf, fc->ix, ds));
  +     }
        break;
       }
       return rc;
  @@ -831,12 +936,14 @@
   /**
    * XXX Having two entries for rpmfcSCRIPT may be unnecessary duplication.
    */
  +/*...@-nullassign@*/
   /*...@unchecked@*/
   static struct rpmfcApplyTbl_s rpmfcApplyTable[] = {
       { rpmfcELF,              RPMFC_ELF },
       { rpmfcSCRIPT,   
(RPMFC_SCRIPT|RPMFC_PERL|RPMFC_PYTHON|RPMFC_LIBTOOL|RPMFC_PKGCONFIG|RPMFC_BOURNE|RPMFC_JAVA|RPMFC_PHP|RPMFC_MONO)
 },
       { NULL, 0 }
   };
  +/*...@=nullassign@*/
   
   rpmRC rpmfcApply(rpmfc fc)
   {
  @@ -844,6 +951,7 @@
       const char * s;
       char * se;
       rpmds ds;
  +    const char * fn;
       const char * N;
       const char * EVR;
       evrFlags Flags;
  @@ -857,6 +965,25 @@
       int xx;
       int skipping;
   
  +    miRE mire;
  +    int skipProv = fc->skipProv;
  +    int skipReq = fc->skipReq;
  +    int j;
  +
  +    if (_filter_execs) {
  +     fc->Pnmire = 0;
  +     fc->PFnmire = 0;
  +     fc->Rnmire = 0;
  +     fc->RFnmire = 0;
  +    
  +     fc->PFmires = rpmfcExpandRegexps("%{__noautoprovfiles}", &fc->PFnmire);
  +     fc->RFmires = rpmfcExpandRegexps("%{__noautoreqfiles}", &fc->RFnmire);
  +     fc->Pmires = rpmfcExpandRegexps("%{__noautoprov}", &fc->Pnmire);
  +     fc->Rmires = rpmfcExpandRegexps("%{__noautoreq}", &fc->Rnmire);
  +     rpmlog(RPMLOG_DEBUG, D_("%i _noautoprov patterns.\n"), fc->Pnmire);
  +     rpmlog(RPMLOG_DEBUG, D_("%i _noautoreq patterns.\n"), fc->Rnmire);
  +    }
  +
   /* Make sure something didn't go wrong previously! */
   assert(fc->fn != NULL);
       /* Generate package and per-file dependencies. */
  @@ -864,7 +991,7 @@
   
        /* XXX Insure that /usr/lib{,64}/python files are marked RPMFC_PYTHON */
        /* XXX HACK: classification by path is intrinsically stupid. */
  -     {   const char *fn = strstr(fc->fn[fc->ix], "/usr/lib");
  +     {   fn = strstr(fc->fn[fc->ix], "/usr/lib");
            if (fn) {
                fn += sizeof("/usr/lib")-1;
                if ((fn[0] == '3' && fn[1] == '2') || 
  @@ -879,10 +1006,45 @@
        for (fcat = rpmfcApplyTable; fcat->func != NULL; fcat++) {
            if (!(fc->fcolor->vals[fc->ix] & fcat->colormask))
                /*...@innercontinue@*/ continue;
  +
  +         if (_filter_execs) {
  +             fc->skipProv = skipProv;
  +             fc->skipReq = skipReq;
  +             if ((mire = fc->PFmires) != NULL)
  +             for (j = 0; j < fc->PFnmire; j++, mire++) {
  +                 fn = fc->fn[fc->ix] + fc->brlen;
  +                 if ((xx = mireRegexec(mire, fn, 0)) < 0)
  +                     /*...@innercontinue@*/ continue;
  +                 rpmlog(RPMLOG_NOTICE, _("skipping %s provides detection\n"),
  +                             fn);
  +                 fc->skipProv = 1;
  +                 /*...@innerbreak@*/ break;
  +             }
  +             if ((mire = fc->RFmires) != NULL)
  +             for (j = 0; j < fc->RFnmire; j++, mire++) {
  +                 fn = fc->fn[fc->ix] + fc->brlen;
  +                 if ((xx = mireRegexec(mire, fn, 0)) < 0)
  +                     /*...@innercontinue@*/ continue;
  +                 rpmlog(RPMLOG_NOTICE, _("skipping %s requires detection\n"),
  +                             fn);
  +                 fc->skipReq = 1;
  +                 /*...@innerbreak@*/ break;
  +             }
  +         }
  +
            xx = (*fcat->func) (fc);
        }
       }
   
  +    if (_filter_execs) {
  +     fc->PFmires = rpmfcFreeRegexps(fc->PFmires, fc->PFnmire);
  +     fc->RFmires = rpmfcFreeRegexps(fc->RFmires, fc->RFnmire);
  +     fc->Pmires = rpmfcFreeRegexps(fc->Pmires, fc->Pnmire);
  +     fc->Rmires = rpmfcFreeRegexps(fc->Rmires, fc->Rnmire);
  +    }
  +    fc->skipProv = skipProv;
  +    fc->skipReq = skipReq;
  +
       /* Generate per-file indices into package dependencies. */
       nddict = argvCount(fc->ddict);
       previx = -1;
  @@ -1053,7 +1215,7 @@
   
        /* Add (filtered) entry to sorted class dictionary. */
        fcolor = rpmfcColoring(se);
  -     xx = argiAdd(&fc->fcolor, fc->ix, fcolor);
  +     xx = argiAdd(&fc->fcolor, (int)fc->ix, fcolor);
   
        if (fcolor != RPMFC_WHITE && (fcolor & RPMFC_INCLUDE))
            xx = rpmfcSaveArg(&fc->cdict, se);
  @@ -1072,10 +1234,10 @@
   
        dav = argvSearch(fc->cdict, se, NULL);
        if (dav) {
  -         xx = argiAdd(&fc->fcdictx, fc->ix, (dav - fc->cdict));
  +         xx = argiAdd(&fc->fcdictx, (int)fc->ix, (dav - fc->cdict));
            fc->fknown++;
        } else {
  -         xx = argiAdd(&fc->fcdictx, fc->ix, 0);
  +         xx = argiAdd(&fc->fcdictx, (int)fc->ix, 0);
            fc->fwhite++;
        }
       }
  @@ -1108,6 +1270,7 @@
   
   /**
    */
  +/*...@-nullassign@*/
   /*...@unchecked@*/
   static struct DepMsg_s depMsgs[] = {
     { "Provides",              { "%{?__find_provides}", NULL, NULL, NULL },
  @@ -1145,6 +1308,7 @@
        0, -1 },
     { NULL,            { NULL, NULL, NULL, NULL },     0, 0, 0, 0, 0 }
   };
  +/*...@=nullassign@*/
   
   /*...@unchecked@*/
   static DepMsg_t DepMsgs = depMsgs;
  @@ -1282,6 +1446,7 @@
   
   /**
    */
  +/*...@-nullassign@*/
   /*...@unchecked@*/
   static struct DepMsg_s scriptMsgs[] = {
     { "Requires(pre)", { "%{?__scriptlet_requires}", NULL, NULL, NULL },
  @@ -1298,6 +1463,7 @@
        RPMSENSE_SCRIPT_POSTUN, 0 },
     { NULL,            { NULL, NULL, NULL, NULL },     0, 0, 0, 0, 0 }
   };
  +/*...@=nullassign@*/
   
   /*...@unchecked@*/
   static DepMsg_t ScriptMsgs = scriptMsgs;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmfc.h
  ============================================================================
  $ cvs diff -u -r1.8.2.3 -r1.8.2.4 rpmfc.h
  --- rpm/lib/rpmfc.h   29 Mar 2009 02:24:22 -0000      1.8.2.3
  +++ rpm/lib/rpmfc.h   4 Apr 2009 21:57:31 -0000       1.8.2.4
  @@ -99,6 +99,19 @@
       rpmiob iob_python;       /*!< concatenated list of python colored files. 
*/
       rpmiob iob_php;  /*!< concatenated list of php colored files. */
   
  +/*...@null@*/
  +    void * Pmires;   /*!< Filter patterns from %{__noautoprov} */
  +    int Pnmire;
  +/*...@null@*/
  +    void * PFmires;  /*!< Filter patterns from %{__noautoprov} */
  +    int PFnmire;
  +/*...@null@*/
  +    void * Rmires;   /*!< Filter patterns from %{__noautoreq} */
  +    int Rnmire;
  +/*...@null@*/
  +    void * RFmires;  /*!< Filter patterns from %{__noautoreqfile} */
  +    int RFnmire;
  +
   };
   
   /**
  @@ -171,7 +184,8 @@
    */
   /*...@-exportlocal@*/
   rpmRC rpmfcApply(rpmfc fc)
  -     /*...@modifies fc @*/;
  +     /*...@globals rpmGlobalMacroContext, h_errno, internalState @*/
  +     /*...@modifies fc, rpmGlobalMacroContext, internalState @*/;
   /*...@=exportlocal@*/
   
   /**
  @@ -182,8 +196,7 @@
    */
   rpmRC rpmfcGenerateDepends(void * specp, void * pkgp)
        /*...@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState 
@*/
  -     /*...@modifies *pkgp,
  -             rpmGlobalMacroContext, fileSystem, internalState @*/;
  +     /*...@modifies rpmGlobalMacroContext, fileSystem, internalState @*/;
   
   /**
    * Unreference a file classifier instance.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmfi.h
  ============================================================================
  $ cvs diff -u -r2.54.2.12 -r2.54.2.13 rpmfi.h
  --- rpm/lib/rpmfi.h   4 Apr 2009 20:31:40 -0000       2.54.2.12
  +++ rpm/lib/rpmfi.h   4 Apr 2009 21:57:31 -0000       2.54.2.13
  @@ -680,6 +680,7 @@
    * @param name               directory path
    * @return           NULL on error
    */
  +/*...@null@*/
   DIR * rpmfiOpendir(rpmfi fi, const char * name)
        /*...@globals fileSystem, internalState @*/
        /*...@modifies fi, fileSystem, internalState @*/;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpminstall.c
  ============================================================================
  $ cvs diff -u -r1.207.2.3 -r1.207.2.4 rpminstall.c
  --- rpm/lib/rpminstall.c      26 Mar 2009 20:10:00 -0000      1.207.2.3
  +++ rpm/lib/rpminstall.c      4 Apr 2009 21:57:31 -0000       1.207.2.4
  @@ -98,9 +98,9 @@
                        /*...@null@*/ fnpyKey key,
                        /*...@null@*/ void * data)
        /*...@globals rpmcliHashesCurrent, rpmcliProgressCurrent, 
rpmcliProgressTotal,
  -             fileSystem @*/
  +             rpmGlobalMacroContext, fileSystem @*/
        /*...@modifies rpmcliHashesCurrent, rpmcliProgressCurrent, 
rpmcliProgressTotal,
  -             fileSystem @*/
  +             rpmGlobalMacroContext, fileSystem @*/
   {
   /*...@-abstract -castexpose @*/
       Header h = (Header) arg;
  @@ -119,6 +119,16 @@
        if (filename == NULL || filename[0] == '\0')
            return NULL;
        fd = Fopen(filename, "r%{?_rpmgio}");
  +
  +       /* XXX Retry once to handle http:// server timeout reopen's. */
  +     if (Ferror(fd)) {
  +         int ut = urlPath(filename, NULL);
  +         if (ut == URL_IS_HTTP || ut == URL_IS_HTTPS) {
  +             /* XXX HACK: Fclose(fd) no workie here. */
  +             fd = Fopen(filename, "r%{?_rpmgio}");
  +         }
  +     }
  +
        /*...@-type@*/ /* FIX: still necessary? */
        if (fd == NULL || Ferror(fd)) {
            rpmlog(RPMLOG_ERR, _("open of %s failed: %s\n"), filename,
  @@ -311,8 +321,8 @@
   }
   
   static rpmRC rpmcliEraseElement(rpmts ts, const char * arg)
  -     /*...@globals fileSystem @*/
  -     /*...@modifies ts, fileSystem @*/
  +     /*...@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState 
@*/
  +     /*...@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/
   {
       rpmdbMatchIterator mi;
       Header h;
  @@ -338,8 +348,8 @@
   }
   
   static const char * rpmcliWalkFirst(ARGV_t av, miRE mire)
  -     /*...@globals fileSystem @*/
  -     /*...@modifies fileSystem @*/
  +     /*...@globals fileSystem, internalState @*/
  +     /*...@modifies mire, fileSystem, internalState @*/
   {
       /* XXX use global ftsOpts? */
       /* XXX changing FTS_LOGICAL to FTS_PHYSICAL prevents symlink follow. */
  @@ -398,8 +408,8 @@
   
   static const char * rpmcliInstallElementPath(/*...@unused@*/ rpmts ts,
                const char * arg)
  -     /*...@globals fileSystem @*/
  -     /*...@modifies fileSystem @*/
  +     /*...@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState 
@*/
  +     /*...@modifies rpmGlobalMacroContext, fileSystem, internalState @*/
   {
       /* A glob pattern list to match repository directories. */
       const char * fn = rpmExpand(
  @@ -473,6 +483,7 @@
       int numRPMS = 0;
       rpmRelocation relocations = NULL;
       rpmVSFlags vsflags, ovsflags;
  +    rpmRC rpmrc;
       int rc;
       int xx;
   
  @@ -534,7 +545,7 @@
        rpmioFtsOpts = (FTS_COMFOLLOW | FTS_LOGICAL | FTS_NOSTAT);
   /*...@=mods@*/
       rc = rpmgiSetArgs(gi, argv, rpmioFtsOpts, _giFlags);
  -    while (rpmgiNext(gi) == RPMRC_OK) {
  +    while ((rpmrc = rpmgiNext(gi)) == RPMRC_OK) {
        Header h;
   
        fn = _free(fn);
  @@ -555,7 +566,7 @@
            fn = nfn;
            /* XXX hack into rpmgi innards for now ... */
            h = rpmgiReadHeader(gi, fn);
  -         if (h)
  +         if (h != NULL)
                gi->h = headerLink(h);
            (void)headerFree(h);
            h = NULL;
  @@ -667,6 +678,8 @@
            numFailed += (rc < 0 ? numRPMS : rc);
       }
   
  +    /* XXX exit if the iteration failed. */
  +    if (rpmrc == RPMRC_FAIL) numFailed = numRPMS;
       if (numFailed) goto exit;
   
   exit:
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmps.c
  ============================================================================
  $ cvs diff -u -r2.22.2.8 -r2.22.2.9 rpmps.c
  --- rpm/lib/rpmps.c   2 Apr 2009 19:12:36 -0000       2.22.2.8
  +++ rpm/lib/rpmps.c   4 Apr 2009 21:57:32 -0000       2.22.2.9
  @@ -397,35 +397,35 @@
        num = ps->numProblems - 1;
       if (num >= ps->numProblems)
           return(NULL);
  -    return(ps->probs + num);
  +    return (ps->probs + num);
   }
   
   char * rpmProblemGetPkgNEVR(rpmProblem prob)
   {
  -    return(prob->pkgNEVR);
  +    return prob->pkgNEVR;
   }
   
   char * rpmProblemGetAltNEVR(rpmProblem prob)
   {
  -    return(prob->altNEVR);
  +    return prob->altNEVR;
   }
   
   char * rpmProblemGetStr(rpmProblem prob)
   {
  -    return(prob->str1);
  +    return prob->str1;
   }
   
   uint64_t rpmProblemGetLong(rpmProblem prob)
   {
  -    return(prob->ulong1);
  +    return prob->ulong1;
   }
   
   rpmProblemType rpmProblemGetType(rpmProblem prob)
   {
  -    return(prob->type);
  +    return prob->type;
   }
   
   fnpyKey rpmProblemKey(rpmProblem prob)
   {
  -    return(prob->key);
  +    return prob->key;
   }
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmps.h
  ============================================================================
  $ cvs diff -u -r2.18.2.5 -r2.18.2.6 rpmps.h
  --- rpm/lib/rpmps.h   27 Mar 2009 21:18:19 -0000      2.18.2.5
  +++ rpm/lib/rpmps.h   4 Apr 2009 21:57:32 -0000       2.18.2.6
  @@ -156,7 +156,7 @@
    * @return           problem set iterator
    */
   rpmpsi rpmpsInitIterator(rpmps ps)
  -     /*...@*/;
  +     /*...@modifies ps @*/;
   
   /**
    * Destroy problem set iterator.
  @@ -164,7 +164,7 @@
    * @return           problem set iterator (NULL)
    */
   rpmpsi rpmpsFreeIterator(rpmpsi psi)
  -     /*...@*/;
  +     /*...@modifies psi @*/;
   
   /**
    * Return next problem set iterator index
  @@ -179,6 +179,7 @@
    * @param psi                problem set iterator
    * @return           current rpmProblem 
    */
  +/*...@observer@*/
   rpmProblem rpmpsProblem(rpmpsi psi)
        /*...@*/;
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmrollback.c
  ============================================================================
  $ cvs diff -u -r1.32.2.1 -r1.32.2.2 rpmrollback.c
  --- rpm/lib/rpmrollback.c     26 Mar 2009 20:10:00 -0000      1.32.2.1
  +++ rpm/lib/rpmrollback.c     4 Apr 2009 21:57:32 -0000       1.32.2.2
  @@ -58,7 +58,7 @@
   {
       IDTX idtx = xcalloc(1, sizeof(*idtx));
       idtx->delta = 10;
  -    idtx->size = sizeof(*((IDT)0));
  +    idtx->size = (int)sizeof(*((IDT)0));
       return idtx;
   }
   
  @@ -531,7 +531,6 @@
        (void) rpmtsSetFlags(ts, transFlags);
        (void) rpmtsSetDFlags(ts, depFlags);
        ts->probs = rpmpsFree(ts->probs);
  -     ts->probs = rpmpsCreate();
   
        /* Install the previously erased packages for this transaction. 
         */
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to