diff options
author | Michael Vogt <mvo@debian.org> | 2013-11-23 09:13:30 +0100 |
---|---|---|
committer | Michael Vogt <mvo@debian.org> | 2013-11-23 09:13:30 +0100 |
commit | 7d2428e03c1fdae79488b9ecd53cc5257b2a0c13 (patch) | |
tree | 81209b60212c997452fd74cf184b8ca5445e8bc0 /apt-pkg/packagemanager.cc | |
parent | f62f17b489405432a3125e51471d8a00e78c5170 (diff) | |
parent | 61f954bff040809e7ab57b3adec2fe95339ffb94 (diff) |
Merge branch 'debian/sid' into ubuntu/master
Conflicts:
debian/changelog
Diffstat (limited to 'apt-pkg/packagemanager.cc')
-rw-r--r-- | apt-pkg/packagemanager.cc | 71 |
1 files changed, 58 insertions, 13 deletions
diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index 8c0d2e855..3fdd9b637 100644 --- a/apt-pkg/packagemanager.cc +++ b/apt-pkg/packagemanager.cc @@ -26,7 +26,6 @@ #include <apt-pkg/sptr.h> #include <iostream> -#include <fcntl.h> #include <apti18n.h> /*}}}*/ @@ -1028,32 +1027,78 @@ pkgPackageManager::OrderResult pkgPackageManager::OrderInstall() return Completed; } +// 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; +} /*}}}*/ // PM::DoInstallPostFork - Does install part that happens after the fork /*{{{*/ // --------------------------------------------------------------------- pkgPackageManager::OrderResult -pkgPackageManager::DoInstallPostFork(int statusFd) +pkgPackageManager::DoInstallPostFork(APT::Progress::PackageManager *progress) { - if(statusFd > 0) - // FIXME: use SetCloseExec here once it taught about throwing - // exceptions instead of doing _exit(100) on failure - fcntl(statusFd,F_SETFD,FD_CLOEXEC); - bool goResult = Go(statusFd); - if(goResult == false) - return Failed; - - return Res; + bool goResult = Go(progress); + if(goResult == false) + return Failed; + + 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) +{ + APT::Progress::PackageManager *progress = new + APT::Progress::PackageManagerProgressFd(statusFd); + OrderResult res = DoInstall(progress); + 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.*/ -pkgPackageManager::OrderResult pkgPackageManager::DoInstall(int statusFd) +#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) +pkgPackageManager::OrderResult +pkgPackageManager::DoInstall(APT::Progress::PackageManager *progress) { if(DoInstallPreFork() == Failed) return Failed; - return DoInstallPostFork(statusFd); + return DoInstallPostFork(progress); } +#endif /*}}}*/ |