Browse Source

restore ABI and prepare next ABI via #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)

tags/debian/0.9.13.exp1
Michael Vogt 8 years ago
parent
commit
bd5f39b34c
7 changed files with 106 additions and 29 deletions
  1. +17
    -0
      apt-pkg/deb/dpkgpm.cc
  2. +7
    -0
      apt-pkg/deb/dpkgpm.h
  3. +22
    -0
      apt-pkg/install-progress.cc
  4. +3
    -0
      apt-pkg/install-progress.h
  5. +30
    -6
      apt-pkg/packagemanager.cc
  6. +14
    -1
      apt-pkg/packagemanager.h
  7. +13
    -22
      apt-private/private-install.cc

+ 17
- 0
apt-pkg/deb/dpkgpm.cc View 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
@@ -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;


+ 7
- 0
apt-pkg/deb/dpkgpm.h View File

@@ -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:


+ 22
- 0
apt-pkg/install-progress.cc View File

@@ -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,


+ 3
- 0
apt-pkg/install-progress.h View File

@@ -8,6 +8,9 @@
namespace APT {
namespace Progress {

class PackageManager;
PackageManager* PackageManagerProgressFactory();

class PackageManager
{
private:


+ 30
- 6
apt-pkg/packagemanager.cc View File

@@ -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
/*}}}*/

+ 14
- 1
apt-pkg/packagemanager.h View File

@@ -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();


+ 13
- 22
apt-private/private-install.cc View File

@@ -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;


Loading…
Cancel
Save