]> git.saurik.com Git - apt.git/blobdiff - cmdline/apt-get.cc
apt-get update works now
[apt.git] / cmdline / apt-get.cc
index 4f8de001f0a415f867b328fa3ae19906adf9adf5..2ed05b8aa8261484c01c054fdadee445d6b3f7af 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: apt-get.cc,v 1.4 1998/10/20 04:33:18 jgg Exp $
+// $Id: apt-get.cc,v 1.7 1998/11/12 04:10:56 jgg Exp $
 /* ######################################################################
    
    apt-get - Cover for dpkg
 #include <apt-pkg/sourcelist.h>
 #include <apt-pkg/pkgcachegen.h>
 #include <apt-pkg/algorithms.h>
+#include <apt-pkg/acquire-item.h>
 
 #include <config.h>
 
+#include "acqprogress.h"
+
 #include <fstream.h>
                                                                        /*}}}*/
 
@@ -445,8 +448,41 @@ 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;
+
+   // Clean out any old list files
+   if (Fetcher.Clean(_config->FindDir("Dir::State::lists")) == false ||
+       Fetcher.Clean(_config->FindDir("Dir::State::lists") + "partial/") == false)
+      return false;
+   
+   // Prepare the cache.   
+   CacheFile Cache;
+   if (Cache.Open() == false)
+      return false;
+   
+   return true;
 }
                                                                        /*}}}*/
 // DoUpgrade - Upgrade all packages                                    /*{{{*/
@@ -782,6 +818,7 @@ int main(int argc,const char *argv[])
       {'f',"fix-broken","APT::Get::Fix-Broken",0},
       {'u',"show-upgraded","APT::Get::Show-Upgraded",0},
       {'m',"ignore-missing","APT::Get::Fix-Broken",0},      
+      {0,"ignore-hold","APT::Ingore-Hold",0},      
       {'c',"config-file",0,CommandLine::ConfigFile},
       {'o',"option",0,CommandLine::ArbItem},
       {0,0,0,0}};
@@ -828,7 +865,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;
       }
    }