From 0919e3f9400aba51bd73e7f90c6d1ba4406b5421 Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Mon, 20 Sep 2004 16:51:24 +0000 Subject: apt-get update works Author: jgg Date: 1998-11-11 23:45:08 GMT apt-get update works --- cmdline/apt-get.cc | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) (limited to 'cmdline/apt-get.cc') diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 95859c811..d9aa9cebe 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: apt-get.cc,v 1.5 1998/10/24 04:58:08 jgg Exp $ +// $Id: apt-get.cc,v 1.6 1998/11/11 23:45:56 jgg Exp $ /* ###################################################################### apt-get - Cover for dpkg @@ -32,9 +32,12 @@ #include #include #include +#include #include +#include "acqprogress.h" + #include /*}}}*/ @@ -445,8 +448,36 @@ bool InstallPackages(pkgDepCache &Cache,bool ShwKept) // DoUpdate - Update the package lists /*{{{*/ // --------------------------------------------------------------------- /* */ -bool DoUpdate(CommandLine &CmdL) +bool DoUpdate(CommandLine &) { + // Get the source list + pkgSourceList List; + if (List.ReadMainList() == false) + return false; + + // Create the download object + AcqTextStatus Stat(ScreenWidth,_config->FindI("quiet",0)); + pkgAcquire Fetcher(&Stat); + + // Populate it with the source selection + pkgSourceList::const_iterator I; + for (I = List.begin(); I != List.end(); I++) + { + new pkgAcqIndex(&Fetcher,I); + if (_error->PendingError() == true) + return false; + } + + // Run it + if (Fetcher.Run() == false) + return false; + + // Prepare the cache. + CacheFile Cache; + if (Cache.Open() == false) + return false; + + return true; } /*}}}*/ // DoUpgrade - Upgrade all packages /*{{{*/ @@ -829,7 +860,8 @@ int main(int argc,const char *argv[]) { if (strcmp(CmdL.FileList[0],Map[I].Match) == 0) { - Map[I].Handler(CmdL); + if (Map[I].Handler(CmdL) == false && _error->PendingError() == false) + _error->Error("Handler silently failed"); break; } } -- cgit v1.2.3