diff options
Diffstat (limited to 'cmdline/apt-get.cc')
-rw-r--r-- | cmdline/apt-get.cc | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 27e16d3f3..f5642c04d 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -111,6 +111,9 @@ class CacheFile : public pkgCacheFile return Open(true); } CacheFile() : List(0) {}; + ~CacheFile() { + delete[] List; + } }; /*}}}*/ @@ -1301,9 +1304,9 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, while ((Parse = SrcRecs.Find(Src.c_str(), MatchSrcOnly)) != 0) { string Ver = Parse->Version(); - + // show name mismatches - if (IsMatch == true && Parse->Package() != Src) + if (IsMatch == true && Parse->Package() != Src) ioprintf(c1out, _("No source package '%s' picking '%s' instead\n"), Parse->Package().c_str(), Src.c_str()); if (VerTag.empty() == false) @@ -1870,7 +1873,8 @@ bool DoInstall(CommandLine &CmdL) // cache.commit() if (AutoMarkChanged > 0 && Cache->DelCount() == 0 && Cache->InstCount() == 0 && - Cache->BadCount() == 0) + Cache->BadCount() == 0 && + _config->FindB("APT::Get::Simulate",false) == false) Cache->writeStateFile(NULL); // See if we need to prompt @@ -2522,7 +2526,7 @@ bool DoBuildDep(CommandLine &CmdL) { // We successfully installed something; skip remaining alternatives skipAlternatives = hasAlternatives; - if(_config->FindB("APT::Get::Build-Dep-Automatic", true) == true) + if(_config->FindB("APT::Get::Build-Dep-Automatic", false) == true) Cache->MarkAuto(Pkg, true); continue; } @@ -2739,7 +2743,6 @@ int main(int argc,const char *argv[]) {0,"only-source","APT::Get::Only-Source",0}, {0,"arch-only","APT::Get::Arch-Only",0}, {0,"auto-remove","APT::Get::AutomaticRemove",0}, - {0,"build-dep-automatic","APT::Get::Build-Dep-Automatic",0}, {0,"allow-unauthenticated","APT::Get::AllowUnauthenticated",0}, {0,"install-recommends","APT::Install-Recommends",CommandLine::Boolean}, {0,"fix-policy","APT::Get::Fix-Policy-Broken",0}, @@ -2789,7 +2792,18 @@ int main(int argc,const char *argv[]) ShowHelp(CmdL); return 0; } - + + // simulate user-friendly if apt-get has no root privileges + if (getuid() != 0 && _config->FindB("APT::Get::Simulate") == true) + { + cout << _("NOTE: This is only a simulation!\n" + " apt-get needs root privileges for real execution.\n" + " Keep also in mind that locking is deactivated,\n" + " so don't depend on the relevance to the real current situation!" + ) << std::endl; + _config->Set("Debug::NoLocking",true); + } + // Deal with stdout not being a tty if (!isatty(STDOUT_FILENO) && _config->FindI("quiet",0) < 1) _config->Set("quiet","1"); |