]> git.saurik.com Git - apt.git/blob - apt-pkg/pkgcachegen.cc
Devel acquire module
[apt.git] / apt-pkg / pkgcachegen.cc
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 // $Id: pkgcachegen.cc,v 1.19 1998/10/15 07:00:00 jgg Exp $
4 /* ######################################################################
5
6 Package Cache Generator - Generator for the cache structure.
7
8 This builds the cache structure from the abstract package list parser.
9
10 ##################################################################### */
11 /*}}}*/
12 // Include Files /*{{{*/
13 #ifdef __GNUG__
14 #pragma implementation "apt-pkg/pkgcachegen.h"
15 #endif
16
17 #include <apt-pkg/pkgcachegen.h>
18 #include <apt-pkg/error.h>
19 #include <apt-pkg/version.h>
20 #include <apt-pkg/progress.h>
21 #include <apt-pkg/sourcelist.h>
22 #include <apt-pkg/configuration.h>
23 #include <apt-pkg/deblistparser.h>
24
25 #include <strutl.h>
26
27 #include <sys/stat.h>
28 #include <unistd.h>
29 /*}}}*/
30
31 // CacheGenerator::pkgCacheGenerator - Constructor /*{{{*/
32 // ---------------------------------------------------------------------
33 /* We set the diry flag and make sure that is written to the disk */
34 pkgCacheGenerator::pkgCacheGenerator(DynamicMMap &Map,OpProgress &Prog) :
35 Map(Map), Cache(Map), Progress(Prog)
36 {
37 if (_error->PendingError() == true)
38 return;
39
40 if (Map.Size() == 0)
41 {
42 Map.RawAllocate(sizeof(pkgCache::Header));
43 *Cache.HeaderP = pkgCache::Header();
44 }
45 Cache.HeaderP->Dirty = true;
46 Map.Sync(0,sizeof(pkgCache::Header));
47 Map.UsePools(*Cache.HeaderP->Pools,sizeof(Cache.HeaderP->Pools)/sizeof(Cache.HeaderP->Pools[0]));
48 }
49 /*}}}*/
50 // CacheGenerator::~pkgCacheGenerator - Destructor /*{{{*/
51 // ---------------------------------------------------------------------
52 /* We sync the data then unset the dirty flag in two steps so as to
53 advoid a problem during a crash */
54 pkgCacheGenerator::~pkgCacheGenerator()
55 {
56 if (_error->PendingError() == true)
57 return;
58 if (Map.Sync() == false)
59 return;
60
61 Cache.HeaderP->Dirty = false;
62 Map.Sync(0,sizeof(pkgCache::Header));
63 }
64 /*}}}*/
65 // CacheGenerator::MergeList - Merge the package list /*{{{*/
66 // ---------------------------------------------------------------------
67 /* This provides the generation of the entries in the cache. Each loop
68 goes through a single package record from the underlying parse engine. */
69 bool pkgCacheGenerator::MergeList(ListParser &List)
70 {
71 List.Owner = this;
72
73 int Counter = 0;
74 while (List.Step() == true)
75 {
76 // Get a pointer to the package structure
77 string PackageName = List.Package();
78 pkgCache::PkgIterator Pkg;
79 if (NewPackage(Pkg,PackageName) == false)
80 return _error->Error("Error occured while processing %s (NewPackage)",PackageName.c_str());
81 Counter++;
82 if (Counter % 100 == 0)
83 Progress.Progress(List.Offset());
84
85 /* Get a pointer to the version structure. We know the list is sorted
86 so we use that fact in the search. Insertion of new versions is
87 done with correct sorting */
88 string Version = List.Version();
89 if (Version.empty() == true)
90 {
91 if (List.UsePackage(Pkg,pkgCache::VerIterator(Cache)) == false)
92 return _error->Error("Error occured while processing %s (UsePackage1)",PackageName.c_str());
93 continue;
94 }
95
96 pkgCache::VerIterator Ver = Pkg.VersionList();
97 unsigned long *Last = &Pkg->VersionList;
98 int Res = 1;
99 for (; Ver.end() == false; Last = &Ver->NextVer, Ver++)
100 {
101 Res = pkgVersionCompare(Version.begin(),Version.end(),Ver.VerStr(),
102 Ver.VerStr() + strlen(Ver.VerStr()));
103 if (Res >= 0)
104 break;
105 }
106
107 /* We already have a version for this item, record that we
108 saw it */
109 if (Res == 0)
110 {
111 if (List.UsePackage(Pkg,Ver) == false)
112 return _error->Error("Error occured while processing %s (UsePackage2)",PackageName.c_str());
113
114 if (NewFileVer(Ver,List) == false)
115 return _error->Error("Error occured while processing %s (NewFileVer1)",PackageName.c_str());
116
117 continue;
118 }
119
120 // Add a new version
121 *Last = NewVersion(Ver,Version,*Last);
122 Ver->ParentPkg = Pkg.Index();
123 if (List.NewVersion(Ver) == false)
124 return _error->Error("Error occured while processing %s (NewVersion1)",PackageName.c_str());
125
126 if (List.UsePackage(Pkg,Ver) == false)
127 return _error->Error("Error occured while processing %s (UsePackage3)",PackageName.c_str());
128
129 if (NewFileVer(Ver,List) == false)
130 return _error->Error("Error occured while processing %s (NewVersion2)",PackageName.c_str());
131 }
132
133 return true;
134 }
135 /*}}}*/
136 // CacheGenerator::NewPackage - Add a new package /*{{{*/
137 // ---------------------------------------------------------------------
138 /* This creates a new package structure and adds it to the hash table */
139 bool pkgCacheGenerator::NewPackage(pkgCache::PkgIterator &Pkg,string Name)
140 {
141 Pkg = Cache.FindPkg(Name);
142 if (Pkg.end() == false)
143 return true;
144
145 // Get a structure
146 unsigned long Package = Map.Allocate(sizeof(pkgCache::Package));
147 if (Package == 0)
148 return false;
149
150 Pkg = pkgCache::PkgIterator(Cache,Cache.PkgP + Package);
151
152 // Insert it into the hash table
153 unsigned long Hash = Cache.Hash(Name);
154 Pkg->NextPackage = Cache.HeaderP->HashTable[Hash];
155 Cache.HeaderP->HashTable[Hash] = Package;
156
157 // Set the name and the ID
158 Pkg->Name = Map.WriteString(Name);
159 if (Pkg->Name == 0)
160 return false;
161 Pkg->ID = Cache.HeaderP->PackageCount++;
162
163 return true;
164 }
165 /*}}}*/
166 // CacheGenerator::NewFileVer - Create a new File<->Version association /*{{{*/
167 // ---------------------------------------------------------------------
168 /* */
169 bool pkgCacheGenerator::NewFileVer(pkgCache::VerIterator &Ver,
170 ListParser &List)
171 {
172 // Get a structure
173 unsigned long VerFile = Map.Allocate(sizeof(pkgCache::VerFile));
174 if (VerFile == 0)
175 return 0;
176
177 pkgCache::VerFileIterator VF(Cache,Cache.VerFileP + VerFile);
178 VF->File = CurrentFile - Cache.PkgFileP;
179 VF->NextFile = Ver->FileList;
180 Ver->FileList = VF.Index();
181 VF->Offset = List.Offset();
182 VF->Size = List.Size();
183 if (Cache.HeaderP->MaxVerFileSize < VF->Size)
184 Cache.HeaderP->MaxVerFileSize = VF->Size;
185 return true;
186 }
187 /*}}}*/
188 // CacheGenerator::NewVersion - Create a new Version /*{{{*/
189 // ---------------------------------------------------------------------
190 /* This puts a version structure in the linked list */
191 unsigned long pkgCacheGenerator::NewVersion(pkgCache::VerIterator &Ver,
192 string VerStr,
193 unsigned long Next)
194 {
195 // Get a structure
196 unsigned long Version = Map.Allocate(sizeof(pkgCache::Version));
197 if (Version == 0)
198 return 0;
199
200 // Fill it in
201 Ver = pkgCache::VerIterator(Cache,Cache.VerP + Version);
202 Ver->NextVer = Next;
203 Ver->ID = Cache.HeaderP->VersionCount++;
204 Ver->VerStr = Map.WriteString(VerStr);
205 if (Ver->VerStr == 0)
206 return 0;
207
208 return Version;
209 }
210 /*}}}*/
211 // ListParser::NewDepends - Create a dependency element /*{{{*/
212 // ---------------------------------------------------------------------
213 /* This creates a dependency element in the tree. It is linked to the
214 version and to the package that it is pointing to. */
215 bool pkgCacheGenerator::ListParser::NewDepends(pkgCache::VerIterator Ver,
216 string PackageName,
217 string Version,
218 unsigned int Op,
219 unsigned int Type)
220 {
221 pkgCache &Cache = Owner->Cache;
222
223 // Get a structure
224 unsigned long Dependency = Owner->Map.Allocate(sizeof(pkgCache::Dependency));
225 if (Dependency == 0)
226 return false;
227
228 // Fill it in
229 pkgCache::DepIterator Dep(Cache,Cache.DepP + Dependency);
230 Dep->ParentVer = Ver.Index();
231 Dep->Type = Type;
232 Dep->CompareOp = Op;
233 Dep->ID = Cache.HeaderP->DependsCount++;
234
235 // Locate the target package
236 pkgCache::PkgIterator Pkg;
237 if (Owner->NewPackage(Pkg,PackageName) == false)
238 return false;
239
240 // Probe the reverse dependency list for a version string that matches
241 if (Version.empty() == false)
242 {
243 for (pkgCache::DepIterator I = Pkg.RevDependsList(); I.end() == false; I++)
244 if (I->Version != 0 && I.TargetVer() == Version)
245 Dep->Version = I->Version;
246 if (Dep->Version == 0)
247 if ((Dep->Version = WriteString(Version)) == 0)
248 return false;
249 }
250
251 // Link it to the package
252 Dep->Package = Pkg.Index();
253 Dep->NextRevDepends = Pkg->RevDepends;
254 Pkg->RevDepends = Dep.Index();
255
256 // Link it to the version (at the end of the list)
257 unsigned long *Last = &Ver->DependsList;
258 for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false; D++)
259 Last = &D->NextDepends;
260 Dep->NextDepends = *Last;
261 *Last = Dep.Index();
262
263 return true;
264 }
265 /*}}}*/
266 // ListParser::NewProvides - Create a Provides element /*{{{*/
267 // ---------------------------------------------------------------------
268 /* */
269 bool pkgCacheGenerator::ListParser::NewProvides(pkgCache::VerIterator Ver,
270 string PackageName,
271 string Version)
272 {
273 pkgCache &Cache = Owner->Cache;
274
275 // We do not add self referencing provides
276 if (Ver.ParentPkg().Name() == PackageName)
277 return true;
278
279 // Get a structure
280 unsigned long Provides = Owner->Map.Allocate(sizeof(pkgCache::Provides));
281 if (Provides == 0)
282 return false;
283
284 // Fill it in
285 pkgCache::PrvIterator Prv(Cache,Cache.ProvideP + Provides,Cache.PkgP);
286 Prv->Version = Ver.Index();
287 Prv->NextPkgProv = Ver->ProvidesList;
288 Ver->ProvidesList = Prv.Index();
289 if (Version.empty() == false && (Prv->Version = WriteString(Version)) == 0)
290 return false;
291
292 // Locate the target package
293 pkgCache::PkgIterator Pkg;
294 if (Owner->NewPackage(Pkg,PackageName) == false)
295 return false;
296
297 // Link it to the package
298 Prv->ParentPkg = Pkg.Index();
299 Prv->NextProvides = Pkg->ProvidesList;
300 Pkg->ProvidesList = Prv.Index();
301
302 return true;
303 }
304 /*}}}*/
305 // CacheGenerator::SelectFile - Select the current file being parsed /*{{{*/
306 // ---------------------------------------------------------------------
307 /* This is used to select which file is to be associated with all newly
308 added versions. */
309 bool pkgCacheGenerator::SelectFile(string File,unsigned long Flags)
310 {
311 struct stat Buf;
312 if (stat(File.c_str(),&Buf) == -1)
313 return _error->Errno("stat","Couldn't stat ",File.c_str());
314
315 // Get some space for the structure
316 CurrentFile = Cache.PkgFileP + Map.Allocate(sizeof(*CurrentFile));
317 if (CurrentFile == Cache.PkgFileP)
318 return false;
319
320 // Fill it in
321 CurrentFile->FileName = Map.WriteString(File);
322 CurrentFile->Size = Buf.st_size;
323 CurrentFile->mtime = Buf.st_mtime;
324 CurrentFile->NextFile = Cache.HeaderP->FileList;
325 CurrentFile->Flags = Flags;
326 CurrentFile->ID = Cache.HeaderP->PackageFileCount;
327 PkgFileName = File;
328 Cache.HeaderP->FileList = CurrentFile - Cache.PkgFileP;
329 Cache.HeaderP->PackageFileCount++;
330
331 if (CurrentFile->FileName == 0)
332 return false;
333
334 Progress.SubProgress(Buf.st_size);
335 return true;
336 }
337 /*}}}*/
338 // CacheGenerator::WriteUniqueString - Insert a unique string /*{{{*/
339 // ---------------------------------------------------------------------
340 /* This is used to create handles to strings. Given the same text it
341 always returns the same number */
342 unsigned long pkgCacheGenerator::WriteUniqString(const char *S,
343 unsigned int Size)
344 {
345 // Search for an insertion point
346 pkgCache::StringItem *I = Cache.StringItemP + Cache.HeaderP->StringList;
347 int Res = 1;
348 unsigned long *Last = &Cache.HeaderP->StringList;
349 for (; I != Cache.StringItemP; Last = &I->NextItem,
350 I = Cache.StringItemP + I->NextItem)
351 {
352 Res = stringcmp(S,S+Size,Cache.StrP + I->String);
353 if (Res >= 0)
354 break;
355 }
356
357 // Match
358 if (Res == 0)
359 return I->String;
360
361 // Get a structure
362 unsigned long Item = Map.Allocate(sizeof(pkgCache::StringItem));
363 if (Item == 0)
364 return 0;
365
366 // Fill in the structure
367 pkgCache::StringItem *ItemP = Cache.StringItemP + Item;
368 ItemP->NextItem = I - Cache.StringItemP;
369 *Last = Item;
370 ItemP->String = Map.WriteString(S,Size);
371 if (ItemP->String == 0)
372 return 0;
373
374 return ItemP->String;
375 }
376 /*}}}*/
377
378 // SrcCacheCheck - Check if the source package cache is uptodate /*{{{*/
379 // ---------------------------------------------------------------------
380 /* The source cache is checked against the source list and the files
381 on disk, any difference results in a false. */
382 bool pkgSrcCacheCheck(pkgSourceList &List)
383 {
384 if (_error->PendingError() == true)
385 return false;
386
387 string CacheFile = _config->FindDir("Dir::Cache::srcpkgcache");
388 string ListDir = _config->FindDir("Dir::State::lists");
389
390 // Count the number of missing files
391 int Missing = 0;
392 for (pkgSourceList::const_iterator I = List.begin(); I != List.end(); I++)
393 {
394 string File = ListDir + URItoFileName(I->PackagesURI());
395 struct stat Buf;
396 if (stat(File.c_str(),&Buf) != 0)
397 {
398 _error->WarningE("stat","Couldn't stat source package list '%s' (%s)",
399 I->PackagesInfo().c_str(),File.c_str());
400 Missing++;
401 }
402 }
403
404 // Open the source package cache
405 if (FileExists(CacheFile) == false)
406 return false;
407
408 FileFd CacheF(CacheFile,FileFd::ReadOnly);
409 if (_error->PendingError() == true)
410 {
411 _error->Discard();
412 return false;
413 }
414
415 MMap Map(CacheF,MMap::Public | MMap::ReadOnly);
416 if (_error->PendingError() == true || Map.Size() == 0)
417 {
418 _error->Discard();
419 return false;
420 }
421
422 pkgCache Cache(Map);
423 if (_error->PendingError() == true)
424 {
425 _error->Discard();
426 return false;
427 }
428
429 // They are certianly out of sync
430 if (Cache.Head().PackageFileCount != List.size() - Missing)
431 return false;
432
433 for (pkgCache::PkgFileIterator F(Cache); F.end() == false; F++)
434 {
435 // Search for a match in the source list
436 bool Bad = true;
437 for (pkgSourceList::const_iterator I = List.begin();
438 I != List.end(); I++)
439 {
440 string File = ListDir + URItoFileName(I->PackagesURI());
441 if (F.FileName() == File)
442 {
443 Bad = false;
444 break;
445 }
446 }
447
448 // Check if the file matches what was cached
449 Bad |= !F.IsOk();
450 if (Bad == true)
451 return false;
452 }
453
454 return true;
455 }
456 /*}}}*/
457 // PkgCacheCheck - Check if the package cache is uptodate /*{{{*/
458 // ---------------------------------------------------------------------
459 /* This does a simple check of all files used to compose the cache */
460 bool pkgPkgCacheCheck(string CacheFile)
461 {
462 if (_error->PendingError() == true)
463 return false;
464
465 // Open the source package cache
466 if (FileExists(CacheFile) == false)
467 return false;
468
469 FileFd CacheF(CacheFile,FileFd::ReadOnly);
470 if (_error->PendingError() == true)
471 {
472 _error->Discard();
473 return false;
474 }
475
476 MMap Map(CacheF,MMap::Public | MMap::ReadOnly);
477 if (_error->PendingError() == true || Map.Size() == 0)
478 {
479 _error->Discard();
480 return false;
481 }
482
483 pkgCache Cache(Map);
484 if (_error->PendingError() == true)
485 {
486 _error->Discard();
487 return false;
488 }
489
490 // Status files that must be in the cache
491 string Status[3];
492 Status[0] = _config->FindDir("Dir::State::xstatus");
493 Status[1]= _config->FindDir("Dir::State::userstatus");
494 Status[2] = _config->FindDir("Dir::State::status");
495
496 // Cheack each file
497 for (pkgCache::PkgFileIterator F(Cache); F.end() == false; F++)
498 {
499 if (F.IsOk() == false)
500 return false;
501
502 // See if this is one of the status files
503 for (int I = 0; I != 3; I++)
504 if (F.FileName() == Status[I])
505 Status[I] = string();
506 }
507
508 // Make sure all the status files are loaded.
509 for (int I = 0; I != 3; I++)
510 {
511 if (Status[I].empty() == false && FileExists(Status[I]) == true)
512 return false;
513 }
514
515 return true;
516 }
517 /*}}}*/
518 // AddSourcesSize - Add the size of the status files /*{{{*/
519 // ---------------------------------------------------------------------
520 /* This adds the size of all the status files to the size counter */
521 static bool pkgAddSourcesSize(unsigned long &TotalSize)
522 {
523 // Grab the file names
524 string xstatus = _config->FindDir("Dir::State::xstatus");
525 string userstatus = _config->FindDir("Dir::State::userstatus");
526 string status = _config->FindDir("Dir::State::status");
527
528 // Grab the sizes
529 struct stat Buf;
530 if (stat(xstatus.c_str(),&Buf) == 0)
531 TotalSize += Buf.st_size;
532 if (stat(userstatus.c_str(),&Buf) == 0)
533 TotalSize += Buf.st_size;
534 if (stat(status.c_str(),&Buf) != 0)
535 return _error->Errno("stat","Couldn't stat the status file %s",status.c_str());
536 TotalSize += Buf.st_size;
537
538 return true;
539 }
540 /*}}}*/
541 // MergeStatus - Add the status files to the cache /*{{{*/
542 // ---------------------------------------------------------------------
543 /* This adds the status files to the map */
544 static bool pkgMergeStatus(OpProgress &Progress,pkgCacheGenerator &Gen,
545 unsigned long &CurrentSize,unsigned long TotalSize)
546 {
547 // Grab the file names
548 string Status[3];
549 Status[0] = _config->FindDir("Dir::State::xstatus");
550 Status[1]= _config->FindDir("Dir::State::userstatus");
551 Status[2] = _config->FindDir("Dir::State::status");
552
553 for (int I = 0; I != 3; I++)
554 {
555 // Check if the file exists and it is not the primary status file.
556 string File = Status[I];
557 if (I != 2 && FileExists(File) == false)
558 continue;
559
560 FileFd Pkg(File,FileFd::ReadOnly);
561 debListParser Parser(Pkg);
562 Progress.OverallProgress(CurrentSize,TotalSize,Pkg.Size(),"Reading Package Lists");
563 if (_error->PendingError() == true)
564 return _error->Error("Problem opening %s",File.c_str());
565 CurrentSize += Pkg.Size();
566
567 Progress.SubProgress(0,"Local Package State - " + flNotDir(File));
568 if (Gen.SelectFile(File,pkgCache::Flag::NotSource) == false)
569 return _error->Error("Problem with SelectFile %s",File.c_str());
570
571 if (Gen.MergeList(Parser) == false)
572 return _error->Error("Problem with MergeList %s",File.c_str());
573 Progress.Progress(Pkg.Size());
574 }
575
576 return true;
577 }
578 /*}}}*/
579 // MakeStatusCache - Generates a cache that includes the status files /*{{{*/
580 // ---------------------------------------------------------------------
581 /* This copies the package source cache and then merges the status and
582 xstatus files into it. */
583 bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress)
584 {
585 Progress.OverallProgress(0,1,1,"Reading Package Lists");
586
587 string CacheFile = _config->FindDir("Dir::Cache::pkgcache");
588 bool SrcOk = pkgSrcCacheCheck(List);
589 bool PkgOk = SrcOk && pkgPkgCacheCheck(CacheFile);
590
591 // Rebuild the source and package caches
592 if (SrcOk == false)
593 {
594 string SCacheFile = _config->FindDir("Dir::Cache::srcpkgcache");
595 string ListDir = _config->FindDir("Dir::State::lists");
596
597 FileFd SCacheF(SCacheFile,FileFd::WriteEmpty);
598 FileFd CacheF(CacheFile,FileFd::WriteEmpty);
599 DynamicMMap Map(CacheF,MMap::Public);
600 if (_error->PendingError() == true)
601 return false;
602
603 pkgCacheGenerator Gen(Map,Progress);
604
605 // Prepare the progress indicator
606 unsigned long TotalSize = 0;
607 struct stat Buf;
608 for (pkgSourceList::const_iterator I = List.begin(); I != List.end(); I++)
609 {
610 string File = ListDir + URItoFileName(I->PackagesURI());
611 if (stat(File.c_str(),&Buf) != 0)
612 continue;
613 TotalSize += Buf.st_size;
614 }
615
616 if (pkgAddSourcesSize(TotalSize) == false)
617 return false;
618
619 // Generate the pkg source cache
620 unsigned long CurrentSize = 0;
621 for (pkgSourceList::const_iterator I = List.begin(); I != List.end(); I++)
622 {
623 string File = ListDir + URItoFileName(I->PackagesURI());
624
625 if (stat(File.c_str(),&Buf) != 0)
626 continue;
627
628 FileFd Pkg(File,FileFd::ReadOnly);
629 debListParser Parser(Pkg);
630 Progress.OverallProgress(CurrentSize,TotalSize,Pkg.Size(),"Reading Package Lists");
631 if (_error->PendingError() == true)
632 return _error->Error("Problem opening %s",File.c_str());
633 CurrentSize += Pkg.Size();
634
635 Progress.SubProgress(0,I->PackagesInfo());
636 if (Gen.SelectFile(File) == false)
637 return _error->Error("Problem with SelectFile %s",File.c_str());
638
639 if (Gen.MergeList(Parser) == false)
640 return _error->Error("Problem with MergeList %s",File.c_str());
641 }
642
643 // Write the src cache
644 Gen.GetCache().HeaderP->Dirty = false;
645 if (SCacheF.Write(Map.Data(),Map.Size()) == false)
646 return _error->Error("IO Error saving source cache");
647 Gen.GetCache().HeaderP->Dirty = true;
648
649 // Merge in the source caches
650 return pkgMergeStatus(Progress,Gen,CurrentSize,TotalSize);
651 }
652
653 if (PkgOk == true)
654 {
655 Progress.OverallProgress(1,1,1,"Reading Package Lists");
656 return true;
657 }
658
659 // We use the source cache to generate the package cache
660 string SCacheFile = _config->FindDir("Dir::Cache::srcpkgcache");
661
662 FileFd SCacheF(SCacheFile,FileFd::ReadOnly);
663 FileFd CacheF(CacheFile,FileFd::WriteEmpty);
664 DynamicMMap Map(CacheF,MMap::Public);
665 if (_error->PendingError() == true)
666 return false;
667
668 // Preload the map with the source cache
669 if (SCacheF.Read((unsigned char *)Map.Data() + Map.RawAllocate(SCacheF.Size()),
670 SCacheF.Size()) == false)
671 return false;
672
673 pkgCacheGenerator Gen(Map,Progress);
674
675 // Compute the progress
676 unsigned long TotalSize = 0;
677 if (pkgAddSourcesSize(TotalSize) == false)
678 return false;
679
680 unsigned long CurrentSize = 0;
681 return pkgMergeStatus(Progress,Gen,CurrentSize,TotalSize);
682 }
683 /*}}}*/