ソースを参照

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
David Kalnischkies 11 年 前
コミット
fa5404ab01

+ 12 - 0
apt-pkg/algorithms.cc

@@ -640,6 +640,12 @@ bool pkgProblemResolver::DoUpgrade(pkgCache::PkgIterator Pkg)
 // ProblemResolver::Resolve - calls a resolver to fix the situation	/*{{{*/
 // 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)
 bool pkgProblemResolver::Resolve(bool BrokenFix, OpProgress * const Progress)
 {
 {
    std::string const solver = _config->Find("APT::Solver", "internal");
    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 
 /* 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
    in that it does not install or remove any packages. It is assumed that the
    system was non-broken previously. */
    system was non-broken previously. */
+#if APT_PKG_ABI < 413
+bool pkgProblemResolver::ResolveByKeep()
+{
+   return ResolveByKeep(NULL);
+}
+#endif
 bool pkgProblemResolver::ResolveByKeep(OpProgress * const Progress)
 bool pkgProblemResolver::ResolveByKeep(OpProgress * const Progress)
 {
 {
    std::string const solver = _config->Find("APT::Solver", "internal");
    std::string const solver = _config->Find("APT::Solver", "internal");

+ 10 - 0
apt-pkg/algorithms.h

@@ -138,10 +138,20 @@ class pkgProblemResolver						/*{{{*/
    inline void Clear(pkgCache::PkgIterator Pkg) {Flags[Pkg->ID] &= ~(Protected | ToRemove);};
    inline void Clear(pkgCache::PkgIterator Pkg) {Flags[Pkg->ID] &= ~(Protected | ToRemove);};
 
 
    // Try to intelligently resolve problems by installing and removing packages
    // Try to intelligently resolve problems by installing and removing packages
+#if APT_PKG_ABI >= 413
    bool Resolve(bool BrokenFix = false, OpProgress * const Progress = NULL);
    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
    // Try to resolve problems only by using keep
+#if APT_PKG_ABI >= 413
    bool ResolveByKeep(OpProgress * const Progress = NULL);
    bool ResolveByKeep(OpProgress * const Progress = NULL);
+#else
+   bool ResolveByKeep();
+   bool ResolveByKeep(OpProgress * const Progress);
+#endif
 
 
    APT_DEPRECATED void InstallProtect();
    APT_DEPRECATED void InstallProtect();
 
 

+ 6 - 0
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			/*{{{*/
 // Configuration::FindVector - Find a vector of values			/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* Returns a vector of config values under the given item */
 /* 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> Configuration::FindVector(const char *Name, std::string const &Default) const
 {
 {
    vector<string> Vec;
    vector<string> Vec;

+ 8 - 0
apt-pkg/contrib/configuration.h

@@ -84,8 +84,16 @@ class Configuration
     *
     *
     * \param Name of the parent node
     * \param Name of the parent node
     * \param Default list of values separated by commas */
     * \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(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(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(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);};
    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;
    bool FindB(const char *Name,bool const &Default = false) const;

+ 2 - 2
apt-pkg/depcache.h

@@ -109,7 +109,7 @@ class pkgDepCache : protected pkgCache::Namespace
     *
     *
     *  \return \b false if an error occurred.
     *  \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
    /** \brief Set the StateCache::Garbage flag on all packages that
     *  should be removed.
     *  should be removed.
@@ -120,7 +120,7 @@ class pkgDepCache : protected pkgCache::Namespace
     *
     *
     *  \return \b false if an error occurred.
     *  \return \b false if an error occurred.
     */
     */
-   APT_HIDDEN bool Sweep();
+   bool Sweep();
 
 
    public:
    public:
    
    

+ 13 - 0
apt-pkg/indexrecords.cc

@@ -270,10 +270,23 @@ void indexRecords::SetTrusted(bool const Trusted)
       this->Trusted = NEVER_TRUSTED;
       this->Trusted = NEVER_TRUSTED;
 }
 }
 
 
+#if APT_PKG_ABI >= 413
 indexRecords::indexRecords(const string &ExpectedDist) :
 indexRecords::indexRecords(const string &ExpectedDist) :
    Trusted(CHECK_TRUST), d(NULL), ExpectedDist(ExpectedDist), ValidUntil(0),
    Trusted(CHECK_TRUST), d(NULL), ExpectedDist(ExpectedDist), ValidUntil(0),
    SupportsAcquireByHash(false)
    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() {}
 indexRecords::~indexRecords() {}

+ 5 - 1
apt-pkg/indexrecords.h

@@ -42,8 +42,12 @@ class indexRecords
    std::map<std::string,checkSum *> Entries;
    std::map<std::string,checkSum *> Entries;
 
 
    public:
    public:
-
+#if APT_PKG_ABI >= 413
    indexRecords(const std::string &ExpectedDist = "");
    indexRecords(const std::string &ExpectedDist = "");
+#else
+   indexRecords();
+   indexRecords(const std::string ExpectedDist);
+#endif
 
 
    // Lookup function
    // Lookup function
    virtual checkSum *Lookup(const std::string MetaKey);
    virtual checkSum *Lookup(const std::string MetaKey);

+ 6 - 0
apt-pkg/tagfile.cc

@@ -281,6 +281,12 @@ pkgTagSection::pkgTagSection()
 }
 }
 									/*}}}*/
 									/*}}}*/
 // TagSection::Scan - Scan for the end of the header information	/*{{{*/
 // 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)
 bool pkgTagSection::Scan(const char *Start,unsigned long MaxLength, bool const Restart)
 {
 {
    Section = Start;
    Section = Start;

+ 6 - 0
apt-pkg/tagfile.h

@@ -86,7 +86,13 @@ class pkgTagSection
     * @return \b true if section end was found, \b false otherwise.
     * @return \b true if section end was found, \b false otherwise.
     *  Beware that internal state will be inconsistent if \b false is returned!
     *  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);
    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;};
    inline unsigned long size() const {return Stop - Section;};
    void Trim();
    void Trim();
    virtual void TrimRecord(bool BeforeRecord, const char* &End);
    virtual void TrimRecord(bool BeforeRecord, const char* &End);

+ 16 - 2
apt-pkg/upgrade.cc

@@ -24,7 +24,7 @@
    
    
    The problem resolver is used to resolve the problems.
    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");
    std::string const solver = _config->Find("APT::Solver", "internal");
    if (solver != "internal")
    if (solver != "internal")
@@ -119,6 +119,10 @@ bool pkgDistUpgrade(pkgDepCache &Cache, OpProgress * const Progress)
    if (Progress != NULL)
    if (Progress != NULL)
       Progress->Done();
       Progress->Done();
    return success;
    return success;
+}
+bool pkgDistUpgrade(pkgDepCache &Cache)
+{
+   return pkgDistUpgrade(Cache, NULL);
 }
 }
 									/*}}}*/
 									/*}}}*/
 // AllUpgradeNoNewPackages - Upgrade but no removals or new pkgs        /*{{{*/
 // AllUpgradeNoNewPackages - Upgrade but no removals or new pkgs        /*{{{*/
@@ -229,9 +233,13 @@ static bool pkgAllUpgradeWithNewPackages(pkgDepCache &Cache, OpProgress * const
 /* Right now the system must be consistent before this can be called.
 /* Right now the system must be consistent before this can be called.
    It also will not change packages marked for install, it only tries
    It also will not change packages marked for install, it only tries
    to install packages not marked for install */
    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);
    return pkgAllUpgradeNoNewPackages(Cache, Progress);
+}
+bool pkgAllUpgrade(pkgDepCache &Cache)
+{
+   return pkgAllUpgrade(Cache, NULL);
 }
 }
 									/*}}}*/
 									/*}}}*/
 // MinimizeUpgrade - Minimizes the set of packages to be upgraded	/*{{{*/
 // 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		/*{{{*/
 // 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)
 bool APT::Upgrade::Upgrade(pkgDepCache &Cache, int mode, OpProgress * const Progress)
 {
 {
 APT_IGNORE_DEPRECATED_PUSH
 APT_IGNORE_DEPRECATED_PUSH

+ 9 - 4
apt-pkg/upgrade.h

@@ -20,17 +20,22 @@ namespace APT {
    namespace Upgrade {
    namespace Upgrade {
       // FIXME: make this "enum class UpgradeMode {" once we enable c++11
       // FIXME: make this "enum class UpgradeMode {" once we enable c++11
       enum UpgradeMode {
       enum UpgradeMode {
-	 ALLOW_EVERYTHING = 0,
          FORBID_REMOVE_PACKAGES = 1,
          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);
       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
 // 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);
 bool pkgMinimizeUpgrade(pkgDepCache &Cache);
 #endif
 #endif

+ 4 - 2
debian/libapt-pkg4.15.symbols

@@ -49,6 +49,8 @@ libapt-pkg.so.4.15 libapt-pkg4.15 #MINVER#
  (c++)"pkgPrioSortList(pkgCache&, pkgCache::Version**)@Base" 0.8.0
  (c++)"pkgPrioSortList(pkgCache&, pkgCache::Version**)@Base" 0.8.0
  (c++)"pkgMakeStatusCache(pkgSourceList&, OpProgress&, MMap**, bool)@Base" 0.8.0
  (c++)"pkgMakeStatusCache(pkgSourceList&, OpProgress&, MMap**, bool)@Base" 0.8.0
  (c++)"pkgMinimizeUpgrade(pkgDepCache&)@Base" 0.8.0
  (c++)"pkgMinimizeUpgrade(pkgDepCache&)@Base" 0.8.0
+ (c++)"pkgAllUpgrade(pkgDepCache&)@Base" 0.8.0
+ (c++)"pkgDistUpgrade(pkgDepCache&)@Base" 0.8.0
  (c++)"GetListOfFilesInDir(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool const&)@Base" 0.8.0
  (c++)"GetListOfFilesInDir(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool const&)@Base" 0.8.0
  (c++)"GetListOfFilesInDir(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool const&, bool const&)@Base" 0.8.0
  (c++)"GetListOfFilesInDir(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool const&, bool const&)@Base" 0.8.0
  (c++)"pkgMakeOnlyStatusCache(OpProgress&, DynamicMMap**)@Base" 0.8.0
  (c++)"pkgMakeOnlyStatusCache(OpProgress&, DynamicMMap**)@Base" 0.8.0
@@ -233,6 +235,8 @@ libapt-pkg.so.4.15 libapt-pkg4.15 #MINVER#
  (c++)"pkgDepCache::CheckDep(pkgCache::DepIterator, int, pkgCache::PkgIterator&)@Base" 0.8.0
  (c++)"pkgDepCache::CheckDep(pkgCache::DepIterator, int, pkgCache::PkgIterator&)@Base" 0.8.0
  (c++)"pkgDepCache::MarkAuto(pkgCache::PkgIterator const&, bool)@Base" 0.8.0
  (c++)"pkgDepCache::MarkAuto(pkgCache::PkgIterator const&, bool)@Base" 0.8.0
  (c++)"pkgDepCache::MarkKeep(pkgCache::PkgIterator const&, bool, bool, unsigned long)@Base" 0.8.0
  (c++)"pkgDepCache::MarkKeep(pkgCache::PkgIterator const&, bool, bool, unsigned long)@Base" 0.8.0
+ (c++)"pkgDepCache::MarkRequired(pkgDepCache::InRootSetFunc&)@Base" 0.8.0
+ (c++)"pkgDepCache::Sweep()@Base" 0.8.0
  (c++)"pkgDepCache::pkgDepCache(pkgCache*, pkgDepCache::Policy*)@Base" 0.8.0
  (c++)"pkgDepCache::pkgDepCache(pkgCache*, pkgDepCache::Policy*)@Base" 0.8.0
  (c++)"pkgDepCache::~pkgDepCache()@Base" 0.8.0
  (c++)"pkgDepCache::~pkgDepCache()@Base" 0.8.0
  (c++)"pkgSimulate::Policy::GetCandidateVer(pkgCache::PkgIterator const&)@Base" 0.8.0
  (c++)"pkgSimulate::Policy::GetCandidateVer(pkgCache::PkgIterator const&)@Base" 0.8.0
@@ -1362,8 +1366,6 @@ libapt-pkg.so.4.15 libapt-pkg4.15 #MINVER#
  (c++)"Popen(char const**, FileFd&, int&, FileFd::OpenMode)@Base" 1.1~exp1
  (c++)"Popen(char const**, FileFd&, int&, FileFd::OpenMode)@Base" 1.1~exp1
  (c++)"APT::String::Startswith(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 1.1~exp2
  (c++)"APT::String::Startswith(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 1.1~exp2
  (c++)"APT::Upgrade::Upgrade(pkgDepCache&, int, OpProgress*)@Base" 1.1~exp4
  (c++)"APT::Upgrade::Upgrade(pkgDepCache&, int, OpProgress*)@Base" 1.1~exp4
- (c++)"pkgAllUpgrade(pkgDepCache&, OpProgress*)@Base" 1.1~exp4
- (c++)"pkgDistUpgrade(pkgDepCache&, OpProgress*)@Base" 1.1~exp4
  (c++)"pkgProblemResolver::Resolve(bool, OpProgress*)@Base" 1.1~exp4
  (c++)"pkgProblemResolver::Resolve(bool, OpProgress*)@Base" 1.1~exp4
  (c++)"pkgProblemResolver::ResolveByKeep(OpProgress*)@Base" 1.1~exp4
  (c++)"pkgProblemResolver::ResolveByKeep(OpProgress*)@Base" 1.1~exp4
  (c++)"pkgCache::PkgIterator::Section() const@Base" 1.1~exp4
  (c++)"pkgCache::PkgIterator::Section() const@Base" 1.1~exp4