From 760d4968005c97f0d5fd6403633f367aac89c763 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 7 Jan 2008 16:47:40 +0100 Subject: * move the ListUpdate() code from cachefile.h into algorithms.{cc,h} as it does not require a cachefile at all --- apt-pkg/cachefile.cc | 74 ---------------------------------------------------- 1 file changed, 74 deletions(-) (limited to 'apt-pkg/cachefile.cc') diff --git a/apt-pkg/cachefile.cc b/apt-pkg/cachefile.cc index 22eac2f60..1a84aea54 100644 --- a/apt-pkg/cachefile.cc +++ b/apt-pkg/cachefile.cc @@ -109,80 +109,6 @@ bool pkgCacheFile::Open(OpProgress &Progress,bool WithLock) } /*}}}*/ -// CacheFile::ListUpdate - update the cache files /*{{{*/ -// --------------------------------------------------------------------- -/* This is a simple wrapper to update the cache. it will fetch stuff - * from the network (or any other sources defined in sources.list) - */ -bool pkgCacheFile::ListUpdate(pkgAcquireStatus &Stat, - pkgSourceList &List, - int PulseInterval) -{ - pkgAcquire::RunResult res; - pkgAcquire Fetcher(&Stat); - - // Populate it with the source selection - if (List.GetIndexes(&Fetcher) == false) - return false; - - // Run scripts - RunScripts("APT::Update::Pre-Invoke"); - - // check arguments - if(PulseInterval>0) - res = Fetcher.Run(PulseInterval); - else - res = Fetcher.Run(); - - if (res == pkgAcquire::Failed) - return false; - - bool Failed = false; - bool TransientNetworkFailure = false; - for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin(); - I != Fetcher.ItemsEnd(); I++) - { - if ((*I)->Status == pkgAcquire::Item::StatDone) - continue; - - (*I)->Finished(); - - fprintf(stderr,_("Failed to fetch %s %s\n"),(*I)->DescURI().c_str(), - (*I)->ErrorText.c_str()); - - if ((*I)->Status == pkgAcquire::Item::StatTransientNetworkError) - { - TransientNetworkFailure = true; - continue; - } - - Failed = true; - } - - // Clean out any old list files - // Keep "APT::Get::List-Cleanup" name for compatibility, but - // this is really a global option for the APT library now - if (!TransientNetworkFailure && !Failed && - (_config->FindB("APT::Get::List-Cleanup",true) == true || - _config->FindB("APT::List-Cleanup",true) == true)) - { - if (Fetcher.Clean(_config->FindDir("Dir::State::lists")) == false || - Fetcher.Clean(_config->FindDir("Dir::State::lists") + "partial/") == false) - // something went wrong with the clean - return false; - } - - if (TransientNetworkFailure == true) - _error->Warning(_("Some index files failed to download, they have been ignored, or old ones used instead.")); - else if (Failed == true) - return _error->Error(_("Some index files failed to download, they have been ignored, or old ones used instead.")); - - - // Run the scripts if all was fine - RunScripts("APT::Update::Post-Invoke"); - return true; -} - /*}}}*/ // CacheFile::Close - close the cache files /*{{{*/ // --------------------------------------------------------------------- -- cgit v1.2.3