From: Michael Vogt Date: Wed, 18 Jun 2014 09:21:35 +0000 (+0200) Subject: Merge remote-tracking branch 'donkult/debian/sid' into debian/experimental X-Git-Tag: 1.1.exp1~11 X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/8d20b69d2fd7a8fec82bb559f0e39059bbaecf1b?ds=inline;hp=-c Merge remote-tracking branch 'donkult/debian/sid' into debian/experimental Conflicts: apt-private/private-install.cc --- 8d20b69d2fd7a8fec82bb559f0e39059bbaecf1b diff --combined apt-private/private-install.cc index 3b94237b4,e08cd8057..55893bda0 --- a/apt-private/private-install.cc +++ b/apt-private/private-install.cc @@@ -19,8 -19,7 +19,8 @@@ #include #include #include - #include + #include +#include #include #include @@@ -31,7 -30,6 +31,7 @@@ #include #include #include +#include #include #include @@@ -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 verset; - return DoCacheManipulationFromCommandLine(CmdL, Cache, verset); + return DoCacheManipulationFromCommandLine(CmdL, Cache, verset, UpgradeMode); } bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, CacheFile &Cache, - std::map &verset) + std::map &verset, int UpgradeMode) { - // Enter the special broken fixing mode if the user specified arguments bool BrokenFix = false; if (Cache->BrokenCount() != 0) @@@ -620,7 -617,17 +619,17 @@@ 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; } @@@ -673,37 -680,13 +682,37 @@@ 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 List; + std::map 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 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 diff --combined cmdline/apt-internal-solver.cc index 0cac12da2,5fda7b6a0..c24a96cdf --- a/cmdline/apt-internal-solver.cc +++ b/cmdline/apt-internal-solver.cc @@@ -24,9 -24,11 +24,11 @@@ #include #include #include + #include #include #include + #include #include #include #include @@@ -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) { @@@ -171,18 -170,20 +173,20 @@@ 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; }