From 5eff00606c0c55cb6e456e521c8c4059e37264a0 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 26 May 2020 15:04:44 +0200 Subject: Allow version selection to match versioned self-provides Edgecase of an edgecase at best, but it works just fine as a dependency, so it should really work on the commandline as well. --- apt-pkg/versionmatch.cc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/versionmatch.cc b/apt-pkg/versionmatch.cc index 340f5a64c..82590edfe 100644 --- a/apt-pkg/versionmatch.cc +++ b/apt-pkg/versionmatch.cc @@ -159,15 +159,16 @@ bool pkgVersionMatch::MatchVer(const char *A,string B,bool Prefix) /* */ pkgCache::VerIterator pkgVersionMatch::Find(pkgCache::PkgIterator Pkg) { - pkgCache::VerIterator Ver = Pkg.VersionList(); - for (; Ver.end() == false; ++Ver) - { + for (auto Ver = Pkg.VersionList(); not Ver.end(); ++Ver) if (VersionMatches(Ver)) return Ver; - } - - // This will be Ended by now. - return Ver; + // check if the package provides itself in a matching version + for (auto Prov = Pkg.ProvidesList(); not Prov.end(); ++Prov) + if (Prov->ProvideVersion != 0 && Prov.OwnerPkg() == Prov.ParentPkg()) + if (MatchVer(Prov.ProvideVersion(), VerStr, VerPrefixMatch) || + ExpressionMatches(VerStr, Prov.ProvideVersion())) + return Prov.OwnerVer(); + return pkgCache::VerIterator{}; } /*}}}*/ -- cgit v1.2.3-70-g09d2