diff options
| author | David Kalnischkies <david@kalnischkies.de> | 2020-05-26 15:04:44 +0200 |
|---|---|---|
| committer | David Kalnischkies <david@kalnischkies.de> | 2020-05-27 11:15:25 +0200 |
| commit | 5eff00606c0c55cb6e456e521c8c4059e37264a0 (patch) | |
| tree | b502f2512c072a6c8f40f380dac0e79a0e87cf2e /apt-pkg | |
| parent | 1941515e1c96f9c33d63e426049d9dad5420c580 (diff) | |
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.
Diffstat (limited to 'apt-pkg')
| -rw-r--r-- | apt-pkg/versionmatch.cc | 15 |
1 files changed, 8 insertions, 7 deletions
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{}; } /*}}}*/ |
