Преглед изворни кода

merged from lp:~donkult/apt/experimental

Michael Vogt пре 15 година
родитељ
комит
a0e07f3ec8
100 измењених фајлова са 632 додато и 299 уклоњено
  1. 3 2
      Makefile
  2. 4 1
      apt-inst/contrib/arfile.cc
  3. 1 1
      apt-inst/contrib/arfile.h
  4. 3 1
      apt-inst/contrib/extracttar.cc
  5. 2 0
      apt-inst/database.cc
  6. 2 0
      apt-inst/deb/debfile.cc
  7. 2 0
      apt-inst/deb/dpkgdb.cc
  8. 2 0
      apt-inst/dirstream.cc
  9. 2 0
      apt-inst/extract.cc
  10. 2 0
      apt-inst/filelist.cc
  11. 26 27
      apt-pkg/acquire-item.cc
  12. 2 0
      apt-pkg/acquire-method.cc
  13. 9 7
      apt-pkg/acquire-worker.cc
  14. 8 2
      apt-pkg/acquire.cc
  15. 4 2
      apt-pkg/algorithms.cc
  16. 2 0
      apt-pkg/aptconfiguration.cc
  17. 17 1
      apt-pkg/cachefile.cc
  18. 1 0
      apt-pkg/cachefile.h
  19. 2 0
      apt-pkg/cachefilter.cc
  20. 4 2
      apt-pkg/cacheset.cc
  21. 3 2
      apt-pkg/cdrom.cc
  22. 4 2
      apt-pkg/clean.cc
  23. 4 2
      apt-pkg/contrib/cdromutl.cc
  24. 3 1
      apt-pkg/contrib/cmndline.cc
  25. 4 1
      apt-pkg/contrib/configuration.cc
  26. 3 1
      apt-pkg/contrib/crc-16.cc
  27. 1 1
      apt-pkg/contrib/crc-16.h
  28. 3 2
      apt-pkg/contrib/error.cc
  29. 21 19
      apt-pkg/contrib/fileutl.cc
  30. 25 10
      apt-pkg/contrib/fileutl.h
  31. 8 6
      apt-pkg/contrib/hashes.cc
  32. 3 3
      apt-pkg/contrib/hashes.h
  33. 6 5
      apt-pkg/contrib/hashsum.cc
  34. 3 3
      apt-pkg/contrib/hashsum_template.h
  35. 3 2
      apt-pkg/contrib/md5.cc
  36. 1 1
      apt-pkg/contrib/md5.h
  37. 13 12
      apt-pkg/contrib/mmap.cc
  38. 4 4
      apt-pkg/contrib/mmap.h
  39. 1 0
      apt-pkg/contrib/netrc.cc
  40. 8 6
      apt-pkg/contrib/progress.cc
  41. 8 8
      apt-pkg/contrib/progress.h
  42. 3 2
      apt-pkg/contrib/sha1.cc
  43. 1 1
      apt-pkg/contrib/sha1.h
  44. 3 3
      apt-pkg/contrib/sha2.h
  45. 1 0
      apt-pkg/contrib/sha2_internal.cc
  46. 31 3
      apt-pkg/contrib/strutl.cc
  47. 1 0
      apt-pkg/contrib/strutl.h
  48. 2 0
      apt-pkg/deb/debindexfile.cc
  49. 2 0
      apt-pkg/deb/deblistparser.cc
  50. 1 0
      apt-pkg/deb/debmetaindex.cc
  51. 2 0
      apt-pkg/deb/debrecords.cc
  52. 2 0
      apt-pkg/deb/debsrcrecords.cc
  53. 4 1
      apt-pkg/deb/debsystem.cc
  54. 1 0
      apt-pkg/deb/debversion.cc
  55. 2 1
      apt-pkg/deb/dpkgpm.cc
  56. 6 4
      apt-pkg/depcache.cc
  57. 4 2
      apt-pkg/edsp.cc
  58. 2 0
      apt-pkg/edsp/edspindexfile.cc
  59. 2 0
      apt-pkg/edsp/edsplistparser.cc
  60. 4 1
      apt-pkg/edsp/edspsystem.cc
  61. 16 13
      apt-pkg/indexcopy.cc
  62. 3 3
      apt-pkg/indexcopy.h
  63. 2 0
      apt-pkg/indexfile.cc
  64. 22 9
      apt-pkg/indexrecords.cc
  65. 2 2
      apt-pkg/indexrecords.h
  66. 4 2
      apt-pkg/init.cc
  67. 55 17
      apt-pkg/orderlist.cc
  68. 3 1
      apt-pkg/orderlist.h
  69. 33 9
      apt-pkg/packagemanager.cc
  70. 5 4
      apt-pkg/pkgcache.cc
  71. 3 4
      apt-pkg/pkgcachegen.cc
  72. 4 2
      apt-pkg/pkgrecords.cc
  73. 0 1
      apt-pkg/pkgrecords.h
  74. 2 0
      apt-pkg/pkgsystem.cc
  75. 4 2
      apt-pkg/policy.cc
  76. 4 2
      apt-pkg/sourcelist.cc
  77. 4 2
      apt-pkg/srcrecords.cc
  78. 13 11
      apt-pkg/tagfile.cc
  79. 2 2
      apt-pkg/tagfile.h
  80. 2 0
      apt-pkg/vendor.cc
  81. 2 0
      apt-pkg/vendorlist.cc
  82. 2 0
      apt-pkg/version.cc
  83. 2 2
      apt-pkg/versionmatch.cc
  84. 3 0
      buildlib/config.h.in
  85. 2 2
      buildlib/defaults.mak
  86. 11 9
      cmdline/acqprogress.cc
  87. 5 5
      cmdline/apt-cache.cc
  88. 4 4
      cmdline/apt-cdrom.cc
  89. 4 3
      cmdline/apt-config.cc
  90. 3 2
      cmdline/apt-extracttemplates.cc
  91. 16 13
      cmdline/apt-get.cc
  92. 1 1
      cmdline/apt-key
  93. 4 3
      cmdline/apt-mark.cc
  94. 4 3
      cmdline/apt-sortpkgs.cc
  95. 5 1
      configure.in
  96. 51 0
      debian/changelog
  97. 6 1
      debian/libapt-pkg4.11.symbols
  98. 6 1
      debian/rules
  99. 17 8
      doc/apt.conf.5.xml
  100. 0 0
      ftparchive/apt-ftparchive.cc

+ 3 - 2
Makefile

@@ -9,8 +9,8 @@ endif
 .PHONY: default
 .PHONY: default
 default: startup all
 default: startup all
 
 
-.PHONY: headers library clean veryclean all binary program doc
-all headers library clean veryclean binary program doc dirs:
+.PHONY: headers library clean veryclean all binary program doc test
+all headers library clean veryclean binary program doc dirs test:
 	$(MAKE) -C apt-pkg $@
 	$(MAKE) -C apt-pkg $@
 	$(MAKE) -C apt-inst $@
 	$(MAKE) -C apt-inst $@
 	$(MAKE) -C methods $@
 	$(MAKE) -C methods $@
@@ -19,6 +19,7 @@ all headers library clean veryclean binary program doc dirs:
 	$(MAKE) -C dselect $@
 	$(MAKE) -C dselect $@
 	$(MAKE) -C doc $@
 	$(MAKE) -C doc $@
 	$(MAKE) -C po $@
 	$(MAKE) -C po $@
+	$(MAKE) -C test $@
 
 
 # Some very common aliases
 # Some very common aliases
 .PHONY: maintainer-clean dist-clean distclean pristine sanity 
 .PHONY: maintainer-clean dist-clean distclean pristine sanity 

+ 4 - 1
apt-inst/contrib/arfile.cc

@@ -14,13 +14,16 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include<config.h>
+
 #include <apt-pkg/arfile.h>
 #include <apt-pkg/arfile.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 
 
 #include <stdlib.h>
 #include <stdlib.h>
-									/*}}}*/
+
 #include <apti18n.h>
 #include <apti18n.h>
+									/*}}}*/
 
 
 struct ARArchive::MemberHeader
 struct ARArchive::MemberHeader
 {
 {

+ 1 - 1
apt-inst/contrib/arfile.h

@@ -54,7 +54,7 @@ struct ARArchive::Member
    unsigned long UID;
    unsigned long UID;
    unsigned long GID;
    unsigned long GID;
    unsigned long Mode;
    unsigned long Mode;
-   unsigned long Size;
+   unsigned long long Size;
    
    
    // Location of the data.
    // Location of the data.
    unsigned long Start;
    unsigned long Start;

+ 3 - 1
apt-inst/contrib/extracttar.cc

@@ -16,8 +16,9 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
-#include <apt-pkg/extracttar.h>
+#include<config.h>
 
 
+#include <apt-pkg/extracttar.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/configuration.h>
@@ -28,6 +29,7 @@
 #include <signal.h>
 #include <signal.h>
 #include <fcntl.h>
 #include <fcntl.h>
 #include <iostream>
 #include <iostream>
+
 #include <apti18n.h>
 #include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 
 

+ 2 - 0
apt-inst/database.cc

@@ -8,6 +8,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include<config.h>
+
 #include <apt-pkg/database.h>
 #include <apt-pkg/database.h>
 									/*}}}*/
 									/*}}}*/
 
 

+ 2 - 0
apt-inst/deb/debfile.cc

@@ -16,6 +16,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include<config.h>
+
 #include <apt-pkg/debfile.h>
 #include <apt-pkg/debfile.h>
 #include <apt-pkg/extracttar.h>
 #include <apt-pkg/extracttar.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>

+ 2 - 0
apt-inst/deb/dpkgdb.cc

@@ -13,6 +13,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include<config.h>
+
 #include <apt-pkg/dpkgdb.h>
 #include <apt-pkg/dpkgdb.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>

+ 2 - 0
apt-inst/dirstream.cc

@@ -11,6 +11,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include<config.h>
+
 #include <apt-pkg/dirstream.h>
 #include <apt-pkg/dirstream.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 
 

+ 2 - 0
apt-inst/extract.cc

@@ -44,6 +44,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include<config.h>
+
 #include <apt-pkg/extract.h>
 #include <apt-pkg/extract.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/debversion.h>
 #include <apt-pkg/debversion.h>

+ 2 - 0
apt-inst/filelist.cc

@@ -32,6 +32,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include<config.h>
+
 #include <apt-pkg/filelist.h>
 #include <apt-pkg/filelist.h>
 #include <apt-pkg/mmap.h>
 #include <apt-pkg/mmap.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>

+ 26 - 27
apt-pkg/acquire-item.cc

@@ -13,6 +13,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include <config.h>
+
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/aptconfiguration.h>
 #include <apt-pkg/aptconfiguration.h>
@@ -24,8 +26,6 @@
 #include <apt-pkg/sha1.h>
 #include <apt-pkg/sha1.h>
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/tagfile.h>
 
 
-#include <apti18n.h>
-    
 #include <sys/stat.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <unistd.h>
 #include <errno.h>
 #include <errno.h>
@@ -33,6 +33,8 @@
 #include <sstream>
 #include <sstream>
 #include <stdio.h>
 #include <stdio.h>
 #include <ctime>
 #include <ctime>
+
+#include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 
 
 using namespace std;
 using namespace std;
@@ -1266,9 +1268,9 @@ void pkgAcqMetaIndex::Done(string Message,unsigned long long Size,string Hash,	/
       if (SigFile == "")
       if (SigFile == "")
       {
       {
          // There was no signature file, so we are finished.  Download
          // There was no signature file, so we are finished.  Download
-         // the indexes and do only hashsum verification
+         // the indexes and do only hashsum verification if possible
          MetaIndexParser->Load(DestFile);
          MetaIndexParser->Load(DestFile);
-         QueueIndexes(true);
+         QueueIndexes(false);
       }
       }
       else
       else
       {
       {
@@ -1386,33 +1388,30 @@ void pkgAcqMetaIndex::QueueIndexes(bool verify)				/*{{{*/
         ++Target)
         ++Target)
    {
    {
       HashString ExpectedIndexHash;
       HashString ExpectedIndexHash;
-      if (verify)
+      const indexRecords::checkSum *Record = MetaIndexParser->Lookup((*Target)->MetaKey);
+      if (Record == NULL)
       {
       {
-	 const indexRecords::checkSum *Record = MetaIndexParser->Lookup((*Target)->MetaKey);
-	 if (Record == NULL)
+	 if (verify == true && (*Target)->IsOptional() == false)
 	 {
 	 {
-	    if ((*Target)->IsOptional() == false)
-	    {
-	       Status = StatAuthError;
-	       strprintf(ErrorText, _("Unable to find expected entry '%s' in Release file (Wrong sources.list entry or malformed file)"), (*Target)->MetaKey.c_str());
-	       return;
-	    }
+	    Status = StatAuthError;
+	    strprintf(ErrorText, _("Unable to find expected entry '%s' in Release file (Wrong sources.list entry or malformed file)"), (*Target)->MetaKey.c_str());
+	    return;
 	 }
 	 }
-	 else
+      }
+      else
+      {
+	 ExpectedIndexHash = Record->Hash;
+	 if (_config->FindB("Debug::pkgAcquire::Auth", false))
 	 {
 	 {
-	    ExpectedIndexHash = Record->Hash;
-	    if (_config->FindB("Debug::pkgAcquire::Auth", false))
-	    {
-	       std::cerr << "Queueing: " << (*Target)->URI << std::endl;
-	       std::cerr << "Expected Hash: " << ExpectedIndexHash.toStr() << std::endl;
-	       std::cerr << "For: " << Record->MetaKeyFilename << std::endl;
-	    }
-	    if (ExpectedIndexHash.empty() == true && (*Target)->IsOptional() == false)
-	    {
-	       Status = StatAuthError;
-	       strprintf(ErrorText, _("Unable to find hash sum for '%s' in Release file"), (*Target)->MetaKey.c_str());
-	       return;
-	    }
+	    std::cerr << "Queueing: " << (*Target)->URI << std::endl;
+	    std::cerr << "Expected Hash: " << ExpectedIndexHash.toStr() << std::endl;
+	    std::cerr << "For: " << Record->MetaKeyFilename << std::endl;
+	 }
+	 if (verify == true && ExpectedIndexHash.empty() == true && (*Target)->IsOptional() == false)
+	 {
+	    Status = StatAuthError;
+	    strprintf(ErrorText, _("Unable to find hash sum for '%s' in Release file"), (*Target)->MetaKey.c_str());
+	    return;
 	 }
 	 }
       }
       }
 
 

+ 2 - 0
apt-pkg/acquire-method.cc

@@ -15,6 +15,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include <config.h>
+
 #include <apt-pkg/acquire-method.h>
 #include <apt-pkg/acquire-method.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/configuration.h>

+ 9 - 7
apt-pkg/acquire-worker.cc

@@ -12,6 +12,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include <config.h>
+
 #include <apt-pkg/acquire-worker.h>
 #include <apt-pkg/acquire-worker.h>
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/configuration.h>
@@ -19,18 +21,18 @@
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/strutl.h>
 
 
-#include <apti18n.h>
-
 #include <iostream>
 #include <iostream>
 #include <sstream>
 #include <sstream>
 #include <fstream>
 #include <fstream>
-    
+
 #include <sys/stat.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <fcntl.h>
 #include <signal.h>
 #include <signal.h>
 #include <stdio.h>
 #include <stdio.h>
 #include <errno.h>
 #include <errno.h>
+
+#include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 
 
 using namespace std;
 using namespace std;
@@ -256,9 +258,9 @@ bool pkgAcquire::Worker::RunMessages()
 	    
 	    
 	    CurrentItem = Itm;
 	    CurrentItem = Itm;
 	    CurrentSize = 0;
 	    CurrentSize = 0;
-	    TotalSize = atoi(LookupTag(Message,"Size","0").c_str());
-	    ResumePoint = atoi(LookupTag(Message,"Resume-Point","0").c_str());
-	    Itm->Owner->Start(Message,atoi(LookupTag(Message,"Size","0").c_str()));
+	    TotalSize = strtoull(LookupTag(Message,"Size","0").c_str(), NULL, 10);
+	    ResumePoint = strtoull(LookupTag(Message,"Resume-Point","0").c_str(), NULL, 10);
+	    Itm->Owner->Start(Message,strtoull(LookupTag(Message,"Size","0").c_str(), NULL, 10));
 
 
 	    // Display update before completion
 	    // Display update before completion
 	    if (Log != 0 && Log->MorePulses == true)
 	    if (Log != 0 && Log->MorePulses == true)
@@ -287,7 +289,7 @@ bool pkgAcquire::Worker::RunMessages()
 	       Log->Pulse(Owner->GetOwner());
 	       Log->Pulse(Owner->GetOwner());
 	    
 	    
 	    OwnerQ->ItemDone(Itm);
 	    OwnerQ->ItemDone(Itm);
-	    unsigned long long const ServerSize = atoll(LookupTag(Message,"Size","0").c_str());
+	    unsigned long long const ServerSize = strtoull(LookupTag(Message,"Size","0").c_str(), NULL, 10);
 	    if (TotalSize != 0 && ServerSize != TotalSize)
 	    if (TotalSize != 0 && ServerSize != TotalSize)
 	       _error->Warning("Size of file %s is not what the server reported %s %llu",
 	       _error->Warning("Size of file %s is not what the server reported %s %llu",
 			       Owner->DestFile.c_str(), LookupTag(Message,"Size","0").c_str(),TotalSize);
 			       Owner->DestFile.c_str(), LookupTag(Message,"Size","0").c_str(),TotalSize);

+ 8 - 2
apt-pkg/acquire.cc

@@ -13,6 +13,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include <config.h>
+
 #include <apt-pkg/acquire.h>
 #include <apt-pkg/acquire.h>
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/acquire-worker.h>
 #include <apt-pkg/acquire-worker.h>
@@ -21,8 +23,6 @@
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/fileutl.h>
 
 
-#include <apti18n.h>
-
 #include <iostream>
 #include <iostream>
 #include <sstream>
 #include <sstream>
 #include <stdio.h>
 #include <stdio.h>
@@ -30,6 +30,8 @@
 #include <dirent.h>
 #include <dirent.h>
 #include <sys/time.h>
 #include <sys/time.h>
 #include <errno.h>
 #include <errno.h>
+
+#include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 
 
 using namespace std;
 using namespace std;
@@ -445,6 +447,10 @@ pkgAcquire::Worker *pkgAcquire::WorkerStep(Worker *I)
    if it is part of the download set. */
    if it is part of the download set. */
 bool pkgAcquire::Clean(string Dir)
 bool pkgAcquire::Clean(string Dir)
 {
 {
+   // non-existing directories are by definition clean…
+   if (DirectoryExists(Dir) == false)
+      return true;
+
    DIR *D = opendir(Dir.c_str());   
    DIR *D = opendir(Dir.c_str());   
    if (D == 0)
    if (D == 0)
       return _error->Errno("opendir",_("Unable to read %s"),Dir.c_str());
       return _error->Errno("opendir",_("Unable to read %s"),Dir.c_str());

+ 4 - 2
apt-pkg/algorithms.cc

@@ -14,6 +14,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include <config.h>
+
 #include <apt-pkg/algorithms.h>
 #include <apt-pkg/algorithms.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/configuration.h>
@@ -22,13 +24,13 @@
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/edsp.h>
 #include <apt-pkg/edsp.h>
 
 
-#include <apti18n.h>
 #include <sys/types.h>
 #include <sys/types.h>
 #include <cstdlib>
 #include <cstdlib>
 #include <algorithm>
 #include <algorithm>
 #include <iostream>
 #include <iostream>
-
 #include <stdio.h>
 #include <stdio.h>
+
+#include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 using namespace std;
 using namespace std;
 
 

+ 2 - 0
apt-pkg/aptconfiguration.cc

@@ -8,6 +8,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include <config.h>
+
 #include <apt-pkg/aptconfiguration.h>
 #include <apt-pkg/aptconfiguration.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>

+ 17 - 1
apt-pkg/cachefile.cc

@@ -12,6 +12,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include <config.h>
+
 #include <apt-pkg/cachefile.h>
 #include <apt-pkg/cachefile.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/sourcelist.h>
 #include <apt-pkg/sourcelist.h>
@@ -21,7 +23,7 @@
 #include <apt-pkg/pkgsystem.h>
 #include <apt-pkg/pkgsystem.h>
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/fileutl.h>
-    
+
 #include <apti18n.h>
 #include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 // CacheFile::CacheFile - Constructor					/*{{{*/
 // CacheFile::CacheFile - Constructor					/*{{{*/
@@ -163,6 +165,20 @@ bool pkgCacheFile::Open(OpProgress *Progress, bool WithLock)
    return true;
    return true;
 }
 }
 									/*}}}*/
 									/*}}}*/
+// CacheFile::RemoveCaches - remove all cache files from disk		/*{{{*/
+// ---------------------------------------------------------------------
+/* */
+void pkgCacheFile::RemoveCaches()
+{
+   std::string const pkgcache = _config->FindFile("Dir::cache::pkgcache");
+   std::string const srcpkgcache = _config->FindFile("Dir::cache::srcpkgcache");
+
+   if (pkgcache.empty() == false && RealFileExists(pkgcache) == true)
+      unlink(pkgcache.c_str());
+   if (srcpkgcache.empty() == false && RealFileExists(srcpkgcache) == true)
+      unlink(srcpkgcache.c_str());
+}
+									/*}}}*/
 // CacheFile::Close - close the cache files				/*{{{*/
 // CacheFile::Close - close the cache files				/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */

+ 1 - 0
apt-pkg/cachefile.h

@@ -60,6 +60,7 @@ class pkgCacheFile
    bool Open(OpProgress *Progress = NULL, bool WithLock = true);
    bool Open(OpProgress *Progress = NULL, bool WithLock = true);
    inline bool ReadOnlyOpen(OpProgress *Progress = NULL) { return Open(Progress, false); };
    inline bool ReadOnlyOpen(OpProgress *Progress = NULL) { return Open(Progress, false); };
    __deprecated bool Open(OpProgress &Progress,bool const &WithLock = true) { return Open(&Progress, WithLock); };
    __deprecated bool Open(OpProgress &Progress,bool const &WithLock = true) { return Open(&Progress, WithLock); };
+   static void RemoveCaches();
    void Close();
    void Close();
 
 
    inline pkgCache* GetPkgCache() { BuildCaches(NULL, false); return Cache; };
    inline pkgCache* GetPkgCache() { BuildCaches(NULL, false); return Cache; };

+ 2 - 0
apt-pkg/cachefilter.cc

@@ -4,6 +4,8 @@
     Collection of functor classes */
     Collection of functor classes */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include <config.h>
+
 #include <apt-pkg/cachefilter.h>
 #include <apt-pkg/cachefilter.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/pkgcache.h>

+ 4 - 2
apt-pkg/cacheset.cc

@@ -9,6 +9,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include <config.h>
+
 #include <apt-pkg/aptconfiguration.h>
 #include <apt-pkg/aptconfiguration.h>
 #include <apt-pkg/cachefilter.h>
 #include <apt-pkg/cachefilter.h>
 #include <apt-pkg/cacheset.h>
 #include <apt-pkg/cacheset.h>
@@ -16,11 +18,11 @@
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/versionmatch.h>
 #include <apt-pkg/versionmatch.h>
 
 
-#include <apti18n.h>
-
 #include <vector>
 #include <vector>
 
 
 #include <regex.h>
 #include <regex.h>
+
+#include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 namespace APT {
 namespace APT {
 // FromTask - Return all packages in the cache from a specific task	/*{{{*/
 // FromTask - Return all packages in the cache from a specific task	/*{{{*/

+ 3 - 2
apt-pkg/cdrom.cc

@@ -1,5 +1,6 @@
 /*
 /*
  */
  */
+#include<config.h>
 
 
 #include<apt-pkg/init.h>
 #include<apt-pkg/init.h>
 #include<apt-pkg/error.h>
 #include<apt-pkg/error.h>
@@ -10,8 +11,6 @@
 
 
 #include<sstream>
 #include<sstream>
 #include<fstream>
 #include<fstream>
-#include<config.h>
-#include<apti18n.h>
 #include <sys/stat.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <fcntl.h>
 #include <dirent.h>
 #include <dirent.h>
@@ -22,6 +21,8 @@
 
 
 #include "indexcopy.h"
 #include "indexcopy.h"
 
 
+#include<apti18n.h>
+
 using namespace std;
 using namespace std;
 
 
 // FindPackages - Find the package files on the CDROM			/*{{{*/
 // FindPackages - Find the package files on the CDROM			/*{{{*/

+ 4 - 2
apt-pkg/clean.cc

@@ -8,17 +8,19 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Includes								/*{{{*/
 // Includes								/*{{{*/
+#include<config.h>
+
 #include <apt-pkg/clean.h>
 #include <apt-pkg/clean.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/aptconfiguration.h>
 #include <apt-pkg/aptconfiguration.h>
 
 
-#include <apti18n.h>    
-
 #include <dirent.h>
 #include <dirent.h>
 #include <sys/stat.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <unistd.h>
+
+#include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 // ArchiveCleaner::Go - Perform smart cleanup of the archive		/*{{{*/
 // ArchiveCleaner::Go - Perform smart cleanup of the archive		/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------

+ 4 - 2
apt-pkg/contrib/cdromutl.cc

@@ -10,6 +10,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include<config.h>
+
 #include <apt-pkg/cdromutl.h>
 #include <apt-pkg/cdromutl.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/md5.h>
 #include <apt-pkg/md5.h>
@@ -17,8 +19,6 @@
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/strutl.h>
 
 
-#include <apti18n.h>
-    
 #include <sys/wait.h>
 #include <sys/wait.h>
 #include <sys/statvfs.h>
 #include <sys/statvfs.h>
 #include <dirent.h>
 #include <dirent.h>
@@ -26,6 +26,8 @@
 #include <sys/stat.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <stdio.h>
+
+#include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 
 
 // IsMounted - Returns true if the mount point is mounted		/*{{{*/
 // IsMounted - Returns true if the mount point is mounted		/*{{{*/

+ 3 - 1
apt-pkg/contrib/cmndline.cc

@@ -11,11 +11,13 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include files							/*{{{*/
 // Include files							/*{{{*/
+#include<config.h>
+
 #include <apt-pkg/cmndline.h>
 #include <apt-pkg/cmndline.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/strutl.h>
 
 
-#include <apti18n.h>    
+#include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 using namespace std;
 using namespace std;
 
 

+ 4 - 1
apt-pkg/contrib/configuration.cc

@@ -15,16 +15,19 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include files							/*{{{*/
 // Include files							/*{{{*/
+#include <config.h>
+
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/fileutl.h>
-#include <apti18n.h>
 
 
 #include <vector>
 #include <vector>
 #include <fstream>
 #include <fstream>
 #include <iostream>
 #include <iostream>
 
 
+#include <apti18n.h>
+
 using namespace std;
 using namespace std;
 									/*}}}*/
 									/*}}}*/
 
 

+ 3 - 1
apt-pkg/contrib/crc-16.cc

@@ -15,6 +15,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include <config.h>
+
 #include <apt-pkg/crc-16.h>
 #include <apt-pkg/crc-16.h>
 									/*}}}*/
 									/*}}}*/
 
 
@@ -63,7 +65,7 @@ static unsigned short const crc16_table[256] =
 /* Recompute the FCS with one more character appended. */
 /* Recompute the FCS with one more character appended. */
 #define CalcFCS(fcs, c) (((fcs) >> 8) ^ crc16_table[((fcs) ^ (c)) & 0xff])
 #define CalcFCS(fcs, c) (((fcs) >> 8) ^ crc16_table[((fcs) ^ (c)) & 0xff])
 unsigned short AddCRC16(unsigned short fcs, void const *Buf,
 unsigned short AddCRC16(unsigned short fcs, void const *Buf,
-			unsigned long len) 
+			unsigned long long len)
 {
 {
    unsigned char const *buf = (unsigned char const *)Buf;
    unsigned char const *buf = (unsigned char const *)Buf;
    while (len--)
    while (len--)

+ 1 - 1
apt-pkg/contrib/crc-16.h

@@ -12,6 +12,6 @@
 
 
 #define INIT_FCS  0xffff
 #define INIT_FCS  0xffff
 unsigned short AddCRC16(unsigned short fcs, void const *buf,
 unsigned short AddCRC16(unsigned short fcs, void const *buf,
-			unsigned long len);
+			unsigned long long len);
 
 
 #endif
 #endif

+ 3 - 2
apt-pkg/contrib/error.cc

@@ -13,6 +13,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include <config.h>
+
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 
 
 #include <iostream>
 #include <iostream>
@@ -24,8 +26,7 @@
 #include <string>
 #include <string>
 #include <cstring>
 #include <cstring>
 
 
-#include "config.h"
-   									/*}}}*/
+									/*}}}*/
 
 
 // Global Error Object							/*{{{*/
 // Global Error Object							/*{{{*/
 /* If the implementation supports posix threads then the accessor function
 /* If the implementation supports posix threads then the accessor function

+ 21 - 19
apt-pkg/contrib/fileutl.cc

@@ -18,14 +18,14 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include <config.h>
+
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/sptr.h>
 #include <apt-pkg/sptr.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/configuration.h>
 
 
-#include <apti18n.h>
-
 #include <cstdlib>
 #include <cstdlib>
 #include <cstring>
 #include <cstring>
 #include <cstdio>
 #include <cstdio>
@@ -43,10 +43,11 @@
 #include <set>
 #include <set>
 #include <algorithm>
 #include <algorithm>
 
 
-#include <config.h>
 #ifdef WORDS_BIGENDIAN
 #ifdef WORDS_BIGENDIAN
 #include <inttypes.h>
 #include <inttypes.h>
 #endif
 #endif
+
+#include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 
 
 using namespace std;
 using namespace std;
@@ -132,10 +133,10 @@ bool CopyFile(FileFd &From,FileFd &To)
    
    
    // Buffered copy between fds
    // Buffered copy between fds
    SPtrArray<unsigned char> Buf = new unsigned char[64000];
    SPtrArray<unsigned char> Buf = new unsigned char[64000];
-   unsigned long Size = From.Size();
+   unsigned long long Size = From.Size();
    while (Size != 0)
    while (Size != 0)
    {
    {
-      unsigned long ToRead = Size;
+      unsigned long long ToRead = Size;
       if (Size > 64000)
       if (Size > 64000)
 	 ToRead = 64000;
 	 ToRead = 64000;
       
       
@@ -810,7 +811,7 @@ FileFd::~FileFd()
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* We are carefull to handle interruption by a signal while reading 
 /* We are carefull to handle interruption by a signal while reading 
    gracefully. */
    gracefully. */
-bool FileFd::Read(void *To,unsigned long Size,unsigned long *Actual)
+bool FileFd::Read(void *To,unsigned long long Size,unsigned long long *Actual)
 {
 {
    int Res;
    int Res;
    errno = 0;
    errno = 0;
@@ -849,13 +850,13 @@ bool FileFd::Read(void *To,unsigned long Size,unsigned long *Actual)
    }
    }
    
    
    Flags |= Fail;
    Flags |= Fail;
-   return _error->Error(_("read, still have %lu to read but none left"),Size);
+   return _error->Error(_("read, still have %llu to read but none left"), Size);
 }
 }
 									/*}}}*/
 									/*}}}*/
 // FileFd::Write - Write to the file					/*{{{*/
 // FileFd::Write - Write to the file					/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-bool FileFd::Write(const void *From,unsigned long Size)
+bool FileFd::Write(const void *From,unsigned long long Size)
 {
 {
    int Res;
    int Res;
    errno = 0;
    errno = 0;
@@ -882,13 +883,13 @@ bool FileFd::Write(const void *From,unsigned long Size)
       return true;
       return true;
    
    
    Flags |= Fail;
    Flags |= Fail;
-   return _error->Error(_("write, still have %lu to write but couldn't"),Size);
+   return _error->Error(_("write, still have %llu to write but couldn't"), Size);
 }
 }
 									/*}}}*/
 									/*}}}*/
 // FileFd::Seek - Seek in the file					/*{{{*/
 // FileFd::Seek - Seek in the file					/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-bool FileFd::Seek(unsigned long To)
+bool FileFd::Seek(unsigned long long To)
 {
 {
    int res;
    int res;
    if (gz)
    if (gz)
@@ -898,7 +899,7 @@ bool FileFd::Seek(unsigned long To)
    if (res != (signed)To)
    if (res != (signed)To)
    {
    {
       Flags |= Fail;
       Flags |= Fail;
-      return _error->Error("Unable to seek to %lu",To);
+      return _error->Error("Unable to seek to %llu", To);
    }
    }
    
    
    return true;
    return true;
@@ -907,7 +908,7 @@ bool FileFd::Seek(unsigned long To)
 // FileFd::Skip - Seek in the file					/*{{{*/
 // FileFd::Skip - Seek in the file					/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-bool FileFd::Skip(unsigned long Over)
+bool FileFd::Skip(unsigned long long Over)
 {
 {
    int res;
    int res;
    if (gz)
    if (gz)
@@ -917,7 +918,7 @@ bool FileFd::Skip(unsigned long Over)
    if (res < 0)
    if (res < 0)
    {
    {
       Flags |= Fail;
       Flags |= Fail;
-      return _error->Error("Unable to seek ahead %lu",Over);
+      return _error->Error("Unable to seek ahead %llu",Over);
    }
    }
    
    
    return true;
    return true;
@@ -926,7 +927,7 @@ bool FileFd::Skip(unsigned long Over)
 // FileFd::Truncate - Truncate the file 				/*{{{*/
 // FileFd::Truncate - Truncate the file 				/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-bool FileFd::Truncate(unsigned long To)
+bool FileFd::Truncate(unsigned long long To)
 {
 {
    if (gz)
    if (gz)
    {
    {
@@ -936,7 +937,7 @@ bool FileFd::Truncate(unsigned long To)
    if (ftruncate(iFd,To) != 0)
    if (ftruncate(iFd,To) != 0)
    {
    {
       Flags |= Fail;
       Flags |= Fail;
-      return _error->Error("Unable to truncate to %lu",To);
+      return _error->Error("Unable to truncate to %llu",To);
    }
    }
    
    
    return true;
    return true;
@@ -945,7 +946,7 @@ bool FileFd::Truncate(unsigned long To)
 // FileFd::Tell - Current seek position					/*{{{*/
 // FileFd::Tell - Current seek position					/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-unsigned long FileFd::Tell()
+unsigned long long FileFd::Tell()
 {
 {
    off_t Res;
    off_t Res;
    if (gz)
    if (gz)
@@ -960,7 +961,7 @@ unsigned long FileFd::Tell()
 // FileFd::FileSize - Return the size of the file			/*{{{*/
 // FileFd::FileSize - Return the size of the file			/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-unsigned long FileFd::FileSize()
+unsigned long long FileFd::FileSize()
 {
 {
    struct stat Buf;
    struct stat Buf;
 
 
@@ -972,9 +973,9 @@ unsigned long FileFd::FileSize()
 // FileFd::Size - Return the size of the content in the file		/*{{{*/
 // FileFd::Size - Return the size of the content in the file		/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-unsigned long FileFd::Size()
+unsigned long long FileFd::Size()
 {
 {
-   unsigned long size = FileSize();
+   unsigned long long size = FileSize();
 
 
    // only check gzsize if we are actually a gzip file, just checking for
    // only check gzsize if we are actually a gzip file, just checking for
    // "gz" is not sufficient as uncompressed files will be opened with
    // "gz" is not sufficient as uncompressed files will be opened with
@@ -984,6 +985,7 @@ unsigned long FileFd::Size()
        /* unfortunately zlib.h doesn't provide a gzsize(), so we have to do
        /* unfortunately zlib.h doesn't provide a gzsize(), so we have to do
 	* this ourselves; the original (uncompressed) file size is the last 32
 	* this ourselves; the original (uncompressed) file size is the last 32
 	* bits of the file */
 	* bits of the file */
+       // FIXME: Size for gz-files is limited by 32bit… no largefile support
        off_t orig_pos = lseek(iFd, 0, SEEK_CUR);
        off_t orig_pos = lseek(iFd, 0, SEEK_CUR);
        if (lseek(iFd, -4, SEEK_END) < 0)
        if (lseek(iFd, -4, SEEK_END) < 0)
 	   return _error->Errno("lseek","Unable to seek to end of gzipped file");
 	   return _error->Errno("lseek","Unable to seek to end of gzipped file");

+ 25 - 10
apt-pkg/contrib/fileutl.h

@@ -49,21 +49,36 @@ class FileFd
    enum OpenMode {ReadOnly,WriteEmpty,WriteExists,WriteAny,WriteTemp,ReadOnlyGzip,
    enum OpenMode {ReadOnly,WriteEmpty,WriteExists,WriteAny,WriteTemp,ReadOnlyGzip,
                   WriteAtomic};
                   WriteAtomic};
    
    
-   inline bool Read(void *To,unsigned long Size,bool AllowEof)
+   inline bool Read(void *To,unsigned long long Size,bool AllowEof)
    {
    {
-      unsigned long Jnk;
+      unsigned long long Jnk;
       if (AllowEof)
       if (AllowEof)
 	 return Read(To,Size,&Jnk);
 	 return Read(To,Size,&Jnk);
       return Read(To,Size);
       return Read(To,Size);
    }   
    }   
-   bool Read(void *To,unsigned long Size,unsigned long *Actual = 0);
-   bool Write(const void *From,unsigned long Size);
-   bool Seek(unsigned long To);
-   bool Skip(unsigned long To);
-   bool Truncate(unsigned long To);
-   unsigned long Tell();
-   unsigned long Size();
-   unsigned long FileSize();
+   bool Read(void *To,unsigned long long Size,unsigned long long *Actual = 0);
+   bool Write(const void *From,unsigned long long Size);
+   bool Seek(unsigned long long To);
+   bool Skip(unsigned long long To);
+   bool Truncate(unsigned long long To);
+   unsigned long long Tell();
+   unsigned long long Size();
+   unsigned long long FileSize();
+
+   /* You want to use 'unsigned long long' if you are talking about a file
+      to be able to support large files (>2 or >4 GB) properly.
+      This shouldn't happen all to often for the indexes, but deb's might be…
+      And as the auto-conversation converts a 'unsigned long *' to a 'bool'
+      instead of 'unsigned long long *' we need to provide this explicitely -
+      otherwise applications magically start to fail… */
+   __deprecated bool Read(void *To,unsigned long long Size,unsigned long *Actual)
+   {
+	unsigned long long R;
+	bool const T = Read(To, Size, &R);
+	*Actual = R;
+	return T;
+   }
+
    bool Open(string FileName,OpenMode Mode,unsigned long Perms = 0666);
    bool Open(string FileName,OpenMode Mode,unsigned long Perms = 0666);
    bool OpenDescriptor(int Fd, OpenMode Mode, bool AutoClose=false);
    bool OpenDescriptor(int Fd, OpenMode Mode, bool AutoClose=false);
    bool Close();
    bool Close();

+ 8 - 6
apt-pkg/contrib/hashes.cc

@@ -11,12 +11,14 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include <config.h>
+
 #include <apt-pkg/hashes.h>
 #include <apt-pkg/hashes.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/macros.h>
 #include <apt-pkg/macros.h>
 
 
-#include <unistd.h>    
+#include <unistd.h>
 #include <string>
 #include <string>
 #include <iostream>
 #include <iostream>
 									/*}}}*/
 									/*}}}*/
@@ -106,18 +108,18 @@ string HashString::toStr() const
 // Hashes::AddFD - Add the contents of the FD				/*{{{*/
 // Hashes::AddFD - Add the contents of the FD				/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-bool Hashes::AddFD(int const Fd,unsigned long Size, bool const addMD5,
+bool Hashes::AddFD(int const Fd,unsigned long long Size, bool const addMD5,
 		   bool const addSHA1, bool const addSHA256, bool const addSHA512)
 		   bool const addSHA1, bool const addSHA256, bool const addSHA512)
 {
 {
    unsigned char Buf[64*64];
    unsigned char Buf[64*64];
-   int Res = 0;
+   ssize_t Res = 0;
    int ToEOF = (Size == 0);
    int ToEOF = (Size == 0);
    while (Size != 0 || ToEOF)
    while (Size != 0 || ToEOF)
    {
    {
-      unsigned n = sizeof(Buf);
-      if (!ToEOF) n = min(Size,(unsigned long)n);
+      unsigned long long n = sizeof(Buf);
+      if (!ToEOF) n = min(Size, n);
       Res = read(Fd,Buf,n);
       Res = read(Fd,Buf,n);
-      if (Res < 0 || (!ToEOF && (unsigned) Res != n)) // error, or short read
+      if (Res < 0 || (!ToEOF && Res != (ssize_t) n)) // error, or short read
 	 return false;
 	 return false;
       if (ToEOF && Res == 0) // EOF
       if (ToEOF && Res == 0) // EOF
 	 break;
 	 break;

+ 3 - 3
apt-pkg/contrib/hashes.h

@@ -62,14 +62,14 @@ class Hashes
    SHA256Summation SHA256;
    SHA256Summation SHA256;
    SHA512Summation SHA512;
    SHA512Summation SHA512;
    
    
-   inline bool Add(const unsigned char *Data,unsigned long Size)
+   inline bool Add(const unsigned char *Data,unsigned long long Size)
    {
    {
       return MD5.Add(Data,Size) && SHA1.Add(Data,Size) && SHA256.Add(Data,Size) && SHA512.Add(Data,Size);
       return MD5.Add(Data,Size) && SHA1.Add(Data,Size) && SHA256.Add(Data,Size) && SHA512.Add(Data,Size);
    };
    };
    inline bool Add(const char *Data) {return Add((unsigned char *)Data,strlen(Data));};
    inline bool Add(const char *Data) {return Add((unsigned char *)Data,strlen(Data));};
-   inline bool AddFD(int const Fd,unsigned long Size = 0)
+   inline bool AddFD(int const Fd,unsigned long long Size = 0)
    { return AddFD(Fd, Size, true, true, true, true); };
    { return AddFD(Fd, Size, true, true, true, true); };
-   bool AddFD(int const Fd, unsigned long Size, bool const addMD5,
+   bool AddFD(int const Fd, unsigned long long Size, bool const addMD5,
 	      bool const addSHA1, bool const addSHA256, bool const addSHA512);
 	      bool const addSHA1, bool const addSHA256, bool const addSHA512);
    inline bool Add(const unsigned char *Beg,const unsigned char *End) 
    inline bool Add(const unsigned char *Beg,const unsigned char *End) 
                   {return Add(Beg,End-Beg);};
                   {return Add(Beg,End-Beg);};

+ 6 - 5
apt-pkg/contrib/hashsum.cc

@@ -1,4 +1,5 @@
 // Cryptographic API Base
 // Cryptographic API Base
+#include <config.h>
 
 
 #include <unistd.h>
 #include <unistd.h>
 #include "hashsum_template.h"
 #include "hashsum_template.h"
@@ -6,16 +7,16 @@
 // Summation::AddFD - Add content of file into the checksum		/*{{{*/
 // Summation::AddFD - Add content of file into the checksum		/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-bool SummationImplementation::AddFD(int const Fd, unsigned long Size) {
+bool SummationImplementation::AddFD(int const Fd, unsigned long long Size) {
    unsigned char Buf[64 * 64];
    unsigned char Buf[64 * 64];
-   int Res = 0;
+   ssize_t Res = 0;
    int ToEOF = (Size == 0);
    int ToEOF = (Size == 0);
    while (Size != 0 || ToEOF)
    while (Size != 0 || ToEOF)
    {
    {
-      unsigned n = sizeof(Buf);
-      if (!ToEOF) n = min(Size,(unsigned long)n);
+      unsigned long long n = sizeof(Buf);
+      if (!ToEOF) n = min(Size, n);
       Res = read(Fd, Buf, n);
       Res = read(Fd, Buf, n);
-      if (Res < 0 || (!ToEOF && (unsigned) Res != n)) // error, or short read
+      if (Res < 0 || (!ToEOF && Res != (ssize_t) n)) // error, or short read
 	 return false;
 	 return false;
       if (ToEOF && Res == 0) // EOF
       if (ToEOF && Res == 0) // EOF
 	 break;
 	 break;

+ 3 - 3
apt-pkg/contrib/hashsum_template.h

@@ -87,8 +87,8 @@ class HashSumValue
 class SummationImplementation
 class SummationImplementation
 {
 {
    public:
    public:
-   virtual bool Add(const unsigned char *inbuf, unsigned long inlen) = 0;
-   inline bool Add(const char *inbuf, unsigned long const inlen)
+   virtual bool Add(const unsigned char *inbuf, unsigned long long inlen) = 0;
+   inline bool Add(const char *inbuf, unsigned long long const inlen)
    { return Add((unsigned char *)inbuf, inlen); };
    { return Add((unsigned char *)inbuf, inlen); };
 
 
    inline bool Add(const unsigned char *Data)
    inline bool Add(const unsigned char *Data)
@@ -101,7 +101,7 @@ class SummationImplementation
    inline bool Add(const char *Beg, const char *End)
    inline bool Add(const char *Beg, const char *End)
    { return Add((const unsigned char *)Beg, End - Beg); };
    { return Add((const unsigned char *)Beg, End - Beg); };
 
 
-   bool AddFD(int Fd, unsigned long Size = 0);
+   bool AddFD(int Fd, unsigned long long Size = 0);
 };
 };
 
 
 #endif
 #endif

+ 3 - 2
apt-pkg/contrib/md5.cc

@@ -35,6 +35,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include <config.h>
+
 #include <apt-pkg/md5.h>
 #include <apt-pkg/md5.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/macros.h>
 #include <apt-pkg/macros.h>
@@ -43,7 +45,6 @@
 #include <unistd.h>
 #include <unistd.h>
 #include <netinet/in.h>                          // For htonl
 #include <netinet/in.h>                          // For htonl
 #include <inttypes.h>
 #include <inttypes.h>
-#include <config.h>
 									/*}}}*/
 									/*}}}*/
 
 
 // byteSwap - Swap bytes in a buffer					/*{{{*/
 // byteSwap - Swap bytes in a buffer					/*{{{*/
@@ -186,7 +187,7 @@ MD5Summation::MD5Summation()
 // MD5Summation::Add - 'Add' a data set to the hash			/*{{{*/
 // MD5Summation::Add - 'Add' a data set to the hash			/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-bool MD5Summation::Add(const unsigned char *data,unsigned long len)
+bool MD5Summation::Add(const unsigned char *data,unsigned long long len)
 {
 {
    if (Done == true)
    if (Done == true)
       return false;
       return false;

+ 1 - 1
apt-pkg/contrib/md5.h

@@ -45,7 +45,7 @@ class MD5Summation : public SummationImplementation
 
 
    public:
    public:
 
 
-   bool Add(const unsigned char *inbuf, unsigned long inlen);
+   bool Add(const unsigned char *inbuf, unsigned long long inlen);
    using SummationImplementation::Add;
    using SummationImplementation::Add;
 
 
    MD5SumValue Result();
    MD5SumValue Result();

+ 13 - 12
apt-pkg/contrib/mmap.cc

@@ -17,20 +17,21 @@
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
 #define _BSD_SOURCE
 #define _BSD_SOURCE
+#include <config.h>
+
 #include <apt-pkg/mmap.h>
 #include <apt-pkg/mmap.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 
 
-#include <apti18n.h>
-
 #include <sys/mman.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <fcntl.h>
 #include <stdlib.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <errno.h>
-
 #include <cstring>
 #include <cstring>
-   									/*}}}*/
+
+#include <apti18n.h>
+									/*}}}*/
 
 
 // MMap::MMap - Constructor						/*{{{*/
 // MMap::MMap - Constructor						/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
@@ -94,7 +95,7 @@ bool MMap::Map(FileFd &Fd)
 	    return false;
 	    return false;
       }
       }
       else
       else
-	 return _error->Errno("mmap",_("Couldn't make mmap of %lu bytes"),
+	 return _error->Errno("mmap",_("Couldn't make mmap of %llu bytes"),
 	                      iSize);
 	                      iSize);
      }
      }
 
 
@@ -165,7 +166,7 @@ bool MMap::Sync(unsigned long Start,unsigned long Stop)
       return true;
       return true;
    
    
 #ifdef _POSIX_SYNCHRONIZED_IO
 #ifdef _POSIX_SYNCHRONIZED_IO
-   unsigned long PSize = sysconf(_SC_PAGESIZE);
+   unsigned long long PSize = sysconf(_SC_PAGESIZE);
    if ((Flags & ReadOnly) != ReadOnly)
    if ((Flags & ReadOnly) != ReadOnly)
    {
    {
       if (SyncToFd != 0)
       if (SyncToFd != 0)
@@ -176,7 +177,7 @@ bool MMap::Sync(unsigned long Start,unsigned long Stop)
       }
       }
       else
       else
       {
       {
-	 if (msync((char *)Base+(int)(Start/PSize)*PSize,Stop - Start,MS_SYNC) < 0)
+	 if (msync((char *)Base+(unsigned long long)(Start/PSize)*PSize,Stop - Start,MS_SYNC) < 0)
 	    return _error->Errno("msync", _("Unable to synchronize mmap"));
 	    return _error->Errno("msync", _("Unable to synchronize mmap"));
       }
       }
    }
    }
@@ -196,7 +197,7 @@ DynamicMMap::DynamicMMap(FileFd &F,unsigned long Flags,unsigned long const &Work
    if (_error->PendingError() == true)
    if (_error->PendingError() == true)
       return;
       return;
    
    
-   unsigned long EndOfFile = Fd->Size();
+   unsigned long long EndOfFile = Fd->Size();
    if (EndOfFile > WorkSpace)
    if (EndOfFile > WorkSpace)
       WorkSpace = EndOfFile;
       WorkSpace = EndOfFile;
    else if(WorkSpace > 0)
    else if(WorkSpace > 0)
@@ -284,7 +285,7 @@ DynamicMMap::~DynamicMMap()
       return;
       return;
    }
    }
    
    
-   unsigned long EndOfFile = iSize;
+   unsigned long long EndOfFile = iSize;
    iSize = WorkSpace;
    iSize = WorkSpace;
    Close(false);
    Close(false);
    if(ftruncate(Fd->Fd(),EndOfFile) < 0)
    if(ftruncate(Fd->Fd(),EndOfFile) < 0)
@@ -294,9 +295,9 @@ DynamicMMap::~DynamicMMap()
 // DynamicMMap::RawAllocate - Allocate a raw chunk of unaligned space	/*{{{*/
 // DynamicMMap::RawAllocate - Allocate a raw chunk of unaligned space	/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* This allocates a block of memory aligned to the given size */
 /* This allocates a block of memory aligned to the given size */
-unsigned long DynamicMMap::RawAllocate(unsigned long Size,unsigned long Aln)
+unsigned long DynamicMMap::RawAllocate(unsigned long long Size,unsigned long Aln)
 {
 {
-   unsigned long Result = iSize;
+   unsigned long long Result = iSize;
    if (Aln != 0)
    if (Aln != 0)
       Result += Aln - (iSize%Aln);
       Result += Aln - (iSize%Aln);
 
 
@@ -411,7 +412,7 @@ bool DynamicMMap::Grow() {
 	if (GrowFactor <= 0)
 	if (GrowFactor <= 0)
 		return _error->Error(_("Unable to increase size of the MMap as automatic growing is disabled by user."));
 		return _error->Error(_("Unable to increase size of the MMap as automatic growing is disabled by user."));
 
 
-	unsigned long const newSize = WorkSpace + GrowFactor;
+	unsigned long long const newSize = WorkSpace + GrowFactor;
 
 
 	if(Fd != 0) {
 	if(Fd != 0) {
 		Fd->Seek(newSize - 1);
 		Fd->Seek(newSize - 1);

+ 4 - 4
apt-pkg/contrib/mmap.h

@@ -41,7 +41,7 @@ class MMap
    protected:
    protected:
    
    
    unsigned long Flags;
    unsigned long Flags;
-   unsigned long iSize;
+   unsigned long long iSize;
    void *Base;
    void *Base;
 
 
    // In case mmap can not be used, we keep a dup of the file
    // In case mmap can not be used, we keep a dup of the file
@@ -60,8 +60,8 @@ class MMap
    // Simple accessors
    // Simple accessors
    inline operator void *() {return Base;};
    inline operator void *() {return Base;};
    inline void *Data() {return Base;}; 
    inline void *Data() {return Base;}; 
-   inline unsigned long Size() {return iSize;};
-   inline void AddSize(unsigned long const size) {iSize += size;};
+   inline unsigned long long Size() {return iSize;};
+   inline void AddSize(unsigned long long const size) {iSize += size;};
    inline bool validData() const { return Base != (void *)-1 && Base != 0; };
    inline bool validData() const { return Base != (void *)-1 && Base != 0; };
    
    
    // File manipulators
    // File manipulators
@@ -99,7 +99,7 @@ class DynamicMMap : public MMap
    public:
    public:
 
 
    // Allocation
    // Allocation
-   unsigned long RawAllocate(unsigned long Size,unsigned long Aln = 0);
+   unsigned long RawAllocate(unsigned long long Size,unsigned long Aln = 0);
    unsigned long Allocate(unsigned long ItemSize);
    unsigned long Allocate(unsigned long ItemSize);
    unsigned long WriteString(const char *String,unsigned long Len = (unsigned long)-1);
    unsigned long WriteString(const char *String,unsigned long Len = (unsigned long)-1);
    inline unsigned long WriteString(const string &S) {return WriteString(S.c_str(),S.length());};
    inline unsigned long WriteString(const string &S) {return WriteString(S.c_str(),S.length());};

+ 1 - 0
apt-pkg/contrib/netrc.cc

@@ -11,6 +11,7 @@
 
 
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
+#include <config.h>
 
 
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/fileutl.h>

+ 8 - 6
apt-pkg/contrib/progress.cc

@@ -8,15 +8,17 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include <config.h>
+
 #include <apt-pkg/progress.h>
 #include <apt-pkg/progress.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/configuration.h>
 
 
-#include <apti18n.h>
-
 #include <iostream>
 #include <iostream>
 #include <stdio.h>
 #include <stdio.h>
 #include <cstring>
 #include <cstring>
+
+#include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 
 
 using namespace std;
 using namespace std;
@@ -35,7 +37,7 @@ OpProgress::OpProgress() : Current(0), Total(0), Size(0), SubTotal(1),
 /* Current is the Base Overall progress in units of Total. Cur is the sub
 /* Current is the Base Overall progress in units of Total. Cur is the sub
    progress in units of SubTotal. Size is a scaling factor that says what
    progress in units of SubTotal. Size is a scaling factor that says what
    percent of Total SubTotal is. */
    percent of Total SubTotal is. */
-void OpProgress::Progress(unsigned long Cur)
+void OpProgress::Progress(unsigned long long Cur)
 {
 {
    if (Total == 0 || Size == 0 || SubTotal == 0)
    if (Total == 0 || Size == 0 || SubTotal == 0)
       Percent = 0;
       Percent = 0;
@@ -47,8 +49,8 @@ void OpProgress::Progress(unsigned long Cur)
 // OpProgress::OverallProgress - Set the overall progress		/*{{{*/
 // OpProgress::OverallProgress - Set the overall progress		/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-void OpProgress::OverallProgress(unsigned long Current, unsigned long Total,
-	  			 unsigned long Size,const string &Op)
+void OpProgress::OverallProgress(unsigned long long Current, unsigned long long Total,
+	  			 unsigned long long Size,const string &Op)
 {
 {
    this->Current = Current;
    this->Current = Current;
    this->Total = Total;
    this->Total = Total;
@@ -65,7 +67,7 @@ void OpProgress::OverallProgress(unsigned long Current, unsigned long Total,
 // OpProgress::SubProgress - Set the sub progress state			/*{{{*/
 // OpProgress::SubProgress - Set the sub progress state			/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-void OpProgress::SubProgress(unsigned long SubTotal,const string &Op,
+void OpProgress::SubProgress(unsigned long long SubTotal,const string &Op,
 			     float const Percent)
 			     float const Percent)
 {
 {
    this->SubTotal = SubTotal;
    this->SubTotal = SubTotal;

+ 8 - 8
apt-pkg/contrib/progress.h

@@ -30,10 +30,10 @@ using std::string;
 class Configuration;
 class Configuration;
 class OpProgress
 class OpProgress
 {
 {
-   unsigned long Current;
-   unsigned long Total;
-   unsigned long Size;
-   unsigned long SubTotal;
+   unsigned long long Current;
+   unsigned long long Total;
+   unsigned long long Size;
+   unsigned long long SubTotal;
    float LastPercent;
    float LastPercent;
    
    
    // Change reduction code
    // Change reduction code
@@ -54,10 +54,10 @@ class OpProgress
    
    
    public:
    public:
    
    
-   void Progress(unsigned long Current);
-   void SubProgress(unsigned long SubTotal, const string &Op = "", float const Percent = -1);
-   void OverallProgress(unsigned long Current,unsigned long Total,
-			unsigned long Size,const string &Op);
+   void Progress(unsigned long long Current);
+   void SubProgress(unsigned long long SubTotal, const string &Op = "", float const Percent = -1);
+   void OverallProgress(unsigned long long Current,unsigned long long Total,
+			unsigned long long Size,const string &Op);
    virtual void Done() {};
    virtual void Done() {};
    
    
    OpProgress();
    OpProgress();

+ 3 - 2
apt-pkg/contrib/sha1.cc

@@ -29,6 +29,8 @@
  */
  */
 									/*}}} */
 									/*}}} */
 // Include Files                                                        /*{{{*/
 // Include Files                                                        /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/sha1.h>
 #include <apt-pkg/sha1.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/macros.h>
 #include <apt-pkg/macros.h>
@@ -36,7 +38,6 @@
 #include <string.h>
 #include <string.h>
 #include <unistd.h>
 #include <unistd.h>
 #include <inttypes.h>
 #include <inttypes.h>
-#include <config.h>
 									/*}}}*/
 									/*}}}*/
 
 
 // SHA1Transform - Alters an existing SHA-1 hash			/*{{{*/
 // SHA1Transform - Alters an existing SHA-1 hash			/*{{{*/
@@ -241,7 +242,7 @@ SHA1SumValue SHA1Summation::Result()
 // SHA1Summation::Add - Adds content of buffer into the checksum        /*{{{*/
 // SHA1Summation::Add - Adds content of buffer into the checksum        /*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* May not be called after Result() is called */
 /* May not be called after Result() is called */
-bool SHA1Summation::Add(const unsigned char *data,unsigned long len)
+bool SHA1Summation::Add(const unsigned char *data,unsigned long long len)
 {
 {
    if (Done)
    if (Done)
       return false;
       return false;

+ 1 - 1
apt-pkg/contrib/sha1.h

@@ -34,7 +34,7 @@ class SHA1Summation : public SummationImplementation
    bool Done;
    bool Done;
    
    
    public:
    public:
-   bool Add(const unsigned char *inbuf, unsigned long inlen);
+   bool Add(const unsigned char *inbuf, unsigned long long inlen);
    using SummationImplementation::Add;
    using SummationImplementation::Add;
 
 
    SHA1SumValue Result();
    SHA1SumValue Result();

+ 3 - 3
apt-pkg/contrib/sha2.h

@@ -30,7 +30,7 @@ class SHA2SummationBase : public SummationImplementation
  protected:
  protected:
    bool Done;
    bool Done;
  public:
  public:
-   bool Add(const unsigned char *inbuf, unsigned long len) = 0;
+   bool Add(const unsigned char *inbuf, unsigned long long len) = 0;
 
 
    void Result();
    void Result();
 };
 };
@@ -41,7 +41,7 @@ class SHA256Summation : public SHA2SummationBase
    unsigned char Sum[32];
    unsigned char Sum[32];
 
 
    public:
    public:
-   bool Add(const unsigned char *inbuf, unsigned long len)
+   bool Add(const unsigned char *inbuf, unsigned long long len)
    {
    {
       if (Done) 
       if (Done) 
          return false;
          return false;
@@ -73,7 +73,7 @@ class SHA512Summation : public SHA2SummationBase
    unsigned char Sum[64];
    unsigned char Sum[64];
 
 
    public:
    public:
-   bool Add(const unsigned char *inbuf, unsigned long len)
+   bool Add(const unsigned char *inbuf, unsigned long long len)
    {
    {
       if (Done) 
       if (Done) 
          return false;
          return false;

+ 1 - 0
apt-pkg/contrib/sha2_internal.cc

@@ -31,6 +31,7 @@
  *
  *
  * $Id: sha2.c,v 1.1 2001/11/08 00:01:51 adg Exp adg $
  * $Id: sha2.c,v 1.1 2001/11/08 00:01:51 adg Exp adg $
  */
  */
+#include <config.h>
 
 
 #include <string.h>	/* memcpy()/memset() or bcopy()/bzero() */
 #include <string.h>	/* memcpy()/memset() or bcopy()/bzero() */
 #include <assert.h>	/* assert() */
 #include <assert.h>	/* assert() */

+ 31 - 3
apt-pkg/contrib/strutl.cc

@@ -15,12 +15,12 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Includes								/*{{{*/
 // Includes								/*{{{*/
+#include <config.h>
+
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 
 
-#include <apti18n.h>
-    
 #include <ctype.h>
 #include <ctype.h>
 #include <string.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdio.h>
@@ -31,7 +31,7 @@
 #include <stdarg.h>
 #include <stdarg.h>
 #include <iconv.h>
 #include <iconv.h>
 
 
-#include "config.h"
+#include <apti18n.h>
 
 
 using namespace std;
 using namespace std;
 									/*}}}*/
 									/*}}}*/
@@ -970,6 +970,34 @@ bool StrToNum(const char *Str,unsigned long &Res,unsigned Len,unsigned Base)
    return true;
    return true;
 }
 }
 									/*}}}*/
 									/*}}}*/
+// StrToNum - Convert a fixed length string to a number			/*{{{*/
+// ---------------------------------------------------------------------
+/* This is used in decoding the crazy fixed length string headers in 
+   tar and ar files. */
+bool StrToNum(const char *Str,unsigned long long &Res,unsigned Len,unsigned Base)
+{
+   char S[30];
+   if (Len >= sizeof(S))
+      return false;
+   memcpy(S,Str,Len);
+   S[Len] = 0;
+   
+   // All spaces is a zero
+   Res = 0;
+   unsigned I;
+   for (I = 0; S[I] == ' '; I++);
+   if (S[I] == 0)
+      return true;
+   
+   char *End;
+   Res = strtoull(S,&End,Base);
+   if (End == S)
+      return false;
+   
+   return true;
+}
+									/*}}}*/
+
 // Base256ToNum - Convert a fixed length binary to a number             /*{{{*/
 // Base256ToNum - Convert a fixed length binary to a number             /*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* This is used in decoding the 256bit encoded fixed length fields in
 /* This is used in decoding the 256bit encoded fixed length fields in

+ 1 - 0
apt-pkg/contrib/strutl.h

@@ -56,6 +56,7 @@ string LookupTag(const string &Message,const char *Tag,const char *Default = 0);
 int StringToBool(const string &Text,int Default = -1);
 int StringToBool(const string &Text,int Default = -1);
 bool ReadMessages(int Fd, vector<string> &List);
 bool ReadMessages(int Fd, vector<string> &List);
 bool StrToNum(const char *Str,unsigned long &Res,unsigned Len,unsigned Base = 0);
 bool StrToNum(const char *Str,unsigned long &Res,unsigned Len,unsigned Base = 0);
+bool StrToNum(const char *Str,unsigned long long &Res,unsigned Len,unsigned Base = 0);
 bool Base256ToNum(const char *Str,unsigned long &Res,unsigned int Len);
 bool Base256ToNum(const char *Str,unsigned long &Res,unsigned int Len);
 bool Hex2Num(const string &Str,unsigned char *Num,unsigned int Length);
 bool Hex2Num(const string &Str,unsigned char *Num,unsigned int Length);
 bool TokSplitString(char Tok,char *Input,char **List,
 bool TokSplitString(char Tok,char *Input,char **List,

+ 2 - 0
apt-pkg/deb/debindexfile.cc

@@ -9,6 +9,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include <config.h>
+
 #include <apt-pkg/debindexfile.h>
 #include <apt-pkg/debindexfile.h>
 #include <apt-pkg/debsrcrecords.h>
 #include <apt-pkg/debsrcrecords.h>
 #include <apt-pkg/deblistparser.h>
 #include <apt-pkg/deblistparser.h>

+ 2 - 0
apt-pkg/deb/deblistparser.cc

@@ -10,6 +10,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include <config.h>
+
 #include <apt-pkg/deblistparser.h>
 #include <apt-pkg/deblistparser.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/configuration.h>

+ 1 - 0
apt-pkg/deb/debmetaindex.cc

@@ -1,4 +1,5 @@
 // ijones, walters
 // ijones, walters
+#include <config.h>
 
 
 #include <apt-pkg/debmetaindex.h>
 #include <apt-pkg/debmetaindex.h>
 #include <apt-pkg/debindexfile.h>
 #include <apt-pkg/debindexfile.h>

+ 2 - 0
apt-pkg/deb/debrecords.cc

@@ -8,6 +8,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include <config.h>
+
 #include <apt-pkg/debrecords.h>
 #include <apt-pkg/debrecords.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>

+ 2 - 0
apt-pkg/deb/debsrcrecords.cc

@@ -9,6 +9,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include <config.h>
+
 #include <apt-pkg/deblistparser.h>
 #include <apt-pkg/deblistparser.h>
 #include <apt-pkg/debsrcrecords.h>
 #include <apt-pkg/debsrcrecords.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>

+ 4 - 1
apt-pkg/deb/debsystem.cc

@@ -10,6 +10,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include <config.h>
+
 #include <apt-pkg/debsystem.h>
 #include <apt-pkg/debsystem.h>
 #include <apt-pkg/debversion.h>
 #include <apt-pkg/debversion.h>
 #include <apt-pkg/debindexfile.h>
 #include <apt-pkg/debindexfile.h>
@@ -17,11 +19,12 @@
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/fileutl.h>
-#include <apti18n.h>
 #include <sys/types.h>
 #include <sys/types.h>
 #include <unistd.h>
 #include <unistd.h>
 #include <dirent.h>
 #include <dirent.h>
 #include <errno.h>
 #include <errno.h>
+
+#include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 
 
 debSystem debSys;
 debSystem debSys;

+ 1 - 0
apt-pkg/deb/debversion.cc

@@ -11,6 +11,7 @@
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
 #define APT_COMPATIBILITY 986
 #define APT_COMPATIBILITY 986
+#include <config.h>
 
 
 #include <apt-pkg/debversion.h>
 #include <apt-pkg/debversion.h>
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/pkgcache.h>

+ 2 - 1
apt-pkg/deb/dpkgpm.cc

@@ -8,6 +8,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Includes								/*{{{*/
 // Includes								/*{{{*/
+#include <config.h>
+
 #include <apt-pkg/dpkgpm.h>
 #include <apt-pkg/dpkgpm.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/configuration.h>
@@ -40,7 +42,6 @@
 #include <sys/ioctl.h>
 #include <sys/ioctl.h>
 #include <pty.h>
 #include <pty.h>
 
 
-#include <config.h>
 #include <apti18n.h>
 #include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 
 

+ 6 - 4
apt-pkg/depcache.cc

@@ -8,6 +8,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include<config.h>
+
 #include <apt-pkg/depcache.h>
 #include <apt-pkg/depcache.h>
 #include <apt-pkg/version.h>
 #include <apt-pkg/version.h>
 #include <apt-pkg/versionmatch.h>
 #include <apt-pkg/versionmatch.h>
@@ -23,12 +25,12 @@
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/tagfile.h>
 
 
 #include <iostream>
 #include <iostream>
-#include <sstream>    
+#include <sstream>
 #include <set>
 #include <set>
 
 
 #include <sys/stat.h>
 #include <sys/stat.h>
 
 
-#include <apti18n.h>    
+#include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 // helper for Install-Recommends-Sections and Never-MarkAuto-Sections	/*{{{*/
 // helper for Install-Recommends-Sections and Never-MarkAuto-Sections	/*{{{*/
 static bool 
 static bool 
@@ -169,14 +171,14 @@ bool pkgDepCache::readStateFile(OpProgress *Prog)			/*{{{*/
    string const state = _config->FindFile("Dir::State::extended_states");
    string const state = _config->FindFile("Dir::State::extended_states");
    if(RealFileExists(state)) {
    if(RealFileExists(state)) {
       state_file.Open(state, FileFd::ReadOnly);
       state_file.Open(state, FileFd::ReadOnly);
-      int const file_size = state_file.Size();
+      off_t const file_size = state_file.Size();
       if(Prog != NULL)
       if(Prog != NULL)
 	 Prog->OverallProgress(0, file_size, 1, 
 	 Prog->OverallProgress(0, file_size, 1, 
 			       _("Reading state information"));
 			       _("Reading state information"));
 
 
       pkgTagFile tagfile(&state_file);
       pkgTagFile tagfile(&state_file);
       pkgTagSection section;
       pkgTagSection section;
-      int amt = 0;
+      off_t amt = 0;
       bool const debug_autoremove = _config->FindB("Debug::pkgAutoRemove",false);
       bool const debug_autoremove = _config->FindB("Debug::pkgAutoRemove",false);
       while(tagfile.Step(section)) {
       while(tagfile.Step(section)) {
 	 string const pkgname = section.FindS("Package");
 	 string const pkgname = section.FindS("Package");

+ 4 - 2
apt-pkg/edsp.cc

@@ -5,6 +5,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include <config.h>
+
 #include <apt-pkg/edsp.h>
 #include <apt-pkg/edsp.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/configuration.h>
@@ -12,10 +14,10 @@
 #include <apt-pkg/policy.h>
 #include <apt-pkg/policy.h>
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/tagfile.h>
 
 
-#include <apti18n.h>
 #include <limits>
 #include <limits>
-
 #include <stdio.h>
 #include <stdio.h>
+
+#include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 
 
 // we could use pkgCache::DepType and ::Priority, but these would be localized strings…
 // we could use pkgCache::DepType and ::Priority, but these would be localized strings…

+ 2 - 0
apt-pkg/edsp/edspindexfile.cc

@@ -6,6 +6,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include <config.h>
+
 #include <apt-pkg/edspindexfile.h>
 #include <apt-pkg/edspindexfile.h>
 #include <apt-pkg/edsplistparser.h>
 #include <apt-pkg/edsplistparser.h>
 #include <apt-pkg/sourcelist.h>
 #include <apt-pkg/sourcelist.h>

+ 2 - 0
apt-pkg/edsp/edsplistparser.cc

@@ -9,6 +9,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include <config.h>
+
 #include <apt-pkg/edsplistparser.h>
 #include <apt-pkg/edsplistparser.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/configuration.h>

+ 4 - 1
apt-pkg/edsp/edspsystem.cc

@@ -9,17 +9,20 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include <config.h>
+
 #include <apt-pkg/edspsystem.h>
 #include <apt-pkg/edspsystem.h>
 #include <apt-pkg/debversion.h>
 #include <apt-pkg/debversion.h>
 #include <apt-pkg/edspindexfile.h>
 #include <apt-pkg/edspindexfile.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/fileutl.h>
-#include <apti18n.h>
 #include <sys/types.h>
 #include <sys/types.h>
 #include <unistd.h>
 #include <unistd.h>
 #include <dirent.h>
 #include <dirent.h>
 #include <errno.h>
 #include <errno.h>
+
+#include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 
 
 edspSystem edspSys;
 edspSystem edspSys;

+ 16 - 13
apt-pkg/indexcopy.cc

@@ -10,7 +10,7 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
-#include "indexcopy.h"
+#include<config.h>
 
 
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/progress.h>
 #include <apt-pkg/progress.h>
@@ -21,7 +21,6 @@
 #include <apt-pkg/indexrecords.h>
 #include <apt-pkg/indexrecords.h>
 #include <apt-pkg/md5.h>
 #include <apt-pkg/md5.h>
 #include <apt-pkg/cdrom.h>
 #include <apt-pkg/cdrom.h>
-#include <apti18n.h>
 
 
 #include <iostream>
 #include <iostream>
 #include <sstream>
 #include <sstream>
@@ -30,6 +29,10 @@
 #include <sys/types.h>
 #include <sys/types.h>
 #include <fcntl.h>
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdio.h>
+#include <stdlib.h>
+
+#include "indexcopy.h"
+#include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 
 
 using namespace std;
 using namespace std;
@@ -53,7 +56,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector<string> &List,
    bool Debug = _config->FindB("Debug::aptcdrom",false);
    bool Debug = _config->FindB("Debug::aptcdrom",false);
    
    
    // Prepare the progress indicator
    // Prepare the progress indicator
-   unsigned long TotalSize = 0;
+   off_t TotalSize = 0;
    for (vector<string>::iterator I = List.begin(); I != List.end(); ++I)
    for (vector<string>::iterator I = List.begin(); I != List.end(); ++I)
    {
    {
       struct stat Buf;
       struct stat Buf;
@@ -64,14 +67,14 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector<string> &List,
       TotalSize += Buf.st_size;
       TotalSize += Buf.st_size;
    }	
    }	
 
 
-   unsigned long CurrentSize = 0;
+   off_t CurrentSize = 0;
    unsigned int NotFound = 0;
    unsigned int NotFound = 0;
    unsigned int WrongSize = 0;
    unsigned int WrongSize = 0;
    unsigned int Packages = 0;
    unsigned int Packages = 0;
    for (vector<string>::iterator I = List.begin(); I != List.end(); ++I)
    for (vector<string>::iterator I = List.begin(); I != List.end(); ++I)
    {      
    {      
       string OrigPath = string(*I,CDROM.length());
       string OrigPath = string(*I,CDROM.length());
-      unsigned long FileSize = 0;
+      off_t FileSize = 0;
       
       
       // Open the package file
       // Open the package file
       FileFd Pkg;
       FileFd Pkg;
@@ -164,7 +167,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector<string> &List,
 	 if(Progress)
 	 if(Progress)
 	    Progress->Progress(Parser.Offset());
 	    Progress->Progress(Parser.Offset());
 	 string File;
 	 string File;
-	 unsigned long Size;
+	 unsigned long long Size;
 	 if (GetFile(File,Size) == false)
 	 if (GetFile(File,Size) == false)
 	 {
 	 {
 	    fclose(TargetFl);
 	    fclose(TargetFl);
@@ -219,7 +222,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector<string> &List,
 	    }	    
 	    }	    
 	    			    	    
 	    			    	    
 	    // Size match
 	    // Size match
-	    if ((unsigned)Buf.st_size != Size)
+	    if ((unsigned long long)Buf.st_size != Size)
 	    {
 	    {
 	       if (Debug == true)
 	       if (Debug == true)
 		  clog << "Wrong Size: " << File << endl;
 		  clog << "Wrong Size: " << File << endl;
@@ -453,7 +456,7 @@ bool IndexCopy::GrabFirst(string Path,string &To,unsigned int Depth)
 // PackageCopy::GetFile - Get the file information from the section	/*{{{*/
 // PackageCopy::GetFile - Get the file information from the section	/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-bool PackageCopy::GetFile(string &File,unsigned long &Size)
+bool PackageCopy::GetFile(string &File,unsigned long long &Size)
 {
 {
    File = Section->FindS("Filename");
    File = Section->FindS("Filename");
    Size = Section->FindI("Size");
    Size = Section->FindI("Size");
@@ -479,7 +482,7 @@ bool PackageCopy::RewriteEntry(FILE *Target,string File)
 // SourceCopy::GetFile - Get the file information from the section	/*{{{*/
 // SourceCopy::GetFile - Get the file information from the section	/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-bool SourceCopy::GetFile(string &File,unsigned long &Size)
+bool SourceCopy::GetFile(string &File,unsigned long long &Size)
 {
 {
    string Files = Section->FindS("Files");
    string Files = Section->FindS("Files");
    if (Files.empty() == true)
    if (Files.empty() == true)
@@ -502,7 +505,7 @@ bool SourceCopy::GetFile(string &File,unsigned long &Size)
       return _error->Error("Error parsing file record");
       return _error->Error("Error parsing file record");
    
    
    // Parse the size and append the directory
    // Parse the size and append the directory
-   Size = atoi(sSize.c_str());
+   Size = strtoull(sSize.c_str(), NULL, 10);
    File = Base + File;
    File = Base + File;
    return true;
    return true;
 }
 }
@@ -785,7 +788,7 @@ bool TranslationsCopy::CopyTranslations(string CDROM,string Name,	/*{{{*/
    bool Debug = _config->FindB("Debug::aptcdrom",false);
    bool Debug = _config->FindB("Debug::aptcdrom",false);
    
    
    // Prepare the progress indicator
    // Prepare the progress indicator
-   unsigned long TotalSize = 0;
+   off_t TotalSize = 0;
    for (vector<string>::iterator I = List.begin(); I != List.end(); ++I)
    for (vector<string>::iterator I = List.begin(); I != List.end(); ++I)
    {
    {
       struct stat Buf;
       struct stat Buf;
@@ -796,14 +799,14 @@ bool TranslationsCopy::CopyTranslations(string CDROM,string Name,	/*{{{*/
       TotalSize += Buf.st_size;
       TotalSize += Buf.st_size;
    }	
    }	
 
 
-   unsigned long CurrentSize = 0;
+   off_t CurrentSize = 0;
    unsigned int NotFound = 0;
    unsigned int NotFound = 0;
    unsigned int WrongSize = 0;
    unsigned int WrongSize = 0;
    unsigned int Packages = 0;
    unsigned int Packages = 0;
    for (vector<string>::iterator I = List.begin(); I != List.end(); ++I)
    for (vector<string>::iterator I = List.begin(); I != List.end(); ++I)
    {      
    {      
       string OrigPath = string(*I,CDROM.length());
       string OrigPath = string(*I,CDROM.length());
-      unsigned long FileSize = 0;
+      off_t FileSize = 0;
       
       
       // Open the package file
       // Open the package file
       FileFd Pkg;
       FileFd Pkg;

+ 3 - 3
apt-pkg/indexcopy.h

@@ -37,7 +37,7 @@ class IndexCopy								/*{{{*/
    bool ReconstructChop(unsigned long &Chop,string Dir,string File);
    bool ReconstructChop(unsigned long &Chop,string Dir,string File);
    void ConvertToSourceList(string CD,string &Path);
    void ConvertToSourceList(string CD,string &Path);
    bool GrabFirst(string Path,string &To,unsigned int Depth);
    bool GrabFirst(string Path,string &To,unsigned int Depth);
-   virtual bool GetFile(string &Filename,unsigned long &Size) = 0;
+   virtual bool GetFile(string &Filename,unsigned long long &Size) = 0;
    virtual bool RewriteEntry(FILE *Target,string File) = 0;
    virtual bool RewriteEntry(FILE *Target,string File) = 0;
    virtual const char *GetFileName() = 0;
    virtual const char *GetFileName() = 0;
    virtual const char *Type() = 0;
    virtual const char *Type() = 0;
@@ -53,7 +53,7 @@ class PackageCopy : public IndexCopy					/*{{{*/
 {
 {
    protected:
    protected:
    
    
-   virtual bool GetFile(string &Filename,unsigned long &Size);
+   virtual bool GetFile(string &Filename,unsigned long long &Size);
    virtual bool RewriteEntry(FILE *Target,string File);
    virtual bool RewriteEntry(FILE *Target,string File);
    virtual const char *GetFileName() {return "Packages";};
    virtual const char *GetFileName() {return "Packages";};
    virtual const char *Type() {return "Package";};
    virtual const char *Type() {return "Package";};
@@ -64,7 +64,7 @@ class SourceCopy : public IndexCopy					/*{{{*/
 {
 {
    protected:
    protected:
    
    
-   virtual bool GetFile(string &Filename,unsigned long &Size);
+   virtual bool GetFile(string &Filename,unsigned long long &Size);
    virtual bool RewriteEntry(FILE *Target,string File);
    virtual bool RewriteEntry(FILE *Target,string File);
    virtual const char *GetFileName() {return "Sources";};
    virtual const char *GetFileName() {return "Sources";};
    virtual const char *Type() {return "Source";};
    virtual const char *Type() {return "Source";};

+ 2 - 0
apt-pkg/indexfile.cc

@@ -8,6 +8,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include<config.h>
+
 #include <apt-pkg/indexfile.h>
 #include <apt-pkg/indexfile.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/aptconfiguration.h>
 #include <apt-pkg/aptconfiguration.h>

+ 22 - 9
apt-pkg/indexrecords.cc

@@ -3,15 +3,17 @@
 // $Id: indexrecords.cc,v 1.1.2.4 2003/12/30 02:11:43 mdz Exp $
 // $Id: indexrecords.cc,v 1.1.2.4 2003/12/30 02:11:43 mdz Exp $
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include<config.h>
+
 #include <apt-pkg/indexrecords.h>
 #include <apt-pkg/indexrecords.h>
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/configuration.h>
-#include <apti18n.h>
 #include <sys/stat.h>
 #include <sys/stat.h>
 #include <clocale>
 #include <clocale>
 
 
+#include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 string indexRecords::GetDist() const
 string indexRecords::GetDist() const
 {
 {
@@ -78,7 +80,7 @@ bool indexRecords::Load(const string Filename)				/*{{{*/
 
 
       string Name;
       string Name;
       string Hash;
       string Hash;
-      size_t Size;
+      unsigned long long Size;
       while (Start < End)
       while (Start < End)
       {
       {
 	 if (!parseSumData(Start, End, Name, Hash, Size))
 	 if (!parseSumData(Start, End, Name, Hash, Size))
@@ -113,10 +115,14 @@ bool indexRecords::Load(const string Filename)				/*{{{*/
    }
    }
    // get the user settings for this archive and use what expires earlier
    // get the user settings for this archive and use what expires earlier
    int MaxAge = _config->FindI("Acquire::Max-ValidTime", 0);
    int MaxAge = _config->FindI("Acquire::Max-ValidTime", 0);
-   if (Label.empty() == true)
+   if (Label.empty() == false)
       MaxAge = _config->FindI(string("Acquire::Max-ValidTime::" + Label).c_str(), MaxAge);
       MaxAge = _config->FindI(string("Acquire::Max-ValidTime::" + Label).c_str(), MaxAge);
+   int MinAge = _config->FindI("Acquire::Min-ValidTime", 0);
+   if (Label.empty() == false)
+      MinAge = _config->FindI(string("Acquire::Min-ValidTime::" + Label).c_str(), MinAge);
 
 
-   if(MaxAge == 0) // No user settings, use the one from the Release file
+   if(MaxAge == 0 &&
+      (MinAge == 0 || ValidUntil == 0)) // No user settings, use the one from the Release file
       return true;
       return true;
 
 
    time_t date;
    time_t date;
@@ -125,10 +131,17 @@ bool indexRecords::Load(const string Filename)				/*{{{*/
       strprintf(ErrorText, _("Invalid 'Date' entry in Release file %s"), Filename.c_str());
       strprintf(ErrorText, _("Invalid 'Date' entry in Release file %s"), Filename.c_str());
       return false;
       return false;
    }
    }
-   date += 24*60*60*MaxAge;
 
 
-   if (ValidUntil == 0 || ValidUntil > date)
-      ValidUntil = date;
+   if (MinAge != 0 && ValidUntil != 0) {
+      time_t const min_date = date + MinAge;
+      if (ValidUntil < min_date)
+	 ValidUntil = min_date;
+   }
+   if (MaxAge != 0) {
+      time_t const max_date = date + MaxAge;
+      if (ValidUntil == 0 || ValidUntil > max_date)
+	 ValidUntil = max_date;
+   }
 
 
    return true;
    return true;
 }
 }
@@ -145,7 +158,7 @@ vector<string> indexRecords::MetaKeys()					/*{{{*/
 }
 }
 									/*}}}*/
 									/*}}}*/
 bool indexRecords::parseSumData(const char *&Start, const char *End,	/*{{{*/
 bool indexRecords::parseSumData(const char *&Start, const char *End,	/*{{{*/
-				   string &Name, string &Hash, size_t &Size)
+				   string &Name, string &Hash, unsigned long long &Size)
 {
 {
    Name = "";
    Name = "";
    Hash = "";
    Hash = "";
@@ -182,7 +195,7 @@ bool indexRecords::parseSumData(const char *&Start, const char *End,	/*{{{*/
    if (EntryEnd == End)
    if (EntryEnd == End)
       return false;
       return false;
    
    
-   Size = strtol (Start, NULL, 10);
+   Size = strtoull (Start, NULL, 10);
       
       
    /* Skip over intermediate blanks */
    /* Skip over intermediate blanks */
    Start = EntryEnd;
    Start = EntryEnd;

+ 2 - 2
apt-pkg/indexrecords.h

@@ -17,7 +17,7 @@
 class indexRecords
 class indexRecords
 {
 {
    bool parseSumData(const char *&Start, const char *End, string &Name,
    bool parseSumData(const char *&Start, const char *End, string &Name,
-		     string &Hash, size_t &Size);
+		     string &Hash, unsigned long long &Size);
    public:
    public:
    struct checkSum;
    struct checkSum;
    string ErrorText;
    string ErrorText;
@@ -53,7 +53,7 @@ struct indexRecords::checkSum
 {
 {
    string MetaKeyFilename;
    string MetaKeyFilename;
    HashString Hash;
    HashString Hash;
-   size_t Size;      
+   unsigned long long Size;
 };
 };
 
 
 #endif
 #endif

+ 4 - 2
apt-pkg/init.cc

@@ -8,14 +8,16 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include files							/*{{{*/
 // Include files							/*{{{*/
+#include<config.h>
+
 #include <apt-pkg/init.h>
 #include <apt-pkg/init.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 
 
-#include <apti18n.h>
-#include <config.h>
 #include <cstdlib>
 #include <cstdlib>
 #include <sys/stat.h>
 #include <sys/stat.h>
+
+#include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 
 
 #define Stringfy_(x) # x
 #define Stringfy_(x) # x

+ 55 - 17
apt-pkg/orderlist.cc

@@ -63,6 +63,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include<config.h>
+
 #include <apt-pkg/orderlist.h>
 #include <apt-pkg/orderlist.h>
 #include <apt-pkg/depcache.h>
 #include <apt-pkg/depcache.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
@@ -152,7 +154,7 @@ bool pkgOrderList::DoRun()
    iterator OldEnd = End;
    iterator OldEnd = End;
    End = NList;
    End = NList;
    for (iterator I = List; I != OldEnd; ++I)
    for (iterator I = List; I != OldEnd; ++I)
-      if (VisitNode(PkgIterator(Cache,*I)) == false)
+      if (VisitNode(PkgIterator(Cache,*I), "DoRun") == false)
       {
       {
 	 End = OldEnd;
 	 End = OldEnd;
 	 return false;
 	 return false;
@@ -495,33 +497,69 @@ bool pkgOrderList::VisitRProvides(DepFunc F,VerIterator Ver)
 									/*}}}*/
 									/*}}}*/
 // OrderList::VisitProvides - Visit all of the providing packages	/*{{{*/
 // OrderList::VisitProvides - Visit all of the providing packages	/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
-/* This routine calls visit on all providing packages. */
+/* This routine calls visit on all providing packages.
+
+   If the dependency is negative it first visits packages which are
+   intended to be removed and after that all other packages.
+   It does so to avoid situations in which this package is used to
+   satisfy a (or-group/provides) dependency of another package which
+   could have been satisfied also by upgrading another package -
+   otherwise we have more broken packages dpkg needs to auto-
+   deconfigure and in very complicated situations it even decides
+   against it! */
 bool pkgOrderList::VisitProvides(DepIterator D,bool Critical)
 bool pkgOrderList::VisitProvides(DepIterator D,bool Critical)
-{   
+{
    SPtrArray<Version *> List = D.AllTargets();
    SPtrArray<Version *> List = D.AllTargets();
-   for (Version **I = List; *I != 0; I++)
+   for (Version **I = List; *I != 0; ++I)
    {
    {
       VerIterator Ver(Cache,*I);
       VerIterator Ver(Cache,*I);
       PkgIterator Pkg = Ver.ParentPkg();
       PkgIterator Pkg = Ver.ParentPkg();
 
 
+      if (D.IsNegative() == true && Cache[Pkg].Delete() == false)
+	 continue;
+
       if (Cache[Pkg].Keep() == true && Pkg.State() == PkgIterator::NeedsNothing)
       if (Cache[Pkg].Keep() == true && Pkg.State() == PkgIterator::NeedsNothing)
 	 continue;
 	 continue;
-      
+
       if (D.IsNegative() == false &&
       if (D.IsNegative() == false &&
 	  Cache[Pkg].InstallVer != *I)
 	  Cache[Pkg].InstallVer != *I)
 	 continue;
 	 continue;
-      
+
       if (D.IsNegative() == true &&
       if (D.IsNegative() == true &&
 	  (Version *)Pkg.CurrentVer() != *I)
 	  (Version *)Pkg.CurrentVer() != *I)
 	 continue;
 	 continue;
-      
+
       // Skip over missing files
       // Skip over missing files
       if (Critical == false && IsMissing(D.ParentPkg()) == true)
       if (Critical == false && IsMissing(D.ParentPkg()) == true)
 	 continue;
 	 continue;
 
 
-      if (VisitNode(Pkg) == false)
+      if (VisitNode(Pkg, "Provides-1") == false)
 	 return false;
 	 return false;
    }
    }
+   if (D.IsNegative() == false)
+      return true;
+   for (Version **I = List; *I != 0; ++I)
+   {
+      VerIterator Ver(Cache,*I);
+      PkgIterator Pkg = Ver.ParentPkg();
+
+      if (Cache[Pkg].Delete() == true)
+	 continue;
+
+      if (Cache[Pkg].Keep() == true && Pkg.State() == PkgIterator::NeedsNothing)
+	 continue;
+
+      if ((Version *)Pkg.CurrentVer() != *I)
+	 continue;
+
+      // Skip over missing files
+      if (Critical == false && IsMissing(D.ParentPkg()) == true)
+	 continue;
+
+      if (VisitNode(Pkg, "Provides-2") == false)
+	 return false;
+   }
+
    return true;
    return true;
 }
 }
 									/*}}}*/
 									/*}}}*/
@@ -530,7 +568,7 @@ bool pkgOrderList::VisitProvides(DepIterator D,bool Critical)
 /* This is the core ordering routine. It calls the set dependency
 /* This is the core ordering routine. It calls the set dependency
    consideration functions which then potentialy call this again. Finite
    consideration functions which then potentialy call this again. Finite
    depth is achived through the colouring mechinism. */
    depth is achived through the colouring mechinism. */
-bool pkgOrderList::VisitNode(PkgIterator Pkg)
+bool pkgOrderList::VisitNode(PkgIterator Pkg, char const* from)
 {
 {
    // Looping or irrelevent.
    // Looping or irrelevent.
    // This should probably trancend not installed packages
    // This should probably trancend not installed packages
@@ -541,7 +579,7 @@ bool pkgOrderList::VisitNode(PkgIterator Pkg)
    if (Debug == true)
    if (Debug == true)
    {
    {
       for (int j = 0; j != Depth; j++) clog << ' ';
       for (int j = 0; j != Depth; j++) clog << ' ';
-      clog << "Visit " << Pkg.FullName() << endl;
+      clog << "Visit " << Pkg.FullName() << " from " << from << endl;
    }
    }
    
    
    Depth++;
    Depth++;
@@ -636,7 +674,7 @@ bool pkgOrderList::DepUnPackCrit(DepIterator D)
 	 if (CheckDep(D) == true)
 	 if (CheckDep(D) == true)
 	    continue;
 	    continue;
 
 
-	 if (VisitNode(D.ParentPkg()) == false)
+	 if (VisitNode(D.ParentPkg(), "UnPackCrit") == false)
 	    return false;
 	    return false;
       }
       }
       else
       else
@@ -811,7 +849,7 @@ bool pkgOrderList::DepUnPackDep(DepIterator D)
 	    if (IsMissing(D.ParentPkg()) == true)
 	    if (IsMissing(D.ParentPkg()) == true)
 	       continue;
 	       continue;
 	    
 	    
-	    if (VisitNode(D.ParentPkg()) == false)
+	    if (VisitNode(D.ParentPkg(), "UnPackDep-Parent") == false)
 	       return false;
 	       return false;
 	 }
 	 }
 	 else
 	 else
@@ -825,7 +863,7 @@ bool pkgOrderList::DepUnPackDep(DepIterator D)
 	       if (CheckDep(D) == true)
 	       if (CheckDep(D) == true)
 		 continue;
 		 continue;
 
 
-	       if (VisitNode(D.TargetPkg()) == false)
+	       if (VisitNode(D.TargetPkg(), "UnPackDep-Target") == false)
 		 return false;
 		 return false;
 	    }
 	    }
 	 }
 	 }
@@ -924,7 +962,7 @@ bool pkgOrderList::DepRemove(DepIterator D)
 			if (IsFlag(P, InList) == true &&
 			if (IsFlag(P, InList) == true &&
 			    IsFlag(P, AddPending) == false &&
 			    IsFlag(P, AddPending) == false &&
 			    Cache[P].InstallVer != 0 &&
 			    Cache[P].InstallVer != 0 &&
-			    VisitNode(P) == true)
+			    VisitNode(P, "Remove-P") == true)
 			{
 			{
 			   Flag(P, Immediate);
 			   Flag(P, Immediate);
 			   tryFixDeps = false;
 			   tryFixDeps = false;
@@ -960,7 +998,7 @@ bool pkgOrderList::DepRemove(DepIterator D)
 		  if (IsFlag(F.TargetPkg(), InList) == true &&
 		  if (IsFlag(F.TargetPkg(), InList) == true &&
 		      IsFlag(F.TargetPkg(), AddPending) == false &&
 		      IsFlag(F.TargetPkg(), AddPending) == false &&
 		      Cache[F.TargetPkg()].InstallVer != 0 &&
 		      Cache[F.TargetPkg()].InstallVer != 0 &&
-		      VisitNode(F.TargetPkg()) == true)
+		      VisitNode(F.TargetPkg(), "Remove-Target") == true)
 		  {
 		  {
 		     Flag(F.TargetPkg(), Immediate);
 		     Flag(F.TargetPkg(), Immediate);
 		     tryFixDeps = false;
 		     tryFixDeps = false;
@@ -974,7 +1012,7 @@ bool pkgOrderList::DepRemove(DepIterator D)
 			if (IsFlag(Prv.OwnerPkg(), InList) == true &&
 			if (IsFlag(Prv.OwnerPkg(), InList) == true &&
 			    IsFlag(Prv.OwnerPkg(), AddPending) == false &&
 			    IsFlag(Prv.OwnerPkg(), AddPending) == false &&
 			    Cache[Prv.OwnerPkg()].InstallVer != 0 &&
 			    Cache[Prv.OwnerPkg()].InstallVer != 0 &&
-			    VisitNode(Prv.OwnerPkg()) == true)
+			    VisitNode(Prv.OwnerPkg(), "Remove-Owner") == true)
 			{
 			{
 			   Flag(Prv.OwnerPkg(), Immediate);
 			   Flag(Prv.OwnerPkg(), Immediate);
 			   tryFixDeps = false;
 			   tryFixDeps = false;
@@ -994,7 +1032,7 @@ bool pkgOrderList::DepRemove(DepIterator D)
 	 if (IsMissing(D.ParentPkg()) == true)
 	 if (IsMissing(D.ParentPkg()) == true)
 	    continue;
 	    continue;
 	 
 	 
-	 if (VisitNode(D.ParentPkg()) == false)
+	 if (VisitNode(D.ParentPkg(), "Remove-Parent") == false)
 	    return false;
 	    return false;
       }
       }
    
    

+ 3 - 1
apt-pkg/orderlist.h

@@ -18,6 +18,7 @@
 
 
 
 
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/pkgcache.h>
+#include <apt-pkg/macros.h>
 
 
 class pkgDepCache;
 class pkgDepCache;
 class pkgOrderList : protected pkgCache::Namespace
 class pkgOrderList : protected pkgCache::Namespace
@@ -45,7 +46,8 @@ class pkgOrderList : protected pkgCache::Namespace
    bool Debug;
    bool Debug;
    
    
    // Main visit function
    // Main visit function
-   bool VisitNode(PkgIterator Pkg);
+   __deprecated bool VisitNode(PkgIterator Pkg) { return VisitNode(Pkg, "UNKNOWN"); };
+   bool VisitNode(PkgIterator Pkg, char const* from);
    bool VisitDeps(DepFunc F,PkgIterator Pkg);
    bool VisitDeps(DepFunc F,PkgIterator Pkg);
    bool VisitRDeps(DepFunc F,PkgIterator Pkg);
    bool VisitRDeps(DepFunc F,PkgIterator Pkg);
    bool VisitRProvides(DepFunc F,VerIterator Ver);
    bool VisitRProvides(DepFunc F,VerIterator Ver);

+ 33 - 9
apt-pkg/packagemanager.cc

@@ -13,6 +13,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include<config.h>
+
 #include <apt-pkg/packagemanager.h>
 #include <apt-pkg/packagemanager.h>
 #include <apt-pkg/orderlist.h>
 #include <apt-pkg/orderlist.h>
 #include <apt-pkg/depcache.h>
 #include <apt-pkg/depcache.h>
@@ -22,10 +24,10 @@
 #include <apt-pkg/algorithms.h>
 #include <apt-pkg/algorithms.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/sptr.h>
 #include <apt-pkg/sptr.h>
-    
-#include <apti18n.h>    
+
+#include <apti18n.h>
 #include <iostream>
 #include <iostream>
-#include <fcntl.h> 
+#include <fcntl.h>
 									/*}}}*/
 									/*}}}*/
 using namespace std;
 using namespace std;
 
 
@@ -598,22 +600,44 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate)
    
    
    for (PrvIterator P = instVer.ProvidesList();
    for (PrvIterator P = instVer.ProvidesList();
 	P.end() == false; ++P)
 	P.end() == false; ++P)
-      CheckRConflicts(Pkg,P.ParentPkg().RevDependsList(),P.ProvideVersion());
+      if (Pkg->Group != P.OwnerPkg()->Group)
+	 CheckRConflicts(Pkg,P.ParentPkg().RevDependsList(),P.ProvideVersion());
 
 
    List->Flag(Pkg,pkgOrderList::UnPacked,pkgOrderList::States);
    List->Flag(Pkg,pkgOrderList::UnPacked,pkgOrderList::States);
 
 
-   if ((instVer->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same)
+   if (Immediate == true && instVer->MultiArch == pkgCache::Version::Same)
+   {
+      /* Do lockstep M-A:same unpacking in two phases:
+	 First unpack all installed architectures, then the not installed.
+	 This way we avoid that M-A: enabled packages are installed before
+	 their older non-M-A enabled packages are replaced by newer versions */
+      bool const installed = Pkg->CurrentVer != 0;
+      if (installed == true && Install(Pkg,FileNames[Pkg->ID]) == false)
+	 return false;
       for (PkgIterator P = Pkg.Group().PackageList();
       for (PkgIterator P = Pkg.Group().PackageList();
 	   P.end() == false; P = Pkg.Group().NextPkg(P))
 	   P.end() == false; P = Pkg.Group().NextPkg(P))
       {
       {
-	 if (Pkg == P || List->IsFlag(P,pkgOrderList::UnPacked) == true ||
+	 if (P->CurrentVer == 0 || P == Pkg || List->IsFlag(P,pkgOrderList::UnPacked) == true ||
 	     Cache[P].InstallVer == 0 || (P.CurrentVer() == Cache[P].InstallVer &&
 	     Cache[P].InstallVer == 0 || (P.CurrentVer() == Cache[P].InstallVer &&
 	      (Cache[Pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall))
 	      (Cache[Pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall))
 	    continue;
 	    continue;
-	 SmartUnPack(P, false);
+	 if (SmartUnPack(P, false) == false)
+	    return false;
       }
       }
-
-   if(Install(Pkg,FileNames[Pkg->ID]) == false)
+      if (installed == false && Install(Pkg,FileNames[Pkg->ID]) == false)
+	 return false;
+      for (PkgIterator P = Pkg.Group().PackageList();
+	   P.end() == false; P = Pkg.Group().NextPkg(P))
+      {
+	 if (P->CurrentVer != 0 || P == Pkg || List->IsFlag(P,pkgOrderList::UnPacked) == true ||
+	     Cache[P].InstallVer == 0 || (P.CurrentVer() == Cache[P].InstallVer &&
+	      (Cache[Pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall))
+	    continue;
+	 if (SmartUnPack(P, false) == false)
+	    return false;
+      }
+   }
+   else if (Install(Pkg,FileNames[Pkg->ID]) == false)
       return false;
       return false;
 
 
    // Perform immedate configuration of the package.
    // Perform immedate configuration of the package.

+ 5 - 4
apt-pkg/pkgcache.cc

@@ -20,6 +20,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include<config.h>
+
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/policy.h>
 #include <apt-pkg/policy.h>
 #include <apt-pkg/version.h>
 #include <apt-pkg/version.h>
@@ -29,13 +31,12 @@
 #include <apt-pkg/aptconfiguration.h>
 #include <apt-pkg/aptconfiguration.h>
 #include <apt-pkg/macros.h>
 #include <apt-pkg/macros.h>
 
 
-#include <apti18n.h>
-    
 #include <string>
 #include <string>
 #include <sys/stat.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <unistd.h>
-
 #include <ctype.h>
 #include <ctype.h>
+
+#include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 
 
 using std::string;
 using std::string;
@@ -637,7 +638,7 @@ pkgCache::Version **pkgCache::DepIterator::AllTargets() const
 	    continue;
 	    continue;
 	 
 	 
 	 if (IsNegative() == true &&
 	 if (IsNegative() == true &&
-	     ParentPkg() == I.OwnerPkg())
+	     ParentPkg()->Group == I.OwnerPkg()->Group)
 	    continue;
 	    continue;
 	 
 	 
 	 Size++;
 	 Size++;

+ 3 - 4
apt-pkg/pkgcachegen.cc

@@ -11,6 +11,7 @@
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
 #define APT_COMPATIBILITY 986
 #define APT_COMPATIBILITY 986
+#include <config.h>
 
 
 #include <apt-pkg/pkgcachegen.h>
 #include <apt-pkg/pkgcachegen.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
@@ -23,17 +24,15 @@
 #include <apt-pkg/sptr.h>
 #include <apt-pkg/sptr.h>
 #include <apt-pkg/pkgsystem.h>
 #include <apt-pkg/pkgsystem.h>
 #include <apt-pkg/macros.h>
 #include <apt-pkg/macros.h>
-
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/tagfile.h>
 
 
-#include <apti18n.h>
-
 #include <vector>
 #include <vector>
-
 #include <sys/stat.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <unistd.h>
 #include <errno.h>
 #include <errno.h>
 #include <stdio.h>
 #include <stdio.h>
+
+#include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 typedef vector<pkgIndexFile *>::iterator FileIterator;
 typedef vector<pkgIndexFile *>::iterator FileIterator;
 template <typename Iter> std::vector<Iter*> pkgCacheGenerator::Dynamic<Iter>::toReMap;
 template <typename Iter> std::vector<Iter*> pkgCacheGenerator::Dynamic<Iter>::toReMap;

+ 4 - 2
apt-pkg/pkgrecords.cc

@@ -9,12 +9,14 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include<config.h>
+
 #include <apt-pkg/pkgrecords.h>
 #include <apt-pkg/pkgrecords.h>
 #include <apt-pkg/indexfile.h>
 #include <apt-pkg/indexfile.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/configuration.h>
-    
-#include <apti18n.h>   
+
+#include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 
 
 // Records::pkgRecords - Constructor					/*{{{*/
 // Records::pkgRecords - Constructor					/*{{{*/

+ 0 - 1
apt-pkg/pkgrecords.h

@@ -19,7 +19,6 @@
 
 
 
 
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/pkgcache.h>
-#include <apt-pkg/fileutl.h>
 #include <vector>
 #include <vector>
 
 
 class pkgRecords							/*{{{*/
 class pkgRecords							/*{{{*/

+ 2 - 0
apt-pkg/pkgsystem.cc

@@ -10,6 +10,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include<config.h>
+
 #include <apt-pkg/pkgsystem.h>
 #include <apt-pkg/pkgsystem.h>
 #include <apt-pkg/policy.h>
 #include <apt-pkg/policy.h>
 #include <cassert>
 #include <cassert>

+ 4 - 2
apt-pkg/policy.cc

@@ -23,6 +23,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include<config.h>
+
 #include <apt-pkg/policy.h>
 #include <apt-pkg/policy.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/tagfile.h>
@@ -31,10 +33,10 @@
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/sptr.h>
 #include <apt-pkg/sptr.h>
 
 
-#include <apti18n.h>
-
 #include <iostream>
 #include <iostream>
 #include <sstream>
 #include <sstream>
+
+#include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 
 
 using namespace std;
 using namespace std;

+ 4 - 2
apt-pkg/sourcelist.cc

@@ -8,15 +8,17 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include<config.h>
+
 #include <apt-pkg/sourcelist.h>
 #include <apt-pkg/sourcelist.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/configuration.h>
 
 
-#include <apti18n.h>
-
 #include <fstream>
 #include <fstream>
+
+#include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 
 
 using namespace std;
 using namespace std;

+ 4 - 2
apt-pkg/srcrecords.cc

@@ -11,12 +11,14 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include<config.h>
+
 #include <apt-pkg/srcrecords.h>
 #include <apt-pkg/srcrecords.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/sourcelist.h>
 #include <apt-pkg/sourcelist.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/strutl.h>
-    
-#include <apti18n.h>    
+
+#include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 
 
 // SrcRecords::pkgSrcRecords - Constructor				/*{{{*/
 // SrcRecords::pkgSrcRecords - Constructor				/*{{{*/

+ 13 - 11
apt-pkg/tagfile.cc

@@ -11,15 +11,17 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include<config.h>
+
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/strutl.h>
 
 
-#include <apti18n.h>
-    
 #include <string>
 #include <string>
 #include <stdio.h>
 #include <stdio.h>
 #include <ctype.h>
 #include <ctype.h>
+
+#include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 
 
 using std::string;
 using std::string;
@@ -27,7 +29,7 @@ using std::string;
 class pkgTagFilePrivate
 class pkgTagFilePrivate
 {
 {
 public:
 public:
-   pkgTagFilePrivate(FileFd *pFd, unsigned long Size) : Fd(*pFd), Size(Size)
+   pkgTagFilePrivate(FileFd *pFd, unsigned long long Size) : Fd(*pFd), Size(Size)
    {
    {
    }
    }
    FileFd &Fd;
    FileFd &Fd;
@@ -35,14 +37,14 @@ public:
    char *Start;
    char *Start;
    char *End;
    char *End;
    bool Done;
    bool Done;
-   unsigned long iOffset;
-   unsigned long Size;
+   unsigned long long iOffset;
+   unsigned long long Size;
 };
 };
 
 
 // TagFile::pkgTagFile - Constructor					/*{{{*/
 // TagFile::pkgTagFile - Constructor					/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-pkgTagFile::pkgTagFile(FileFd *pFd,unsigned long Size)
+pkgTagFile::pkgTagFile(FileFd *pFd,unsigned long long Size)
 {
 {
    d = new pkgTagFilePrivate(pFd, Size);
    d = new pkgTagFilePrivate(pFd, Size);
 
 
@@ -84,7 +86,7 @@ unsigned long pkgTagFile::Offset()
 bool pkgTagFile::Resize()
 bool pkgTagFile::Resize()
 {
 {
    char *tmp;
    char *tmp;
-   unsigned long EndSize = d->End - d->Start;
+   unsigned long long EndSize = d->End - d->Start;
 
 
    // fail is the buffer grows too big
    // fail is the buffer grows too big
    if(d->Size > 1024*1024+1)
    if(d->Size > 1024*1024+1)
@@ -136,8 +138,8 @@ bool pkgTagFile::Step(pkgTagSection &Tag)
    then fills the rest from the file */
    then fills the rest from the file */
 bool pkgTagFile::Fill()
 bool pkgTagFile::Fill()
 {
 {
-   unsigned long EndSize = d->End - d->Start;
-   unsigned long Actual = 0;
+   unsigned long long EndSize = d->End - d->Start;
+   unsigned long long Actual = 0;
    
    
    memmove(d->Buffer,d->Start,EndSize);
    memmove(d->Buffer,d->Start,EndSize);
    d->Start = d->Buffer;
    d->Start = d->Buffer;
@@ -178,12 +180,12 @@ bool pkgTagFile::Fill()
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* This jumps to a pre-recorded file location and reads the record
 /* This jumps to a pre-recorded file location and reads the record
    that is there */
    that is there */
-bool pkgTagFile::Jump(pkgTagSection &Tag,unsigned long Offset)
+bool pkgTagFile::Jump(pkgTagSection &Tag,unsigned long long Offset)
 {
 {
    // We are within a buffer space of the next hit..
    // We are within a buffer space of the next hit..
    if (Offset >= d->iOffset && d->iOffset + (d->End - d->Start) > Offset)
    if (Offset >= d->iOffset && d->iOffset + (d->End - d->Start) > Offset)
    {
    {
-      unsigned long Dist = Offset - d->iOffset;
+      unsigned long long Dist = Offset - d->iOffset;
       d->Start += Dist;
       d->Start += Dist;
       d->iOffset += Dist;
       d->iOffset += Dist;
       return Step(Tag);
       return Step(Tag);

+ 2 - 2
apt-pkg/tagfile.h

@@ -94,9 +94,9 @@ class pkgTagFile
 
 
    bool Step(pkgTagSection &Section);
    bool Step(pkgTagSection &Section);
    unsigned long Offset();
    unsigned long Offset();
-   bool Jump(pkgTagSection &Tag,unsigned long Offset);
+   bool Jump(pkgTagSection &Tag,unsigned long long Offset);
 
 
-   pkgTagFile(FileFd *F,unsigned long Size = 32*1024);
+   pkgTagFile(FileFd *F,unsigned long long Size = 32*1024);
    virtual ~pkgTagFile();
    virtual ~pkgTagFile();
 };
 };
 
 

+ 2 - 0
apt-pkg/vendor.cc

@@ -1,3 +1,5 @@
+#include<config.h>
+
 #include <iostream>
 #include <iostream>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/vendor.h>
 #include <apt-pkg/vendor.h>

+ 2 - 0
apt-pkg/vendorlist.cc

@@ -1,3 +1,5 @@
+#include<config.h>
+
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apti18n.h>
 #include <apti18n.h>

+ 2 - 0
apt-pkg/version.cc

@@ -8,6 +8,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include<config.h>
+
 #include <apt-pkg/version.h>
 #include <apt-pkg/version.h>
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/pkgcache.h>
 
 

+ 2 - 2
apt-pkg/versionmatch.cc

@@ -11,8 +11,9 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
-#include <apt-pkg/versionmatch.h>
+#include<config.h>
 
 
+#include <apt-pkg/versionmatch.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 
 
@@ -21,7 +22,6 @@
 #include <fnmatch.h>
 #include <fnmatch.h>
 #include <sys/types.h>
 #include <sys/types.h>
 #include <regex.h>
 #include <regex.h>
-
 									/*}}}*/
 									/*}}}*/
 
 
 // VersionMatch::pkgVersionMatch - Constructor				/*{{{*/
 // VersionMatch::pkgVersionMatch - Constructor				/*{{{*/

+ 3 - 0
buildlib/config.h.in

@@ -33,6 +33,9 @@
 /* If there is no socklen_t, define this for the netdb shim */
 /* If there is no socklen_t, define this for the netdb shim */
 #undef NEED_SOCKLEN_T_DEFINE
 #undef NEED_SOCKLEN_T_DEFINE
 
 
+/* Define to the size of the filesize containing structures */
+#undef _FILE_OFFSET_BITS
+
 /* Define the arch name string */
 /* Define the arch name string */
 #undef COMMON_ARCH
 #undef COMMON_ARCH
 
 

+ 2 - 2
buildlib/defaults.mak

@@ -118,10 +118,10 @@ MKDIRS := $(BIN)
 # list
 # list
 .PHONY: headers library clean veryclean all binary program doc dirs
 .PHONY: headers library clean veryclean all binary program doc dirs
 .PHONY: maintainer-clean dist-clean distclean pristine sanity
 .PHONY: maintainer-clean dist-clean distclean pristine sanity
-all: binary doc
+all: dirs binary doc
 binary: library program
 binary: library program
 maintainer-clean dist-clean distclean pristine sanity: veryclean
 maintainer-clean dist-clean distclean pristine sanity: veryclean
-headers library clean veryclean program:
+headers library clean veryclean program test:
 
 
 veryclean:
 veryclean:
 	echo Very Clean done for $(SUBDIR)
 	echo Very Clean done for $(SUBDIR)

+ 11 - 9
cmdline/acqprogress.cc

@@ -8,19 +8,21 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include files							/*{{{*/
 // Include files							/*{{{*/
-#include "acqprogress.h"
+#include<config.h>
+
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/acquire-worker.h>
 #include <apt-pkg/acquire-worker.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 
 
-#include <apti18n.h>
-    
 #include <stdio.h>
 #include <stdio.h>
 #include <signal.h>
 #include <signal.h>
 #include <iostream>
 #include <iostream>
 #include <unistd.h>
 #include <unistd.h>
+
+#include "acqprogress.h"
+#include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 
 
 using namespace std;
 using namespace std;
@@ -161,7 +163,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner)
       ScreenWidth = sizeof(Buffer)-1;
       ScreenWidth = sizeof(Buffer)-1;
 
 
    // Put in the percent done
    // Put in the percent done
-   sprintf(S,"%ld%%",long(double((CurrentBytes + CurrentItems)*100.0)/double(TotalBytes+TotalItems)));
+   sprintf(S,"%.0f%%",((CurrentBytes + CurrentItems)*100.0)/(TotalBytes+TotalItems));
 
 
    bool Shown = false;
    bool Shown = false;
    for (pkgAcquire::Worker *I = Owner->WorkersBegin(); I != 0;
    for (pkgAcquire::Worker *I = Owner->WorkersBegin(); I != 0;
@@ -212,11 +214,11 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner)
       if (I->TotalSize > 0 && I->CurrentItem->Owner->Complete == false)
       if (I->TotalSize > 0 && I->CurrentItem->Owner->Complete == false)
       {
       {
 	 if (Mode == Short)
 	 if (Mode == Short)
-	    snprintf(S,End-S," %lu%%",
-		     long(double(I->CurrentSize*100.0)/double(I->TotalSize)));
+	    snprintf(S,End-S," %.0f%%",
+		     (I->CurrentSize*100.0)/I->TotalSize);
 	 else
 	 else
-	    snprintf(S,End-S,"/%sB %lu%%",SizeToStr(I->TotalSize).c_str(),
-		     long(double(I->CurrentSize*100.0)/double(I->TotalSize)));
+	    snprintf(S,End-S,"/%sB %.0f%%",SizeToStr(I->TotalSize).c_str(),
+		     (I->CurrentSize*100.0)/I->TotalSize);
       }      
       }      
       S += strlen(S);
       S += strlen(S);
       snprintf(S,End-S,"]");
       snprintf(S,End-S,"]");
@@ -236,7 +238,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner)
    if (CurrentCPS != 0)
    if (CurrentCPS != 0)
    {      
    {      
       char Tmp[300];
       char Tmp[300];
-      unsigned long ETA = (unsigned long)((TotalBytes - CurrentBytes)/CurrentCPS);
+      unsigned long long ETA = (TotalBytes - CurrentBytes)/CurrentCPS;
       sprintf(Tmp," %sB/s %s",SizeToStr(CurrentCPS).c_str(),TimeToStr(ETA).c_str());
       sprintf(Tmp," %sB/s %s",SizeToStr(CurrentCPS).c_str(),TimeToStr(ETA).c_str());
       unsigned int Len = strlen(Buffer);
       unsigned int Len = strlen(Buffer);
       unsigned int LenT = strlen(Tmp);
       unsigned int LenT = strlen(Tmp);

+ 5 - 5
cmdline/apt-cache.cc

@@ -13,8 +13,9 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include<config.h>
+
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
-#include <cassert>
 #include <apt-pkg/pkgcachegen.h>
 #include <apt-pkg/pkgcachegen.h>
 #include <apt-pkg/cachefile.h>
 #include <apt-pkg/cachefile.h>
 #include <apt-pkg/cacheset.h>
 #include <apt-pkg/cacheset.h>
@@ -31,17 +32,16 @@
 #include <apt-pkg/algorithms.h>
 #include <apt-pkg/algorithms.h>
 #include <apt-pkg/sptr.h>
 #include <apt-pkg/sptr.h>
 
 
-#include <config.h>
-#include <apti18n.h>
-
+#include <cassert>
 #include <locale.h>
 #include <locale.h>
 #include <iostream>
 #include <iostream>
 #include <unistd.h>
 #include <unistd.h>
 #include <errno.h>
 #include <errno.h>
 #include <regex.h>
 #include <regex.h>
 #include <stdio.h>
 #include <stdio.h>
-
 #include <iomanip>
 #include <iomanip>
+
+#include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 
 
 using namespace std;
 using namespace std;

+ 4 - 4
cmdline/apt-cdrom.cc

@@ -11,6 +11,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include<config.h>
+
 #include <apt-pkg/cmndline.h>
 #include <apt-pkg/cmndline.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/init.h>
 #include <apt-pkg/init.h>
@@ -21,10 +23,6 @@
 #include <apt-pkg/acquire.h>
 #include <apt-pkg/acquire.h>
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/cdrom.h>
 #include <apt-pkg/cdrom.h>
-#include <config.h>
-#include <apti18n.h>
-    
-//#include "indexcopy.h"
 
 
 #include <locale.h>
 #include <locale.h>
 #include <iostream>
 #include <iostream>
@@ -36,6 +34,8 @@
 #include <dirent.h>
 #include <dirent.h>
 #include <unistd.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <stdio.h>
+
+#include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 
 
 using namespace std;
 using namespace std;

+ 4 - 3
cmdline/apt-config.cc

@@ -16,6 +16,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include<config.h>
+
 #include <apt-pkg/cmndline.h>
 #include <apt-pkg/cmndline.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/init.h>
 #include <apt-pkg/init.h>
@@ -23,13 +25,12 @@
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/aptconfiguration.h>
 #include <apt-pkg/aptconfiguration.h>
 
 
-#include <config.h>
-#include <apti18n.h>
-
 #include <locale.h>
 #include <locale.h>
 #include <iostream>
 #include <iostream>
 #include <string>
 #include <string>
 #include <vector>
 #include <vector>
+
+#include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 using namespace std;
 using namespace std;
 
 

+ 3 - 2
cmdline/apt-extracttemplates.cc

@@ -13,6 +13,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include<config.h>
+
 #include <apt-pkg/init.h>
 #include <apt-pkg/init.h>
 #include <apt-pkg/cmndline.h>
 #include <apt-pkg/cmndline.h>
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/pkgcache.h>
@@ -28,7 +30,7 @@
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/fileutl.h>
-	
+
 #include <stdio.h>
 #include <stdio.h>
 #include <string.h>
 #include <string.h>
 #include <stdlib.h>
 #include <stdlib.h>
@@ -36,7 +38,6 @@
 #include <fstream>
 #include <fstream>
 
 
 #include <locale.h>
 #include <locale.h>
-#include <config.h>
 #include <apti18n.h>
 #include <apti18n.h>
 #include "apt-extracttemplates.h"
 #include "apt-extracttemplates.h"
 									/*}}}*/
 									/*}}}*/

+ 16 - 13
cmdline/apt-get.cc

@@ -25,8 +25,7 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
-#define _LARGEFILE_SOURCE
-#define _LARGEFILE64_SOURCE
+#include <config.h>
 
 
 #include <apt-pkg/aptconfiguration.h>
 #include <apt-pkg/aptconfiguration.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
@@ -46,9 +45,6 @@
 #include <apt-pkg/md5.h>
 #include <apt-pkg/md5.h>
 #include <apt-pkg/versionmatch.h>
 #include <apt-pkg/versionmatch.h>
 
 
-#include <config.h>
-#include <apti18n.h>
-
 #include "acqprogress.h"
 #include "acqprogress.h"
 
 
 #include <set>
 #include <set>
@@ -68,8 +64,7 @@
 #include <sys/wait.h>
 #include <sys/wait.h>
 #include <sstream>
 #include <sstream>
 
 
-#define statfs statfs64
-#define statvfs statvfs64
+#include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 
 
 #define RAMFS_MAGIC     0x858458f6
 #define RAMFS_MAGIC     0x858458f6
@@ -1630,7 +1625,8 @@ bool DoUpdate(CommandLine &CmdL)
    if (_config->FindB("APT::Get::Download",true) == true)
    if (_config->FindB("APT::Get::Download",true) == true)
        ListUpdate(Stat, *List);
        ListUpdate(Stat, *List);
 
 
-   // Rebuild the cache.   
+   // Rebuild the cache.
+   pkgCacheFile::RemoveCaches();
    if (Cache.BuildCaches() == false)
    if (Cache.BuildCaches() == false)
       return false;
       return false;
    
    
@@ -2210,10 +2206,14 @@ bool DoDSelectUpgrade(CommandLine &CmdL)
 /* */
 /* */
 bool DoClean(CommandLine &CmdL)
 bool DoClean(CommandLine &CmdL)
 {
 {
+   std::string const archivedir = _config->FindDir("Dir::Cache::archives");
+   std::string const pkgcache = _config->FindFile("Dir::cache::pkgcache");
+   std::string const srcpkgcache = _config->FindFile("Dir::cache::srcpkgcache");
+
    if (_config->FindB("APT::Get::Simulate") == true)
    if (_config->FindB("APT::Get::Simulate") == true)
    {
    {
-      cout << "Del " << _config->FindDir("Dir::Cache::archives") << "* " <<
-	 _config->FindDir("Dir::Cache::archives") << "partial/*" << endl;
+      cout << "Del " << archivedir << "* " << archivedir << "partial/*"<< endl
+	   << "Del " << pkgcache << " " << srcpkgcache << endl;
       return true;
       return true;
    }
    }
    
    
@@ -2221,14 +2221,17 @@ bool DoClean(CommandLine &CmdL)
    FileFd Lock;
    FileFd Lock;
    if (_config->FindB("Debug::NoLocking",false) == false)
    if (_config->FindB("Debug::NoLocking",false) == false)
    {
    {
-      Lock.Fd(GetLock(_config->FindDir("Dir::Cache::Archives") + "lock"));
+      Lock.Fd(GetLock(archivedir + "lock"));
       if (_error->PendingError() == true)
       if (_error->PendingError() == true)
 	 return _error->Error(_("Unable to lock the download directory"));
 	 return _error->Error(_("Unable to lock the download directory"));
    }
    }
    
    
    pkgAcquire Fetcher;
    pkgAcquire Fetcher;
-   Fetcher.Clean(_config->FindDir("Dir::Cache::archives"));
-   Fetcher.Clean(_config->FindDir("Dir::Cache::archives") + "partial/");
+   Fetcher.Clean(archivedir);
+   Fetcher.Clean(archivedir + "partial/");
+
+   pkgCacheFile::RemoveCaches();
+
    return true;
    return true;
 }
 }
 									/*}}}*/
 									/*}}}*/

+ 1 - 1
cmdline/apt-key

@@ -152,7 +152,7 @@ if [ "$1" = "--keyring" ]; then
         #echo "keyfile given"
         #echo "keyfile given"
 	shift
 	shift
 	TRUSTEDFILE="$1"
 	TRUSTEDFILE="$1"
-	if [ -r "$TRUSTEDFILE" ]; then
+	if [ -r "$TRUSTEDFILE" ] || [ "$2" = 'add' ]; then
 		GPG="$GPG --keyring $TRUSTEDFILE --primary-keyring $TRUSTEDFILE"
 		GPG="$GPG --keyring $TRUSTEDFILE --primary-keyring $TRUSTEDFILE"
 	else
 	else
 		echo >&2 "Error: The specified keyring »$TRUSTEDFILE« is missing or not readable"
 		echo >&2 "Error: The specified keyring »$TRUSTEDFILE« is missing or not readable"

+ 4 - 3
cmdline/apt-mark.cc

@@ -5,6 +5,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include <config.h>
+
 #include <apt-pkg/cachefile.h>
 #include <apt-pkg/cachefile.h>
 #include <apt-pkg/cacheset.h>
 #include <apt-pkg/cacheset.h>
 #include <apt-pkg/cmndline.h>
 #include <apt-pkg/cmndline.h>
@@ -12,10 +14,9 @@
 #include <apt-pkg/init.h>
 #include <apt-pkg/init.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/strutl.h>
 
 
-#include <config.h>
-#include <apti18n.h>
-
 #include <algorithm>
 #include <algorithm>
+
+#include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 using namespace std;
 using namespace std;
 
 

+ 4 - 3
cmdline/apt-sortpkgs.cc

@@ -12,6 +12,8 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
+#include <config.h>
+
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/configuration.h>
@@ -19,14 +21,13 @@
 #include <apt-pkg/init.h>
 #include <apt-pkg/init.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/strutl.h>
 
 
-#include <config.h>
-#include <apti18n.h>
-    
 #include <vector>
 #include <vector>
 #include <algorithm>
 #include <algorithm>
 
 
 #include <locale.h>
 #include <locale.h>
 #include <unistd.h>
 #include <unistd.h>
+
+#include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 
 
 using namespace std;
 using namespace std;

+ 5 - 1
configure.in

@@ -31,6 +31,10 @@ AC_CHECK_TOOL_PREFIX
 AC_PROG_CC
 AC_PROG_CC
 AC_ISC_POSIX
 AC_ISC_POSIX
 
 
+dnl check for large file support and enable it if possible
+dnl do this early as other stuff might depend on it
+AC_SYS_LARGEFILE
+
 dnl Check for other programs
 dnl Check for other programs
 AC_PROG_CXX
 AC_PROG_CXX
 AC_PROG_CPP
 AC_PROG_CPP
@@ -151,7 +155,7 @@ if test "$cross_compiling" = "yes" -a "x$archline" = "x"; then
   AC_MSG_ERROR(When cross compiling, architecture must be present in sizetable)
   AC_MSG_ERROR(When cross compiling, architecture must be present in sizetable)
 fi
 fi
 AC_C_BIGENDIAN
 AC_C_BIGENDIAN
-   
+
 dnl We do not need this if we have inttypes!
 dnl We do not need this if we have inttypes!
 HAVE_C9X=yes
 HAVE_C9X=yes
 if test x"$apt_cv_c9x_ints" = x"no"; then
 if test x"$apt_cv_c9x_ints" = x"no"; then

+ 51 - 0
debian/changelog

@@ -1,3 +1,12 @@
+apt (0.8.16~exp6) experimental; urgency=low
+
+  [ David Kalnischkies ]
+  * Support large files in the complete toolset. Indexes of this
+    size are pretty unlikely for now, but we need it for deb
+    packages which could become bigger than 4GB now (LP: #815895)
+
+ -- David Kalnischkies <kalnischkies@gmail.com>  Tue, 13 Sep 2011 17:51:49 +0200
+
 apt (0.8.16~exp5) experimental; urgency=low
 apt (0.8.16~exp5) experimental; urgency=low
 
 
   * merged the latest debian-sid fixes
   * merged the latest debian-sid fixes
@@ -115,6 +124,48 @@ apt (0.8.16~exp1) experimental; urgency=low
 
 
  -- Michael Vogt <mvo@debian.org>  Wed, 29 Jun 2011 12:40:31 +0200
  -- Michael Vogt <mvo@debian.org>  Wed, 29 Jun 2011 12:40:31 +0200
 
 
+apt (0.8.15.7) unstable; urgency=low
+
+  [ David Kalnischkies ]
+  * apt-pkg/packagemanager.cc, apt-pkg/pkgcache.cc:
+    - ignore "self"-conflicts for all architectures of a package
+      instead of just for the architecture of the package look at
+      in the ordering of installations, too (LP: #802901)
+    - M-A:same lockstep unpack should operate on installed
+      packages first (LP: #835625)
+  * test/*
+    - reorganize the various testcases and helper we have and
+      integrate them better into the buildsystem
+    - run the test/libapt testcases at package build-time
+  * debian/apt.symbols:
+    - add the newly added symbols since 0.8.15.3
+  * cmdline/apt-get.cc:
+    - remove the binary caches in 'apt-get clean' as it is the first
+      thing recommend by many supporters in case of APT segfaults
+    - remove the caches in 'apt-get update', too, as they will be
+      invalid in most cases anyway
+  * apt-pkg/acquire-item.cc:
+    - if no Release.gpg file is found try to verify with hashes,
+      but do not fail if a hash can't be found
+  * apt-pkg/acquire.cc:
+    - non-existing directories are by definition clean
+  * cmdline/apt-key:
+    - if command is 'add' do not error out if the specified
+      keyring doesn't exist, it will be created by gpg
+  * apt-pkg/orderlist.cc:
+    - prefer visiting packages marked for deletion in VisitProvides
+      if we are operating on a negative dependency so that we can
+      deal early with the fallout of this remove
+  * apt-pkg/indexrecords.cc:
+    - fix Acquire::Max-ValidTime option by interpreting it really
+      as seconds as specified in the manpage and not as days
+    - add an Acquire::Min-ValidTime option (Closes: #640122)
+  * doc/apt.conf.5.xml:
+    - reword Acquire::Max-ValidTime documentation to make clear
+      that it doesn't provide the new Min-ValidTime functionality
+
+ -- Michael Vogt <mvo@debian.org>  Mon, 12 Sep 2011 16:38:46 +0200
+
 apt (0.8.15.6) unstable; urgency=low
 apt (0.8.15.6) unstable; urgency=low
 
 
   [ Michael Vogt ]
   [ Michael Vogt ]

+ 6 - 1
debian/libapt-pkg4.11.symbols

@@ -562,7 +562,6 @@ libapt-pkg.so.4.11 libapt-pkg4.11 #MINVER#
  (c++)"pkgCacheGenerator::ListParser::NewProvides(pkgCache::VerIterator&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.8.0
  (c++)"pkgCacheGenerator::ListParser::NewProvides(pkgCache::VerIterator&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.8.0
  (c++)"pkgCacheGenerator::ListParser::CollectFileProvides(pkgCache&, pkgCache::VerIterator&)@Base" 0.8.0
  (c++)"pkgCacheGenerator::ListParser::CollectFileProvides(pkgCache&, pkgCache::VerIterator&)@Base" 0.8.0
  (c++)"pkgCacheGenerator::ListParser::~ListParser()@Base" 0.8.0
  (c++)"pkgCacheGenerator::ListParser::~ListParser()@Base" 0.8.0
- (c++)"pkgCacheGenerator::NewDepends(pkgCache::PkgIterator&, pkgCache::VerIterator&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int const&, unsigned int const&, unsigned int*)@Base" 0.8.0
  (c++)"pkgCacheGenerator::NewFileVer(pkgCache::VerIterator&, pkgCacheGenerator::ListParser&)@Base" 0.8.0
  (c++)"pkgCacheGenerator::NewFileVer(pkgCache::VerIterator&, pkgCacheGenerator::ListParser&)@Base" 0.8.0
  (c++)"pkgCacheGenerator::NewPackage(pkgCache::PkgIterator&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.8.0
  (c++)"pkgCacheGenerator::NewPackage(pkgCache::PkgIterator&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.8.0
  (c++)"pkgCacheGenerator::NewVersion(pkgCache::VerIterator&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long)@Base" 0.8.0
  (c++)"pkgCacheGenerator::NewVersion(pkgCache::VerIterator&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long)@Base" 0.8.0
@@ -1327,3 +1326,9 @@ libapt-pkg.so.4.11 libapt-pkg4.11 #MINVER#
  (c++)"pkgDepCache::IsModeChangeOk(pkgDepCache::ModeList, pkgCache::PkgIterator const&, unsigned long, bool)@Base" 0.8.13.2
  (c++)"pkgDepCache::IsModeChangeOk(pkgDepCache::ModeList, pkgCache::PkgIterator const&, unsigned long, bool)@Base" 0.8.13.2
  (c++)"pkgPackageManager::SmartUnPack(pkgCache::PkgIterator, bool)@Base" 0.8.15~exp1
  (c++)"pkgPackageManager::SmartUnPack(pkgCache::PkgIterator, bool)@Base" 0.8.15~exp1
  (c++)"pkgCache::DepIterator::IsNegative() const@Base" 0.8.15~exp1
  (c++)"pkgCache::DepIterator::IsNegative() const@Base" 0.8.15~exp1
+ (c++)"Configuration::CndSet(char const*, int)@Base" 0.8.15.3
+ (c++)"pkgProblemResolver::InstOrNewPolicyBroken(pkgCache::PkgIterator)@Base" 0.8.15.3
+ (c++)"DeEscapeString(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.8.15.4
+ (c++)"GetModificationTime(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.8.15.6
+ (c++)"pkgSourceList::GetLastModifiedTime()@Base" 0.8.15.6
+ (c++)"pkgCacheGenerator::NewDepends(pkgCache::PkgIterator&, pkgCache::VerIterator&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int const&, unsigned int const&, unsigned int*&)@Base" 0.8.15.6

+ 6 - 1
debian/rules

@@ -100,7 +100,12 @@ build/build-stamp: build/configure-stamp
 	# compat symlink for the locale split
 	# compat symlink for the locale split
 	mkdir -p build/usr/share 
 	mkdir -p build/usr/share 
 	cd build/usr/share && ln -f -s ../../locale .
 	cd build/usr/share && ln -f -s ../../locale .
-	# done here
+	# compile and run tests
+ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
+	$(MAKE) test
+else
+	@echo "Tests DISABLED"
+endif
 	touch $@
 	touch $@
 
 
 build/build-doc-stamp: build/configure-stamp
 build/build-doc-stamp: build/configure-stamp

+ 17 - 8
doc/apt.conf.5.xml

@@ -267,14 +267,23 @@ DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt";};
 
 
      <varlistentry><term>Max-ValidTime</term>
      <varlistentry><term>Max-ValidTime</term>
 	 <listitem><para>Seconds the Release file should be considered valid after
 	 <listitem><para>Seconds the Release file should be considered valid after
-	 it was created. The default is "for ever" (0) if the Release file of the
-	 archive doesn't include a <literal>Valid-Until</literal> header.
-	 If it does then this date is the default. The date from the Release file or
-	 the date specified by the creation time of the Release file
-	 (<literal>Date</literal> header) plus the seconds specified with this
-	 options are used to check if the validation of a file has expired by using
-	 the earlier date of the two. Archive specific settings can be made by
-	 appending the label of the archive to the option name.
+	 it was created (indicated by the <literal>Date</literal> header).
+	 If the Release file itself includes a <literal>Valid-Until</literal> header
+	 the earlier date of the two is used as the expiration date.
+	 The default value is <literal>0</literal> which stands for "for ever".
+	 Archive specific settings can be made by appending the label of the archive
+	 to the option name.
+	 </para></listitem>
+     </varlistentry>
+
+     <varlistentry><term>Min-ValidTime</term>
+	 <listitem><para>Minimum of seconds the Release file should be considered
+	 valid after it was created (indicated by the <literal>Date</literal> header).
+	 Use this if you need to use a seldomly updated (local) mirror of a more
+	 regular updated archive with a <literal>Valid-Until</literal> header
+	 instead of competely disabling the expiration date checking.
+	 Archive specific settings can and should be used by appending the label of
+	 the archive to the option name.
 	 </para></listitem>
 	 </para></listitem>
      </varlistentry>
      </varlistentry>
 
 

+ 0 - 0
ftparchive/apt-ftparchive.cc


Неке датотеке нису приказане због велике количине промена