]> git.saurik.com Git - apt.git/blobdiff - apt-private/private-upgrade.cc
Move sysconf(_SC_OPEN_MAX); out of the for() loop to avoid unneeded syscalls
[apt.git] / apt-private / private-upgrade.cc
index e76b5d7fc0efd6e29d255050db3db7108c51aa20..31f0675767a06ee97e96c5e6853a785a63594854 100644 (file)
@@ -1,11 +1,18 @@
 // Includes                                                            /*{{{*/
-#include <apt-pkg/algorithms.h>
+#include <config.h>
+
 #include <apt-pkg/upgrade.h>
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/error.h>
+
+#include <apt-private/private-install.h>
+#include <apt-private/private-cachefile.h>
+#include <apt-private/private-upgrade.h>
+#include <apt-private/private-output.h>
+
 #include <iostream>
-#include "private-install.h"
-#include "private-cachefile.h"
-#include "private-upgrade.h"
-#include "private-output.h"
+
+#include <apti18n.h>
                                                                        /*}}}*/
 
 // this is actually performing the various upgrade operations 
@@ -16,18 +23,10 @@ static bool UpgradeHelper(CommandLine &CmdL, int UpgradeFlags)
       return false;
 
    c0out << _("Calculating upgrade... ") << std::flush;
-   if (APT::Upgrade::Upgrade(Cache, UpgradeFlags) == false)
-   {
-      c0out << _("Failed") << std::endl;
-      ShowBroken(c1out,Cache,false);
-      return _error->Error(_("Internal error, Upgrade broke stuff"));
-   }
+   if(!DoCacheManipulationFromCommandLine(CmdL, Cache, UpgradeFlags))
+      return false;
    c0out << _("Done") << std::endl;
 
-   // parse additional cmdline pkg manipulation switches
-   if(!DoCacheManipulationFromCommandLine(CmdL, Cache))
-      return false;
-   
    return InstallPackages(Cache,true);
 }
 
@@ -39,6 +38,14 @@ bool DoDistUpgrade(CommandLine &CmdL)
    return UpgradeHelper(CmdL, 0);
 }
                                                                        /*}}}*/
+bool DoUpgrade(CommandLine &CmdL)                                      /*{{{*/
+{
+   if (_config->FindB("APT::Get::Upgrade-Allow-New", false) == true)
+      return DoUpgradeWithAllowNewPackages(CmdL);
+   else
+      return DoUpgradeNoNewPackages(CmdL);
+}
+                                                                       /*}}}*/
 // DoUpgradeNoNewPackages - Upgrade all packages                       /*{{{*/
 // ---------------------------------------------------------------------
 /* Upgrade all packages without installing new packages or erasing old