]>
git.saurik.com Git - apt.git/blob - apt-private/private-update.cc
1 // Include files /*{{{*/
4 #include <apt-pkg/aptconfiguration.h>
5 #include <apt-pkg/error.h>
6 #include <apt-pkg/cmndline.h>
7 #include <apt-pkg/init.h>
8 #include <apt-pkg/depcache.h>
9 #include <apt-pkg/sourcelist.h>
10 #include <apt-pkg/algorithms.h>
11 #include <apt-pkg/acquire-item.h>
12 #include <apt-pkg/strutl.h>
13 #include <apt-pkg/fileutl.h>
14 #include <apt-pkg/clean.h>
15 #include <apt-pkg/srcrecords.h>
16 #include <apt-pkg/version.h>
17 #include <apt-pkg/cachefile.h>
18 #include <apt-pkg/cacheset.h>
19 #include <apt-pkg/sptr.h>
20 #include <apt-pkg/md5.h>
21 #include <apt-pkg/versionmatch.h>
22 #include <apt-pkg/progress.h>
23 #include <apt-pkg/pkgsystem.h>
24 #include <apt-pkg/pkgrecords.h>
25 #include <apt-pkg/indexfile.h>
27 #include <sys/types.h>
31 #include "private-cachefile.h"
32 #include "private-output.h"
33 #include "acqprogress.h"
38 // DoUpdate - Update the package lists /*{{{*/
39 // ---------------------------------------------------------------------
41 bool DoUpdate(CommandLine
&CmdL
)
43 if (CmdL
.FileSize() != 1)
44 return _error
->Error(_("The update command takes no arguments"));
48 // Get the source list
49 if (Cache
.BuildSourceList() == false)
51 pkgSourceList
*List
= Cache
.GetSourceList();
53 // Create the progress
54 AcqTextStatus
Stat(ScreenWidth
,_config
->FindI("quiet",0));
56 // Just print out the uris an exit if the --print-uris flag was used
57 if (_config
->FindB("APT::Get::Print-URIs") == true)
59 // force a hashsum for compatibility reasons
60 _config
->CndSet("Acquire::ForceHash", "md5sum");
64 if (Fetcher
.Setup(&Stat
) == false)
67 // Populate it with the source selection and get all Indexes
69 if (List
->GetIndexes(&Fetcher
,true) == false)
72 pkgAcquire::UriIterator I
= Fetcher
.UriBegin();
73 for (; I
!= Fetcher
.UriEnd(); ++I
)
74 c1out
<< '\'' << I
->URI
<< "' " << flNotDir(I
->Owner
->DestFile
) << ' ' <<
75 I
->Owner
->FileSize
<< ' ' << I
->Owner
->HashSum() << std::endl
;
80 if (_config
->FindB("APT::Get::Download",true) == true)
81 ListUpdate(Stat
, *List
);
84 if (_config
->FindB("pkgCacheFile::Generate", true) == true)
86 pkgCacheFile::RemoveCaches();
87 if (Cache
.BuildCaches() == false)