1st element in tsort candidate queue was not marked.
authorjbj <devnull@localhost>
Sun, 18 Nov 2001 11:46:22 +0000 (11:46 +0000)
committerjbj <devnull@localhost>
Sun, 18 Nov 2001 11:46:22 +0000 (11:46 +0000)
CVS patchset: 5191
CVS date: 2001/11/18 11:46:22

lib/depends.c
lib/rpmte.c
po/rpm.pot

index f7ad0ef..6740cda 100644 (file)
@@ -39,6 +39,9 @@ int _cacheDependsRC = 1;
 /*@unchecked@*/
 int _ts_debug = 0;
 
+/*@unchecked@*/
+static int _tso_debug = 1;
+
 /*@observer@*/ /*@unchecked@*/
 const char *rpmNAME = PACKAGE;
 
@@ -1053,7 +1056,7 @@ static void prtTSI(const char * msg, tsortInfo tsi)
        /*@modifies fileSystem@*/
 {
 /*@-nullpass@*/
-if (_te_debug) {
+if (_tso_debug) {
     if (msg) fprintf(stderr, "%s", msg);
 /*@i@*/ fprintf(stderr, " tsi %p suc %p next %p chain %p reqx %d qcnt %d\n", tsi, tsi->tsi_suc, tsi->tsi_next, tsi->tsi_chain, tsi->tsi_reqx, tsi->tsi_qcnt);
 }
@@ -1093,7 +1096,7 @@ static inline int addRelation(rpmTransactionSet ts,
     pkgKey = RPMAL_NOMATCH;
     key = alSatisfiesDepend(ts->addedPackages, requires, &pkgKey);
 
-if (_te_debug)
+if (_tso_debug)
 fprintf(stderr, "addRelation: pkgKey %ld\n", (long)pkgKey);
 
     /* Ordering depends only on added package relations. */
@@ -1120,7 +1123,7 @@ fprintf(stderr, "addRelation: pkgKey %ld\n", (long)pkgKey);
 #endif
 
 /*@-nullpass -nullderef -formattype@*/
-if (_te_debug)
+if (_tso_debug)
 fprintf(stderr, "addRelation: q %p(%s) from %p[%d:%d]\n", q, teGetN(q), ts->order, i, ts->orderCount);
 /*@=nullpass =nullderef =formattype@*/
 
@@ -1130,7 +1133,7 @@ fprintf(stderr, "addRelation: q %p(%s) from %p[%d:%d]\n", q, teGetN(q), ts->orde
        return 0;
     selected[i] = 1;
 /*@-nullpass@*/
-if (_te_debug)
+if (_tso_debug)
 fprintf(stderr, "addRelation: selected[%d] = 1\n", i);
 /*@=nullpass@*/
 
@@ -1141,7 +1144,7 @@ fprintf(stderr, "addRelation: selected[%d] = 1\n", i);
        (void) teSetDepth(p, (teGetDepth(q) + 1));
 
 /*@-nullpass@*/
-if (_te_debug)
+if (_tso_debug)
 /*@i@*/ fprintf(stderr, "addRelation: p %p(%s) depth %d", p, teGetN(p), teGetDepth(p));
 prtTSI(NULL, teGetTSI(p));
 /*@=nullpass@*/
@@ -1154,7 +1157,7 @@ prtTSI(NULL, teGetTSI(p));
     tsi->tsi_next = teGetTSI(q)->tsi_next;
 /*@-nullpass -compmempass@*/
 prtTSI("addRelation: new", tsi);
-if (_te_debug)
+if (_tso_debug)
 /*@i@*/ fprintf(stderr, "addRelation: BEFORE q %p(%s)", q, teGetN(q));
 prtTSI(NULL, teGetTSI(q));
 /*@=nullpass =compmempass@*/
@@ -1163,7 +1166,7 @@ prtTSI(NULL, teGetTSI(q));
     teGetTSI(q)->tsi_qcnt++;                   /* bump q successor count */
 /*@=mods@*/
 /*@-nullpass -compmempass@*/
-if (_te_debug)
+if (_tso_debug)
 /*@i@*/ fprintf(stderr, "addRelation:  AFTER q %p(%s)", q, teGetN(q));
 prtTSI(NULL, teGetTSI(q));
 /*@=nullpass =compmempass@*/
@@ -1187,7 +1190,7 @@ static int orderListIndexCmp(const void * one, const void * two)  /*@*/
 }
 
 /**
- * Add element to list sorting by initial successor count.
+ * Add element to list sorting by tsi_qcnt.
  * @param p            new element
  * @retval qp          address of first element
  * @retval rp          address of last element
@@ -1200,20 +1203,25 @@ static void addQ(/*@dependent@*/ transactionElement p,
 {
     transactionElement q, qprev;
 
+    /* Mark the package as queued. */
+    teGetTSI(p)->tsi_reqx = 1;
+
     if ((*rp) == NULL) {       /* 1st element */
        /*@-dependenttrans@*/ /* FIX: double indirection */
        (*rp) = (*qp) = p;
        /*@=dependenttrans@*/
        return;
     }
-    for (qprev = NULL, q = (*qp); q != NULL; qprev = q, q = teGetTSI(q)->tsi_suc) {
+
+    /* Find location in queue using metric tsi_qcnt. */
+    for (qprev = NULL, q = (*qp);
+        q != NULL;
+        qprev = q, q = teGetTSI(q)->tsi_suc)
+    {
        if (teGetTSI(q)->tsi_qcnt <= teGetTSI(p)->tsi_qcnt)
            break;
     }
 
-    /* Mark the package as queued. */
-    teGetTSI(p)->tsi_reqx = 1;
-
     if (qprev == NULL) {       /* insert at beginning of list */
        teGetTSI(p)->tsi_suc = q;
        /*@-dependenttrans@*/
@@ -1256,6 +1264,7 @@ int rpmdepOrder(rpmTransactionSet ts)
     int numOrderList;
     int nrescans = 10;
     int _printed = 0;
+    char deptypechar;
 #ifdef DYING
     int oType = TR_ADDED;
 #else
@@ -1267,7 +1276,7 @@ int rpmdepOrder(rpmTransactionSet ts)
     alMakeIndex(ts->addedPackages);
 
 /*@-modfilesystem -nullpass -formattype@*/
-if (_te_debug)
+if (_tso_debug)
 fprintf(stderr, "*** rpmdepOrder(%p) order %p[%d]\n", ts, ts->order, ts->orderCount);
 /*@=modfilesystem =nullpass =formattype@*/
 
@@ -1376,7 +1385,7 @@ fprintf(stderr, "*** rpmdepOrder(%p) order %p[%d]\n", ts, ts->order, ts->orderCo
        (void) teSetNpreds(p, teGetTSI(p)->tsi_count);
 
 /*@-modfilesystem -nullpass @*/
-if (_te_debug)
+if (_tso_debug)
 /*@i@*/ fprintf(stderr, "\t+++ %p[%d] %s npreds %d\n", p, teiGetOc(pi), teGetNEVR(p), teGetNpreds(p));
 /*@=modfilesystem =nullpass @*/
 
@@ -1403,7 +1412,7 @@ rescan:
        addQ(p, &q, &r);
        qlen++;
 /*@-modfilesystem -nullpass @*/
-if (_te_debug)
+if (_tso_debug)
 /*@i@*/ fprintf(stderr, "\t+++ addQ ++ qlen %d p %p(%s)", qlen, p, teGetNEVR(p));
 prtTSI(" p", teGetTSI(p));
 /*@=modfilesystem =nullpass @*/
@@ -1412,7 +1421,6 @@ prtTSI(" p", teGetTSI(p));
 
     /* T5. Output front of queue (T7. Remove from queue.) */
     for (; q != NULL; q = teGetTSI(q)->tsi_suc) {
-       char deptypechar;
 
        /* Mark the package as unqueued. */
        teGetTSI(q)->tsi_reqx = 0;
@@ -1458,7 +1466,7 @@ prtTSI(" p", teGetTSI(p));
                addQ(p, &teGetTSI(q)->tsi_suc, &r);
                qlen++;
 /*@-modfilesystem -nullpass @*/
-if (_te_debug)
+if (_tso_debug)
 /*@i@*/ fprintf(stderr, "\t+++ addQ ++ qlen %d p %p(%s)", qlen, p, teGetNEVR(p));
 prtTSI(" p", teGetTSI(p));
 /*@=modfilesystem =nullpass @*/
index 5d097ca..d765ed0 100644 (file)
@@ -416,7 +416,7 @@ transactionElement teNext(teIterator tei, rpmTransactionType type)
     transactionElement p;
 
     while ((p = teNextIterator(tei)) != NULL) {
-       if (type == 0 || p->type == type)
+       if (type == 0 || (p->type & type) != 0)
            break;
     }
     return p;
index 7e02a71..fb8d92f 100644 (file)
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2001-11-17 15:43-0500\n"
+"POT-Creation-Date: 2001-11-18 06:36-0500\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -1410,83 +1410,83 @@ msgstr ""
 msgid " failed - "
 msgstr ""
 
-#: lib/depends.c:101
+#: lib/depends.c:104
 #, c-format
 msgid "cannot open Packages database in %s\n"
 msgstr ""
 
-#: lib/depends.c:294
+#: lib/depends.c:297
 #, c-format
 msgid "package %s was already added, replacing with %s\n"
 msgstr ""
 
-#: lib/depends.c:566
+#: lib/depends.c:569
 msgid "(cached)"
 msgstr ""
 
-#: lib/depends.c:591
+#: lib/depends.c:594
 msgid "(rpmrc provides)"
 msgstr ""
 
-#: lib/depends.c:607
+#: lib/depends.c:610
 msgid "(rpmlib provides)"
 msgstr ""
 
-#: lib/depends.c:628
+#: lib/depends.c:631
 msgid "(db files)"
 msgstr ""
 
-#: lib/depends.c:640
+#: lib/depends.c:643
 msgid "(db provides)"
 msgstr ""
 
-#: lib/depends.c:653
+#: lib/depends.c:656
 msgid "(db package)"
 msgstr ""
 
-#: lib/depends.c:692
+#: lib/depends.c:695
 #, c-format
 msgid "%9s: (%s, %s) added to Depends cache.\n"
 msgstr ""
 
-#: lib/depends.c:694 lib/rpmds.c:407 lib/rpmds.c:566
+#: lib/depends.c:697 lib/rpmds.c:407 lib/rpmds.c:566
 msgid "NO "
 msgstr ""
 
-#: lib/depends.c:694 lib/rpmds.c:407 lib/rpmds.c:566
+#: lib/depends.c:697 lib/rpmds.c:407 lib/rpmds.c:566
 msgid "YES"
 msgstr ""
 
-#: lib/depends.c:1031
+#: lib/depends.c:1034
 #, c-format
 msgid "removing %s \"%s\" from tsort relations.\n"
 msgstr ""
 
 #. Record all relations.
-#: lib/depends.c:1293
+#: lib/depends.c:1302
 msgid "========== recording tsort relations\n"
 msgstr ""
 
 #. T4. Scan for zeroes.
-#: lib/depends.c:1387
+#: lib/depends.c:1396
 msgid ""
 "========== tsorting packages (order, #predecessors, #succesors, depth)\n"
 msgstr ""
 
-#: lib/depends.c:1471
+#: lib/depends.c:1479
 msgid "========== successors only (presentation order)\n"
 msgstr ""
 
-#: lib/depends.c:1541
+#: lib/depends.c:1549
 msgid "LOOP:\n"
 msgstr ""
 
-#: lib/depends.c:1576
+#: lib/depends.c:1584
 msgid "========== continuing tsort ...\n"
 msgstr ""
 
 #. Return no. of packages that could not be ordered.
-#: lib/depends.c:1581
+#: lib/depends.c:1589
 #, c-format
 msgid "rpmdepOrder failed, %d elements remain\n"
 msgstr ""