]> git.saurik.com Git - apt.git/blobdiff - apt-private/private-install.cc
add hashsum support in apt-file download and add more tests
[apt.git] / apt-private / private-install.cc
index 643a6b370475dc9b2eeded856b9a8b568db175c7..3adb00b2361444779e381c8998741a4ddf68a5f5 100644 (file)
@@ -23,6 +23,8 @@
 #include <apt-pkg/pkgsystem.h>
 #include <apt-pkg/pkgrecords.h>
 #include <apt-pkg/indexfile.h>
 #include <apt-pkg/pkgsystem.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>
@@ -103,8 +105,16 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety)
    if (_config->FindB("APT::Get::Simulate") == true)
    {
       pkgSimulate PM(Cache);
    if (_config->FindB("APT::Get::Simulate") == true)
    {
       pkgSimulate PM(Cache);
+
+#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);
       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::Completed)
       if (Res == pkgPackageManager::Failed)
         return false;
       if (Res != pkgPackageManager::Completed)
@@ -332,8 +342,16 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety)
       }
 
       _system->UnLock();
       }
 
       _system->UnLock();
-      int status_fd = _config->FindI("APT::Status-Fd",-1);
+      
+#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);
       pkgPackageManager::OrderResult Res = PM->DoInstall(status_fd);
+#endif
+
       if (Res == pkgPackageManager::Failed || _error->PendingError() == true)
         return false;
       if (Res == pkgPackageManager::Completed)
       if (Res == pkgPackageManager::Failed || _error->PendingError() == true)
         return false;
       if (Res == pkgPackageManager::Completed)