]> git.saurik.com Git - apt.git/commitdiff
restore ABI and prepare next ABI via #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
authorMichael Vogt <mvo@debian.org>
Thu, 31 Oct 2013 07:23:12 +0000 (08:23 +0100)
committerMichael Vogt <mvo@debian.org>
Thu, 31 Oct 2013 07:23:12 +0000 (08:23 +0100)
apt-pkg/deb/dpkgpm.cc
apt-pkg/deb/dpkgpm.h
apt-pkg/install-progress.cc
apt-pkg/install-progress.h
apt-pkg/packagemanager.cc
apt-pkg/packagemanager.h
apt-private/private-install.cc

index 98fb7581a814915374b00f92e29a0b48c7fcb7f7..b252c02ebef52824ab81ab901705130e84185ec5 100644 (file)
@@ -1000,6 +1000,19 @@ void pkgDPkgPM::BuildPackagesProgressMap()
    }
 }
                                                                         /*}}}*/
    }
 }
                                                                         /*}}}*/
+#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR < 13)
+bool pkgDPkgPM::Go(int StatusFd)
+{
+   APT::Progress::PackageManager *progress = NULL;
+   if (StatusFd == -1)
+      progress = APT::Progress::PackageManagerProgressFactory();
+   else
+      progress = new APT::Progress::PackageManagerProgressFd(StatusFd);
+   
+   return GoNoABIBreak(progress);
+}
+#endif
+
 // DPkgPM::Go - Run the sequence                                       /*{{{*/
 // ---------------------------------------------------------------------
 /* This globs the operations and calls dpkg 
 // DPkgPM::Go - Run the sequence                                       /*{{{*/
 // ---------------------------------------------------------------------
 /* This globs the operations and calls dpkg 
@@ -1009,7 +1022,11 @@ void pkgDPkgPM::BuildPackagesProgressMap()
  * through to human readable (and i10n-able)
  * names and calculates a percentage for each step.
  */
  * through to human readable (and i10n-able)
  * names and calculates a percentage for each step.
  */
+#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
 bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress)
 bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress)
+#else
+bool pkgDPkgPM::GoNoABIBreak(APT::Progress::PackageManager *progress)
+#endif
 {
    pkgPackageManager::SigINTStop = false;
    d->progress = progress;
 {
    pkgPackageManager::SigINTStop = false;
    d->progress = progress;
index 5f00eee5d9c40cc1880d1750d8de7d759b012bda..4494bbae3290d87daed4b7cde5c5674a0257cda7 100644 (file)
@@ -15,6 +15,7 @@
 #include <map>
 #include <stdio.h>
 #include <apt-pkg/macros.h>
 #include <map>
 #include <stdio.h>
 #include <apt-pkg/macros.h>
+#include <apt-pkg/init.h>
 
 #ifndef APT_8_CLEANER_HEADERS
 using std::vector;
 
 #ifndef APT_8_CLEANER_HEADERS
 using std::vector;
@@ -112,7 +113,13 @@ class pkgDPkgPM : public pkgPackageManager
    virtual bool Configure(PkgIterator Pkg);
    virtual bool Remove(PkgIterator Pkg,bool Purge = false);
 
    virtual bool Configure(PkgIterator Pkg);
    virtual bool Remove(PkgIterator Pkg,bool Purge = false);
 
+#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
    virtual bool Go(APT::Progress::PackageManager *progress);
    virtual bool Go(APT::Progress::PackageManager *progress);
+#else
+   virtual bool Go(int StatusFd=-1);
+   bool GoNoABIBreak(APT::Progress::PackageManager *progress);
+#endif
+
    virtual void Reset();
    
    public:
    virtual void Reset();
    
    public:
index 9d0d4e3f16d844b2463f9a9c48321622c2b5518d..a9146f27d600ac1f1748a172fa193fc1a7de136a 100644 (file)
 namespace APT {
 namespace Progress {
 
 namespace APT {
 namespace Progress {
 
+PackageManager* PackageManagerProgressFactory()
+{
+   // select the right progress
+   int status_fd = _config->FindI("APT::Status-Fd", -1);
+   int status_deb822_fd = _config->FindI("APT::Status-deb822-Fd", -1);
+
+   APT::Progress::PackageManager *progress = NULL;
+   if (status_deb822_fd > 0)
+      progress = new APT::Progress::PackageManagerProgressDeb822Fd(
+         status_deb822_fd);
+   else if (status_fd > 0)
+      progress = new APT::Progress::PackageManagerProgressFd(status_fd);
+   else if(_config->FindB("Dpkg::Progress-Fancy", false) == true)
+      progress = new APT::Progress::PackageManagerFancy();
+   else if (_config->FindB("Dpkg::Progress", 
+                           _config->FindB("DpkgPM::Progress", false)) == true)
+      progress = new APT::Progress::PackageManagerText();
+   else
+      progress = new APT::Progress::PackageManager();
+   return progress;
+}
+
 bool PackageManager::StatusChanged(std::string PackageName, 
                                    unsigned int StepsDone,
                                    unsigned int TotalSteps,
 bool PackageManager::StatusChanged(std::string PackageName, 
                                    unsigned int StepsDone,
                                    unsigned int TotalSteps,
index 9c31eac928ebf0c7ad0f0e70dcdcf571a582a0a7..050954bb5c74dc82158c6daddf56b97e5d8af366 100644 (file)
@@ -8,6 +8,9 @@
 namespace APT {
 namespace Progress {
 
 namespace APT {
 namespace Progress {
 
+ class PackageManager;
+ PackageManager* PackageManagerProgressFactory();
+
  class PackageManager
  {
  private:
  class PackageManager
  {
  private:
index a2079a2e4554d76429a8765612cb2c690eae4dae..3fdd9b6375e570997f42f27157efbe83f3d895b9 100644 (file)
@@ -1030,15 +1030,16 @@ pkgPackageManager::OrderResult pkgPackageManager::OrderInstall()
 // PM::DoInstallPostFork - compat /*{{{*/
 // ---------------------------------------------------------------------
                                                                        /*}}}*/
 // PM::DoInstallPostFork - compat /*{{{*/
 // ---------------------------------------------------------------------
                                                                        /*}}}*/
+#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
 pkgPackageManager::OrderResult
 pkgPackageManager::DoInstallPostFork(int statusFd)
 {
 pkgPackageManager::OrderResult
 pkgPackageManager::DoInstallPostFork(int statusFd)
 {
-      APT::Progress::PackageManager *progress = new
-         APT::Progress::PackageManagerProgressFd(statusFd);
-      pkgPackageManager::OrderResult res = DoInstallPostFork(progress);
-      delete progress;
-      return res;
-   }
+   APT::Progress::PackageManager *progress = new
+      APT::Progress::PackageManagerProgressFd(statusFd);
+   pkgPackageManager::OrderResult res = DoInstallPostFork(progress);
+   delete progress;
+   return res;
+}
                                                                        /*}}}*/
 // PM::DoInstallPostFork - Does install part that happens after the fork /*{{{*/
 // ---------------------------------------------------------------------
                                                                        /*}}}*/
 // PM::DoInstallPostFork - Does install part that happens after the fork /*{{{*/
 // ---------------------------------------------------------------------
@@ -1051,10 +1052,22 @@ pkgPackageManager::DoInstallPostFork(APT::Progress::PackageManager *progress)
    
    return Res;
 };
    
    return Res;
 };
+#else
+pkgPackageManager::OrderResult
+pkgPackageManager::DoInstallPostFork(int statusFd)
+{
+   bool goResult = Go(statusFd);
+   if(goResult == false) 
+      return Failed;
+   
+   return Res;
+}
+#endif
                                                                        /*}}}*/ 
 // PM::DoInstall - Does the installation                               /*{{{*/
 // ---------------------------------------------------------------------
 /* compat */
                                                                        /*}}}*/ 
 // PM::DoInstall - Does the installation                               /*{{{*/
 // ---------------------------------------------------------------------
 /* compat */
+#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
 pkgPackageManager::OrderResult 
 pkgPackageManager::DoInstall(int statusFd)
 {
 pkgPackageManager::OrderResult 
 pkgPackageManager::DoInstall(int statusFd)
 {
@@ -1064,11 +1077,21 @@ pkgPackageManager::DoInstall(int statusFd)
     delete progress;
     return res;
  }
     delete progress;
     return res;
  }
+#else
+pkgPackageManager::OrderResult pkgPackageManager::DoInstall(int statusFd)
+{
+   if(DoInstallPreFork() == Failed)
+      return Failed;
+
+   return DoInstallPostFork(statusFd);
+}
+#endif
                                                                        /*}}}*/ 
 // PM::DoInstall - Does the installation                               /*{{{*/
 // ---------------------------------------------------------------------
 /* This uses the filenames in FileNames and the information in the
    DepCache to perform the installation of packages.*/
                                                                        /*}}}*/ 
 // PM::DoInstall - Does the installation                               /*{{{*/
 // ---------------------------------------------------------------------
 /* This uses the filenames in FileNames and the information in the
    DepCache to perform the installation of packages.*/
+#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
 pkgPackageManager::OrderResult 
 pkgPackageManager::DoInstall(APT::Progress::PackageManager *progress)
 {
 pkgPackageManager::OrderResult 
 pkgPackageManager::DoInstall(APT::Progress::PackageManager *progress)
 {
@@ -1077,4 +1100,5 @@ pkgPackageManager::DoInstall(APT::Progress::PackageManager *progress)
    
    return DoInstallPostFork(progress);
 }
    
    return DoInstallPostFork(progress);
 }
+#endif
                                                                        /*}}}*/       
                                                                        /*}}}*/       
index 8ffac2f1397729405bb245b16b622da20020ecce..a5c58e4a7e46702c55aeec71805903d9d8bc93d8 100644 (file)
@@ -26,6 +26,7 @@
 #include <apt-pkg/macros.h>
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/install-progress.h>
 #include <apt-pkg/macros.h>
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/install-progress.h>
+#include <apt-pkg/init.h>
 
 #include <string>
 #include <iostream>
 
 #include <string>
 #include <iostream>
@@ -87,7 +88,12 @@ class pkgPackageManager : protected pkgCache::Namespace
    virtual bool Install(PkgIterator /*Pkg*/,std::string /*File*/) {return false;};
    virtual bool Configure(PkgIterator /*Pkg*/) {return false;};
    virtual bool Remove(PkgIterator /*Pkg*/,bool /*Purge*/=false) {return false;};
    virtual bool Install(PkgIterator /*Pkg*/,std::string /*File*/) {return false;};
    virtual bool Configure(PkgIterator /*Pkg*/) {return false;};
    virtual bool Remove(PkgIterator /*Pkg*/,bool /*Purge*/=false) {return false;};
+#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
    virtual bool Go(APT::Progress::PackageManager *progress) {return true;};
    virtual bool Go(APT::Progress::PackageManager *progress) {return true;};
+#else
+   virtual bool Go(int StatusFd=-1) {return true;};
+#endif
+
    virtual void Reset() {};
 
    // the result of the operation
    virtual void Reset() {};
 
    // the result of the operation
@@ -100,9 +106,13 @@ class pkgPackageManager : protected pkgCache::Namespace
                    pkgRecords *Recs);
 
    // Do the installation 
                    pkgRecords *Recs);
 
    // Do the installation 
+#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
    OrderResult DoInstall(APT::Progress::PackageManager *progress);
    // compat
    __deprecated OrderResult DoInstall(int statusFd=-1);
    OrderResult DoInstall(APT::Progress::PackageManager *progress);
    // compat
    __deprecated OrderResult DoInstall(int statusFd=-1);
+#else
+   OrderResult DoInstall(int statusFd=-1);
+#endif
 
    // stuff that needs to be done before the fork() of a library that
    // uses apt
 
    // stuff that needs to be done before the fork() of a library that
    // uses apt
@@ -110,11 +120,14 @@ class pkgPackageManager : protected pkgCache::Namespace
       Res = OrderInstall();
       return Res;
    };
       Res = OrderInstall();
       return Res;
    };
-
+#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
    // stuff that needs to be done after the fork
    OrderResult DoInstallPostFork(APT::Progress::PackageManager *progress);
    // compat
    __deprecated OrderResult DoInstallPostFork(int statusFd=-1);
    // stuff that needs to be done after the fork
    OrderResult DoInstallPostFork(APT::Progress::PackageManager *progress);
    // compat
    __deprecated OrderResult DoInstallPostFork(int statusFd=-1);
+#else
+   OrderResult DoInstallPostFork(int statusFd=-1);
+#endif
 
    // ?
    bool FixMissing();
 
    // ?
    bool FixMissing();
index d9d46dba0b38d9acaa500ca617fa0b129f1c3177..3adb00b2361444779e381c8998741a4ddf68a5f5 100644 (file)
@@ -24,6 +24,7 @@
 #include <apt-pkg/pkgrecords.h>
 #include <apt-pkg/indexfile.h>
 #include <apt-pkg/install-progress.h>
 #include <apt-pkg/pkgrecords.h>
 #include <apt-pkg/indexfile.h>
 #include <apt-pkg/install-progress.h>
+#include <apt-pkg/init.h>
 
 #include <set>
 #include <locale.h>
 
 #include <set>
 #include <locale.h>
@@ -105,12 +106,14 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety)
    {
       pkgSimulate PM(Cache);
 
    {
       pkgSimulate PM(Cache);
 
-      int status_fd = _config->FindI("APT::Status-Fd",-1);
-      APT::Progress::PackageManager *progress = NULL;
-      if (status_fd > 0)
-         progress = new APT::Progress::PackageManagerProgressFd(status_fd);
+#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
+      APT::Progress::PackageManager *progress = APT::Progress::PackageManagerProgressFactory();
       pkgPackageManager::OrderResult Res = PM.DoInstall(progress);
       delete progress;
       pkgPackageManager::OrderResult Res = PM.DoInstall(progress);
       delete progress;
+#else
+      int status_fd = _config->FindI("APT::Status-Fd",-1);
+      pkgPackageManager::OrderResult Res = PM.DoInstall(status_fd);
+#endif
 
       if (Res == pkgPackageManager::Failed)
         return false;
 
       if (Res == pkgPackageManager::Failed)
         return false;
@@ -340,26 +343,14 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety)
 
       _system->UnLock();
       
 
       _system->UnLock();
       
-      // FIXME: make this a factory
-      // select the right progress
-      int status_fd = _config->FindI("APT::Status-Fd", -1);
-      int status_deb822_fd = _config->FindI("APT::Status-deb822-Fd", -1);
-
-      APT::Progress::PackageManager *progress = NULL;
-      if (status_deb822_fd > 0)
-         progress = new APT::Progress::PackageManagerProgressDeb822Fd(
-            status_deb822_fd);
-      else if (status_fd > 0)
-         progress = new APT::Progress::PackageManagerProgressFd(status_fd);
-      else if(_config->FindB("Dpkg::Progress-Fancy", false) == true)
-         progress = new APT::Progress::PackageManagerFancy();
-      else if (_config->FindB("Dpkg::Progress", 
-                _config->FindB("DpkgPM::Progress", false)) == true)
-         progress = new APT::Progress::PackageManagerText();
-      else
-         progress = new APT::Progress::PackageManager();
+#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
+      APT::Progress::PackageManager *progress = APT::Progress::PackageManagerProgressFactory();
       pkgPackageManager::OrderResult Res = PM->DoInstall(progress);
       delete progress;
       pkgPackageManager::OrderResult Res = PM->DoInstall(progress);
       delete progress;
+#else
+      int status_fd = _config->FindI("APT::Status-Fd", -1);
+      pkgPackageManager::OrderResult Res = PM->DoInstall(status_fd);
+#endif
 
       if (Res == pkgPackageManager::Failed || _error->PendingError() == true)
         return false;
 
       if (Res == pkgPackageManager::Failed || _error->PendingError() == true)
         return false;