fix: restore upgrade functionality with colors.
authorjbj <devnull@localhost>
Wed, 1 Jan 2003 16:54:04 +0000 (16:54 +0000)
committerjbj <devnull@localhost>
Wed, 1 Jan 2003 16:54:04 +0000 (16:54 +0000)
CVS patchset: 5991
CVS date: 2003/01/01 16:54:04

lib/depends.c
lib/psm.c
lib/rpmds.h
lib/rpmte.c
lib/rpmte.h
lib/rpmts.h
lib/transaction.c
rpmdb/rpmdb.c

index 8ce4cde..b4fbdb7 100644 (file)
@@ -228,6 +228,17 @@ int rpmtsAddInstallElement(rpmts ts, Header h,
            goto exit;
     }
 
+    {  rpmdbMatchIterator mi;
+       Header oh;
+
+       mi = rpmtsInitIterator(ts, RPMTAG_PROVIDENAME, rpmteN(p), 0);
+       while((oh = rpmdbNextIterator(mi)) != NULL) {
+           if (rpmVersionCompare(h, oh))
+               xx = removePackage(ts, oh, rpmdbGetIteratorOffset(mi), pkgKey);
+       }
+       mi = rpmdbFreeIterator(mi);
+    }
+
     obsoletes = rpmdsLink(rpmteDS(p, RPMTAG_OBSOLETENAME), "Obsoletes");
     obsoletes = rpmdsInit(obsoletes);
     if (obsoletes != NULL)
index 1040259..9595585 100644 (file)
--- a/lib/psm.c
+++ b/lib/psm.c
@@ -1407,9 +1407,6 @@ rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage)
     const rpmts ts = psm->ts;
     rpmfi fi = psm->fi;
     HGE_t hge = fi->hge;
-#ifdef DYING
-    HME_t hme = fi->hme;
-#endif
     HFD_t hfd = (fi->hfd ? fi->hfd : headerFreeData);
     rpmRC rc = psm->rc;
     int saveerrno;
@@ -1451,7 +1448,7 @@ assert(psm->mi == NULL);
 
            while ((psm->oh = rpmdbNextIterator(psm->mi))) {
                fi->record = rpmdbGetIteratorOffset(psm->mi);
-                   psm->oh = NULL;
+               psm->oh = NULL;
                /*@loopbreak@*/ break;
            }
            psm->mi = rpmdbFreeIterator(psm->mi);
index ec44887..8530291 100644 (file)
@@ -233,6 +233,40 @@ int rpmdsNoPromote(/*@null@*/ const rpmds ds)
        /*@*/;
 
 /**
+ * Return current dependency color.
+ * @param ds           dependency set
+ * @return             current dependency color
+ */
+uint_32 rpmdsColor(/*@null@*/ const rpmds ds)
+       /*@*/;
+
+/**
+ * Return current dependency color.
+ * @param ds           dependency set
+ * @param color                new dependency color
+ * @return             previous dependency color
+ */
+uint_32 rpmdsSetColor(/*@null@*/ const rpmds ds, uint_32 color)
+       /*@modifies ds @*/;
+
+/**
+ * Return current dependency file refs.
+ * @param ds           dependency set
+ * @return             current dependency file refs, -1 on global
+ */
+int_32 rpmdsRefs(/*@null@*/ const rpmds ds)
+       /*@*/;
+
+/**
+ * Return current dependency color.
+ * @param ds           dependency set
+ * @param refs         new dependency refs
+ * @return             previous dependency refs
+ */
+int_32 rpmdsSetRefs(/*@null@*/ const rpmds ds, int_32 refs)
+       /*@modifies ds @*/;
+
+/**
  * Set "Don't promote Epoch:" flag.
  * @param ds           dependency set
  * @param nopromote    Should an unspecified Epoch: be treated as Epoch: 0?
index 1aeb9d4..ced6690 100644 (file)
@@ -501,6 +501,7 @@ assert (ix < Count);
        (void) rpmdsSetRefs(ds, val);
     }
 }
+
 int rpmtsiOc(rpmtsi tsi)
 {
     return tsi->ocsave;
index edb1c23..b209014 100644 (file)
@@ -97,7 +97,7 @@ struct rpmte_s {
 /*@refcounted@*/ /*@null@*/
     rpmfi fi;                  /*!< File information. */
 
-    uint_32 color;             /*!< Bit(s) from package dependencies */
+    uint_32 color;             /*!< Color bit(s) from package dependencies */
 
 /*@exposed@*/ /*@dependent@*/ /*@null@*/
     fnpyKey key;               /*!< (TR_ADDED) Retrieval key. */
index dc04f2e..9cc09f6 100644 (file)
@@ -769,6 +769,23 @@ Spec rpmtsSetSpec(rpmts ts, /*@null@*/ Spec spec)
 rpmte rpmtsRelocateElement(rpmts ts)
        /*@*/;
 
+/**
+ * Retrieve color bits of transaction set.
+ * @param ts           transaction set
+ * @return             color bits
+ */
+uint_32 rpmtsColor(rpmts ts)
+       /*@*/;
+
+/**
+ * Set color bits of transaction set.
+ * @param ts           transaction set
+ * @param color                new color bits
+ * @return             previous color bits
+ */
+uint_32 rpmtsSetColor(rpmts ts, uint_32 color)
+       /*@modifies ts @*/;
+
 /** \ingroup rpmts
  * Set current relocate transaction element.
  * @param ts           transaction set
index e42dfdc..5c64688 100644 (file)
@@ -1076,13 +1076,7 @@ rpmMessage(RPMMESS_DEBUG, _("sanity checking %d elements\n"), rpmtsNElements(ts)
            mi = rpmdbFreeIterator(mi);
        }
 
-#ifdef DYING
-       /* XXX multilib should not display "already installed" problems */
-       if (!(rpmtsFilterFlags(ts) & RPMPROB_FILTER_REPLACEPKG) && !rpmteColor(p))
-#else
-       if (!(rpmtsFilterFlags(ts) & RPMPROB_FILTER_REPLACEPKG) && !tscolor)
-#endif
-       {
+       if (!(rpmtsFilterFlags(ts) & RPMPROB_FILTER_REPLACEPKG)) {
            mi = rpmtsInitIterator(ts, RPMTAG_NAME, rpmteN(p), 0);
            xx = rpmdbSetIteratorRE(mi, RPMTAG_EPOCH, RPMMIRE_DEFAULT,
                                rpmteE(p));
index 1081100..a5da7f7 100644 (file)
@@ -1278,9 +1278,9 @@ if (rc == 0)
 
            prevoff = offset;
            i++;
-           offset = dbiIndexRecordOffset(allMatches, i);
-       } while (i < allMatches->count && 
-               (i == 0 || offset == prevoff));
+           if (i < allMatches->count)
+               offset = dbiIndexRecordOffset(allMatches, i);
+       } while (i < allMatches->count && offset == prevoff);
 
        baseNames = hfd(baseNames, bnt);
        dirNames = hfd(dirNames, dnt);