summaryrefslogtreecommitdiff
path: root/apt-private
diff options
context:
space:
mode:
Diffstat (limited to 'apt-private')
-rw-r--r--apt-private/private-cacheset.cc65
-rw-r--r--apt-private/private-cacheset.h16
2 files changed, 69 insertions, 12 deletions
diff --git a/apt-private/private-cacheset.cc b/apt-private/private-cacheset.cc
index 95a16f8ba..98b842adb 100644
--- a/apt-private/private-cacheset.cc
+++ b/apt-private/private-cacheset.cc
@@ -188,6 +188,25 @@ CacheSetHelperAPTGet::CacheSetHelperAPTGet(std::ostream &pout) :
{
explicitlyNamed = true;
}
+void CacheSetHelperAPTGet::showPackageSelection(pkgCache::PkgIterator const &pkg, enum PkgSelector const select,
+ std::string const &pattern)
+{
+ switch (select)
+ {
+ case REGEX:
+ showRegExSelection(pkg, pattern);
+ break;
+ case TASK:
+ showTaskSelection(pkg, pattern);
+ break;
+ case FNMATCH:
+ showFnmatchSelection(pkg, pattern);
+ break;
+ default:
+ APT::CacheSetHelper::showPackageSelection(pkg, select, pattern);
+ break;
+ }
+}
void CacheSetHelperAPTGet::showTaskSelection(pkgCache::PkgIterator const &Pkg, std::string const &pattern)
{
ioprintf(out, _("Note, selecting '%s' for task '%s'\n"),
@@ -206,13 +225,22 @@ void CacheSetHelperAPTGet::showRegExSelection(pkgCache::PkgIterator const &Pkg,
Pkg.FullName(true).c_str(), pattern.c_str());
explicitlyNamed = false;
}
-void CacheSetHelperAPTGet::showSelectedVersion(pkgCache::PkgIterator const &/*Pkg*/, pkgCache::VerIterator const Ver,
- std::string const &ver, bool const /*verIsRel*/)
+void CacheSetHelperAPTGet::showVersionSelection(pkgCache::PkgIterator const &Pkg,
+ pkgCache::VerIterator const &Ver, enum VerSelector const select, std::string const &pattern)
{
- if (ver == Ver.VerStr())
- return;
- selectedByRelease.push_back(make_pair(Ver, ver));
+ switch (select)
+ {
+ case RELEASE:
+ case VERSIONNUMBER:
+ if (pattern == Ver.VerStr())
+ return;
+ selectedByRelease.push_back(make_pair(Ver, pattern));
+ break;
+ default:
+ return APT::CacheSetHelper::showVersionSelection(Pkg, Ver, select, pattern);
+ }
}
+
bool CacheSetHelperAPTGet::showVirtualPackageErrors(pkgCacheFile &Cache)
{
if (virtualPkgs.empty() == true)
@@ -268,6 +296,33 @@ bool CacheSetHelperAPTGet::showVirtualPackageErrors(pkgCacheFile &Cache)
}
return false;
}
+pkgCache::VerIterator CacheSetHelperAPTGet::canNotGetVersion(enum VerSelector const select, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg)
+{
+ switch (select)
+ {
+ case NEWEST:
+ return canNotFindNewestVer(Cache, Pkg);
+ case CANDIDATE:
+ return canNotFindCandidateVer(Cache, Pkg);
+ default:
+ return APT::CacheSetHelper::canNotGetVersion(select, Cache, Pkg);
+ }
+}
+void CacheSetHelperAPTGet::canNotFindVersion(enum VerSelector const select, APT::VersionContainerInterface * const vci, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg)
+{
+ switch (select)
+ {
+ case NEWEST:
+ canNotFindNewestVer(Cache, Pkg);
+ break;
+ case CANDIDATE:
+ canNotFindCandidateVer(Cache, Pkg);
+ break;
+ default:
+ return APT::CacheSetHelper::canNotFindVersion(select, vci, Cache, Pkg);
+ }
+}
+
pkgCache::VerIterator CacheSetHelperAPTGet::canNotFindCandidateVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg)
{
APT::VersionSet const verset = tryVirtualPackage(Cache, Pkg, CacheSetHelper::CANDIDATE);
diff --git a/apt-private/private-cacheset.h b/apt-private/private-cacheset.h
index c52df36d7..8848aa3aa 100644
--- a/apt-private/private-cacheset.h
+++ b/apt-private/private-cacheset.h
@@ -107,15 +107,17 @@ public:
explicit CacheSetHelperAPTGet(std::ostream &out);
- virtual void showTaskSelection(pkgCache::PkgIterator const &Pkg, std::string const &pattern) APT_OVERRIDE;
- virtual void showFnmatchSelection(pkgCache::PkgIterator const &Pkg, std::string const &pattern) APT_OVERRIDE;
- virtual void showRegExSelection(pkgCache::PkgIterator const &Pkg, std::string const &pattern) APT_OVERRIDE;
- virtual void showSelectedVersion(pkgCache::PkgIterator const &/*Pkg*/, pkgCache::VerIterator const Ver,
- std::string const &ver, bool const /*verIsRel*/) APT_OVERRIDE;
+ virtual void showPackageSelection(pkgCache::PkgIterator const &Pkg, enum PkgSelector const select, std::string const &pattern) APT_OVERRIDE;
+ void showTaskSelection(pkgCache::PkgIterator const &Pkg, std::string const &pattern);
+ void showFnmatchSelection(pkgCache::PkgIterator const &Pkg, std::string const &pattern);
+ void showRegExSelection(pkgCache::PkgIterator const &Pkg, std::string const &pattern);
+ void showVersionSelection(pkgCache::PkgIterator const &Pkg, pkgCache::VerIterator const &Ver, enum VerSelector const select, std::string const &pattern) APT_OVERRIDE;
bool showVirtualPackageErrors(pkgCacheFile &Cache);
- virtual pkgCache::VerIterator canNotFindCandidateVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) APT_OVERRIDE;
- virtual pkgCache::VerIterator canNotFindNewestVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) APT_OVERRIDE;
+ pkgCache::VerIterator canNotGetVersion(enum VerSelector const select, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) APT_OVERRIDE;
+ void canNotFindVersion(enum VerSelector const select, APT::VersionContainerInterface * const vci, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) APT_OVERRIDE;
+ pkgCache::VerIterator canNotFindCandidateVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg);
+ pkgCache::VerIterator canNotFindNewestVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg);
virtual pkgCache::PkgIterator canNotFindPkgName(pkgCacheFile &Cache, std::string const &str) APT_OVERRIDE;
APT::VersionSet tryVirtualPackage(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg,