~mvo/apt/mvo

« back to all changes in this revision

Viewing changes to ftparchive/apt-ftparchive.cc

  • Committer: Michael Vogt
  • Date: 2011-11-10 15:32:52 UTC
  • mfrom: (1561.70.60 debian-experimental2)
  • Revision ID: michael.vogt@ubuntu.com-20111110153252-1u9lc3lm2cgb6b1m
merged from http://bzr.debian.org/bzr/apt/apt/debian-experimental2

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
   ##################################################################### */
11
11
                                                                        /*}}}*/
12
12
// Include Files                                                        /*{{{*/
13
 
#include "apt-ftparchive.h"
14
 
    
 
13
#include <config.h>
 
14
 
15
15
#include <apt-pkg/error.h>
16
16
#include <apt-pkg/configuration.h>
17
17
#include <apt-pkg/cmndline.h>
18
18
#include <apt-pkg/strutl.h>
19
19
#include <apt-pkg/init.h>
20
 
#include <config.h>
21
 
#include <apti18n.h>
22
20
#include <algorithm>
23
21
 
24
22
#include <climits>
25
23
#include <sys/time.h>
26
24
#include <regex.h>
27
25
 
 
26
#include "apt-ftparchive.h"
28
27
#include "contents.h"
29
28
#include "multicompress.h"
30
 
#include "writer.h"    
 
29
#include "writer.h"
 
30
 
 
31
#include <apti18n.h>
31
32
                                                                        /*}}}*/
32
33
 
33
34
using namespace std;    
205
206
   Packages.Output = 0;      // Just in case
206
207
   
207
208
   // Finish compressing
208
 
   unsigned long Size;
 
209
   unsigned long long Size;
209
210
   if (Comp.Finalize(Size) == false)
210
211
   {
211
212
      c0out << endl;
291
292
   Sources.Output = 0;      // Just in case
292
293
   
293
294
   // Finish compressing
294
 
   unsigned long Size;
 
295
   unsigned long long Size;
295
296
   if (Comp.Finalize(Size) == false)
296
297
   {
297
298
      c0out << endl;
362
363
      if (_error->PendingError() == true)
363
364
         return false;
364
365
      
365
 
      unsigned long Size = Head.Size();
 
366
      unsigned long long Size = Head.Size();
366
367
      unsigned char Buf[4096];
367
368
      while (Size != 0)
368
369
      {
369
 
         unsigned long ToRead = Size;
 
370
         unsigned long long ToRead = Size;
370
371
         if (Size > sizeof(Buf))
371
372
            ToRead = sizeof(Buf);
372
373
         
384
385
      files associated with this contents file into one great big honking
385
386
      memory structure, then dump the sorted version */
386
387
   c0out << ' ' << this->Contents << ":" << flush;
387
 
   for (vector<PackageMap>::iterator I = Begin; I != End; I++)
 
388
   for (vector<PackageMap>::iterator I = Begin; I != End; ++I)
388
389
   {
389
390
      if (I->Contents != this->Contents)
390
391
         continue;
400
401
   Contents.Finish();
401
402
   
402
403
   // Finish compressing
403
 
   unsigned long Size;
 
404
   unsigned long long Size;
404
405
   if (Comp.Finalize(Size) == false || _error->PendingError() == true)
405
406
   {
406
407
      c0out << endl;
770
771
   // Generate packages
771
772
   if (CmdL.FileSize() <= 2)
772
773
   {
773
 
      for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); I++)
 
774
      for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); ++I)
774
775
         if (I->GenPackages(Setup,Stats) == false)
775
776
            _error->DumpErrors();
776
 
      for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); I++)
 
777
      for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); ++I)
777
778
         if (I->GenSources(Setup,SrcStats) == false)
778
779
            _error->DumpErrors();
779
780
   }
782
783
      // Make a choice list out of the package list..
783
784
      RxChoiceList *List = new RxChoiceList[2*PkgList.size()+1];
784
785
      RxChoiceList *End = List;
785
 
      for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); I++)
 
786
      for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); ++I)
786
787
      {
787
788
         End->UserData = &(*I);
788
789
         End->Str = I->BaseDir.c_str();
832
833
   }
833
834
 
834
835
   // close the Translation master files
835
 
   for (vector<PackageMap>::reverse_iterator I = PkgList.rbegin(); I != PkgList.rend(); I++)
 
836
   for (vector<PackageMap>::reverse_iterator I = PkgList.rbegin(); I != PkgList.rend(); ++I)
836
837
      if (I->TransWriter != NULL && I->TransWriter->DecreaseRefCounter() == 0)
837
838
         delete I->TransWriter;
838
839
 
843
844
 
844
845
   // Sort the contents file list by date
845
846
   string ArchiveDir = Setup.FindDir("Dir::ArchiveDir");
846
 
   for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); I++)
 
847
   for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); ++I)
847
848
   {
848
849
      struct stat A;
849
850
      if (MultiCompress::GetStat(flCombine(ArchiveDir,I->Contents),
860
861
      hashes of the .debs this means they have not changed either so the 
861
862
      contents must be up to date. */
862
863
   unsigned long MaxContentsChange = Setup.FindI("Default::MaxContentsChange",UINT_MAX)*1024;
863
 
   for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); I++)
 
864
   for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); ++I)
864
865
   {
865
866
      // This record is not relevent
866
867
      if (I->ContentsDone == true ||
936
937
         _error->DumpErrors();
937
938
      
938
939
      string CacheDB = I->BinCacheDB;
939
 
      for (; I != PkgList.end() && I->BinCacheDB == CacheDB; I++);
 
940
      for (; I != PkgList.end() && I->BinCacheDB == CacheDB; ++I);
940
941
   }
941
942
   
942
943
   return true;