From b9f5062c227f4a8feff83c0ee1cde2929da7cd3e Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Tue, 15 Feb 2011 15:07:02 +0200 Subject: [PATCH] Allow installation of self-conflicting packages (ticket #806, RhBug:651951) - Besides fixing the stupid situation where we happily create package(s) that can under no circumstances be installed, this makes it possible to create "singleton" packages which can be useful in some cases, eg http://lists.rpm.org/pipermail/rpm-maint/2010-April/002719.html --- lib/depends.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/lib/depends.c b/lib/depends.c index 4a4daa5..4daa512 100644 --- a/lib/depends.c +++ b/lib/depends.c @@ -412,9 +412,24 @@ retry: goto exit; /* Pretrans dependencies can't be satisfied by added packages. */ - if (!(dsflags & RPMSENSE_PRETRANS) && - rpmalSatisfiesDepend(tsmem->addedPackages, dep) != NULL) { - goto exit; + if (!(dsflags & RPMSENSE_PRETRANS)) { + rpmte match = rpmalSatisfiesDepend(tsmem->addedPackages, dep); + + /* + * Handle definitive matches within the added package set. + * Self-obsoletes and -conflicts fall through here as we need to + * check for possible other matches in the rpmdb. + */ + if (match) { + rpmTagVal dtag = rpmdsTagN(dep); + /* Requires match, look no further */ + if (dtag == RPMTAG_REQUIRENAME) + goto exit; + + /* Conflicts/obsoletes match on another package, look no further */ + if (rpmteDS(match, dtag) != dep) + goto exit; + } } /* See if the rpmdb provides it */ -- 2.7.4