1st crack at colored installs.
authorjbj <devnull@localhost>
Tue, 31 Dec 2002 01:23:03 +0000 (01:23 +0000)
committerjbj <devnull@localhost>
Tue, 31 Dec 2002 01:23:03 +0000 (01:23 +0000)
CVS patchset: 5989
CVS date: 2002/12/31 01:23:03

21 files changed:
lib/depends.c
lib/fsm.c
lib/psm.c
lib/query.c
lib/rpmal.c
lib/rpmal.h
lib/rpmds.c
lib/rpmds.h
lib/rpmfi.c
lib/rpmlib.h
lib/rpmte.c
lib/rpmte.h
lib/rpmts.c
lib/rpmts.h
lib/transaction.c
lib/verify.c
python/rpmal-py.c
python/rpmte-py.c
python/rpmts-py.c
rpm.spec.in
rpmpopt.in

index 1ed60f2..56fd404 100644 (file)
@@ -127,7 +127,8 @@ static int removePackage(rpmts ts, Header h, int dboffset,
 int rpmtsAddInstallElement(rpmts ts, Header h,
                        fnpyKey key, int upgrade, rpmRelocation * relocs)
 {
-    HGE_t hge = (HGE_t)headerGetEntryMinMemory;
+    uint_32 tscolor = rpmtsColor(ts);
+    uint_32 dscolor;
     int isSource;
     int duplicate = 0;
     rpmtsi pi; rpmte p;
@@ -138,7 +139,6 @@ int rpmtsAddInstallElement(rpmts ts, Header h,
     int ec = 0;
     int rc;
     int oc;
-uint_32 *mlmp, multiLibMask, oldMultiLibMask;
 
     /*
      * Check for previously added versions with the same name.
@@ -201,7 +201,7 @@ uint_32 *mlmp, multiLibMask, oldMultiLibMask;
     
     pkgKey = rpmalAdd(&ts->addedPackages, pkgKey, rpmteKey(p),
                        rpmteDS(p, RPMTAG_PROVIDENAME),
-                       rpmteFI(p, RPMTAG_BASENAMES));
+                       rpmteFI(p, RPMTAG_BASENAMES), tscolor);
     if (pkgKey == RPMAL_NOMATCH) {
 /*@-boundswrite@*/
        ts->order[oc] = rpmteFree(ts->order[oc]);
@@ -211,26 +211,6 @@ uint_32 *mlmp, multiLibMask, oldMultiLibMask;
     }
     (void) rpmteSetAddedKey(p, pkgKey);
 
-#ifdef NOYET
-    /* XXX MULTLIBTODO: search over ts->order, not ts->addedPackages */
-
-    multiLibMask = 0;
-    if (hge(h, RPMTAG_MULTILIBMASK, NULL, (void **) &mlmp, NULL)
-    && mlmp != NULL)
-       multiLibMask = *mlmp;
-
-    if (multiLibMask) {
-       for (i = 0; i < ts->orderCount - 1; i++) {
-           if (!strcmp (rpmteN(p), al->list[i].name)
-               && hge(al->list[i].h, RPMTAG_MULTILIBMASK, NULL,
-                                 (void **) &mlmp, NULL)
-               && !rpmVersionCompare(p->h, al->list[i].h)
-               && *mlmp && !(*mlmp & multiLibMask))
-                   (void) rpmteSetMultiLib(p, multiLibMask);
-       }
-    }
-#endif
-
     if (!duplicate) {
        ts->numAddedPackages++;
     }
@@ -248,35 +228,6 @@ uint_32 *mlmp, multiLibMask, oldMultiLibMask;
            goto exit;
     }
 
-/*@-boundsread@*/
-    {  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);
-           else {
-
-               mlmp = NULL;
-               oldMultiLibMask = 0;
-               if (hge(oh, RPMTAG_MULTILIBMASK, NULL, (void **) &mlmp, NULL))
-                   oldMultiLibMask = *mlmp;
-               mlmp = NULL;
-               multiLibMask = 0;
-               if (hge(h, RPMTAG_MULTILIBMASK, NULL, (void **) &mlmp, NULL))
-                   multiLibMask = *mlmp;
-               if (oldMultiLibMask && multiLibMask
-                && !(oldMultiLibMask & multiLibMask))
-               {
-                   (void) rpmteSetMultiLib(p, multiLibMask);
-               }
-           }
-       }
-       mi = rpmdbFreeIterator(mi);
-    }
-/*@=boundsread@*/
-
     obsoletes = rpmdsLink(rpmteDS(p, RPMTAG_OBSOLETENAME), "Obsoletes");
     obsoletes = rpmdsInit(obsoletes);
     if (obsoletes != NULL)
@@ -286,6 +237,11 @@ uint_32 *mlmp, multiLibMask, oldMultiLibMask;
        if ((Name = rpmdsN(obsoletes)) == NULL)
            continue;   /* XXX can't happen */
 
+       /* Ignore colored obsoletes not in our rainbow. */
+       dscolor = rpmdsColor(obsoletes);
+       if (tscolor && dscolor && !(tscolor & dscolor))
+           continue;
+
        /* XXX avoid self-obsoleting packages. */
        if (!strcmp(rpmteN(p), Name))
                continue;
@@ -569,20 +525,20 @@ exit:
  * @param requires     Requires: dependencies (or NULL)
  * @param conflicts    Conflicts: dependencies (or NULL)
  * @param depName      dependency name to filter (or NULL)
- * @param multiLib     skip multilib colored dependencies?
+ * @param tscolor      color bits for transaction set (0 disables)
  * @param adding       dependency is from added package set?
  * @return             0 no problems found
  */
 static int checkPackageDeps(rpmts ts, const char * pkgNEVR,
                /*@null@*/ rpmds requires, /*@null@*/ rpmds conflicts,
-               /*@null@*/ const char * depName, uint_32 multiLib, int adding)
+               /*@null@*/ const char * depName, uint_32 tscolor, int adding)
        /*@globals rpmGlobalMacroContext,
                fileSystem, internalState @*/
        /*@modifies ts, requires, conflicts, rpmGlobalMacroContext,
                fileSystem, internalState */
 {
+    uint_32 dscolor;
     const char * Name;
-    int_32 Flags;
     int rc;
     int ourrc = 0;
 
@@ -597,11 +553,9 @@ static int checkPackageDeps(rpmts ts, const char * pkgNEVR,
        if (depName != NULL && strcmp(depName, Name))
            continue;
 
-       Flags = rpmdsFlags(requires);
-
-       /* If this requirement comes from the core package only, not libraries,
-          then if we're installing the libraries only, don't count it in. */
-       if (multiLib && !isDependsMULTILIB(Flags))
+       /* Ignore colored requires not in our rainbow. */
+       dscolor = rpmdsColor(requires);
+       if (tscolor && dscolor && !(tscolor & dscolor))
            continue;
 
        rc = unsatisfiedDepend(ts, requires, adding);
@@ -641,11 +595,9 @@ static int checkPackageDeps(rpmts ts, const char * pkgNEVR,
        if (depName != NULL && strcmp(depName, Name))
            continue;
 
-       Flags = rpmdsFlags(conflicts);
-
-       /* If this requirement comes from the core package only, not libraries,
-          then if we're installing the libraries only, don't count it in. */
-       if (multiLib && !isDependsMULTILIB(Flags))
+       /* Ignore colored conflicts not in our rainbow. */
+       dscolor = rpmdsColor(conflicts);
+       if (tscolor && dscolor && !(tscolor & dscolor))
            continue;
 
        rc = unsatisfiedDepend(ts, conflicts, adding);
@@ -1172,11 +1124,7 @@ int rpmtsOrder(rpmts ts)
     int nrescans = 10;
     int _printed = 0;
     char deptypechar;
-#ifdef DYING
-    int oType = TR_ADDED;
-#else
     int oType = 0;
-#endif
     int treex;
     int depth;
     int qlen;
@@ -1207,7 +1155,6 @@ int rpmtsOrder(rpmts ts)
     /* Record all relations. */
     rpmMessage(RPMMESS_DEBUG, _("========== recording tsort relations\n"));
     pi = rpmtsiInit(ts);
-    /* XXX Only added packages are ordered (for now). */
     while ((p = rpmtsiNext(pi, oType)) != NULL) {
 
        if ((requires = rpmteDS(p, RPMTAG_REQUIRENAME)) == NULL)
@@ -1600,6 +1547,7 @@ assert(newOrderCount == ts->orderCount);
 
 int rpmtsCheck(rpmts ts)
 {
+    uint_32 tscolor = rpmtsColor(ts);
     rpmdbMatchIterator mi = NULL;
     rpmtsi pi = NULL; rpmte p;
     int closeatexit = 0;
@@ -1626,12 +1574,13 @@ int rpmtsCheck(rpmts ts)
     while ((p = rpmtsiNext(pi, TR_ADDED)) != NULL) {
        rpmds provides;
 
-        rpmMessage(RPMMESS_DEBUG,  "========== +++ %s\n" , rpmteNEVR(p));
+        rpmMessage(RPMMESS_DEBUG,  "========== +++ %s %s/%s 0x%x\n",
+               rpmteNEVR(p), rpmteA(p), rpmteO(p), rpmteColor(p));
        rc = checkPackageDeps(ts, rpmteNEVR(p),
                        rpmteDS(p, RPMTAG_REQUIRENAME),
                        rpmteDS(p, RPMTAG_CONFLICTNAME),
                        NULL,
-                       rpmteMultiLib(p), 1);
+                       tscolor, 1);
        if (rc)
            goto exit;
 
@@ -1673,7 +1622,8 @@ int rpmtsCheck(rpmts ts)
        rpmds provides;
        rpmfi fi;
 
-       rpmMessage(RPMMESS_DEBUG,  "========== --- %s\n" , rpmteNEVR(p));
+       rpmMessage(RPMMESS_DEBUG,  "========== --- %s %s/%s 0x%x\n",
+               rpmteNEVR(p), rpmteA(p), rpmteO(p), rpmteColor(p));
 
 #if defined(DYING) || defined(__LCLINT__)
        /* XXX all packages now have Provides: name = version-release */
index 9ca62a0..7f777d2 100644 (file)
--- a/lib/fsm.c
+++ b/lib/fsm.c
@@ -619,8 +619,6 @@ int fsmMapPath(FSM_t fsm)
        switch (fsm->action) {
        case FA_SKIP:
            break;
-       case FA_SKIPMULTILIB:   /* XXX RPMFILE_STATE_MULTILIB? */
-           break;
        case FA_UNKNOWN:
            break;
 
@@ -641,6 +639,11 @@ assert(rpmteType(fi->te) == TR_ADDED);
                fi->fstates[i] = RPMFILE_STATE_NETSHARED;
            break;
 
+       case FA_SKIPCOLOR:
+           if (fi->fstates && rpmteType(fi->te) == TR_ADDED)
+               fi->fstates[i] = RPMFILE_STATE_WRONGCOLOR;
+           break;
+
        case FA_BACKUP:
            if (!(fsm->fflags & RPMFILE_GHOST)) /* XXX Don't if %ghost file. */
            switch (rpmteType(fi->te)) {
@@ -2309,7 +2312,7 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
     case FA_ERASE:     return "erase";
     case FA_SKIPNSTATE: return "skipnstate";
     case FA_SKIPNETSHARED: return "skipnetshared";
-    case FA_SKIPMULTILIB: return "skipmultilib";
+    case FA_SKIPCOLOR: return "skipcolor";
     default:           return "???";
     }
     /*@notreached@*/
index 017580b..4d8bde9 100644 (file)
--- a/lib/psm.c
+++ b/lib/psm.c
@@ -154,6 +154,7 @@ static int rpmInstallLoadMacros(rpmfi fi, Header h)
     return 0;
 }
 
+#ifdef DYING
 /**
  * Copy file data from h to newH.
  * @param fi           transaction element file info
@@ -206,7 +207,7 @@ static rpmRC mergeFiles(rpmfi fi, Header h, Header newH)
     fileSize = *fileSizes;
     xx = hge(newH, RPMTAG_FILESIZES, NULL, (void **) &fileSizes, &count);
     for (i = 0, fc = 0; i < count; i++)
-       if (actions[i] != FA_SKIPMULTILIB) {
+       if (actions[i] != FA_SKIPCOLOR) {
            fc++;
            fileSize += fileSizes[i];
        }
@@ -221,7 +222,7 @@ static rpmRC mergeFiles(rpmfi fi, Header h, Header newH)
        case RPM_INT8_TYPE:
            newdata = xcalloc(fc, sizeof(int_8));
            for (j = 0, k = 0; j < count; j++)
-               if (actions[j] != FA_SKIPMULTILIB)
+               if (actions[j] != FA_SKIPCOLOR)
                        ((int_8 *) newdata)[k++] = ((int_8 *) data)[j];
            xx = headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fc);
            free (newdata);
@@ -229,7 +230,7 @@ static rpmRC mergeFiles(rpmfi fi, Header h, Header newH)
        case RPM_INT16_TYPE:
            newdata = xcalloc(fc, sizeof(int_16));
            for (j = 0, k = 0; j < count; j++)
-               if (actions[j] != FA_SKIPMULTILIB)
+               if (actions[j] != FA_SKIPCOLOR)
                    ((int_16 *) newdata)[k++] = ((int_16 *) data)[j];
            xx = headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fc);
            free (newdata);
@@ -237,7 +238,7 @@ static rpmRC mergeFiles(rpmfi fi, Header h, Header newH)
        case RPM_INT32_TYPE:
            newdata = xcalloc(fc, sizeof(int_32));
            for (j = 0, k = 0; j < count; j++)
-               if (actions[j] != FA_SKIPMULTILIB)
+               if (actions[j] != FA_SKIPCOLOR)
                    ((int_32 *) newdata)[k++] = ((int_32 *) data)[j];
            xx = headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fc);
            free (newdata);
@@ -245,7 +246,7 @@ static rpmRC mergeFiles(rpmfi fi, Header h, Header newH)
        case RPM_STRING_ARRAY_TYPE:
            newdata = xcalloc(fc, sizeof(char *));
            for (j = 0, k = 0; j < count; j++)
-               if (actions[j] != FA_SKIPMULTILIB)
+               if (actions[j] != FA_SKIPCOLOR)
                    ((char **) newdata)[k++] = ((char **) data)[j];
            xx = headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fc);
            free (newdata);
@@ -270,7 +271,7 @@ static rpmRC mergeFiles(rpmfi fi, Header h, Header newH)
     dirCount = dirNamesCount;
     newdata = xcalloc(fc, sizeof(*newDirIndexes));
     for (i = 0, k = 0; i < count; i++) {
-       if (actions[i] == FA_SKIPMULTILIB)
+       if (actions[i] == FA_SKIPCOLOR)
            continue;
        for (j = 0; j < dirCount; j++)
            if (!strcmp(dirNames[j], newDirNames[newDirIndexes[i]]))
@@ -316,7 +317,11 @@ static rpmRC mergeFiles(rpmfi fi, Header h, Header newH)
                    }
        }
        for (j = 0, k = 0; j < newCount; j++) {
+#ifdef DYING
            if (!newNames[j] || !isDependsMULTILIB(newFlags[j]))
+#else
+           if (!newNames[j])
+#endif
                /*@innercontinue@*/ continue;
            if (j != k) {
                newNames[k] = newNames[j];
@@ -340,6 +345,7 @@ static rpmRC mergeFiles(rpmfi fi, Header h, Header newH)
     return RPMRC_OK;
 }
 /*@=boundswrite@*/
+#endif
 
 /**
  * Mark files in database shared with this package as "replaced".
@@ -1594,7 +1600,9 @@ 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;
@@ -1636,9 +1644,11 @@ assert(psm->mi == NULL);
 
            while ((psm->oh = rpmdbNextIterator(psm->mi))) {
                fi->record = rpmdbGetIteratorOffset(psm->mi);
+#ifdef DYING
                if (rpmtsFlags(ts) & RPMTRANS_FLAG_MULTILIB)
                    psm->oh = headerCopy(psm->oh);
                else
+#endif
                    psm->oh = NULL;
                /*@loopbreak@*/ break;
            }
@@ -2046,6 +2056,7 @@ psm->te->h = headerLink(fi->h);
            xx = headerAddEntry(fi->h, RPMTAG_INSTALLTIME, RPM_INT32_TYPE,
                                &installTime, 1);
 
+#ifdef DYING
            if (rpmtsFlags(ts) & RPMTRANS_FLAG_MULTILIB) {
                uint_32 multiLib, * newMultiLib, * p;
 
@@ -2062,7 +2073,7 @@ psm->te->h = headerLink(fi->h);
                rc = mergeFiles(fi, psm->oh, fi->h);
                if (rc) break;
            }
-
+#endif
 
            /*
             * If this package has already been installed, remove it from
index da623df..2df8d20 100644 (file)
@@ -254,6 +254,9 @@ int showQueryPackage(QVA_t qva, /*@unused@*/ rpmts ts, Header h)
            case RPMFILE_STATE_NETSHARED:
                te = stpcpy(te, _("net shared    "));
                /*@switchbreak@*/ break;
+           case RPMFILE_STATE_WRONGCOLOR:
+               te = stpcpy(te, _("wrong color   "));
+               /*@switchbreak@*/ break;
            case RPMFILE_STATE_MISSING:
                te = stpcpy(te, _("(no state)    "));
                /*@switchbreak@*/ break;
index 963e2a1..c825dbe 100644 (file)
@@ -33,9 +33,7 @@ struct availablePackage_s {
 /*@refcounted@*/ /*@null@*/
     rpmfi fi;                  /*!< File info set. */
 
-#ifdef DYING
-    uint_32 multiLib;  /* MULTILIB */
-#endif
+    uint_32 tscolor;           /*!< Transaction color bits. */
 
 /*@exposed@*/ /*@dependent@*/ /*@null@*/
     fnpyKey key;               /*!< Associated file name/python object */
@@ -84,7 +82,7 @@ struct fileIndexEntry_s {
     const char * baseName;     /*!< File basename. */
     int baseNameLen;
     alNum pkgNum;              /*!< Containing package index. */
-    int fileFlags;     /* MULTILIB */
+    uint_32 ficolor;
 };
 
 typedef /*@abstract@*/ struct dirInfo_s *              dirInfo;
@@ -112,6 +110,7 @@ struct rpmal_s {
     int delta;                 /*!< Delta for pkg list reallocation. */
     int size;                  /*!< No. of pkgs in list. */
     int alloced;               /*!< No. of pkgs allocated for list. */
+    uint_32 tscolor;           /*!< Transaction color. */
     int numDirs;               /*!< No. of directories. */
 /*@owned@*/ /*@null@*/
     dirInfo dirs;              /*!< Set of directories. */
@@ -378,7 +377,7 @@ fprintf(stderr, "*** del %p[%d]\n", al->list, pkgNum);
 
 /*@-bounds@*/
 alKey rpmalAdd(rpmal * alistp, alKey pkgKey, fnpyKey key,
-               rpmds provides, rpmfi fi)
+               rpmds provides, rpmfi fi, uint_32 tscolor)
 {
     alNum pkgNum;
     rpmal al;
@@ -406,10 +405,11 @@ alKey rpmalAdd(rpmal * alistp, alKey pkgKey, fnpyKey key,
     alp = al->list + pkgNum;
 
     alp->key = key;
+    alp->tscolor = tscolor;
 
 /*@-modfilesys@*/
 if (_rpmal_debug)
-fprintf(stderr, "*** add %p[%d]\n", al->list, pkgNum);
+fprintf(stderr, "*** add %p[%d] 0x%x\n", al->list, pkgNum, tscolor);
 /*@=modfilesys@*/
 
     alp->provides = rpmdsLink(provides, "Provides (rpmalAdd)");
@@ -495,7 +495,7 @@ fprintf(stderr, "+++ die[%3d] %p [%d] %s\n", al->numDirs, die, die->dirNameLen,
                /*@=assignexpose =dependenttrans =observertrans @*/
                fie->baseNameLen = (fie->baseName ? strlen(fie->baseName) : 0);
                fie->pkgNum = pkgNum;
-               fie->fileFlags = rpmfiFFlags(fi);
+               fie->ficolor = rpmfiFColor(fi);
                die->numFiles++;
                fie++;
            }
@@ -538,8 +538,10 @@ static int indexcmp(const void * one, const void * two)
     return strcmp(a->entry, b->entry);
 }
 
-void rpmalAddProvides(rpmal al, alKey pkgKey, rpmds provides)
+void rpmalAddProvides(rpmal al, alKey pkgKey, rpmds provides, uint_32 tscolor)
 {
+    uint_32 dscolor;
+    const char * Name;
     alNum pkgNum = alKey2Num(al, pkgKey);
     availableIndex ai = &al->index;
     availableIndexEntry aie;
@@ -552,21 +554,15 @@ void rpmalAddProvides(rpmal al, alKey pkgKey, rpmds provides)
 
     if (rpmdsInit(provides) != NULL)
     while (rpmdsNext(provides) >= 0) {
-       const char * Name;
-
-#ifdef DYING   /* XXX FIXME: multilib colored dependency search */
-       const int_32 Flags = rpmdsFlags(provides);
-
-       /* If multilib install, skip non-multilib provides. */
-       if (al->list[i].multiLib && !isDependsMULTILIB(Flags)) {
-           ai->size--;
-           /*@innercontinue@*/ continue;
-       }
-#endif
 
        if ((Name = rpmdsN(provides)) == NULL)
            continue;   /* XXX can't happen */
 
+       /* Ignore colored provides not in our rainbow. */
+       dscolor = rpmdsColor(provides);
+       if (tscolor && dscolor && !(tscolor & dscolor))
+           continue;
+
        aie = ai->index + ai->k;
        ai->k++;
 
@@ -605,7 +601,7 @@ void rpmalMakeIndex(rpmal al)
 
     for (i = 0; i < al->size; i++) {
        alp = al->list + i;
-       rpmalAddProvides(al, (alKey)i, alp->provides);
+       rpmalAddProvides(al, (alKey)i, alp->provides, alp->tscolor);
     }
     qsort(ai->index, ai->size, sizeof(*ai->index), indexcmp);
 }
@@ -613,6 +609,8 @@ void rpmalMakeIndex(rpmal al)
 fnpyKey *
 rpmalAllFileSatisfiesDepend(const rpmal al, const rpmds ds, alKey * keyp)
 {
+    uint_32 tscolor;
+    uint_32 ficolor;
     int found = 0;
     const char * dirName;
     const char * baseName;
@@ -683,18 +681,16 @@ if (_rpmal_debug)
 fprintf(stderr, "==> fie %p %s\n", fie, (fie->baseName ? fie->baseName : "(nil)"));
 /*@=modfilesys@*/
 
-#ifdef DYING   /* XXX FIXME: multilib colored dependency search */
-       /*
-        * If a file dependency would be satisfied by a file
-        * we are not going to install, skip it.
-        */
-       if (al->list[fie->pkgNum].multiLib && !isFileMULTILIB(fie->fileFlags))
-           continue;
-#endif
+       alp = al->list + fie->pkgNum;
+
+        /* Ignore colored files not in our rainbow. */
+       tscolor = alp->tscolor;
+       ficolor = fie->ficolor;
+        if (tscolor && ficolor && !(tscolor & ficolor))
+            continue;
 
        rpmdsNotify(ds, _("(added files)"), 0);
 
-       alp = al->list + fie->pkgNum;
        ret = xrealloc(ret, (found+2) * sizeof(*ret));
        if (ret)        /* can't happen */
            ret[found] = alp->key;
index 0a4f1fe..ec90022 100644 (file)
@@ -58,12 +58,14 @@ void rpmalDel(/*@null@*/ rpmal al, /*@null@*/ alKey pkgKey)
  * @param key          associated file name/python object
  * @param provides     provides dependency set
  * @param fi           file info set
+ * @param tscolor      transaction color bits
  * @return             available package index
  */
 alKey rpmalAdd(rpmal * alistp,
                /*@dependent@*/ /*@null@*/ alKey pkgKey,
                /*@dependent@*/ /*@null@*/ fnpyKey key,
-               /*@null@*/ rpmds provides, /*@null@*/ rpmfi fi)
+               /*@null@*/ rpmds provides, /*@null@*/ rpmfi fi,
+               uint_32 tscolor)
        /*@globals fileSystem @*/
        /*@modifies *alistp, provides, fi, fileSystem @*/;
 
@@ -72,11 +74,12 @@ alKey rpmalAdd(rpmal * alistp,
  * @param al           available list
  * @param pkgKey       package key
  * @param provides     added package provides
+ * @param tscolor      transaction color bits
  */
 /*@-exportlocal@*/
 void rpmalAddProvides(rpmal al,
                /*@dependent@*/ /*@null@*/ alKey pkgKey,
-               /*@null@*/ rpmds provides)
+               /*@null@*/ rpmds provides, uint_32 tscolor)
        /*@modifies al, provides @*/;
 /*@=exportlocal@*/
 
index e2afe50..50cb1cf 100644 (file)
@@ -472,9 +472,9 @@ int rpmdsSetNoPromote(rpmds ds, int nopromote)
     return onopromote;
 }
 
-int_32 rpmdsColor(const rpmds ds)
+uint_32 rpmdsColor(const rpmds ds)
 {
-    int_32 Color = 0;
+    uint_32 Color = 0;
 
     if (ds != NULL && ds->i >= 0 && ds->i < ds->Count) {
 /*@-boundsread@*/
@@ -485,9 +485,9 @@ int_32 rpmdsColor(const rpmds ds)
     return Color;
 }
 
-int_32 rpmdsSetColor(const rpmds ds, int_32 color)
+uint_32 rpmdsSetColor(const rpmds ds, uint_32 color)
 {
-    int_32 ocolor = 0;
+    uint_32 ocolor = 0;
 
     if (ds != NULL && ds->i >= 0 && ds->i < ds->Count) {
 /*@-bounds@*/
index 101ad98..ec44887 100644 (file)
@@ -40,7 +40,7 @@ struct rpmds_s {
 /*@only@*/ /*@null@*/
     int_32 * Flags;            /*!< Bit(s) identifying context/comparison. */
 /*@only@*/ /*@null@*/
-    int_32 * Color;            /*!< Bit(s) calculated from file color(s). */
+    uint_32 * Color;           /*!< Bit(s) calculated from file color(s). */
 /*@only@*/ /*@null@*/
     int_32 * Refs;             /*!< No. of file refs. */
     rpmTag tagN;               /*!< Header tag. */
@@ -246,7 +246,7 @@ int rpmdsSetNoPromote(/*@null@*/ rpmds ds, int nopromote)
  * @param ds           dependency set
  * @return             current dependency color
  */
-int_32 rpmdsColor(/*@null@*/ const rpmds ds)
+uint_32 rpmdsColor(/*@null@*/ const rpmds ds)
        /*@*/;
 
 /**
@@ -255,7 +255,7 @@ int_32 rpmdsColor(/*@null@*/ const rpmds ds)
  * @param color                new dependency color
  * @return             previous dependency color
  */
-int_32 rpmdsSetColor(/*@null@*/ const rpmds ds, int_32 color)
+uint_32 rpmdsSetColor(/*@null@*/ const rpmds ds, uint_32 color)
        /*@modifies ds @*/;
 
 /**
index 79176fa..77db41d 100644 (file)
@@ -272,7 +272,8 @@ uint_32 rpmfiFColor(rpmfi fi)
     if (fi != NULL && fi->i >= 0 && fi->i < fi->fc) {
 /*@-boundsread@*/
        if (fi->fcolors != NULL)
-           fcolor = fi->fcolors[fi->i];
+           /* XXX ignore all but lsnibble for now. */
+           fcolor = (fi->fcolors[fi->i] & 0x0f);
 /*@=boundsread@*/
     }
     return fcolor;
@@ -724,11 +725,12 @@ assert(p != NULL);
        fileTypes ft;
        int fnlen;
 
+#ifdef DYING
        /*
         * If only adding libraries of different arch into an already
         * installed package, skip all other files.
         */
-       if (rpmteMultiLib(p) && !isFileMULTILIB((fFlags[i]))) {
+       if (rpmteColor(p) && !isFileMULTILIB((fFlags[i]))) {
            if (actions) {
                actions[i] = FA_SKIPMULTILIB;
                rpmMessage(RPMMESS_DEBUG, _("excluding multilib path %s%s\n"), 
@@ -736,6 +738,7 @@ assert(p != NULL);
            }
            continue;
        }
+#endif
 
        len = reldel +
                strlen(dirNames[dirIndexes[i]]) + strlen(baseNames[i]) + 1;
index 3def985..31c61d3 100644 (file)
@@ -401,7 +401,8 @@ typedef enum rpmfileState_e {
     RPMFILE_STATE_NORMAL       = 0,
     RPMFILE_STATE_REPLACED     = 1,
     RPMFILE_STATE_NOTINSTALLED = 2,
-    RPMFILE_STATE_NETSHARED    = 3
+    RPMFILE_STATE_NETSHARED    = 3,
+    RPMFILE_STATE_WRONGCOLOR   = 4
 } rpmfileState;
 #define        RPMFILE_STATE_MISSING   -1      /* XXX used for unavailable data */
 
@@ -787,11 +788,11 @@ typedef enum fileAction_e {
     FA_ERASE,          /*!< ... to be removed. */
     FA_SKIPNSTATE,     /*!< ... untouched, state "not installed". */
     FA_SKIPNETSHARED,  /*!< ... untouched, state "netshared". */
-    FA_SKIPMULTILIB    /*!< ... untouched. @todo state "multilib" ???. */
+    FA_SKIPCOLOR       /*!< ... untouched, state "wrong color". */
 } fileAction;
 
 #define XFA_SKIPPING(_a)       \
-    ((_a) == FA_SKIP || (_a) == FA_SKIPNSTATE || (_a) == FA_SKIPNETSHARED || (_a) == FA_SKIPMULTILIB)
+    ((_a) == FA_SKIP || (_a) == FA_SKIPNSTATE || (_a) == FA_SKIPNETSHARED || (_a) == FA_SKIPCOLOR)
 
 /**
  * File types.
index b2211a0..1aeb9d4 100644 (file)
@@ -154,8 +154,6 @@ static void addTE(rpmts ts, rpmte p, Header h,
 
     rpmteColorDS(p, RPMTAG_PROVIDENAME);
     rpmteColorDS(p, RPMTAG_REQUIRENAME);
-
-    p->multiLib = 0;
 }
 /*@=bounds@*/
 
@@ -228,19 +226,19 @@ const char * rpmteO(rpmte te)
     return (te != NULL ? te->os : NULL);
 }
 
-int rpmteMultiLib(rpmte te)
+uint_32 rpmteColor(rpmte te)
 {
-    return (te != NULL ? te->multiLib : 0);
+    return (te != NULL ? te->color : 0);
 }
 
-int rpmteSetMultiLib(rpmte te, int nmultiLib)
+uint_32 rpmteSetColor(rpmte te, uint_32 color)
 {
-    int omultiLib = 0;
+    int ocolor = 0;
     if (te != NULL) {
-       omultiLib = te->multiLib;
-       te->multiLib = nmultiLib;
+       ocolor = te->color;
+       te->color = color;
     }
-    return omultiLib;
+    return ocolor;
 }
 
 int rpmteDepth(rpmte te)
@@ -475,8 +473,7 @@ void rpmteColorDS(rpmte te, rpmTag tag)
     fi = rpmfiInit(fi, 0);
     if (fi != NULL)
     while (rpmfiNext(fi) >= 0) {
-       /* XXX ignore all but lsnibble for now. */
-       val = (rpmfiFColor(fi) & 0x0f);
+       val = rpmfiFColor(fi);
        ddict = NULL;
        ndx = rpmfiFDepends(fi, &ddict);
        if (ddict != NULL)
@@ -496,6 +493,7 @@ assert (ix < Count);
     ds = rpmdsInit(ds);
     while ((i = rpmdsNext(ds)) >= 0) {
        val = colors[i];
+       te->color |= val;
        (void) rpmdsSetColor(ds, val);
        val = refs[i];
        if (val >= 0)
index 8fe7749..d263b22 100644 (file)
@@ -97,7 +97,7 @@ struct rpmte_s {
 /*@refcounted@*/ /*@null@*/
     rpmfi fi;                  /*!< File information. */
 
-    uint_32 multiLib;          /*!< (TR_ADDED) MULTILIB */
+    uint_32 color;             /*!< Bit(s) from package dependencies */
 
 /*@exposed@*/ /*@dependent@*/ /*@null@*/
     fnpyKey key;               /*!< (TR_ADDED) Retrieval key. */
@@ -230,20 +230,20 @@ extern const char * rpmteO(rpmte te)
        /*@*/;
 
 /**
- * Retrieve multlib flags of transaction element.
+ * Retrieve color bits of transaction element.
  * @param te           transaction element
- * @return             multilib flags
+ * @return             color bits
  */
-int rpmteMultiLib(rpmte te)
+uint_32 rpmteColor(rpmte te)
        /*@*/;
 
 /**
- * Set multlib flags of transaction element.
+ * Set color bits of transaction element.
  * @param te           transaction element
- * @param nmultiLib    new multilib flags
- * @return             previous multilib flags
+ * @param color                new color bits
+ * @return             previous color bits
  */
-int rpmteSetMultiLib(rpmte te, int nmultiLib)
+uint_32 rpmteSetColor(rpmte te, uint_32 color)
        /*@modifies te @*/;
 
 /**
index 31e8d50..f9fec1c 100644 (file)
@@ -1133,6 +1133,21 @@ rpmte rpmtsSetRelocateElement(rpmts ts, rpmte relocateElement)
     return orelocateElement;
 }
 
+uint_32 rpmtsColor(rpmts ts)
+{
+    return (ts != NULL ? ts->color : 0);
+}
+
+uint_32 rpmtsSetColor(rpmts ts, uint_32 color)
+{
+    uint_32 ocolor = 0;
+    if (ts != NULL) {
+       ocolor = ts->color;
+       ts->color = color;
+    }
+    return ocolor;
+}
+
 int rpmtsSetNotifyCallback(rpmts ts,
                rpmCallbackFunction notify, rpmCallbackData notifyData)
 {
@@ -1197,6 +1212,8 @@ rpmts rpmtsCreate(void)
     ts->tid = (int_32) time(NULL);
     ts->delta = 5;
 
+    ts->color = rpmExpandNumeric("%{?_transaction_color}");
+
     ts->numRemovedPackages = 0;
     ts->allocedRemovedPackages = ts->delta;
     ts->removedPackages = xcalloc(ts->allocedRemovedPackages,
index 883b827..fbb7476 100644 (file)
@@ -175,6 +175,8 @@ struct rpmts_s {
     int delta;                 /*!< Delta for reallocation. */
     int_32 tid;                        /*!< Transaction id. */
 
+    uint_32 color;             /*!< Transaction color bits. */
+
     rpmVSFlags vsflags;                /*!< Signature/digest verification flags. */
 
 /*@observer@*/ /*@dependent@*/ /*@null@*/
@@ -777,6 +779,23 @@ rpmte rpmtsRelocateElement(rpmts ts)
 rpmte rpmtsSetRelocateElement(rpmts ts, /*@null@*/ rpmte relocateElement)
        /*@modifies 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 transaction notify callback function and argument.
  *
index 967bc87..91e93bb 100644 (file)
@@ -732,6 +732,8 @@ static void skipFiles(const rpmts ts, rpmfi fi)
        /*@globals rpmGlobalMacroContext @*/
        /*@modifies fi, rpmGlobalMacroContext @*/
 {
+    uint_32 tscolor = rpmtsColor(ts);
+    uint_32 ficolor;
     int noConfigs = (rpmtsFlags(ts) & RPMTRANS_FLAG_NOCONFIGS);
     int noDocs = (rpmtsFlags(ts) & RPMTRANS_FLAG_NODOCS);
     char ** netsharedPaths = NULL;
@@ -777,7 +779,7 @@ static void skipFiles(const rpmts ts, rpmfi fi)
     if (fi != NULL)    /* XXX lclint */
     while ((i = rpmfiNext(fi)) >= 0)
     {
-       char **nsp;
+       char ** nsp;
 
        bn = rpmfiBN(fi);
        bnlen = strlen(bn);
@@ -791,10 +793,18 @@ static void skipFiles(const rpmts ts, rpmfi fi)
 
        /* Don't bother with skipped files */
        if (XFA_SKIPPING(fi->actions[i])) {
-           drc[ix]--;
+           drc[ix]--;  dff[ix] = 1;
            continue;
        }
 
+       /* Ignore colored files not in our rainbow. */
+       ficolor = rpmfiFColor(fi);
+        if (tscolor && ficolor && !(tscolor & ficolor)) {
+           drc[ix]--;  dff[ix] = 1;
+           fi->actions[i] = FA_SKIPCOLOR;
+            continue;
+       }
+
        /*
         * Skip net shared paths.
         * Net shared paths are not relative to the current root (though
@@ -967,6 +977,7 @@ rpmfi rpmtsiFi(const rpmtsi tsi)
 
 int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
 {
+    uint_32 tscolor = rpmtsColor(ts);
     int i, j;
     int ourrc = 0;
     int totalFileCount = 0;
@@ -1043,7 +1054,7 @@ rpmMessage(RPMMESS_DEBUG, _("sanity checking %d elements\n"), rpmtsNElements(ts)
            continue;   /* XXX can't happen */
        fc = rpmfiFC(fi);
 
-       if (!(rpmtsFilterFlags(ts) & RPMPROB_FILTER_IGNOREARCH))
+       if (!(rpmtsFilterFlags(ts) & RPMPROB_FILTER_IGNOREARCH) && !tscolor)
            if (!archOkay(rpmteA(p)))
                rpmpsAppend(ps, RPMPROB_BADARCH,
                        rpmteNEVR(p), rpmteKey(p),
@@ -1065,8 +1076,13 @@ 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) && !rpmteMultiLib(p)) {
+       if (!(rpmtsFilterFlags(ts) & RPMPROB_FILTER_REPLACEPKG) && !rpmteColor(p))
+#else
+       if (!(rpmtsFilterFlags(ts) & RPMPROB_FILTER_REPLACEPKG) && !tscolor)
+#endif
+       {
            mi = rpmtsInitIterator(ts, RPMTAG_NAME, rpmteN(p), 0);
            xx = rpmdbSetIteratorRE(mi, RPMTAG_EPOCH, RPMMIRE_DEFAULT,
                                rpmteE(p));
@@ -1494,9 +1510,11 @@ rpmMessage(RPMMESS_DEBUG, _("computing file dispositions\n"));
                }
                psm->fi = rpmfiLink(p->fi, NULL);
 
-               if (rpmteMultiLib(p))
+#ifdef DYING
+               if (rpmteColor(p))
                    (void) rpmtsSetFlags(ts, (rpmtsFlags(ts) | RPMTRANS_FLAG_MULTILIB));
                else
+#endif
                    (void) rpmtsSetFlags(ts, (rpmtsFlags(ts) & ~RPMTRANS_FLAG_MULTILIB));
 
 /*@-nullstate@*/ /* FIX: psm->fi may be NULL */
index 4ee5173..47da601 100644 (file)
@@ -67,6 +67,7 @@ int rpmVerifyFile(const rpmts ts, const rpmfi fi,
     case RPMFILE_STATE_NETSHARED:
     case RPMFILE_STATE_REPLACED:
     case RPMFILE_STATE_NOTINSTALLED:
+    case RPMFILE_STATE_WRONGCOLOR:
        return 0;
        /*@notreached@*/ break;
     case RPMFILE_STATE_NORMAL:
index fb6eaa1..1a159df 100644 (file)
@@ -41,7 +41,8 @@ rpmal_Add(rpmalObject * s, PyObject * args)
        return NULL;
 
     /* XXX errors */
-    pkgKey = rpmalAdd(&s->al, pkgKey, key, dso->ds, fio->fi);
+    /* XXX transaction colors */
+    pkgKey = rpmalAdd(&s->al, pkgKey, key, dso->ds, fio->fi, 0);
 
     return Py_BuildValue("i", pkgKey);
 }
@@ -73,7 +74,8 @@ rpmal_AddProvides(rpmalObject * s, PyObject * args)
     if (!PyArg_ParseTuple(args, "iOO!O!:AddProvides", &pkgKey, &rpmds_Type, &dso))
        return NULL;
 
-    rpmalAddProvides(s->al, pkgKey, dso->ds);
+    /* XXX transaction colors */
+    rpmalAddProvides(s->al, pkgKey, dso->ds, 0);
 
     Py_INCREF(Py_None);
     return Py_None;
index ec94a9c..2b90021 100644 (file)
@@ -132,11 +132,11 @@ rpmte_NEVR(rpmteObject * s, PyObject * args)
 }
 
 static PyObject *
-rpmte_MultiLib(rpmteObject * s, PyObject * args)
+rpmte_Color(rpmteObject * s, PyObject * args)
        /*@*/
 {
-    if (!PyArg_ParseTuple(args, ":MultiLib")) return NULL;
-    return Py_BuildValue("i", rpmteMultiLib(s->te));
+    if (!PyArg_ParseTuple(args, ":Color")) return NULL;
+    return Py_BuildValue("i", rpmteColor(s->te));
 }
 
 static PyObject *
@@ -311,7 +311,7 @@ static struct PyMethodDef rpmte_methods[] = {
     {"NEVR",   (PyCFunction)rpmte_NEVR,        METH_VARARGS,
 "te.NEVR() -> NEVR\n\
 - Return element name-version-release.\n" },
-    {"MultiLib",(PyCFunction)rpmte_MultiLib,   METH_VARARGS,
+    {"Color",(PyCFunction)rpmte_Color,         METH_VARARGS,
         NULL},
     {"Depth",  (PyCFunction)rpmte_Depth,       METH_VARARGS,
         NULL},
index 7c2b13c..1b9abce 100644 (file)
@@ -199,7 +199,7 @@ static void rpmtsAddAvailableElement(rpmts ts, Header h,
 
     /* XXX FIXME: return code RPMAL_NOMATCH is error */
     (void) rpmalAdd(&ts->availablePackages, RPMAL_NOMATCH, key,
-               provides, fi);
+               provides, fi, rpmtsColor(ts));
     fi = rpmfiFree(fi);
     provides = rpmdsFree(provides);
 
@@ -850,6 +850,24 @@ fprintf(stderr, "*** rpmts_SetVSFlags(%p) ts %p\n", s, s->ts);
 /** \ingroup python
  */
 static PyObject *
+rpmts_SetColor(rpmtsObject * s, PyObject * args)
+       /*@modifies s @*/
+{
+    uint_32 tscolor;
+
+if (_rpmts_debug)
+fprintf(stderr, "*** rpmts_SetColor(%p) ts %p\n", s, s->ts);
+
+    if (!PyArg_ParseTuple(args, "i:Color", &tscolor)) return NULL;
+
+    /* XXX FIXME: value check on tscolor. */
+
+    return Py_BuildValue("i", rpmtsSetColor(s->ts, tscolor));
+}
+
+/** \ingroup python
+ */
+static PyObject *
 rpmts_PgpPrtPkts(rpmtsObject * s, PyObject * args)
        /*@globals _Py_NoneStruct @*/
        /*@modifies _Py_NoneStruct @*/
@@ -1305,6 +1323,8 @@ static struct PyMethodDef rpmts_methods[] = {
     rpm.RPMVSF_NORSA         if set, don't check header+payload RSA signature\n\
     rpm._RPMVSF_NODIGESTS    if set, don't check digest(s)\n\
     rpm._RPMVSF_NOSIGNATURES if set, don't check signature(s)\n" },
+ {"setColor",(PyCFunction) rpmts_SetColor,     METH_VARARGS,
+       NULL },
  {"pgpPrtPkts",        (PyCFunction) rpmts_PgpPrtPkts, METH_VARARGS,
        NULL },
  {"pgpImportPubkey",   (PyCFunction) rpmts_PgpImportPubkey,    METH_VARARGS,
index eb16aea..d059e3b 100644 (file)
@@ -15,7 +15,7 @@ Name: rpm
 %define version @VERSION@
 Version: %{version}
 %{expand: %%define rpm_version %{version}}
-Release: 0.46
+Release: 0.48
 Group: System Environment/Base
 Source: ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.0.x/rpm-%{rpm_version}.tar.gz
 Copyright: GPL
index 19d64f3..1aed414 100644 (file)
@@ -89,7 +89,7 @@ rpm   alias --filesbypkg --qf '[%-25{=NAME} %{FILENAMES}\n]' \
 rpm    alias --fileclass --qf '[%{FILENAMES}\t%{FILECLASS}\n]' \
        --POPTdesc=$"list file names with classes"
 
-rpm    alias --filecolor --qf '[%{FILENAMES}\t%{FILECOLOR}\n]' \
+rpm    alias --filecolor --qf '[%{FILENAMES}\t%{FILECOLORS}\n]' \
        --POPTdesc=$"list file names with colors"
 
 rpm    alias --fileprovide --qf '[%{FILENAMES}\t%{FILEPROVIDE}\n]' \
@@ -357,7 +357,7 @@ rpmq        alias --filesbypkg --qf '[%-25{=NAME} %{FILENAMES}\n]' \
 rpmq   alias --fileclass --qf '[%{FILENAMES}\t%{FILECLASS}\n]' \
        --POPTdesc=$"list file names with classes"
 
-rpmq   alias --filecolor --qf '[%{FILENAMES}\t%{FILECOLOR}\n]' \
+rpmq   alias --filecolor --qf '[%{FILENAMES}\t%{FILECOLORS}\n]' \
        --POPTdesc=$"list file names with colors"
 
 rpmq   alias --fileprovide --qf '[%{FILENAMES}\t%{FILEPROVIDE}\n]' \
@@ -442,7 +442,7 @@ rpmquery    alias --filesbypkg --qf '[%-25{=NAME} %{FILENAMES}\n]' \
 rpmquery       alias --fileclass --qf '[%{FILENAMES}\t%{FILECLASS}\n]' \
        --POPTdesc=$"list file names with classes"
 
-rpmquery       alias --filecolor --qf '[%{FILENAMES}\t%{FILECOLOR}\n]' \
+rpmquery       alias --filecolor --qf '[%{FILENAMES}\t%{FILECOLORS}\n]' \
        --POPTdesc=$"list file names with colors"
 
 rpmquery       alias --fileprovide --qf '[%{FILENAMES}\t%{FILEPROVIDE}\n]' \