diff options
author | David Kalnischkies <david@kalnischkies.de> | 2014-11-07 18:18:14 +0100 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2014-11-08 14:29:25 +0100 |
commit | fa5404ab01bdf06eaf147d9f133139e6c89b906a (patch) | |
tree | 431e763fc49e892b7c59286fc2b80102cd8ebfff /apt-pkg | |
parent | 02e20767719873fa8f1919bd0e7a75f63e00c484 (diff) |
explicit overload methods instead of adding parameters
Adding a new parameter (with a default) is an ABI break, but you can
overload a method, which is "just" an API break for everyone doing
references to this method (aka: nobody).
Git-Dch: Ignore
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/algorithms.cc | 12 | ||||
-rw-r--r-- | apt-pkg/algorithms.h | 10 | ||||
-rw-r--r-- | apt-pkg/contrib/configuration.cc | 6 | ||||
-rw-r--r-- | apt-pkg/contrib/configuration.h | 8 | ||||
-rw-r--r-- | apt-pkg/depcache.h | 4 | ||||
-rw-r--r-- | apt-pkg/indexrecords.cc | 13 | ||||
-rw-r--r-- | apt-pkg/indexrecords.h | 6 | ||||
-rw-r--r-- | apt-pkg/tagfile.cc | 6 | ||||
-rw-r--r-- | apt-pkg/tagfile.h | 6 | ||||
-rw-r--r-- | apt-pkg/upgrade.cc | 18 | ||||
-rw-r--r-- | apt-pkg/upgrade.h | 13 |
11 files changed, 93 insertions, 9 deletions
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 71b5ac2c1..c8696b8ad 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -640,6 +640,12 @@ bool pkgProblemResolver::DoUpgrade(pkgCache::PkgIterator Pkg) // ProblemResolver::Resolve - calls a resolver to fix the situation /*{{{*/ // --------------------------------------------------------------------- /* */ +#if APT_PKG_ABI < 413 +bool pkgProblemResolver::Resolve(bool BrokenFix) +{ + return Resolve(BrokenFix, NULL); +} +#endif bool pkgProblemResolver::Resolve(bool BrokenFix, OpProgress * const Progress) { std::string const solver = _config->Find("APT::Solver", "internal"); @@ -1138,6 +1144,12 @@ bool pkgProblemResolver::InstOrNewPolicyBroken(pkgCache::PkgIterator I) /* This is the work horse of the soft upgrade routine. It is very gental in that it does not install or remove any packages. It is assumed that the system was non-broken previously. */ +#if APT_PKG_ABI < 413 +bool pkgProblemResolver::ResolveByKeep() +{ + return ResolveByKeep(NULL); +} +#endif bool pkgProblemResolver::ResolveByKeep(OpProgress * const Progress) { std::string const solver = _config->Find("APT::Solver", "internal"); diff --git a/apt-pkg/algorithms.h b/apt-pkg/algorithms.h index b6da1f2bf..2ac28c0d7 100644 --- a/apt-pkg/algorithms.h +++ b/apt-pkg/algorithms.h @@ -138,10 +138,20 @@ class pkgProblemResolver /*{{{*/ inline void Clear(pkgCache::PkgIterator Pkg) {Flags[Pkg->ID] &= ~(Protected | ToRemove);}; // Try to intelligently resolve problems by installing and removing packages +#if APT_PKG_ABI >= 413 bool Resolve(bool BrokenFix = false, OpProgress * const Progress = NULL); +#else + bool Resolve(bool BrokenFix = false); + bool Resolve(bool BrokenFix, OpProgress * const Progress); +#endif // Try to resolve problems only by using keep +#if APT_PKG_ABI >= 413 bool ResolveByKeep(OpProgress * const Progress = NULL); +#else + bool ResolveByKeep(); + bool ResolveByKeep(OpProgress * const Progress); +#endif APT_DEPRECATED void InstallProtect(); diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc index 4380d64b9..483d5bb1b 100644 --- a/apt-pkg/contrib/configuration.cc +++ b/apt-pkg/contrib/configuration.cc @@ -253,6 +253,12 @@ string Configuration::FindDir(const char *Name,const char *Default) const // Configuration::FindVector - Find a vector of values /*{{{*/ // --------------------------------------------------------------------- /* Returns a vector of config values under the given item */ +#if APT_PKG_ABI < 413 +vector<string> Configuration::FindVector(const char *Name) const +{ + return FindVector(Name, ""); +} +#endif vector<string> Configuration::FindVector(const char *Name, std::string const &Default) const { vector<string> Vec; diff --git a/apt-pkg/contrib/configuration.h b/apt-pkg/contrib/configuration.h index 2ecea8bee..8d7d51037 100644 --- a/apt-pkg/contrib/configuration.h +++ b/apt-pkg/contrib/configuration.h @@ -84,8 +84,16 @@ class Configuration * * \param Name of the parent node * \param Default list of values separated by commas */ +#if APT_PKG_ABI >= 413 std::vector<std::string> FindVector(const char *Name, std::string const &Default = "") const; std::vector<std::string> FindVector(std::string const &Name, std::string const &Default = "") const { return FindVector(Name.c_str(), Default); }; +#else + std::vector<std::string> FindVector(const char *Name, std::string const &Default) const; + std::vector<std::string> FindVector(std::string const &Name, std::string const &Default) const { return FindVector(Name.c_str(), Default); }; + std::vector<std::string> FindVector(const char *Name) const; + std::vector<std::string> FindVector(std::string const &Name) const { return FindVector(Name.c_str(), ""); }; +#endif + int FindI(const char *Name,int const &Default = 0) const; int FindI(std::string const &Name,int const &Default = 0) const {return FindI(Name.c_str(),Default);}; bool FindB(const char *Name,bool const &Default = false) const; diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h index 5554e1a69..20d263c67 100644 --- a/apt-pkg/depcache.h +++ b/apt-pkg/depcache.h @@ -109,7 +109,7 @@ class pkgDepCache : protected pkgCache::Namespace * * \return \b false if an error occurred. */ - APT_HIDDEN bool MarkRequired(InRootSetFunc &rootFunc); + bool MarkRequired(InRootSetFunc &rootFunc); /** \brief Set the StateCache::Garbage flag on all packages that * should be removed. @@ -120,7 +120,7 @@ class pkgDepCache : protected pkgCache::Namespace * * \return \b false if an error occurred. */ - APT_HIDDEN bool Sweep(); + bool Sweep(); public: diff --git a/apt-pkg/indexrecords.cc b/apt-pkg/indexrecords.cc index 0f27af32b..d65266f64 100644 --- a/apt-pkg/indexrecords.cc +++ b/apt-pkg/indexrecords.cc @@ -270,10 +270,23 @@ void indexRecords::SetTrusted(bool const Trusted) this->Trusted = NEVER_TRUSTED; } +#if APT_PKG_ABI >= 413 indexRecords::indexRecords(const string &ExpectedDist) : Trusted(CHECK_TRUST), d(NULL), ExpectedDist(ExpectedDist), ValidUntil(0), SupportsAcquireByHash(false) { } +#else +indexRecords::indexRecords() : + Trusted(CHECK_TRUST), d(NULL), ExpectedDist(""), ValidUntil(0), + SupportsAcquireByHash(false) +{ +} +indexRecords::indexRecords(const string ExpectedDist) : + Trusted(CHECK_TRUST), d(NULL), ExpectedDist(ExpectedDist), ValidUntil(0), + SupportsAcquireByHash(false) +{ +} +#endif indexRecords::~indexRecords() {} diff --git a/apt-pkg/indexrecords.h b/apt-pkg/indexrecords.h index 06b9dafa6..35e534c12 100644 --- a/apt-pkg/indexrecords.h +++ b/apt-pkg/indexrecords.h @@ -42,8 +42,12 @@ class indexRecords std::map<std::string,checkSum *> Entries; public: - +#if APT_PKG_ABI >= 413 indexRecords(const std::string &ExpectedDist = ""); +#else + indexRecords(); + indexRecords(const std::string ExpectedDist); +#endif // Lookup function virtual checkSum *Lookup(const std::string MetaKey); diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc index e667c495f..3ee5c7076 100644 --- a/apt-pkg/tagfile.cc +++ b/apt-pkg/tagfile.cc @@ -281,6 +281,12 @@ pkgTagSection::pkgTagSection() } /*}}}*/ // TagSection::Scan - Scan for the end of the header information /*{{{*/ +#if APT_PKG_ABI < 413 +bool pkgTagSection::Scan(const char *Start,unsigned long MaxLength) +{ + return Scan(Start, MaxLength, true); +} +#endif bool pkgTagSection::Scan(const char *Start,unsigned long MaxLength, bool const Restart) { Section = Start; diff --git a/apt-pkg/tagfile.h b/apt-pkg/tagfile.h index 99e2a8d93..ac6d42089 100644 --- a/apt-pkg/tagfile.h +++ b/apt-pkg/tagfile.h @@ -86,7 +86,13 @@ class pkgTagSection * @return \b true if section end was found, \b false otherwise. * Beware that internal state will be inconsistent if \b false is returned! */ +#if APT_PKG_ABI >= 413 APT_MUSTCHECK bool Scan(const char *Start, unsigned long MaxLength, bool const Restart = true); +#else + APT_MUSTCHECK bool Scan(const char *Start, unsigned long MaxLength, bool const Restart); + APT_MUSTCHECK bool Scan(const char *Start, unsigned long MaxLength); +#endif + inline unsigned long size() const {return Stop - Section;}; void Trim(); virtual void TrimRecord(bool BeforeRecord, const char* &End); diff --git a/apt-pkg/upgrade.cc b/apt-pkg/upgrade.cc index 41e76802a..6c8721da8 100644 --- a/apt-pkg/upgrade.cc +++ b/apt-pkg/upgrade.cc @@ -24,7 +24,7 @@ The problem resolver is used to resolve the problems. */ -bool pkgDistUpgrade(pkgDepCache &Cache, OpProgress * const Progress) +static bool pkgDistUpgrade(pkgDepCache &Cache, OpProgress * const Progress) { std::string const solver = _config->Find("APT::Solver", "internal"); if (solver != "internal") @@ -120,6 +120,10 @@ bool pkgDistUpgrade(pkgDepCache &Cache, OpProgress * const Progress) Progress->Done(); return success; } +bool pkgDistUpgrade(pkgDepCache &Cache) +{ + return pkgDistUpgrade(Cache, NULL); +} /*}}}*/ // AllUpgradeNoNewPackages - Upgrade but no removals or new pkgs /*{{{*/ static bool pkgAllUpgradeNoNewPackages(pkgDepCache &Cache, OpProgress * const Progress) @@ -229,10 +233,14 @@ static bool pkgAllUpgradeWithNewPackages(pkgDepCache &Cache, OpProgress * const /* Right now the system must be consistent before this can be called. It also will not change packages marked for install, it only tries to install packages not marked for install */ -bool pkgAllUpgrade(pkgDepCache &Cache, OpProgress * const Progress) +static bool pkgAllUpgrade(pkgDepCache &Cache, OpProgress * const Progress) { return pkgAllUpgradeNoNewPackages(Cache, Progress); } +bool pkgAllUpgrade(pkgDepCache &Cache) +{ + return pkgAllUpgrade(Cache, NULL); +} /*}}}*/ // MinimizeUpgrade - Minimizes the set of packages to be upgraded /*{{{*/ // --------------------------------------------------------------------- @@ -280,6 +288,12 @@ bool pkgMinimizeUpgrade(pkgDepCache &Cache) } /*}}}*/ // APT::Upgrade::Upgrade - Upgrade using a specific strategy /*{{{*/ +#if APT_PKG_ABI < 413 +bool APT::Upgrade::Upgrade(pkgDepCache &Cache, int mode) +{ + return Upgrade(Cache, mode, NULL); +} +#endif bool APT::Upgrade::Upgrade(pkgDepCache &Cache, int mode, OpProgress * const Progress) { APT_IGNORE_DEPRECATED_PUSH diff --git a/apt-pkg/upgrade.h b/apt-pkg/upgrade.h index a3f693d86..18b6aac7b 100644 --- a/apt-pkg/upgrade.h +++ b/apt-pkg/upgrade.h @@ -20,17 +20,22 @@ namespace APT { namespace Upgrade { // FIXME: make this "enum class UpgradeMode {" once we enable c++11 enum UpgradeMode { - ALLOW_EVERYTHING = 0, FORBID_REMOVE_PACKAGES = 1, - FORBID_INSTALL_NEW_PACKAGES = 2 + FORBID_INSTALL_NEW_PACKAGES = 2, + ALLOW_EVERYTHING = 0 }; +#if APT_PKG_ABI >= 413 bool Upgrade(pkgDepCache &Cache, int UpgradeMode, OpProgress * const Progress = NULL); +#else + bool Upgrade(pkgDepCache &Cache, int UpgradeMode); + bool Upgrade(pkgDepCache &Cache, int UpgradeMode, OpProgress * const Progress); +#endif } } // please use APT::Upgrade::Upgrade() instead -APT_DEPRECATED bool pkgDistUpgrade(pkgDepCache &Cache, OpProgress * const Progress = NULL); -APT_DEPRECATED bool pkgAllUpgrade(pkgDepCache &Cache, OpProgress * const Progress = NULL); +APT_DEPRECATED bool pkgDistUpgrade(pkgDepCache &Cache); +APT_DEPRECATED bool pkgAllUpgrade(pkgDepCache &Cache); bool pkgMinimizeUpgrade(pkgDepCache &Cache); #endif |