summaryrefslogtreecommitdiff
path: root/cmdline/apt-internal-solver.cc
diff options
context:
space:
mode:
Diffstat (limited to 'cmdline/apt-internal-solver.cc')
-rw-r--r--cmdline/apt-internal-solver.cc25
1 files changed, 23 insertions, 2 deletions
diff --git a/cmdline/apt-internal-solver.cc b/cmdline/apt-internal-solver.cc
index 83a671a96..68489e213 100644
--- a/cmdline/apt-internal-solver.cc
+++ b/cmdline/apt-internal-solver.cc
@@ -53,6 +53,8 @@ int main(int argc,const char *argv[]) /*{{{*/
{'v',"version","version",0},
{'q',"quiet","quiet",CommandLine::IntLevel},
{'q',"silent","quiet",CommandLine::IntLevel},
+ {'c',"config-file",0,CommandLine::ConfigFile},
+ {'o',"option",0,CommandLine::ArbItem},
{0,0,0,0}};
CommandLine CmdL(Args,_config);
@@ -69,6 +71,25 @@ int main(int argc,const char *argv[]) /*{{{*/
return 1;
}
+ if (CmdL.FileList[0] != 0 && strcmp(CmdL.FileList[0], "scenario") == 0)
+ {
+ if (pkgInitSystem(*_config,_system) == false) {
+ std::cerr << "System could not be initialized!" << std::endl;
+ return 1;
+ }
+ pkgCacheFile CacheFile;
+ CacheFile.Open(NULL, false);
+ APT::PackageSet pkgset = APT::PackageSet::FromCommandLine(CacheFile, CmdL.FileList + 1);
+ FILE* output = stdout;
+ if (pkgset.empty() == true)
+ EDSP::WriteScenario(CacheFile, output);
+ else
+ EDSP::WriteLimitedScenario(CacheFile, output, pkgset);
+ fclose(output);
+ _error->DumpErrors(std::cerr);
+ return 0;
+ }
+
// Deal with stdout not being a tty
if (!isatty(STDOUT_FILENO) && _config->FindI("quiet", -1) == -1)
_config->Set("quiet","1");
@@ -138,9 +159,9 @@ int main(int argc,const char *argv[]) /*{{{*/
bool const Errors = _error->PendingError();
if (_config->FindI("quiet",0) > 0)
- _error->DumpErrors();
+ _error->DumpErrors(std::cerr);
else
- _error->DumpErrors(GlobalError::DEBUG);
+ _error->DumpErrors(std::cerr, GlobalError::DEBUG);
return Errors == true ? 100 : 0;
}
/*}}}*/