summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2013-10-31 08:23:12 +0100
committerMichael Vogt <mvo@debian.org>2013-10-31 08:23:12 +0100
commitbd5f39b34cc0e8cebbe9103f569d4d903e75bd2b (patch)
tree841b7121ddb1a782c5afb51ff80f448de8f7125e
parent00354054c15b030b90aca8a79b62b4ab2844e3f0 (diff)
restore ABI and prepare next ABI via #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
-rw-r--r--apt-pkg/deb/dpkgpm.cc17
-rw-r--r--apt-pkg/deb/dpkgpm.h7
-rw-r--r--apt-pkg/install-progress.cc22
-rw-r--r--apt-pkg/install-progress.h3
-rw-r--r--apt-pkg/packagemanager.cc36
-rw-r--r--apt-pkg/packagemanager.h15
-rw-r--r--apt-private/private-install.cc35
7 files changed, 106 insertions, 29 deletions
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index 98fb7581a..b252c02eb 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -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
@@ -1009,7 +1022,11 @@ void pkgDPkgPM::BuildPackagesProgressMap()
* 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)
+#else
+bool pkgDPkgPM::GoNoABIBreak(APT::Progress::PackageManager *progress)
+#endif
{
pkgPackageManager::SigINTStop = false;
d->progress = progress;
diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h
index 5f00eee5d..4494bbae3 100644
--- a/apt-pkg/deb/dpkgpm.h
+++ b/apt-pkg/deb/dpkgpm.h
@@ -15,6 +15,7 @@
#include <map>
#include <stdio.h>
#include <apt-pkg/macros.h>
+#include <apt-pkg/init.h>
#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);
+#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
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:
diff --git a/apt-pkg/install-progress.cc b/apt-pkg/install-progress.cc
index 9d0d4e3f1..a9146f27d 100644
--- a/apt-pkg/install-progress.cc
+++ b/apt-pkg/install-progress.cc
@@ -13,6 +13,28 @@
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,
diff --git a/apt-pkg/install-progress.h b/apt-pkg/install-progress.h
index 9c31eac92..050954bb5 100644
--- a/apt-pkg/install-progress.h
+++ b/apt-pkg/install-progress.h
@@ -8,6 +8,9 @@
namespace APT {
namespace Progress {
+ class PackageManager;
+ PackageManager* PackageManagerProgressFactory();
+
class PackageManager
{
private:
diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc
index a2079a2e4..3fdd9b637 100644
--- a/apt-pkg/packagemanager.cc
+++ b/apt-pkg/packagemanager.cc
@@ -1030,15 +1030,16 @@ pkgPackageManager::OrderResult pkgPackageManager::OrderInstall()
// PM::DoInstallPostFork - compat /*{{{*/
// ---------------------------------------------------------------------
/*}}}*/
+#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
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 /*{{{*/
// ---------------------------------------------------------------------
@@ -1051,10 +1052,22 @@ pkgPackageManager::DoInstallPostFork(APT::Progress::PackageManager *progress)
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 */
+#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
pkgPackageManager::OrderResult
pkgPackageManager::DoInstall(int statusFd)
{
@@ -1064,11 +1077,21 @@ pkgPackageManager::DoInstall(int statusFd)
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.*/
+#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
pkgPackageManager::OrderResult
pkgPackageManager::DoInstall(APT::Progress::PackageManager *progress)
{
@@ -1077,4 +1100,5 @@ pkgPackageManager::DoInstall(APT::Progress::PackageManager *progress)
return DoInstallPostFork(progress);
}
+#endif
/*}}}*/
diff --git a/apt-pkg/packagemanager.h b/apt-pkg/packagemanager.h
index 8ffac2f13..a5c58e4a7 100644
--- a/apt-pkg/packagemanager.h
+++ b/apt-pkg/packagemanager.h
@@ -26,6 +26,7 @@
#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>
@@ -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;};
+#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
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
@@ -100,9 +106,13 @@ class pkgPackageManager : protected pkgCache::Namespace
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);
+#else
+ OrderResult DoInstall(int statusFd=-1);
+#endif
// 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;
};
-
+#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);
+#else
+ OrderResult DoInstallPostFork(int statusFd=-1);
+#endif
// ?
bool FixMissing();
diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc
index d9d46dba0..3adb00b23 100644
--- a/apt-private/private-install.cc
+++ b/apt-private/private-install.cc
@@ -24,6 +24,7 @@
#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>
@@ -105,12 +106,14 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety)
{
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;
+#else
+ int status_fd = _config->FindI("APT::Status-Fd",-1);
+ pkgPackageManager::OrderResult Res = PM.DoInstall(status_fd);
+#endif
if (Res == pkgPackageManager::Failed)
return false;
@@ -340,26 +343,14 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety)
_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;
+#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;