diff options
author | Florian Festi <ffesti@redhat.com> | 2014-07-22 13:09:33 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2014-08-18 10:00:01 +0300 |
commit | 4e55f32530475f2ddc111af7152bec6efe5ba065 (patch) | |
tree | f5fe726d898966601f4e2546e76aa0a780cc0e57 | |
parent | 61559415c5d83ce19b63e32e2c09c47c26204003 (diff) | |
download | rpm-4e55f32530475f2ddc111af7152bec6efe5ba065.tar.gz |
Modify rpmalSatisfiesDepend() to get the requesting TE as a param to be able to prefere self provides.
This way the ordering code can ignore self provides and avoid unnessecary dependency loops as in rhbz#1111349
(cherry picked from commit 6b6f8e6ecba05c69e4ecfc0ef6981a920b4b0eb6)
-rw-r--r-- | lib/order.c | 2 | ||||
-rw-r--r-- | lib/rpmal.c | 16 | ||||
-rw-r--r-- | lib/rpmal.h | 2 |
3 files changed, 12 insertions, 8 deletions
diff --git a/lib/order.c b/lib/order.c index 5222cf324..f09b192ba 100644 --- a/lib/order.c +++ b/lib/order.c @@ -152,7 +152,7 @@ static inline int addRelation(rpmts ts, if (dsflags & (RPMSENSE_RPMLIB|RPMSENSE_CONFIG|RPMSENSE_PRETRANS|RPMSENSE_POSTTRANS)) return 0; - q = rpmalSatisfiesDepend(al, requires); + q = rpmalSatisfiesDepend(al, p, requires); /* Avoid deps outside this transaction and self dependencies */ if (q == NULL || q == p) diff --git a/lib/rpmal.c b/lib/rpmal.c index 23f39786d..f732788c8 100644 --- a/lib/rpmal.c +++ b/lib/rpmal.c @@ -512,26 +512,30 @@ rpmte * rpmalAllSatisfiesDepend(const rpmal al, const rpmds ds) } rpmte -rpmalSatisfiesDepend(const rpmal al, const rpmds ds) +rpmalSatisfiesDepend(const rpmal al, const rpmte te, const rpmds ds) { rpmte *providers = rpmalAllSatisfiesDepend(al, ds); rpmte best = NULL; if (providers) { - if (al->tscolor) { + rpm_color_t dscolor = rpmdsColor(ds); + for (rpmte *p = providers; *p; p++) { + if (*p == te) { + /* package provides requirement itself */ + return *p; + } + if (al->tscolor) { /* * For colored dependencies, try to find a matching provider. * Otherwise prefer provider of ts preferred color. */ - rpm_color_t dscolor = rpmdsColor(ds); - for (rpmte *p = providers; *p; p++) { rpm_color_t tecolor = rpmteColor(*p); if (dscolor) { if (dscolor == tecolor) best = *p; - } else if (al->prefcolor) { + } else if (al->prefcolor && !best) { + /* Do not overwrite previous findings */ if (al->prefcolor == tecolor) best = *p; } - if (best) break; } } /* if not decided by now, just pick first match */ diff --git a/lib/rpmal.h b/lib/rpmal.h index cbb3b8ceb..772fb66c6 100644 --- a/lib/rpmal.h +++ b/lib/rpmal.h @@ -77,7 +77,7 @@ rpmte * rpmalAllSatisfiesDepend(const rpmal al, const rpmds ds); * @return best provider for the dependency, NULL if none */ RPM_GNUC_INTERNAL -rpmte rpmalSatisfiesDepend(const rpmal al, const rpmds ds); +rpmte rpmalSatisfiesDepend(const rpmal al, const rpmte te, const rpmds ds); #ifdef __cplusplus } |