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

  Server: rpm5.org                         Name:   Per Øyvind Karlsen
  Root:   /v/rpm/cvs                       Email:  pkarl...@rpm5.org
  Module: rpm                              Date:   19-Oct-2011 15:00:53
  Branch: rpm-5_3                          Handle: 2011101913005201

  Modified files:           (Branch: rpm-5_3)
    rpm                     CHANGES
    rpm/lib                 transaction.c

  Log:
    fix different epoch being ignored when comparing two packages with
    same NVRA.

  Summary:
    Revision    Changes     Path
    1.3296.2.251+2  -0      rpm/CHANGES
    1.428.2.8   +22 -16     rpm/lib/transaction.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.3296.2.250 -r1.3296.2.251 CHANGES
  --- rpm/CHANGES       15 Oct 2011 12:58:19 -0000      1.3296.2.250
  +++ rpm/CHANGES       19 Oct 2011 13:00:52 -0000      1.3296.2.251
  @@ -1,4 +1,6 @@
   5.3.12 -> 5.3.13
  +    - proyvind: fix different epoch being ignored when comparing two packages
  +     with same NVRA.
       - proyvind: add %ruby_sitedir and %ruby_vendor macros.
       - proyvind: really always invoke %clean at end
       - proyvind: add sparc64v2 arch to %sparcx.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/transaction.c
  ============================================================================
  $ cvs diff -u -r1.428.2.7 -r1.428.2.8 transaction.c
  --- rpm/lib/transaction.c     12 Jul 2011 10:44:41 -0000      1.428.2.7
  +++ rpm/lib/transaction.c     19 Oct 2011 13:00:53 -0000      1.428.2.8
  @@ -1169,28 +1169,34 @@
                RPMMIRE_STRCMP, rpmteNEVRA(p), &keys);
            nkeys = argvCount(keys);
   
  -#if defined(RPM_VENDOR_MANDRIVA)
            /* mdvbz: #63711
  -          * workaround for distepoch never being added to RPMTAG_NVRA yet,
  -          * leading to packages of same EVRA but with different distepoch
  +          * workaround for epoch & distepoch not being part of RPMTAG_NVRA,
  +          * leading to packages of same VRA but with different epoch or 
distepoch
             * being treated as the same package */
            if (nkeys > 0) {
  -             int i;
  -             for (i = 0; i < nkeys; i++) {
  -                 rpmmi mi = rpmtsInitIterator(ts, RPMTAG_NVRA, keys[i], 0);
  -                 Header h;
  -                 while ((h = rpmmiNext(mi)) != NULL) {
  -                     HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
  -                     he->tag = RPMTAG_DISTEPOCH;
  -                     xx = headerGet(h, he, 0);
  -                     if (strcmp(he->p.str ? he->p.str : "", rpmteD(p) ? 
rpmteD(p) : ""))
  -                         nkeys--;
  -                     he->p.ptr = _free(he->p.ptr);
  +             int i, t;
  +             rpmTag tags[2] = { RPMTAG_EPOCH, RPMTAG_DISTEPOCH };
  +             for (t = 0; t < 2; t++) {
  +                 for (i = 0; i < nkeys; i++) {
  +                     rpmmi mi = rpmtsInitIterator(ts, RPMTAG_NVRA, keys[i], 
0);
  +                     Header h;
  +                     while ((h = rpmmiNext(mi)) != NULL) {
  +                         HE_t he = memset(alloca(sizeof(*he)), 0, 
sizeof(*he));
  +                         const char *val = NULL;
  +                         he->tag = tags[t];
  +                         xx = headerGet(h, he, 0);
  +                         if (he->tag == RPMTAG_EPOCH)
  +                             val = rpmteE(p);
  +                         else if (he->tag == RPMTAG_DISTEPOCH)
  +                             val = rpmteD(p);
  +                         if (strcmp(he->p.str ? he->p.str : "", val ? val : 
""))
  +                             nkeys--;
  +                         he->p.ptr = _free(he->p.ptr);
  +                     }
  +                     mi = rpmmiFree(mi);
                    }
  -                 mi = rpmmiFree(mi);
                }
            }
  -#endif
            if (nkeys > 0)
                rpmpsAppend(ps, RPMPROB_PKG_INSTALLED,
                        rpmteNEVR(p), rpmteKey(p),
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to