[Rpm-maint] [PATCH] Removing old rpmpsTrim from rpmps

Rakesh Pandit rakesh.pandit at gmail.com
Wed Apr 14 11:33:14 UTC 2010


Pasting corresponding patch inline.

Link: http://rakesh.fedorapeople.org/misc/0001-Removing-old-rpmpsTrim-from-rpmps.patch

-- 
Rakesh Pandit
https://fedoraproject.org/wiki/User:Rakesh
freedom, friends, features, first


>From 93e2cfabe045fee8ff55ec1ed9e4cea8a01918f9 Mon Sep 17 00:00:00 2001
From: Rakesh Pandit <rakesh at fedoraproject.org>
Date: Wed, 14 Apr 2010 16:44:52 +0530
Subject: [PATCH] Removing old rpmpsTrim from rpmps
  - marking okProbs parameter of rpmtsRun function as unused

---
 lib/rpmps.c       |   37 -------------------------------------
 lib/rpmps.h       |   17 -----------------
 lib/rpmts.h       |    2 +-
 lib/transaction.c |    7 ++-----
 4 files changed, 3 insertions(+), 60 deletions(-)

diff --git a/lib/rpmps.c b/lib/rpmps.c
index 7f089af..7107e39 100644
--- a/lib/rpmps.c
+++ b/lib/rpmps.c
@@ -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)
diff --git a/lib/rpmps.h b/lib/rpmps.h
index b355e78..4b1050b 100644
--- a/lib/rpmps.h
+++ b/lib/rpmps.h
@@ -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
diff --git a/lib/rpmts.h b/lib/rpmts.h
index fad4dfa..8520bd0 100644
--- a/lib/rpmts.h
+++ b/lib/rpmts.h
@@ -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
  */
diff --git a/lib/transaction.c b/lib/transaction.c
index d0686f2..339b4cd 100644
--- a/lib/transaction.c
+++ b/lib/transaction.c
@@ -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;
-- 
1.6.6.1


More information about the Rpm-maint mailing list