diff options
-rw-r--r-- | apt-pkg/cacheset.cc | 10 | ||||
-rw-r--r-- | apt-pkg/cacheset.h | 40 | ||||
-rw-r--r-- | apt-private/private-cacheset.cc | 65 | ||||
-rw-r--r-- | apt-private/private-cacheset.h | 16 |
4 files changed, 85 insertions, 46 deletions
diff --git a/apt-pkg/cacheset.cc b/apt-pkg/cacheset.cc index 0c0f213b7..789727266 100644 --- a/apt-pkg/cacheset.cc +++ b/apt-pkg/cacheset.cc @@ -681,14 +681,12 @@ void CacheSetHelper::canNotFindPackage(enum PkgSelector const select, PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &pattern) { switch (select) { -APT_IGNORE_DEPRECATED_PUSH case REGEX: canNotFindRegEx(pci, Cache, pattern); break; case TASK: canNotFindTask(pci, Cache, pattern); break; case FNMATCH: canNotFindFnmatch(pci, Cache, pattern); break; case PACKAGENAME: canNotFindPackage(pci, Cache, pattern); break; case STRING: canNotFindPackage(pci, Cache, pattern); break; case UNKNOWN: break; -APT_IGNORE_DEPRECATED_POP } } // canNotFindTask - handle the case no package is found for a task /*{{{*/ @@ -726,14 +724,12 @@ pkgCache::PkgIterator CacheSetHelper::canNotFindPkgName(pkgCacheFile &Cache, void CacheSetHelper::canNotFindVersion(enum VerSelector const select, VersionContainerInterface * const vci, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) { switch (select) { -APT_IGNORE_DEPRECATED_PUSH case ALL: canNotFindAllVer(vci, Cache, Pkg); break; case INSTCAND: canNotFindInstCandVer(vci, Cache, Pkg); break; case CANDINST: canNotFindCandInstVer(vci, Cache, Pkg); break; case NEWEST: canNotFindNewestVer(Cache, Pkg); break; case CANDIDATE: canNotFindCandidateVer(Cache, Pkg); break; case INSTALLED: canNotFindInstalledVer(Cache, Pkg); break; -APT_IGNORE_DEPRECATED_POP case CANDANDINST: canNotGetCandInstVer(Cache, Pkg); break; case RELEASE: case VERSIONNUMBER: @@ -764,11 +760,9 @@ void CacheSetHelper::canNotFindCandInstVer(VersionContainerInterface * const /*v // canNotGetVersion - for package by selector /*{{{*/ pkgCache::VerIterator CacheSetHelper::canNotGetVersion(enum VerSelector const select, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) { switch (select) { -APT_IGNORE_DEPRECATED_PUSH case NEWEST: return canNotFindNewestVer(Cache, Pkg); case CANDIDATE: return canNotFindCandidateVer(Cache, Pkg); case INSTALLED: return canNotFindInstalledVer(Cache, Pkg); -APT_IGNORE_DEPRECATED_POP case CANDINST: return canNotGetCandInstVer(Cache, Pkg); case INSTCAND: return canNotGetInstCandVer(Cache, Pkg); case ALL: @@ -825,11 +819,9 @@ pkgCache::VerIterator CacheSetHelper::canNotGetCandInstVer(pkgCacheFile &Cache, void CacheSetHelper::showPackageSelection(pkgCache::PkgIterator const &pkg, enum PkgSelector const select, std::string const &pattern) { switch (select) { -APT_IGNORE_DEPRECATED_PUSH case REGEX: showRegExSelection(pkg, pattern); break; case TASK: showTaskSelection(pkg, pattern); break; case FNMATCH: showFnmatchSelection(pkg, pattern); break; -APT_IGNORE_DEPRECATED_POP case PACKAGENAME: /* no surprises here */ break; case STRING: /* handled by the special cases */ break; case UNKNOWN: break; @@ -855,14 +847,12 @@ void CacheSetHelper::showFnmatchSelection(pkgCache::PkgIterator const &/*pkg*/, void CacheSetHelper::showVersionSelection(pkgCache::PkgIterator const &Pkg, pkgCache::VerIterator const &Ver, enum VerSelector const select, std::string const &pattern) { switch (select) { -APT_IGNORE_DEPRECATED_PUSH case RELEASE: showSelectedVersion(Pkg, Ver, pattern, true); break; case VERSIONNUMBER: showSelectedVersion(Pkg, Ver, pattern, false); break; -APT_IGNORE_DEPRECATED_POP case NEWEST: case CANDIDATE: case INSTALLED: diff --git a/apt-pkg/cacheset.h b/apt-pkg/cacheset.h index 26dd82a60..489fb6220 100644 --- a/apt-pkg/cacheset.h +++ b/apt-pkg/cacheset.h @@ -79,11 +79,6 @@ public: /*{{{*/ * \param pattern is the string used by the selection method to pick the package */ virtual void showPackageSelection(pkgCache::PkgIterator const &pkg, PkgSelector const select, std::string const &pattern); - // use the method above instead, react only on the type you need and let the base handle the rest if need be - // this allows us to add new selection methods without breaking the ABI constantly with new virtual methods - APT_DEPRECATED_MSG("override .showPackageSelection and select with switch") virtual void showTaskSelection(pkgCache::PkgIterator const &pkg, std::string const &pattern); - APT_DEPRECATED_MSG("override .showPackageSelection and select with switch") virtual void showRegExSelection(pkgCache::PkgIterator const &pkg, std::string const &pattern); - APT_DEPRECATED_MSG("override .showPackageSelection and select with switch") virtual void showFnmatchSelection(pkgCache::PkgIterator const &pkg, std::string const &pattern); /** \brief be notified if a package can't be found via pattern * @@ -95,11 +90,6 @@ public: /*{{{*/ * \param pattern is the string not matching anything */ virtual void canNotFindPackage(enum PkgSelector const select, PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &pattern); - // same as above for showPackageSelection - APT_DEPRECATED_MSG("override .canNotFindPackage and select with switch") virtual void canNotFindTask(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern); - APT_DEPRECATED_MSG("override .canNotFindPackage and select with switch") virtual void canNotFindRegEx(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern); - APT_DEPRECATED_MSG("override .canNotFindPackage and select with switch") virtual void canNotFindFnmatch(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern); - APT_DEPRECATED_MSG("override .canNotFindPackage and select with switch") virtual void canNotFindPackage(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &str); /** \brief specifies which version(s) we want to refer to */ enum VerSelector { @@ -136,8 +126,6 @@ public: /*{{{*/ */ virtual void showVersionSelection(pkgCache::PkgIterator const &Pkg, pkgCache::VerIterator const &Ver, enum VerSelector const select, std::string const &pattern); - APT_DEPRECATED_MSG("use .showVersionSelection instead, similar to .showPackageSelection") virtual void showSelectedVersion(pkgCache::PkgIterator const &Pkg, pkgCache::VerIterator const Ver, - std::string const &ver, bool const verIsRel); /** \brief be notified if a version can't be found for a package * @@ -149,22 +137,10 @@ public: /*{{{*/ * \param Pkg is the package we wanted a version from */ virtual void canNotFindVersion(enum VerSelector const select, VersionContainerInterface * const vci, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg); - APT_DEPRECATED_MSG("override .canNotFindVersion and select via switch") virtual void canNotFindAllVer(VersionContainerInterface * const vci, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg); - APT_DEPRECATED_MSG("override .canNotFindVersion and select via switch") virtual void canNotFindInstCandVer(VersionContainerInterface * const vci, pkgCacheFile &Cache, - pkgCache::PkgIterator const &Pkg); - APT_DEPRECATED_MSG("override .canNotFindVersion and select via switch") virtual void canNotFindCandInstVer(VersionContainerInterface * const vci, - pkgCacheFile &Cache, - pkgCache::PkgIterator const &Pkg); // the difference between canNotFind and canNotGet is that the later is more low-level // and called from other places: In this case looking into the code is the only real answer… virtual pkgCache::VerIterator canNotGetVersion(enum VerSelector const select, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg); - APT_DEPRECATED_MSG("override .canNotGetVersion and select via switch") virtual pkgCache::VerIterator canNotFindNewestVer(pkgCacheFile &Cache, - pkgCache::PkgIterator const &Pkg); - APT_DEPRECATED_MSG("override .canNotGetVersion and select via switch") virtual pkgCache::VerIterator canNotFindCandidateVer(pkgCacheFile &Cache, - pkgCache::PkgIterator const &Pkg); - APT_DEPRECATED_MSG("override .canNotGetVersion and select via switch") virtual pkgCache::VerIterator canNotFindInstalledVer(pkgCacheFile &Cache, - pkgCache::PkgIterator const &Pkg); virtual pkgCache::PkgIterator canNotFindPkgName(pkgCacheFile &Cache, std::string const &str); @@ -197,6 +173,22 @@ protected: bool PackageFromPackageName(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern); bool PackageFromString(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &pattern); private: + void showTaskSelection(pkgCache::PkgIterator const &pkg, std::string const &pattern); + void showRegExSelection(pkgCache::PkgIterator const &pkg, std::string const &pattern); + void showFnmatchSelection(pkgCache::PkgIterator const &pkg, std::string const &pattern); + void canNotFindTask(PackageContainerInterface *const pci, pkgCacheFile &Cache, std::string pattern); + void canNotFindRegEx(PackageContainerInterface *const pci, pkgCacheFile &Cache, std::string pattern); + void canNotFindFnmatch(PackageContainerInterface *const pci, pkgCacheFile &Cache, std::string pattern); + void canNotFindPackage(PackageContainerInterface *const pci, pkgCacheFile &Cache, std::string const &str); + void showSelectedVersion(pkgCache::PkgIterator const &Pkg, pkgCache::VerIterator const Ver, + std::string const &ver, bool const verIsRel); + void canNotFindAllVer(VersionContainerInterface * const vci, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg); + void canNotFindInstCandVer(VersionContainerInterface * const vci, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg); + void canNotFindCandInstVer(VersionContainerInterface * const vci, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg); + pkgCache::VerIterator canNotFindNewestVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg); + pkgCache::VerIterator canNotFindCandidateVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg); + pkgCache::VerIterator canNotFindInstalledVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg); + void * const d; }; /*}}}*/ // Iterator templates for our Containers /*{{{*/ 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, |