Eliminate unused "known problems" based filtering from rpmtsRun()
authorRakesh Pandit <rakesh@fedoraproject.org>
Wed, 14 Apr 2010 11:14:52 +0000 (16:44 +0530)
committerPanu Matilainen <pmatilai@redhat.com>
Wed, 21 Apr 2010 09:03:09 +0000 (12:03 +0300)
- This mechanism has never been used by anything at all, which suggests
  its not a particularly useful feature
- Removing unused rpmpsTrim() from rpmps
- Marking okProbs parameter of rpmtsRun() function as unused to avoid
  unnecessary breakage

lib/rpmps.c
lib/rpmps.h
lib/rpmts.h
lib/transaction.c

index 7f089af..7107e39 100644 (file)
@@ -139,43 +139,6 @@ void rpmpsAppendProblem(rpmps ps, rpmProblem prob)
     ps->numProblems++;
 }
 
-/* XXX TODO: implement with iterators */
-int rpmpsTrim(rpmps ps, rpmps filter)
-{
-    rpmProblem *t;
-    rpmProblem *f;
-    int gotProblems = 0;
-
-    if (ps == NULL || ps->numProblems == 0)
-       return 0;
-
-    if (filter == NULL)
-       return (ps->numProblems == 0 ? 0 : 1);
-
-    t = ps->probs;
-    f = filter->probs;
-
-    while ((f - filter->probs) < filter->numProblems) {
-       while ((t - ps->probs) < ps->numProblems) {
-           if (rpmProblemCompare(*f, *t) == 0)
-               break;
-           t++;
-           gotProblems = 1;
-       }
-
-       /* XXX This can't happen, but let's be sane in case it does. */
-       if ((t - ps->probs) == ps->numProblems)
-           break;
-
-       t++, f++;
-    }
-
-    if ((t - ps->probs) < ps->numProblems)
-       gotProblems = 1;
-
-    return gotProblems;
-}
-
 /*
  * TODO: filter out duplicates while merging. Also horribly inefficient... */
 int rpmpsMerge(rpmps dest, rpmps src)
index b355e78..4b1050b 100644 (file)
@@ -103,23 +103,6 @@ void rpmpsPrint(FILE *fp, rpmps ps);
 void rpmpsAppendProblem(rpmps ps, rpmProblem prob);
 
 /** \ingroup rpmps
- * Filter a problem set.
- *
- * As the problem sets are generated in an order solely dependent
- * on the ordering of the packages in the transaction, and that
- * ordering can't be changed, the problem sets must be parallel to
- * one another. Additionally, the filter set must be a subset of the
- * target set, given the operations available on transaction set.
- * This is good, as it lets us perform this trim in linear time, rather
- * then logarithmic or quadratic.
- *
- * @param ps           problem set
- * @param filter       problem filter (or NULL)
- * @return             0 no problems, 1 if problems remain
- */
-int rpmpsTrim(rpmps ps, rpmps filter);
-
-/** \ingroup rpmps
  * Merge problem set into another.
  * @param dest         destination problem set
  * @param src          source problem set
index fad4dfa..8520bd0 100644 (file)
@@ -188,7 +188,7 @@ int rpmtsOrder(rpmts ts);
  *    - setup the rpm verify signature flags via rpmtsSetVSFlags().
  *       
  * @param ts           transaction set
- * @param okProbs      previously known problems (or NULL)
+ * @param okProbs      unused
  * @param ignoreSet    bits to filter problem types
  * @return             0 on success, -1 on error, >0 with newProbs set
  */
index d0686f2..339b4cd 100644 (file)
@@ -1383,8 +1383,7 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
     /* Run pre-transaction scripts, but only if there are no known
      * problems up to this point and not disabled otherwise. */
     if (!((rpmtsFlags(ts) & (RPMTRANS_FLAG_BUILD_PROBS|RPMTRANS_FLAG_TEST|RPMTRANS_FLAG_NOPRE))
-         || (rpmpsNumProblems(tsprobs) &&
-               (okProbs == NULL || rpmpsTrim(tsprobs, okProbs))))) {
+         || (rpmpsNumProblems(tsprobs)))) {
        rpmlog(RPMLOG_DEBUG, "running pre-transaction scripts\n");
        runTransScripts(ts, PKG_PRETRANS);
     }
@@ -1398,9 +1397,7 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
     tsprobs = rpmtsProblems(ts);
 
      /* If unfiltered problems exist, free memory and return. */
-    if ((rpmtsFlags(ts) & RPMTRANS_FLAG_BUILD_PROBS) ||
-               (rpmpsNumProblems(tsprobs) &&
-               (okProbs == NULL || rpmpsTrim(tsprobs, okProbs)))) {
+    if ((rpmtsFlags(ts) & RPMTRANS_FLAG_BUILD_PROBS) || (rpmpsNumProblems(tsprobs))) {
        tsMembers tsmem = rpmtsMembers(ts);
        rc = tsmem->orderCount;
        goto exit;