diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2010-03-26 12:23:47 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2010-03-26 12:47:18 +0200 |
commit | a6bf388ab32f388147084e0f9936ed6567ada776 (patch) | |
tree | fe46ddf288cebdc470acade95c5991d2c06a5231 /lib/rpmte.c | |
parent | 0aba719592a1dd6532a1e70e9defbad5e62fc1ed (diff) | |
download | librpm-tizen-a6bf388ab32f388147084e0f9936ed6567ada776.tar.gz librpm-tizen-a6bf388ab32f388147084e0f9936ed6567ada776.tar.bz2 librpm-tizen-a6bf388ab32f388147084e0f9936ed6567ada776.zip |
Filter out duplicate problems when adding to element problem sets
- Problems associated with a transaction element are necessarily unique
to that element, so when filtered there we don't have to worry about
skipping dupes elsewhere like in merged sets. This can actually lead
to apparent duplicates in the current problem report output (eg in cases
where multiple packages provide the same dependency which would be
removed, like multilib packages), but this is only an artifact of
they way the problems are currently printed out.
- While this is still a dumb linear search, it can be several seconds
faster than the previous filtering in rpmpsPrint(), which is now
just a dumb convenience function.
Diffstat (limited to 'lib/rpmte.c')
-rw-r--r-- | lib/rpmte.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/rpmte.c b/lib/rpmte.c index cf46236bd..10e9bee93 100644 --- a/lib/rpmte.c +++ b/lib/rpmte.c @@ -721,11 +721,22 @@ static void appendProblem(rpmte te, rpmProblemType type, const char * pkgNEVR, fnpyKey key, const char * altNEVR, const char * str, uint64_t number) { - if (te->probs == NULL) - te->probs = rpmpsCreate(); - + rpmProblem o; rpmProblem p = rpmProblemCreate(type, pkgNEVR, key, altNEVR, str, number); - rpmpsAppendProblem(te->probs, p); + rpmpsi psi = rpmpsInitIterator(te->probs); + + /* Only add new, unique problems to the set */ + while ((o = rpmpsiNext(psi))) { + if (rpmProblemCompare(p, o) == 0) + break; + } + rpmpsFreeIterator(psi); + + if (o == NULL) { + if (te->probs == NULL) + te->probs = rpmpsCreate(); + rpmpsAppendProblem(te->probs, p); + } rpmProblemFree(p); } |