--- apt-0.5.15lorg2/cmdline/acqprogress.cc.orig 2006-11-30 14:49:57 +0000 +++ apt-0.5.15lorg2/cmdline/acqprogress.cc 2006-11-30 14:49:57 +0000 @@ -13,6 +13,7 @@ #include #include #include +#include #include @@ -274,6 +275,8 @@ bool AcqTextStatus::MediaChange(string M " '%s'\n" "in the drive '%s' and press enter\n"), Media.c_str(),Drive.c_str()); + if (_config->FindB("simple-output")) + cout << "apt-get:media-change:" << Drive << ":" << Media << std::endl; char C = 0; while (C != '\n' && C != '\r') --- apt-0.5.15lorg2/cmdline/apt-get.cc.orig 2006-10-10 20:43:05 +0000 +++ apt-0.5.15lorg2/cmdline/apt-get.cc 2006-10-10 20:43:32 +0000 @@ -71,6 +71,7 @@ using namespace std; ostream c0out(0); ostream c1out(0); ostream c2out(0); +ostream c3out(0); // script output stream ofstream devnull("/dev/null"); unsigned int ScreenWidth = 80; @@ -418,6 +419,7 @@ void ShowNew(ostream &out,CacheFile &Cac } } + if (!List.empty()) c3out<<"apt-get:install-list:"< " + Cache[I].CandVersion + "\n"; } + if (!List.empty()) c3out<<"apt-get:keep-list:"< " + Cache[I].CandVersion + "\n"; } + if (!List.empty()) c3out<<"apt-get:upgrade-list:"< " + Cache[I].CandVersion + "\n"; } + if (!List.empty()) c3out<<"apt-get:downgrade-list:"<BrokenCount() != 0) { c1out << _(" failed.") << endl; - ShowBroken(c1out,*this,true); + ShowBroken(cerr,*this,true); return _error->Error(_("Unable to correct dependencies")); } @@ -826,7 +842,7 @@ bool CacheFile::CheckDeps(bool AllowBrok else { c1out << _("You might want to run `apt-get --fix-broken install' to correct these.") << endl; - ShowBroken(c1out,*this,true); + ShowBroken(cerr,*this,true); return _error->Error(_("Unmet dependencies. Try using --fix-broken.")); } @@ -876,7 +892,7 @@ bool InstallPackages(CacheFile &Cache,bo // Sanity check if (Cache->BrokenCount() != 0) { - ShowBroken(c1out,Cache,false); + ShowBroken(cerr,Cache,false); return _error->Error("Internal Error, InstallPackages was called with broken packages!"); } @@ -955,6 +971,7 @@ bool InstallPackages(CacheFile &Cache,bo else ioprintf(c1out,_("After unpacking %sB disk space will be freed.\n"), SizeToStr(-1*Cache->UsrSize()).c_str()); + c3out<<"apt-get:status:disk-size:"<UsrSize())<PendingError() == true) return false; @@ -1011,6 +1028,7 @@ bool InstallPackages(CacheFile &Cache,bo if (_config->FindI("quiet",0) < 2 && _config->FindB("APT::Get::Assume-Yes",false) == false) { + c3out << "apt-get:wait-yes-no:" << endl; c2out << _("Do you want to continue? [Y/n] ") << flush; if (YnPrompt() == false) @@ -1342,23 +1360,23 @@ bool TryToInstall(pkgCache::PkgIterator } else { - ioprintf(c1out,_("Package %s is a virtual package provided by:\n"), + ioprintf(cerr,_("Package %s is a virtual package provided by:\n"), Pkg.Name()); for (unsigned int i = 0; i != GoodSolutions.size(); i++) { pkgCache::PkgIterator GoodPkg(Cache, GoodSolutions[i]); if (GoodPkg.CurrentVer().end() == false) - c1out << " " << GoodSolutionNames[i] + cerr << " " << GoodSolutionNames[i] << " " << Cache[GoodPkg].CandVersion << _(" [Installed]") << endl; else - c1out << " " << GoodSolutionNames[i] + cerr << " " << GoodSolutionNames[i] << " " << Cache[GoodPkg].CandVersion << endl; } if (Remove) - c1out << _("You should explicitly select one to remove.") << endl; + cerr << _("You should explicitly select one to remove.") << endl; else - c1out << _("You should explicitly select one to install.") << endl; + cerr << _("You should explicitly select one to install.") << endl; _error->Error(_("Package %s is a virtual package with multiple " "good providers.\n"), Pkg.Name()); return false; @@ -1446,6 +1464,7 @@ bool TryToInstall(pkgCache::PkgIterator List += string(Dep.ParentPkg().Name()) + " "; //VersionsList += string(Dep.ParentPkg().CurVersion) + "\n"; ??? } + if (!List.empty()) c3out<<"apt-get:however-replace-list:"<Error(_("Internal Error, AllUpgrade broke stuff")); } @@ -2107,7 +2126,7 @@ bool DoInstall(CommandLine &CmdL) if (BrokenFix == true && Cache->BrokenCount() != 0) { c1out << _("You might want to run `apt-get --fix-broken install' to correct these:") << endl; - ShowBroken(c1out,Cache,false); + ShowBroken(cerr,Cache,false); return _error->Error(_("Unmet dependencies. Try 'apt-get --fix-broken install' with no packages (or specify a solution).")); } @@ -2146,7 +2165,7 @@ bool DoInstall(CommandLine &CmdL) c1out << _("The following information may help to resolve the situation:") << endl; c1out << endl; - ShowBroken(c1out,Cache,false); + ShowBroken(cerr,Cache,false); return _error->Error(_("Broken packages")); } @@ -2174,6 +2193,7 @@ bool DoInstall(CommandLine &CmdL) } } + if (!List.empty()) c3out<<"apt-get:extra-list:"<Error("Internal Error, problem resolver broke stuff"); } } @@ -2370,7 +2392,7 @@ bool DoDSelectUpgrade(CommandLine &CmdL) // Now upgrade everything if (pkgAllUpgrade(Cache) == false) { - ShowBroken(c1out,Cache,false); + ShowBroken(cerr,Cache,false); return _error->Error("Internal Error, problem resolver broke stuff"); } @@ -3007,7 +3029,7 @@ bool DoBuildDep(CommandLine &CmdL) if (Cache->BrokenCount() != 0) { // CNC:2004-07-05 - ShowBroken(c1out, Cache, false); + ShowBroken(cerr, Cache, false); return _error->Error(_("Some broken packages were found while trying to process build-dependencies for %s.\n" "You might want to run `apt-get --fix-broken install' to correct these."),*I); } @@ -3210,6 +3232,7 @@ int main(int argc,const char *argv[]) {'v',"version","version",0}, {'V',"verbose-versions","APT::Get::Show-Versions",0}, {'q',"quiet","quiet",CommandLine::IntLevel}, + { 0, "simple-output","simple-output",0}, {'q',"silent","quiet",CommandLine::IntLevel}, {'d',"download-only","APT::Get::Download-Only",0}, {'b',"compile","APT::Get::Compile",0}, @@ -3322,9 +3345,21 @@ int main(int argc,const char *argv[]) _config->Set("quiet","1"); // Setup the output streams - c0out.rdbuf(cout.rdbuf()); - c1out.rdbuf(cout.rdbuf()); - c2out.rdbuf(cout.rdbuf()); + if (_config->FindB("simple-output")) + { + c0out.rdbuf(devnull.rdbuf()); + c1out.rdbuf(devnull.rdbuf()); + c2out.rdbuf(devnull.rdbuf()); + c3out.rdbuf(cout.rdbuf()); + } + else + { + c0out.rdbuf(cout.rdbuf()); + c1out.rdbuf(cout.rdbuf()); + c2out.rdbuf(cout.rdbuf()); + c3out.rdbuf(devnull.rdbuf()); + } + if (_config->FindI("quiet",0) > 0) c0out.rdbuf(devnull.rdbuf()); if (_config->FindI("quiet",0) > 1)