diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2010-08-30 11:57:14 +0200 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2010-08-30 11:57:14 +0200 |
commit | 4cb0cd1648e4a2623cb00a11b2db2649e286706d (patch) | |
tree | f629993a945f63f26629affba9feac011e594eb3 /cmdline | |
parent | 61110beb5f398b7f83fa8135bd4e04294ea408b4 (diff) | |
parent | ba91b1518a1208fecc1ca076fd9cfbd28344b5b3 (diff) |
merged lp:~donkult/apt/sid
Diffstat (limited to 'cmdline')
-rw-r--r-- | cmdline/apt-cache.cc | 11 | ||||
-rw-r--r-- | cmdline/apt-get.cc | 55 |
2 files changed, 20 insertions, 46 deletions
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc index 74a4f69c2..ba4ad1943 100644 --- a/cmdline/apt-cache.cc +++ b/cmdline/apt-cache.cc @@ -1781,15 +1781,6 @@ bool ShowHelp(CommandLine &Cmd) return true; } /*}}}*/ -// CacheInitialize - Initialize things for apt-cache /*{{{*/ -// --------------------------------------------------------------------- -/* */ -void CacheInitialize() -{ - _config->Set("quiet",0); - _config->Set("help",false); -} - /*}}}*/ int main(int argc,const char *argv[]) /*{{{*/ { CommandLine::Args Args[] = { @@ -1841,8 +1832,6 @@ int main(int argc,const char *argv[]) /*{{{*/ {"madison",&Madison}, {0,0}}; - CacheInitialize(); - // Set up gettext support setlocale(LC_ALL,""); textdomain(PACKAGE); diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 9b69e9589..d1c010e49 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1084,13 +1084,13 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true, return false; // Read the source list - pkgSourceList List; - if (List.ReadMainList() == false) - return _error->Error(_("The list of sources could not be read.")); + if (Cache.BuildSourceList() == false) + return false; + pkgSourceList *List = Cache.GetSourceList(); // Create the package manager and prepare to download SPtr<pkgPackageManager> PM= _system->CreatePM(Cache); - if (PM->GetArchives(&Fetcher,&List,&Recs) == false || + if (PM->GetArchives(&Fetcher,List,&Recs) == false || _error->PendingError() == true) return false; @@ -1306,7 +1306,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true, // Reload the fetcher object and loop again for media swapping Fetcher.Shutdown(); - if (PM->GetArchives(&Fetcher,&List,&Recs) == false) + if (PM->GetArchives(&Fetcher,List,&Recs) == false) return false; _system->Lock(); @@ -1542,11 +1542,13 @@ bool DoUpdate(CommandLine &CmdL) { if (CmdL.FileSize() != 1) return _error->Error(_("The update command takes no arguments")); - + + CacheFile Cache; + // Get the source list - pkgSourceList List; - if (List.ReadMainList() == false) + if (Cache.BuildSourceList() == false) return false; + pkgSourceList *List = Cache.GetSourceList(); // Create the progress AcqTextStatus Stat(ScreenWidth,_config->FindI("quiet",0)); @@ -1564,7 +1566,7 @@ bool DoUpdate(CommandLine &CmdL) // Populate it with the source selection and get all Indexes // (GetAll=true) - if (List.GetIndexes(&Fetcher,true) == false) + if (List->GetIndexes(&Fetcher,true) == false) return false; pkgAcquire::UriIterator I = Fetcher.UriBegin(); @@ -1575,9 +1577,8 @@ bool DoUpdate(CommandLine &CmdL) } // do the work - CacheFile Cache; if (_config->FindB("APT::Get::Download",true) == true) - ListUpdate(Stat, List); + ListUpdate(Stat, *List); // Rebuild the cache. if (Cache.BuildCaches() == false) @@ -2189,13 +2190,13 @@ bool DoSource(CommandLine &CmdL) return _error->Error(_("Must specify at least one package to fetch source for")); // Read the source list - pkgSourceList List; - if (List.ReadMainList() == false) - return _error->Error(_("The list of sources could not be read.")); + if (Cache.BuildSourceList() == false) + return false; + pkgSourceList *List = Cache.GetSourceList(); // Create the text record parsers pkgRecords Recs(Cache); - pkgSrcRecords SrcRecs(List); + pkgSrcRecords SrcRecs(*List); if (_error->PendingError() == true) return false; @@ -2480,13 +2481,13 @@ bool DoBuildDep(CommandLine &CmdL) return _error->Error(_("Must specify at least one package to check builddeps for")); // Read the source list - pkgSourceList List; - if (List.ReadMainList() == false) - return _error->Error(_("The list of sources could not be read.")); + if (Cache.BuildSourceList() == false) + return false; + pkgSourceList *List = Cache.GetSourceList(); // Create the text record parsers pkgRecords Recs(Cache); - pkgSrcRecords SrcRecs(List); + pkgSrcRecords SrcRecs(*List); if (_error->PendingError() == true) return false; @@ -2833,22 +2834,6 @@ bool ShowHelp(CommandLine &CmdL) return true; } /*}}}*/ -// GetInitialize - Initialize things for apt-get /*{{{*/ -// --------------------------------------------------------------------- -/* */ -void GetInitialize() -{ - _config->Set("quiet",0); - _config->Set("help",false); - _config->Set("APT::Get::Download-Only",false); - _config->Set("APT::Get::Simulate",false); - _config->Set("APT::Get::Assume-Yes",false); - _config->Set("APT::Get::Fix-Broken",false); - _config->Set("APT::Get::Force-Yes",false); - _config->Set("APT::Get::List-Cleanup",true); - _config->Set("APT::Get::AutomaticRemove",false); -} - /*}}}*/ // SigWinch - Window size change signal handler /*{{{*/ // --------------------------------------------------------------------- /* */ |