]>
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>
26 #include <apt-pkg/update.h>
28 #include <sys/types.h>
32 #include "private-cachefile.h"
33 #include "private-output.h"
34 #include "acqprogress.h"
39 // DoUpdate - Update the package lists /*{{{*/
40 // ---------------------------------------------------------------------
42 bool DoUpdate(CommandLine
&CmdL
)
44 if (CmdL
.FileSize() != 1)
45 return _error
->Error(_("The update command takes no arguments"));
49 // Get the source list
50 if (Cache
.BuildSourceList() == false)
52 pkgSourceList
*List
= Cache
.GetSourceList();
54 // Create the progress
55 AcqTextStatus
Stat(ScreenWidth
,_config
->FindI("quiet",0));
57 // Just print out the uris an exit if the --print-uris flag was used
58 if (_config
->FindB("APT::Get::Print-URIs") == true)
60 // force a hashsum for compatibility reasons
61 _config
->CndSet("Acquire::ForceHash", "md5sum");
65 if (Fetcher
.Setup(&Stat
) == false)
68 // Populate it with the source selection and get all Indexes
70 if (List
->GetIndexes(&Fetcher
,true) == false)
73 pkgAcquire::UriIterator I
= Fetcher
.UriBegin();
74 for (; I
!= Fetcher
.UriEnd(); ++I
)
75 c1out
<< '\'' << I
->URI
<< "' " << flNotDir(I
->Owner
->DestFile
) << ' ' <<
76 I
->Owner
->FileSize
<< ' ' << I
->Owner
->HashSum() << std::endl
;
81 if (_config
->FindB("APT::Get::Download",true) == true)
82 ListUpdate(Stat
, *List
);
85 if (_config
->FindB("pkgCacheFile::Generate", true) == true)
87 pkgCacheFile::RemoveCaches();
88 if (Cache
.BuildCaches() == false)