]> git.saurik.com Git - apt.git/commitdiff
Merge remote-tracking branch 'donkult/debian/sid' into debian/experimental
authorMichael Vogt <mvo@debian.org>
Wed, 18 Jun 2014 09:21:35 +0000 (11:21 +0200)
committerMichael Vogt <mvo@debian.org>
Wed, 18 Jun 2014 09:24:16 +0000 (11:24 +0200)
Conflicts:
apt-private/private-install.cc

1  2 
apt-private/private-install.cc
cmdline/apt-internal-solver.cc

index 3b94237b4f15bdeaaf3c6875d8c564d5dcecfe52,e08cd8057f1c0b8d3cc55b9bf2e88fa63dbd2285..55893bda05941e503611102b96e5cb68a7cbdf05
@@@ -19,8 -19,7 +19,8 @@@
  #include <apt-pkg/macros.h>
  #include <apt-pkg/packagemanager.h>
  #include <apt-pkg/pkgcache.h>
- #include <apt-pkg/sourcelist.h>
+ #include <apt-pkg/upgrade.h>
 +#include <apt-pkg/install-progress.h>
  
  #include <errno.h>
  #include <stdlib.h>
@@@ -31,7 -30,6 +31,7 @@@
  #include <iostream>
  #include <set>
  #include <vector>
 +#include <map>
  
  #include <apt-private/acqprogress.h>
  #include <apt-private/private-install.h>
@@@ -527,15 -525,14 +527,14 @@@ static bool DoAutomaticRemove(CacheFil
  static const unsigned short MOD_REMOVE = 1;
  static const unsigned short MOD_INSTALL = 2;
  
- bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, CacheFile &Cache)
+ bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, CacheFile &Cache, int UpgradeMode)
  {
     std::map<unsigned short, APT::VersionSet> verset;
-    return DoCacheManipulationFromCommandLine(CmdL, Cache, verset);
+    return DoCacheManipulationFromCommandLine(CmdL, Cache, verset, UpgradeMode);
  }
  bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, CacheFile &Cache,
-                                         std::map<unsigned short, APT::VersionSet> &verset)
+                                         std::map<unsigned short, APT::VersionSet> &verset, int UpgradeMode)
  {
     // Enter the special broken fixing mode if the user specified arguments
     bool BrokenFix = false;
     if (Cache->BrokenCount() != 0)
        if (Fix != NULL)
        {
         // Call the scored problem resolver
-        if (Fix->Resolve(true) == false && Cache->BrokenCount() == 0)
+        bool resolver_fail = false;
+        if (UpgradeMode == 0)
+        {
+           if (strcmp(CmdL.FileList[0], "dist-upgrade") == 0 || strcmp(CmdL.FileList[0], "full-upgrade") == 0)
+              resolver_fail = APT::Upgrade::Upgrade(Cache, 0);
+           else
+              resolver_fail = Fix->Resolve(true);
+        } else
+           resolver_fail = APT::Upgrade::Upgrade(Cache, UpgradeMode);
+        if (resolver_fail == false && Cache->BrokenCount() == 0)
            return false;
        }
  
  bool DoInstall(CommandLine &CmdL)
  {
     CacheFile Cache;
 +   // first check for local pkgs and add them to the cache
 +   for (const char **I = CmdL.FileList; *I != 0; I++)
 +   {
 +      if(FileExists(*I))
 +      {
 +         // FIXME: make this more elegant
 +         std::string TypeStr = flExtension(*I) + "-file";
 +         pkgSourceList::Type *Type = pkgSourceList::Type::GetType(TypeStr.c_str());
 +         if(Type != 0)
 +         {
 +            std::vector<metaIndex *> List;
 +            std::map<std::string, std::string> Options;
 +            if(Type->CreateItem(List, *I, "", "", Options))
 +            {
 +               // we have our own CacheFile that gives us a SourceList
 +               // with superpowerz
 +               SourceList *sources = (SourceList*)Cache.GetSourceList();
 +               sources->AddMetaIndex(List[0]);
 +            }
 +         }
 +      }
 +   }
 +
 +   // then open the cache
     if (Cache.OpenForInstall() == false || 
         Cache.CheckDeps(CmdL.FileSize() != 1) == false)
        return false;
 -
 +   
     std::map<unsigned short, APT::VersionSet> verset;
  
-    if(!DoCacheManipulationFromCommandLine(CmdL, Cache, verset))
+    if(!DoCacheManipulationFromCommandLine(CmdL, Cache, verset, 0))
        return false;
  
     /* Print out a list of packages that are going to be installed extra
index 0cac12da23455d7b184a2bf04370a227b325df96,5fda7b6a0af4d393626967a4ecec12e5cd20b7d8..c24a96cdfa2d87152287e8c2c7ef30d15befba70
  #include <apt-pkg/depcache.h>
  #include <apt-pkg/pkgcache.h>
  #include <apt-pkg/cacheiterators.h>
+ #include <apt-private/private-output.h>
  
  #include <string.h>
  #include <iostream>
+ #include <sstream>
  #include <list>
  #include <string>
  #include <unistd.h>
@@@ -74,9 -76,6 +76,9 @@@ int main(int argc,const char *argv[]
                {'o',"option",0,CommandLine::ArbItem},
                {0,0,0,0}};
  
 +        // we really don't need anything
 +        DropPrivs();
 +
        CommandLine CmdL(Args,_config);
        if (pkgInitConfig(*_config) == false ||
            CmdL.Parse(argc,argv) == false) {
  
        EDSP::WriteProgress(60, "Call problemresolver on current scenario…", output);
  
+       std::string failure;
        if (upgrade == true) {
-               if (pkgAllUpgrade(CacheFile) == false) {
-                       EDSP::WriteError("ERR_UNSOLVABLE_UPGRADE", "An upgrade error occurred", output);
-                       return 0;
-               }
+               if (pkgAllUpgrade(CacheFile) == false)
+                       failure = "ERR_UNSOLVABLE_UPGRADE";
        } else if (distUpgrade == true) {
-               if (pkgDistUpgrade(CacheFile) == false) {
-                       EDSP::WriteError("ERR_UNSOLVABLE_DIST_UPGRADE", "An dist-upgrade error occurred", output);
-                       return 0;
-               }
-       } else if (Fix.Resolve() == false) {
-               EDSP::WriteError("ERR_UNSOLVABLE", "An error occurred", output);
+               if (pkgDistUpgrade(CacheFile) == false)
+                       failure = "ERR_UNSOLVABLE_DIST_UPGRADE";
+       } else if (Fix.Resolve() == false)
+               failure = "ERR_UNSOLVABLE";
+       if (failure.empty() == false) {
+               std::ostringstream broken;
+               ShowBroken(broken, CacheFile, false);
+               EDSP::WriteError(failure.c_str(), broken.str(), output);
                return 0;
        }