Eliminate unused "known problems" based filtering from rpmtsRun()

- 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
This commit is contained in:
Rakesh Pandit 2010-04-14 16:44:52 +05:30 committed by Panu Matilainen
parent c0ab315e71
commit 8cc740c43f
4 changed files with 3 additions and 60 deletions

View 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)

View File

@ -102,23 +102,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

View 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
*/

View 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;