summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2019-05-06 15:02:38 +0200
committerJulian Andres Klode <julian.klode@canonical.com>2019-05-06 15:02:38 +0200
commitf6d7e21b7ba31f396d4e8c8e8a0b5b31562afb5b (patch)
tree78c02ae1e5ecf1c6aaf1ffd64217075d6169fbe1
parentdb36c35a351a76825ae00628b74c160bc418683c (diff)
cacheset: Remove simple cases of deprecated code
This is missing the ones that are still actively used in cacheset.cc, we need to clean those up too, but they are obviously more tricky.
-rw-r--r--apt-pkg/cacheset.cc27
-rw-r--r--apt-pkg/cacheset.h156
-rw-r--r--cmdline/apt-cache.cc8
3 files changed, 6 insertions, 185 deletions
diff --git a/apt-pkg/cacheset.cc b/apt-pkg/cacheset.cc
index 670cdba3a..0c0f213b7 100644
--- a/apt-pkg/cacheset.cc
+++ b/apt-pkg/cacheset.cc
@@ -231,33 +231,6 @@ bool CacheSetHelper::PackageFromFnmatch(PackageContainerInterface * const pci,
return true;
}
/*}}}*/
-// PackageFromName - Returns the package defined by this string /*{{{*/
-pkgCache::PkgIterator CacheSetHelper::PackageFromName(pkgCacheFile &Cache,
- std::string const &str) {
- std::string pkg = str;
- size_t archfound = pkg.find_last_of(':');
- std::string arch;
- if (archfound != std::string::npos) {
- arch = pkg.substr(archfound+1);
- pkg.erase(archfound);
- }
-
- if (Cache.GetPkgCache() == 0)
- return pkgCache::PkgIterator(Cache, 0);
-
- pkgCache::PkgIterator Pkg(Cache, 0);
- if (arch.empty() == true) {
- pkgCache::GrpIterator Grp = Cache.GetPkgCache()->FindGrp(pkg);
- if (Grp.end() == false)
- Pkg = Grp.FindPreferredPkg();
- } else
- Pkg = Cache.GetPkgCache()->FindPkg(pkg, arch);
-
- if (Pkg.end() == true)
- return canNotFindPkgName(Cache, str);
- return Pkg;
-}
- /*}}}*/
// PackageFromPackageName - Returns the package defined by this string /*{{{*/
bool CacheSetHelper::PackageFromPackageName(PackageContainerInterface * const pci, pkgCacheFile &Cache,
std::string pkg) {
diff --git a/apt-pkg/cacheset.h b/apt-pkg/cacheset.h
index b00fc7318..934f6611c 100644
--- a/apt-pkg/cacheset.h
+++ b/apt-pkg/cacheset.h
@@ -75,7 +75,6 @@ public: /*{{{*/
pkgCacheFile &Cache, const char * cmdline,
std::list<PkgModifier> const &mods);
- APT_DEPRECATED_MSG("use .PackageFrom(PACKAGENAME, …) instead") pkgCache::PkgIterator PackageFromName(pkgCacheFile &Cache, std::string const &pattern);
/** \brief be notified about the package being selected via pattern
*
@@ -311,11 +310,6 @@ public:
inline const char *Name() const {return getType().Name(); }
inline std::string FullName(bool const Pretty) const { return getType().FullName(Pretty); }
inline std::string FullName() const { return getType().FullName(); }
- APT_DEPRECATED_MSG("Use the .Section method of VerIterator instead") inline const char *Section() const {
- APT_IGNORE_DEPRECATED_PUSH
- return getType().Section();
- APT_IGNORE_DEPRECATED_POP
- }
inline bool Purge() const {return getType().Purge(); }
inline const char *Arch() const {return getType().Arch(); }
inline pkgCache::GrpIterator Group() const { return getType().Group(); }
@@ -324,7 +318,6 @@ public:
inline pkgCache::DepIterator RevDependsList() const { return getType().RevDependsList(); }
inline pkgCache::PrvIterator ProvidesList() const { return getType().ProvidesList(); }
inline pkgCache::PkgIterator::OkState State() const { return getType().State(); }
- APT_DEPRECATED_MSG("This method does not respect apt_preferences! Use pkgDepCache::GetCandidateVersion(Pkg)") inline const char *CandVersion() const { return getType().CandVersion(); }
inline const char *CurVersion() const { return getType().CurVersion(); }
inline pkgCache *Cache() const { return getType().Cache(); }
inline unsigned long Index() const {return getType().Index();}
@@ -340,14 +333,6 @@ public:
virtual void clear() = 0;
virtual size_t size() const = 0;
- enum APT_DEPRECATED_MSG("Use CacheSetHelper::PkgSelector instead") Constructor { UNKNOWN = CacheSetHelper::UNKNOWN,
- REGEX = CacheSetHelper::REGEX,
- TASK = CacheSetHelper::TASK,
- FNMATCH = CacheSetHelper::FNMATCH };
-APT_IGNORE_DEPRECATED_PUSH
- void setConstructor(Constructor const by) { ConstructedBy = (CacheSetHelper::PkgSelector)by; }
-APT_IGNORE_DEPRECATED_POP
-
void setConstructor(CacheSetHelper::PkgSelector const by) { ConstructedBy = by; }
CacheSetHelper::PkgSelector getConstructor() const { return ConstructedBy; }
PackageContainerInterface();
@@ -355,30 +340,6 @@ APT_IGNORE_DEPRECATED_POP
PackageContainerInterface& operator=(PackageContainerInterface const &other);
virtual ~PackageContainerInterface();
- APT_DEPRECATED_MSG("Use helper.PackageFrom(CacheSetHelper::TASK, …) instead") static bool FromTask(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
- return helper.PackageFrom(CacheSetHelper::TASK, pci, Cache, pattern); }
- APT_DEPRECATED_MSG("Use helper.PackageFrom(CacheSetHelper::REGEX, …) instead") static bool FromRegEx(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
- return helper.PackageFrom(CacheSetHelper::REGEX, pci, Cache, pattern); }
- APT_DEPRECATED_MSG("Use helper.PackageFrom(CacheSetHelper::FNMATCH, …) instead") static bool FromFnmatch(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
- return helper.PackageFrom(CacheSetHelper::FNMATCH, pci, Cache, pattern); }
- APT_DEPRECATED_MSG("Use helper.PackageFrom(CacheSetHelper::PACKAGENAME, …) instead") static bool FromGroup(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
- return helper.PackageFrom(CacheSetHelper::PACKAGENAME, pci, Cache, pattern); }
- APT_DEPRECATED_MSG("Use helper.PackageFrom(CacheSetHelper::STRING, …) instead") static bool FromString(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
- return helper.PackageFrom(CacheSetHelper::STRING, pci, Cache, pattern); }
- APT_DEPRECATED_MSG("Use helper.PackageFromCommandLine instead") static bool FromCommandLine(PackageContainerInterface * const pci, pkgCacheFile &Cache, const char **cmdline, CacheSetHelper &helper) {
- return helper.PackageFromCommandLine(pci, Cache, cmdline); }
-
- APT_DEPRECATED_MSG("enum moved to CacheSetHelper::PkgModifier") typedef CacheSetHelper::PkgModifier Modifier;
-
-APT_IGNORE_DEPRECATED_PUSH
- APT_DEPRECATED_MSG("Use helper.PackageFromName instead") static pkgCache::PkgIterator FromName(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
- return helper.PackageFromName(Cache, pattern); }
- APT_DEPRECATED_MSG("Use helper.PackageFromModifierCommandLine instead") static bool FromModifierCommandLine(unsigned short &modID, PackageContainerInterface * const pci,
- pkgCacheFile &Cache, const char * cmdline,
- std::list<Modifier> const &mods, CacheSetHelper &helper) {
- return helper.PackageFromModifierCommandLine(modID, pci, Cache, cmdline, mods); }
-APT_IGNORE_DEPRECATED_POP
-
private:
CacheSetHelper::PkgSelector ConstructedBy;
void * const d;
@@ -438,9 +399,6 @@ public: /*{{{*/
PackageContainer() : PackageContainerInterface(CacheSetHelper::UNKNOWN) {}
explicit PackageContainer(CacheSetHelper::PkgSelector const &by) : PackageContainerInterface(by) {}
-APT_IGNORE_DEPRECATED_PUSH
- APT_DEPRECATED_MSG("Construct with a CacheSetHelper::PkgSelector instead") explicit PackageContainer(Constructor const &by) : PackageContainerInterface((CacheSetHelper::PkgSelector)by) {}
-APT_IGNORE_DEPRECATED_POP
template<typename Itr> PackageContainer(Itr first, Itr last) : PackageContainerInterface(CacheSetHelper::UNKNOWN), _cont(first, last) {}
#if __cplusplus >= 201103L
PackageContainer(std::initializer_list<value_type> list) : PackageContainerInterface(CacheSetHelper::UNKNOWN), _cont(list) {}
@@ -508,21 +466,6 @@ APT_IGNORE_DEPRECATED_POP
return FromFnmatch(Cache, pattern, helper);
}
-APT_IGNORE_DEPRECATED_PUSH
- /** \brief returns a package specified by a string
-
- \param Cache the package is in
- \param pattern String the package name should be extracted from
- \param helper responsible for error and message handling */
- APT_DEPRECATED_MSG("Use helper.PackageFromName instead") static pkgCache::PkgIterator FromName(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
- return helper.PackageFromName(Cache, pattern);
- }
- APT_DEPRECATED_MSG("Use helper.PackageFromName instead") static pkgCache::PkgIterator FromName(pkgCacheFile &Cache, std::string const &pattern) {
- CacheSetHelper helper;
- return FromName(Cache, pattern, helper);
- }
-APT_IGNORE_DEPRECATED_POP
-
/** \brief returns all packages specified by a string
\param Cache the packages are in
@@ -792,17 +735,6 @@ public:
virtual void clear() = 0;
virtual size_t size() const = 0;
- /** \brief specifies which version(s) will be returned if non is given */
- enum APT_DEPRECATED_MSG("enum moved to CacheSetHelper::VerSelector instead") Version {
- ALL = CacheSetHelper::ALL,
- CANDANDINST = CacheSetHelper::CANDANDINST,
- CANDIDATE = CacheSetHelper::CANDIDATE,
- INSTALLED = CacheSetHelper::INSTALLED,
- CANDINST = CacheSetHelper::CANDINST,
- INSTCAND = CacheSetHelper::INSTCAND,
- NEWEST = CacheSetHelper::NEWEST
- };
-
struct Modifier {
unsigned short const ID;
const char * const Alias;
@@ -811,45 +743,20 @@ public:
Modifier (unsigned short const &id, const char * const alias, Position const &pos,
enum CacheSetHelper::VerSelector const select) : ID(id), Alias(alias), Pos(pos),
SelectVersion(select) {}
-APT_IGNORE_DEPRECATED_PUSH
- APT_DEPRECATED_MSG("Construct with a CacheSetHelper::VerSelector instead") Modifier(unsigned short const &id, const char * const alias, Position const &pos,
- Version const &select) : ID(id), Alias(alias), Pos(pos),
- SelectVersion((CacheSetHelper::VerSelector)select) {}
-APT_IGNORE_DEPRECATED_POP
};
static bool FromCommandLine(VersionContainerInterface * const vci, pkgCacheFile &Cache,
const char **cmdline, CacheSetHelper::VerSelector const fallback,
CacheSetHelper &helper);
-APT_IGNORE_DEPRECATED_PUSH
- APT_DEPRECATED_MSG("Use CacheSetHelper::VerSelector as fallback selector") static bool FromCommandLine(VersionContainerInterface * const vci, pkgCacheFile &Cache,
- const char **cmdline, Version const &fallback,
- CacheSetHelper &helper) {
- return FromCommandLine(vci, Cache, cmdline, (CacheSetHelper::VerSelector)fallback, helper);
- }
-APT_IGNORE_DEPRECATED_POP
static bool FromString(VersionContainerInterface * const vci, pkgCacheFile &Cache,
std::string pkg, CacheSetHelper::VerSelector const fallback, CacheSetHelper &helper,
bool const onlyFromName = false);
-APT_IGNORE_DEPRECATED_PUSH
- APT_DEPRECATED_MSG("Use CacheSetHelper::VerSelector as fallback selector") static bool FromString(VersionContainerInterface * const vci, pkgCacheFile &Cache,
- std::string pkg, Version const &fallback, CacheSetHelper &helper,
- bool const onlyFromName = false) {
- return FromString(vci, Cache, pkg, (CacheSetHelper::VerSelector)fallback, helper, onlyFromName);
- }
-APT_IGNORE_DEPRECATED_POP
+
static bool FromPackage(VersionContainerInterface * const vci, pkgCacheFile &Cache,
pkgCache::PkgIterator const &P, CacheSetHelper::VerSelector const fallback,
CacheSetHelper &helper);
-APT_IGNORE_DEPRECATED_PUSH
- APT_DEPRECATED_MSG("Use CacheSetHelper::VerSelector as fallback selector") static bool FromPackage(VersionContainerInterface * const vci, pkgCacheFile &Cache,
- pkgCache::PkgIterator const &P, Version const &fallback,
- CacheSetHelper &helper) {
- return FromPackage(vci, Cache, P, (CacheSetHelper::VerSelector)fallback, helper);
- }
-APT_IGNORE_DEPRECATED_POP
static bool FromModifierCommandLine(unsigned short &modID,
VersionContainerInterface * const vci,
@@ -863,15 +770,6 @@ APT_IGNORE_DEPRECATED_POP
pkgCache::DepIterator const &D,
CacheSetHelper::VerSelector const selector,
CacheSetHelper &helper);
-APT_IGNORE_DEPRECATED_PUSH
- APT_DEPRECATED_MSG("Use CacheSetHelper::VerSelector as fallback selector") static bool FromDependency(VersionContainerInterface * const vci,
- pkgCacheFile &Cache,
- pkgCache::DepIterator const &D,
- Version const &selector,
- CacheSetHelper &helper) {
- return FromDependency(vci, Cache, D, (CacheSetHelper::VerSelector)selector, helper);
- }
-APT_IGNORE_DEPRECATED_POP
VersionContainerInterface();
VersionContainerInterface& operator=(VersionContainerInterface const &other);
@@ -1008,31 +906,7 @@ public: /*{{{*/
static VersionContainer FromString(pkgCacheFile &Cache, std::string pkg) {
return FromString(Cache, pkg, CacheSetHelper::CANDINST);
}
-APT_IGNORE_DEPRECATED_PUSH
- static VersionContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline,
- Version const &fallback, CacheSetHelper &helper) {
- VersionContainer vercon;
- VersionContainerInterface::FromCommandLine(&vercon, Cache, cmdline, (CacheSetHelper::VerSelector)fallback, helper);
- return vercon;
- }
- static VersionContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline,
- Version const &fallback) {
- CacheSetHelper helper;
- return FromCommandLine(Cache, cmdline, (CacheSetHelper::VerSelector)fallback, helper);
- }
- static VersionContainer FromString(pkgCacheFile &Cache, std::string const &pkg,
- Version const &fallback, CacheSetHelper &helper,
- bool const /*onlyFromName = false*/) {
- VersionContainer vercon;
- VersionContainerInterface::FromString(&vercon, Cache, pkg, (CacheSetHelper::VerSelector)fallback, helper);
- return vercon;
- }
- static VersionContainer FromString(pkgCacheFile &Cache, std::string pkg,
- Version const &fallback) {
- CacheSetHelper helper;
- return FromString(Cache, pkg, (CacheSetHelper::VerSelector)fallback, helper);
- }
-APT_IGNORE_DEPRECATED_POP
+
/** \brief returns all versions specified for the package
@@ -1051,19 +925,6 @@ APT_IGNORE_DEPRECATED_POP
CacheSetHelper helper;
return FromPackage(Cache, P, fallback, helper);
}
-APT_IGNORE_DEPRECATED_PUSH
- static VersionContainer FromPackage(pkgCacheFile &Cache, pkgCache::PkgIterator const &P,
- Version const &fallback, CacheSetHelper &helper) {
- VersionContainer vercon;
- VersionContainerInterface::FromPackage(&vercon, Cache, P, (CacheSetHelper::VerSelector)fallback, helper);
- return vercon;
- }
- static VersionContainer FromPackage(pkgCacheFile &Cache, pkgCache::PkgIterator const &P,
- Version const &fallback) {
- CacheSetHelper helper;
- return FromPackage(Cache, P, (CacheSetHelper::VerSelector)fallback, helper);
- }
-APT_IGNORE_DEPRECATED_POP
static VersionContainer FromPackage(pkgCacheFile &Cache, pkgCache::PkgIterator const &P) {
return FromPackage(Cache, P, CacheSetHelper::CANDIDATE);
}
@@ -1104,19 +965,6 @@ APT_IGNORE_DEPRECATED_POP
CacheSetHelper helper;
return FromDependency(Cache, D, selector, helper);
}
-APT_IGNORE_DEPRECATED_PUSH
- static VersionContainer FromDependency(pkgCacheFile &Cache, pkgCache::DepIterator const &D,
- Version const &selector, CacheSetHelper &helper) {
- VersionContainer vercon;
- VersionContainerInterface::FromDependency(&vercon, Cache, D, (CacheSetHelper::VerSelector)selector, helper);
- return vercon;
- }
- static VersionContainer FromDependency(pkgCacheFile &Cache, pkgCache::DepIterator const &D,
- Version const &selector) {
- CacheSetHelper helper;
- return FromDependency(Cache, D, (CacheSetHelper::VerSelector)selector, helper);
- }
-APT_IGNORE_DEPRECATED_POP
static VersionContainer FromDependency(pkgCacheFile &Cache, pkgCache::DepIterator const &D) {
return FromDependency(Cache, D, CacheSetHelper::CANDIDATE);
}
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc
index ce7400fc7..499c9edc9 100644
--- a/cmdline/apt-cache.cc
+++ b/cmdline/apt-cache.cc
@@ -595,8 +595,8 @@ static bool XVcg(CommandLine &CmdL)
// Load the list of packages from the command line into the show list
APT::CacheSetHelper helper(true, GlobalError::NOTICE);
std::list<APT::CacheSetHelper::PkgModifier> mods;
- mods.push_back(APT::CacheSetHelper::PkgModifier(0, ",", APT::PackageSet::Modifier::POSTFIX));
- mods.push_back(APT::CacheSetHelper::PkgModifier(1, "^", APT::PackageSet::Modifier::POSTFIX));
+ mods.push_back(APT::CacheSetHelper::PkgModifier(0, ",", APT::CacheSetHelper::PkgModifier::POSTFIX));
+ mods.push_back(APT::CacheSetHelper::PkgModifier(1, "^", APT::CacheSetHelper::PkgModifier::POSTFIX));
std::map<unsigned short, APT::PackageSet> pkgsets =
APT::PackageSet::GroupedFromCommandLine(CacheFile, CmdL.FileList + 1, mods, 0, helper);
@@ -808,8 +808,8 @@ static bool Dotty(CommandLine &CmdL)
// Load the list of packages from the command line into the show list
APT::CacheSetHelper helper(true, GlobalError::NOTICE);
std::list<APT::CacheSetHelper::PkgModifier> mods;
- mods.push_back(APT::CacheSetHelper::PkgModifier(0, ",", APT::PackageSet::Modifier::POSTFIX));
- mods.push_back(APT::CacheSetHelper::PkgModifier(1, "^", APT::PackageSet::Modifier::POSTFIX));
+ mods.push_back(APT::CacheSetHelper::PkgModifier(0, ",", APT::CacheSetHelper::PkgModifier::POSTFIX));
+ mods.push_back(APT::CacheSetHelper::PkgModifier(1, "^", APT::CacheSetHelper::PkgModifier::POSTFIX));
std::map<unsigned short, APT::PackageSet> pkgsets =
APT::PackageSet::GroupedFromCommandLine(CacheFile, CmdL.FileList + 1, mods, 0, helper);