Explorar o código

merge with debian/experimental

David Kalnischkies %!s(int64=15) %!d(string=hai) anos
pai
achega
74b2200285
Modificáronse 100 ficheiros con 10742 adicións e 8591 borrados
  1. 23 23
      apt-pkg/acquire-item.cc
  2. 30 5
      apt-pkg/acquire-item.h
  3. 3 7
      apt-pkg/acquire-method.cc
  4. 13 11
      apt-pkg/acquire.cc
  5. 2 0
      apt-pkg/acquire.h
  6. 31 31
      apt-pkg/algorithms.cc
  7. 3 3
      apt-pkg/aptconfiguration.cc
  8. 2 1
      apt-pkg/aptconfiguration.h
  9. 14 22
      apt-pkg/cdrom.cc
  10. 3 5
      apt-pkg/cdrom.h
  11. 2 2
      apt-pkg/clean.cc
  12. 3 1
      apt-pkg/contrib/cdromutl.cc
  13. 4 4
      apt-pkg/contrib/configuration.cc
  14. 1 1
      apt-pkg/contrib/configuration.h
  15. 3 3
      apt-pkg/contrib/error.cc
  16. 11 0
      apt-pkg/contrib/fileutl.cc
  17. 1 0
      apt-pkg/contrib/fileutl.h
  18. 4 3
      apt-pkg/contrib/netrc.cc
  19. 2 3
      apt-pkg/contrib/sha1.cc
  20. 1 1
      apt-pkg/contrib/sha256.h
  21. 0 9
      apt-pkg/contrib/sha2_internal.h
  22. 73 12
      apt-pkg/contrib/strutl.cc
  23. 4 0
      apt-pkg/contrib/strutl.h
  24. 3 3
      apt-pkg/deb/debindexfile.cc
  25. 26 9
      apt-pkg/deb/deblistparser.cc
  26. 6 6
      apt-pkg/deb/debmetaindex.cc
  27. 10 1
      apt-pkg/deb/debrecords.cc
  28. 3 0
      apt-pkg/deb/debrecords.h
  29. 10 10
      apt-pkg/deb/dpkgpm.cc
  30. 16 16
      apt-pkg/depcache.cc
  31. 11 3
      apt-pkg/depcache.h
  32. 10 11
      apt-pkg/indexcopy.cc
  33. 2 1
      apt-pkg/indexfile.cc
  34. 1 1
      apt-pkg/makefile
  35. 13 13
      apt-pkg/orderlist.cc
  36. 16 16
      apt-pkg/packagemanager.cc
  37. 18 13
      apt-pkg/pkgcache.cc
  38. 3 0
      apt-pkg/pkgcache.h
  39. 37 21
      apt-pkg/pkgcachegen.cc
  40. 1 1
      apt-pkg/pkgcachegen.h
  41. 1 1
      apt-pkg/pkgrecords.cc
  42. 4 1
      apt-pkg/pkgrecords.h
  43. 23 9
      apt-pkg/policy.cc
  44. 28 6
      apt-pkg/sourcelist.cc
  45. 3 0
      apt-pkg/sourcelist.h
  46. 5 5
      apt-pkg/srcrecords.cc
  47. 1 1
      apt-pkg/tagfile.h
  48. 3 3
      apt-pkg/vendorlist.cc
  49. 3 3
      apt-pkg/versionmatch.cc
  50. 52 52
      cmdline/apt-cache.cc
  51. 230 133
      cmdline/apt-get.cc
  52. 4 1
      cmdline/apt-key
  53. 1 1
      cmdline/apt-sortpkgs.cc
  54. 1 1
      cmdline/makefile
  55. 1 1
      configure.in
  56. 5 0
      debian/apt.postinst
  57. 129 4
      debian/changelog
  58. 1 1
      doc/apt-cache.8.xml
  59. 24 3
      doc/apt-get.8.xml
  60. 1 0
      doc/examples/configure-index
  61. 1 1
      doc/po/apt-doc.pot
  62. 2 2
      doc/po/de.po
  63. 1 1
      doc/po/es.po
  64. 1 1
      doc/po/fr.po
  65. 1 1
      doc/po/it.po
  66. 2 2
      doc/po/ja.po
  67. 2 2
      doc/po/pl.po
  68. 2 2
      doc/po/pt.po
  69. 4 1
      doc/po/pt_BR.po
  70. 8 8
      ftparchive/apt-ftparchive.cc
  71. 4 4
      ftparchive/multicompress.cc
  72. 3 3
      ftparchive/override.cc
  73. 2 2
      ftparchive/writer.cc
  74. 2 1
      methods/cdrom.cc
  75. 3 2
      methods/ftp.cc
  76. 3 3
      methods/gpgv.cc
  77. 3 3
      methods/http.cc
  78. 7 7
      methods/http.h
  79. 20 4
      methods/mirror.cc
  80. 5 2
      methods/rred.cc
  81. 1 1
      methods/rsh.h
  82. 519 416
      po/ar.po
  83. 533 420
      po/ast.po
  84. 535 421
      po/bg.po
  85. 515 415
      po/bs.po
  86. 620 631
      po/ca.po
  87. 529 420
      po/cs.po
  88. 527 420
      po/cy.po
  89. 531 420
      po/da.po
  90. 533 420
      po/de.po
  91. 523 420
      po/dz.po
  92. 524 419
      po/el.po
  93. 534 420
      po/es.po
  94. 524 419
      po/eu.po
  95. 524 419
      po/fi.po
  96. 536 420
      po/fr.po
  97. 596 559
      po/gl.po
  98. 526 419
      po/hu.po
  99. 597 562
      po/it.po
  100. 0 0
      po/ja.po

+ 23 - 23
apt-pkg/acquire-item.cc

@@ -683,17 +683,17 @@ bool pkgAcqIndexDiffs::QueueNextDiff()					/*{{{*/
    // remove all patches until the next matching patch is found
    // remove all patches until the next matching patch is found
    // this requires the Index file to be ordered
    // this requires the Index file to be ordered
    for(vector<DiffInfo>::iterator I=available_patches.begin();
    for(vector<DiffInfo>::iterator I=available_patches.begin();
-       available_patches.size() > 0 && 
+       available_patches.empty() == false &&
 	  I != available_patches.end() &&
 	  I != available_patches.end() &&
-	  (*I).sha1 != local_sha1; 
-       I++) 
+	  I->sha1 != local_sha1;
+       ++I)
    {
    {
       available_patches.erase(I);
       available_patches.erase(I);
    }
    }
 
 
    // error checking and falling back if no patch was found
    // error checking and falling back if no patch was found
-   if(available_patches.size() == 0) 
-   { 
+   if(available_patches.empty() == true)
+   {
       Failed("", NULL);
       Failed("", NULL);
       return false;
       return false;
    }
    }
@@ -758,7 +758,7 @@ void pkgAcqIndexDiffs::Done(string Message,unsigned long long Size,string Md5Has
       chmod(FinalFile.c_str(),0644);
       chmod(FinalFile.c_str(),0644);
 
 
       // see if there is more to download
       // see if there is more to download
-      if(available_patches.size() > 0) {
+      if(available_patches.empty() == false) {
 	 new pkgAcqIndexDiffs(Owner, RealURI, Description, Desc.ShortDesc,
 	 new pkgAcqIndexDiffs(Owner, RealURI, Description, Desc.ShortDesc,
 			      ExpectedHash, ServerSha1, available_patches);
 			      ExpectedHash, ServerSha1, available_patches);
 	 return Finish();
 	 return Finish();
@@ -810,6 +810,13 @@ pkgAcqIndex::pkgAcqIndex(pkgAcquire *Owner, IndexTarget const *Target,
    if (CompressionExtension.empty() == false)
    if (CompressionExtension.empty() == false)
       CompressionExtension.erase(CompressionExtension.end()-1);
       CompressionExtension.erase(CompressionExtension.end()-1);
 
 
+   // only verify non-optional targets, see acquire-item.h for a FIXME
+   // to make this more flexible
+   if (Target->IsOptional())
+     Verify = false;
+   else
+     Verify = true;
+
    Init(Target->URI, Target->Description, Target->ShortDesc);
    Init(Target->URI, Target->Description, Target->ShortDesc);
 }
 }
 									/*}}}*/
 									/*}}}*/
@@ -907,6 +914,7 @@ void pkgAcqIndex::Done(string Message,unsigned long long Size,string Hash,
 
 
       /* Verify the index file for correctness (all indexes must
       /* Verify the index file for correctness (all indexes must
        * have a Package field) (LP: #346386) (Closes: #627642) */
        * have a Package field) (LP: #346386) (Closes: #627642) */
+      if (Verify == true)
       {
       {
 	 FileFd fd(DestFile, FileFd::ReadOnly);
 	 FileFd fd(DestFile, FileFd::ReadOnly);
 	 pkgTagSection sec;
 	 pkgTagSection sec;
@@ -1260,8 +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 without verification.
-         QueueIndexes(false);
+         // the indexes and do only hashsum verification
+         MetaIndexParser->Load(DestFile);
+         QueueIndexes(true);
       }
       }
       else
       else
       {
       {
@@ -1376,7 +1385,7 @@ void pkgAcqMetaIndex::QueueIndexes(bool verify)				/*{{{*/
 #endif
 #endif
    for (vector <struct IndexTarget*>::const_iterator Target = IndexTargets->begin();
    for (vector <struct IndexTarget*>::const_iterator Target = IndexTargets->begin();
         Target != IndexTargets->end();
         Target != IndexTargets->end();
-        Target++)
+        ++Target)
    {
    {
       HashString ExpectedIndexHash;
       HashString ExpectedIndexHash;
       if (verify)
       if (verify)
@@ -1398,6 +1407,7 @@ void pkgAcqMetaIndex::QueueIndexes(bool verify)				/*{{{*/
 	    {
 	    {
 	       std::cerr << "Queueing: " << (*Target)->URI << std::endl;
 	       std::cerr << "Queueing: " << (*Target)->URI << std::endl;
 	       std::cerr << "Expected Hash: " << ExpectedIndexHash.toStr() << std::endl;
 	       std::cerr << "Expected Hash: " << ExpectedIndexHash.toStr() << std::endl;
+	       std::cerr << "For: " << Record->MetaKeyFilename << std::endl;
 	    }
 	    }
 	    if (ExpectedIndexHash.empty() == true && (*Target)->IsOptional() == false)
 	    if (ExpectedIndexHash.empty() == true && (*Target)->IsOptional() == false)
 	    {
 	    {
@@ -1673,7 +1683,7 @@ pkgAcqArchive::pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources,
 
 
    // check if we have one trusted source for the package. if so, switch
    // check if we have one trusted source for the package. if so, switch
    // to "TrustedOnly" mode
    // to "TrustedOnly" mode
-   for (pkgCache::VerFileIterator i = Version.FileList(); i.end() == false; i++)
+   for (pkgCache::VerFileIterator i = Version.FileList(); i.end() == false; ++i)
    {
    {
       pkgIndexFile *Index;
       pkgIndexFile *Index;
       if (Sources->FindIndex(i.File(),Index) == false)
       if (Sources->FindIndex(i.File(),Index) == false)
@@ -1710,7 +1720,7 @@ pkgAcqArchive::pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources,
 bool pkgAcqArchive::QueueNext()
 bool pkgAcqArchive::QueueNext()
 {
 {
    string const ForceHash = _config->Find("Acquire::ForceHash");
    string const ForceHash = _config->Find("Acquire::ForceHash");
-   for (; Vf.end() == false; Vf++)
+   for (; Vf.end() == false; ++Vf)
    {
    {
       // Ignore not source sources
       // Ignore not source sources
       if ((Vf.File()->Flags & pkgCache::Flag::NotSource) != 0)
       if ((Vf.File()->Flags & pkgCache::Flag::NotSource) != 0)
@@ -1825,7 +1835,7 @@ bool pkgAcqArchive::QueueNext()
       Desc.ShortDesc = Version.ParentPkg().Name();
       Desc.ShortDesc = Version.ParentPkg().Name();
       QueueURI(Desc);
       QueueURI(Desc);
 
 
-      Vf++;
+      ++Vf;
       return true;
       return true;
    }
    }
    return false;
    return false;
@@ -1899,7 +1909,7 @@ void pkgAcqArchive::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
        StringToBool(LookupTag(Message,"Transient-Failure"),false) == true)
        StringToBool(LookupTag(Message,"Transient-Failure"),false) == true)
    {
    {
       // Vf = Version.FileList();
       // Vf = Version.FileList();
-      while (Vf.end() == false) Vf++;
+      while (Vf.end() == false) ++Vf;
       StoreFilename = string();
       StoreFilename = string();
       Item::Failed(Message,Cnf);
       Item::Failed(Message,Cnf);
       return;
       return;
@@ -2073,13 +2083,3 @@ string pkgAcqFile::Custom600Headers()
    return "";
    return "";
 }
 }
 									/*}}}*/
 									/*}}}*/
-bool IndexTarget::IsOptional() const {
-   if (strncmp(ShortDesc.c_str(), "Translation", 11) != 0)
-      return false;
-   return true;
-}
-bool IndexTarget::IsSubIndex() const {
-   if (ShortDesc != "TranslationIndex")
-      return false;
-   return true;
-}

+ 30 - 5
apt-pkg/acquire-item.h

@@ -559,6 +559,16 @@ class pkgAcqIndex : public pkgAcquire::Item
     */
     */
    bool Erase;
    bool Erase;
 
 
+   /** \brief Verify for correctness by checking if a "Package"
+    *         tag is found in the index. This can be set to
+    *         false for optional index targets
+    *       
+    */
+   // FIXME: instead of a bool it should use a verify string that will
+   //        then be used in the pkgAcqIndex::Done method to ensure that
+   //        the downloaded file contains the expected tag
+   bool Verify;
+
    /** \brief The download request that is currently being
    /** \brief The download request that is currently being
     *   processed.
     *   processed.
     */
     */
@@ -646,8 +656,9 @@ class pkgAcqIndexTrans : public pkgAcqIndex
 };
 };
 									/*}}}*/
 									/*}}}*/
 /** \brief Information about an index file. */				/*{{{*/
 /** \brief Information about an index file. */				/*{{{*/
-struct IndexTarget
+class IndexTarget
 {
 {
+ public:
    /** \brief A URI from which the index file can be downloaded. */
    /** \brief A URI from which the index file can be downloaded. */
    string URI;
    string URI;
 
 
@@ -662,14 +673,28 @@ struct IndexTarget
     */
     */
    string MetaKey;
    string MetaKey;
 
 
-   //FIXME: We should use virtual methods here instead…
-   bool IsOptional() const;
-   bool IsSubIndex() const;
+   virtual bool IsOptional() const {
+      return false;
+   }
+   virtual bool IsSubIndex() const {
+      return false;
+   }
 };
 };
 									/*}}}*/
 									/*}}}*/
 /** \brief Information about an optional index file. */			/*{{{*/
 /** \brief Information about an optional index file. */			/*{{{*/
-struct OptionalIndexTarget : public IndexTarget
+class OptionalIndexTarget : public IndexTarget
+{
+   virtual bool IsOptional() const {
+      return true;
+   }
+};
+									/*}}}*/
+/** \brief Information about an subindex index file. */			/*{{{*/
+class SubIndexTarget : public IndexTarget
 {
 {
+   virtual bool IsSubIndex() const {
+      return true;
+   }
 };
 };
 									/*}}}*/
 									/*}}}*/
 
 

+ 3 - 7
apt-pkg/acquire-method.cc

@@ -83,7 +83,7 @@ void pkgAcqMethod::Fail(bool Transient)
 void pkgAcqMethod::Fail(string Err,bool Transient)
 void pkgAcqMethod::Fail(string Err,bool Transient)
 {
 {
    // Strip out junk from the error messages
    // Strip out junk from the error messages
-   for (string::iterator I = Err.begin(); I != Err.end(); I++)
+   for (string::iterator I = Err.begin(); I != Err.end(); ++I)
    {
    {
       if (*I == '\r') 
       if (*I == '\r') 
 	 *I = ' ';
 	 *I = ' ';
@@ -427,12 +427,8 @@ void pkgAcqMethod::Status(const char *Format,...)
    to keep the pipeline synchronized. */
    to keep the pipeline synchronized. */
 void pkgAcqMethod::Redirect(const string &NewURI)
 void pkgAcqMethod::Redirect(const string &NewURI)
 {
 {
-   std::cout << "103 Redirect\nURI: ";
-   if (Queue != 0)
-      std::cout << Queue->Uri << "\n";
-   else
-      std::cout << "<UNKNOWN>\n";
-   std::cout << "New-URI: " << NewURI << "\n"
+   std::cout << "103 Redirect\nURI: " << Queue->Uri << "\n"
+	     << "New-URI: " << NewURI << "\n"
 	     << "\n" << std::flush;
 	     << "\n" << std::flush;
 
 
    // Change the URI for the request.
    // Change the URI for the request.

+ 13 - 11
apt-pkg/acquire.cc

@@ -118,7 +118,7 @@ pkgAcquire::~pkgAcquire()
 /* */
 /* */
 void pkgAcquire::Shutdown()
 void pkgAcquire::Shutdown()
 {
 {
-   while (Items.size() != 0)
+   while (Items.empty() == false)
    {
    {
       if (Items[0]->Status == Item::StatFetching)
       if (Items[0]->Status == Item::StatFetching)
          Items[0]->Status = Item::StatError;
          Items[0]->Status = Item::StatError;
@@ -157,7 +157,7 @@ void pkgAcquire::Remove(Item *Itm)
 	 I = Items.begin();
 	 I = Items.begin();
       }      
       }      
       else 
       else 
-	 I++;
+	 ++I;
    }
    }
 }
 }
 									/*}}}*/
 									/*}}}*/
@@ -413,7 +413,7 @@ pkgAcquire::RunResult pkgAcquire::Run(int PulseIntervall)
       I->Shutdown(false);
       I->Shutdown(false);
 
 
    // Shut down the items
    // Shut down the items
-   for (ItemIterator I = Items.begin(); I != Items.end(); I++)
+   for (ItemIterator I = Items.begin(); I != Items.end(); ++I)
       (*I)->Finished(); 
       (*I)->Finished(); 
    
    
    if (_error->PendingError())
    if (_error->PendingError())
@@ -469,7 +469,7 @@ bool pkgAcquire::Clean(string Dir)
       
       
       // Look in the get list
       // Look in the get list
       ItemCIterator I = Items.begin();
       ItemCIterator I = Items.begin();
-      for (; I != Items.end(); I++)
+      for (; I != Items.end(); ++I)
 	 if (flNotDir((*I)->DestFile) == Dir->d_name)
 	 if (flNotDir((*I)->DestFile) == Dir->d_name)
 	    break;
 	    break;
       
       
@@ -490,7 +490,7 @@ bool pkgAcquire::Clean(string Dir)
 unsigned long long pkgAcquire::TotalNeeded()
 unsigned long long pkgAcquire::TotalNeeded()
 {
 {
    unsigned long long Total = 0;
    unsigned long long Total = 0;
-   for (ItemCIterator I = ItemsBegin(); I != ItemsEnd(); I++)
+   for (ItemCIterator I = ItemsBegin(); I != ItemsEnd(); ++I)
       Total += (*I)->FileSize;
       Total += (*I)->FileSize;
    return Total;
    return Total;
 }
 }
@@ -501,7 +501,7 @@ unsigned long long pkgAcquire::TotalNeeded()
 unsigned long long pkgAcquire::FetchNeeded()
 unsigned long long pkgAcquire::FetchNeeded()
 {
 {
    unsigned long long Total = 0;
    unsigned long long Total = 0;
-   for (ItemCIterator I = ItemsBegin(); I != ItemsEnd(); I++)
+   for (ItemCIterator I = ItemsBegin(); I != ItemsEnd(); ++I)
       if ((*I)->Local == false)
       if ((*I)->Local == false)
 	 Total += (*I)->FileSize;
 	 Total += (*I)->FileSize;
    return Total;
    return Total;
@@ -513,7 +513,7 @@ unsigned long long pkgAcquire::FetchNeeded()
 unsigned long long pkgAcquire::PartialPresent()
 unsigned long long pkgAcquire::PartialPresent()
 {
 {
   unsigned long long Total = 0;
   unsigned long long Total = 0;
-   for (ItemCIterator I = ItemsBegin(); I != ItemsEnd(); I++)
+   for (ItemCIterator I = ItemsBegin(); I != ItemsEnd(); ++I)
       if ((*I)->Local == false)
       if ((*I)->Local == false)
 	 Total += (*I)->PartialSize;
 	 Total += (*I)->PartialSize;
    return Total;
    return Total;
@@ -783,11 +783,11 @@ bool pkgAcquireStatus::Pulse(pkgAcquire *Owner)
    unsigned int Unknown = 0;
    unsigned int Unknown = 0;
    unsigned int Count = 0;
    unsigned int Count = 0;
    for (pkgAcquire::ItemCIterator I = Owner->ItemsBegin(); I != Owner->ItemsEnd();
    for (pkgAcquire::ItemCIterator I = Owner->ItemsBegin(); I != Owner->ItemsEnd();
-	I++, Count++)
+	++I, ++Count)
    {
    {
       TotalItems++;
       TotalItems++;
       if ((*I)->Status == pkgAcquire::Item::StatDone)
       if ((*I)->Status == pkgAcquire::Item::StatDone)
-	 CurrentItems++;
+	 ++CurrentItems;
       
       
       // Totally ignore local items
       // Totally ignore local items
       if ((*I)->Local == true)
       if ((*I)->Local == true)
@@ -797,7 +797,7 @@ bool pkgAcquireStatus::Pulse(pkgAcquire *Owner)
       if ((*I)->Complete == true)
       if ((*I)->Complete == true)
 	 CurrentBytes += (*I)->FileSize;
 	 CurrentBytes += (*I)->FileSize;
       if ((*I)->FileSize == 0 && (*I)->Complete == false)
       if ((*I)->FileSize == 0 && (*I)->Complete == false)
-	 Unknown++;
+	 ++Unknown;
    }
    }
    
    
    // Compute the current completion
    // Compute the current completion
@@ -851,7 +851,9 @@ bool pkgAcquireStatus::Pulse(pkgAcquire *Owner)
 
 
       char msg[200];
       char msg[200];
       long i = CurrentItems < TotalItems ? CurrentItems + 1 : CurrentItems;
       long i = CurrentItems < TotalItems ? CurrentItems + 1 : CurrentItems;
-      unsigned long long const ETA = (TotalBytes - CurrentBytes) / CurrentCPS;
+      unsigned long long ETA = 0;
+      if(CurrentCPS > 0)
+         ETA = (TotalBytes - CurrentBytes) / CurrentCPS;
 
 
       // only show the ETA if it makes sense
       // only show the ETA if it makes sense
       if (ETA > 0 && ETA < 172800 /* two days */ )
       if (ETA > 0 && ETA < 172800 /* two days */ )

+ 2 - 0
apt-pkg/acquire.h

@@ -349,6 +349,8 @@ class pkgAcquire
     */
     */
    bool Setup(pkgAcquireStatus *Progress = NULL, string const &Lock = "");
    bool Setup(pkgAcquireStatus *Progress = NULL, string const &Lock = "");
 
 
+   void SetLog(pkgAcquireStatus *Progress) { Log = Progress; }
+
    /** \brief Construct a new pkgAcquire. */
    /** \brief Construct a new pkgAcquire. */
    pkgAcquire(pkgAcquireStatus *Log) __deprecated;
    pkgAcquire(pkgAcquireStatus *Log) __deprecated;
    pkgAcquire();
    pkgAcquire();

+ 31 - 31
apt-pkg/algorithms.cc

@@ -96,7 +96,7 @@ bool pkgSimulate::Install(PkgIterator iPkg,string /*File*/)
    Sim.MarkInstall(Pkg,false);
    Sim.MarkInstall(Pkg,false);
 
 
    // Look for broken conflicts+predepends.
    // Look for broken conflicts+predepends.
-   for (PkgIterator I = Sim.PkgBegin(); I.end() == false; I++)
+   for (PkgIterator I = Sim.PkgBegin(); I.end() == false; ++I)
    {
    {
       if (Sim[I].InstallVer == 0)
       if (Sim[I].InstallVer == 0)
 	 continue;
 	 continue;
@@ -145,7 +145,7 @@ bool pkgSimulate::Configure(PkgIterator iPkg)
       Sim.Update();
       Sim.Update();
       
       
       // Print out each package and the failed dependencies
       // Print out each package and the failed dependencies
-      for (pkgCache::DepIterator D = Sim[Pkg].InstVerIter(Sim).DependsList(); D.end() == false; D++)
+      for (pkgCache::DepIterator D = Sim[Pkg].InstVerIter(Sim).DependsList(); D.end() == false; ++D)
       {
       {
 	 if (Sim.IsImportantDep(D) == false || 
 	 if (Sim.IsImportantDep(D) == false || 
 	     (Sim[D] & pkgDepCache::DepInstall) != 0)
 	     (Sim[D] & pkgDepCache::DepInstall) != 0)
@@ -209,7 +209,7 @@ bool pkgSimulate::Remove(PkgIterator iPkg,bool Purge)
 void pkgSimulate::ShortBreaks()
 void pkgSimulate::ShortBreaks()
 {
 {
    cout << " [";
    cout << " [";
-   for (PkgIterator I = Sim.PkgBegin(); I.end() == false; I++)
+   for (PkgIterator I = Sim.PkgBegin(); I.end() == false; ++I)
    {
    {
       if (Sim[I].InstBroken() == true)
       if (Sim[I].InstBroken() == true)
       {
       {
@@ -231,7 +231,7 @@ bool pkgApplyStatus(pkgDepCache &Cache)
 {
 {
    pkgDepCache::ActionGroup group(Cache);
    pkgDepCache::ActionGroup group(Cache);
 
 
-   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
+   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
    {
    {
       if (I->VersionList == 0)
       if (I->VersionList == 0)
 	 continue;
 	 continue;
@@ -300,13 +300,13 @@ bool pkgFixBroken(pkgDepCache &Cache)
    pkgDepCache::ActionGroup group(Cache);
    pkgDepCache::ActionGroup group(Cache);
 
 
    // Auto upgrade all broken packages
    // Auto upgrade all broken packages
-   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
+   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
       if (Cache[I].NowBroken() == true)
       if (Cache[I].NowBroken() == true)
 	 Cache.MarkInstall(I, true, 0, false);
 	 Cache.MarkInstall(I, true, 0, false);
    
    
    /* Fix packages that are in a NeedArchive state but don't have a
    /* Fix packages that are in a NeedArchive state but don't have a
       downloadable install version */
       downloadable install version */
-   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
+   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
    {
    {
       if (I.State() != pkgCache::PkgIterator::NeedsUnpack ||
       if (I.State() != pkgCache::PkgIterator::NeedsUnpack ||
 	  Cache[I].Delete() == true)
 	  Cache[I].Delete() == true)
@@ -349,19 +349,19 @@ bool pkgDistUpgrade(pkgDepCache &Cache)
 
 
    /* Auto upgrade all installed packages, this provides the basis 
    /* Auto upgrade all installed packages, this provides the basis 
       for the installation */
       for the installation */
-   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
+   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
       if (I->CurrentVer != 0)
       if (I->CurrentVer != 0)
 	 Cache.MarkInstall(I, true, 0, false);
 	 Cache.MarkInstall(I, true, 0, false);
 
 
    /* Now, auto upgrade all essential packages - this ensures that
    /* Now, auto upgrade all essential packages - this ensures that
       the essential packages are present and working */
       the essential packages are present and working */
-   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
+   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
       if ((I->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential)
       if ((I->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential)
 	 Cache.MarkInstall(I, true, 0, false);
 	 Cache.MarkInstall(I, true, 0, false);
    
    
    /* We do it again over all previously installed packages to force 
    /* We do it again over all previously installed packages to force 
       conflict resolution on them all. */
       conflict resolution on them all. */
-   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
+   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
       if (I->CurrentVer != 0)
       if (I->CurrentVer != 0)
 	 Cache.MarkInstall(I, false, 0, false);
 	 Cache.MarkInstall(I, false, 0, false);
 
 
@@ -370,7 +370,7 @@ bool pkgDistUpgrade(pkgDepCache &Cache)
    // Hold back held packages.
    // Hold back held packages.
    if (_config->FindB("APT::Ignore-Hold",false) == false)
    if (_config->FindB("APT::Ignore-Hold",false) == false)
    {
    {
-      for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
+      for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
       {
       {
 	 if (I->SelectedState == pkgCache::State::Hold)
 	 if (I->SelectedState == pkgCache::State::Hold)
 	 {
 	 {
@@ -404,7 +404,7 @@ bool pkgAllUpgrade(pkgDepCache &Cache)
       return false;
       return false;
    
    
    // Upgrade all installed packages
    // Upgrade all installed packages
-   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
+   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
    {
    {
       if (Cache[I].Install() == true)
       if (Cache[I].Install() == true)
 	 Fix.Protect(I);
 	 Fix.Protect(I);
@@ -438,7 +438,7 @@ bool pkgMinimizeUpgrade(pkgDepCache &Cache)
    do
    do
    {
    {
       Change = false;
       Change = false;
-      for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
+      for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
       {
       {
 	 // Not interesting
 	 // Not interesting
 	 if (Cache[I].Upgrade() == false || Cache[I].NewInstall() == true)
 	 if (Cache[I].Upgrade() == false || Cache[I].NewInstall() == true)
@@ -455,7 +455,7 @@ bool pkgMinimizeUpgrade(pkgDepCache &Cache)
 	       Change = true;
 	       Change = true;
 	 }	 
 	 }	 
       }      
       }      
-      Count++;
+      ++Count;
    }
    }
    while (Change == true && Count < 10);
    while (Change == true && Count < 10);
 
 
@@ -542,7 +542,7 @@ void pkgProblemResolver::MakeScores()
          << "  AddEssential => " << AddEssential << endl;
          << "  AddEssential => " << AddEssential << endl;
 
 
    // Generate the base scores for a package based on its properties
    // Generate the base scores for a package based on its properties
-   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
+   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
    {
    {
       if (Cache[I].InstallVer == 0)
       if (Cache[I].InstallVer == 0)
 	 continue;
 	 continue;
@@ -569,12 +569,12 @@ void pkgProblemResolver::MakeScores()
    }
    }
 
 
    // Now that we have the base scores we go and propogate dependencies
    // Now that we have the base scores we go and propogate dependencies
-   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
+   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
    {
    {
       if (Cache[I].InstallVer == 0)
       if (Cache[I].InstallVer == 0)
 	 continue;
 	 continue;
       
       
-      for (pkgCache::DepIterator D = Cache[I].InstVerIter(Cache).DependsList(); D.end() == false; D++)
+      for (pkgCache::DepIterator D = Cache[I].InstVerIter(Cache).DependsList(); D.end() == false; ++D)
       {
       {
 	 if (D->Type == pkgCache::Dep::Depends || 
 	 if (D->Type == pkgCache::Dep::Depends || 
 	     D->Type == pkgCache::Dep::PreDepends)
 	     D->Type == pkgCache::Dep::PreDepends)
@@ -591,12 +591,12 @@ void pkgProblemResolver::MakeScores()
    /* Now we cause 1 level of dependency inheritance, that is we add the 
    /* Now we cause 1 level of dependency inheritance, that is we add the 
       score of the packages that depend on the target Package. This 
       score of the packages that depend on the target Package. This 
       fortifies high scoring packages */
       fortifies high scoring packages */
-   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
+   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
    {
    {
       if (Cache[I].InstallVer == 0)
       if (Cache[I].InstallVer == 0)
 	 continue;
 	 continue;
       
       
-      for (pkgCache::DepIterator D = I.RevDependsList(); D.end() == false; D++)
+      for (pkgCache::DepIterator D = I.RevDependsList(); D.end() == false; ++D)
       {
       {
 	 // Only do it for the install version
 	 // Only do it for the install version
 	 if ((pkgCache::Version *)D.ParentVer() != Cache[D.ParentPkg()].InstallVer ||
 	 if ((pkgCache::Version *)D.ParentVer() != Cache[D.ParentPkg()].InstallVer ||
@@ -611,9 +611,9 @@ void pkgProblemResolver::MakeScores()
 
 
    /* Now we propogate along provides. This makes the packages that 
    /* Now we propogate along provides. This makes the packages that 
       provide important packages extremely important */
       provide important packages extremely important */
-   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
+   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
    {
    {
-      for (pkgCache::PrvIterator P = I.ProvidesList(); P.end() == false; P++)
+      for (pkgCache::PrvIterator P = I.ProvidesList(); P.end() == false; ++P)
       {
       {
 	 // Only do it once per package
 	 // Only do it once per package
 	 if ((pkgCache::Version *)P.OwnerVer() != Cache[P.OwnerPkg()].InstallVer)
 	 if ((pkgCache::Version *)P.OwnerVer() != Cache[P.OwnerPkg()].InstallVer)
@@ -624,7 +624,7 @@ void pkgProblemResolver::MakeScores()
 
 
    /* Protected things are pushed really high up. This number should put them
    /* Protected things are pushed really high up. This number should put them
       ahead of everything */
       ahead of everything */
-   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
+   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
    {
    {
       if ((Flags[I->ID] & Protected) != 0)
       if ((Flags[I->ID] & Protected) != 0)
 	 Scores[I->ID] += AddProtected;
 	 Scores[I->ID] += AddProtected;
@@ -721,7 +721,7 @@ bool pkgProblemResolver::DoUpgrade(pkgCache::PkgIterator Pkg)
 	 
 	 
 	 if (Start == End)
 	 if (Start == End)
 	    break;
 	    break;
-	 Start++;
+	 ++Start;
       }
       }
       if (Fail == true)
       if (Fail == true)
 	 break;
 	 break;
@@ -778,7 +778,7 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
    do
    do
    {
    {
       Again = false;
       Again = false;
-      for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
+      for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
       {
       {
 	 if (Cache[I].Install() == true)
 	 if (Cache[I].Install() == true)
 	    Flags[I->ID] |= PreInstalled;
 	    Flags[I->ID] |= PreInstalled;
@@ -811,7 +811,7 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
       would cause the removal of even lower score packages. */
       would cause the removal of even lower score packages. */
    SPtrArray<pkgCache::Package *> PList = new pkgCache::Package *[Size];
    SPtrArray<pkgCache::Package *> PList = new pkgCache::Package *[Size];
    pkgCache::Package **PEnd = PList;
    pkgCache::Package **PEnd = PList;
-   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
+   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
       *PEnd++ = I;
       *PEnd++ = I;
    This = this;
    This = this;
    qsort(PList,PEnd - PList,sizeof(*PList),&ScoreSort);
    qsort(PList,PEnd - PList,sizeof(*PList),&ScoreSort);
@@ -931,7 +931,7 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
 	    }
 	    }
 	    else
 	    else
             {
             {
-	       Start++;
+	       ++Start;
 	       // We only worry about critical deps.
 	       // We only worry about critical deps.
 	       if (Start.IsCritical() != true)
 	       if (Start.IsCritical() != true)
                   continue;
                   continue;
@@ -1180,7 +1180,7 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
    {
    {
       // See if this is the result of a hold
       // See if this is the result of a hold
       pkgCache::PkgIterator I = Cache.PkgBegin();
       pkgCache::PkgIterator I = Cache.PkgBegin();
-      for (;I.end() != true; I++)
+      for (;I.end() != true; ++I)
       {
       {
 	 if (Cache[I].InstBroken() == false)
 	 if (Cache[I].InstBroken() == false)
 	    continue;
 	    continue;
@@ -1192,7 +1192,7 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
    
    
    // set the auto-flags (mvo: I'm not sure if we _really_ need this)
    // set the auto-flags (mvo: I'm not sure if we _really_ need this)
    pkgCache::PkgIterator I = Cache.PkgBegin();
    pkgCache::PkgIterator I = Cache.PkgBegin();
-   for (;I.end() != true; I++) {
+   for (;I.end() != true; ++I) {
       if (Cache[I].NewInstall() && !(Flags[I->ID] & PreInstalled)) {
       if (Cache[I].NewInstall() && !(Flags[I->ID] & PreInstalled)) {
 	 if(_config->FindI("Debug::pkgAutoRemove",false)) {
 	 if(_config->FindI("Debug::pkgAutoRemove",false)) {
 	    std::clog << "Resolve installed new pkg: " << I.FullName(false) 
 	    std::clog << "Resolve installed new pkg: " << I.FullName(false) 
@@ -1265,7 +1265,7 @@ bool pkgProblemResolver::ResolveByKeepInternal()
       would cause the removal of even lower score packages. */
       would cause the removal of even lower score packages. */
    pkgCache::Package **PList = new pkgCache::Package *[Size];
    pkgCache::Package **PList = new pkgCache::Package *[Size];
    pkgCache::Package **PEnd = PList;
    pkgCache::Package **PEnd = PList;
-   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
+   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
       *PEnd++ = I;
       *PEnd++ = I;
    This = this;
    This = this;
    qsort(PList,PEnd - PList,sizeof(*PList),&ScoreSort);
    qsort(PList,PEnd - PList,sizeof(*PList),&ScoreSort);
@@ -1362,7 +1362,7 @@ bool pkgProblemResolver::ResolveByKeepInternal()
 
 
 	    if (Start == End)
 	    if (Start == End)
 	       break;
 	       break;
-	    Start++;
+	    ++Start;
 	 }
 	 }
 	      
 	      
 	 if (InstOrNewPolicyBroken(I) == false)
 	 if (InstOrNewPolicyBroken(I) == false)
@@ -1389,7 +1389,7 @@ void pkgProblemResolver::InstallProtect()
 {
 {
    pkgDepCache::ActionGroup group(Cache);
    pkgDepCache::ActionGroup group(Cache);
 
 
-   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
+   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
    {
    {
       if ((Flags[I->ID] & Protected) == Protected)
       if ((Flags[I->ID] & Protected) == Protected)
       {
       {
@@ -1469,7 +1469,7 @@ bool ListUpdate(pkgAcquireStatus &Stat,
    bool Failed = false;
    bool Failed = false;
    bool TransientNetworkFailure = false;
    bool TransientNetworkFailure = false;
    for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin(); 
    for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin(); 
-	I != Fetcher.ItemsEnd(); I++)
+	I != Fetcher.ItemsEnd(); ++I)
    {
    {
       if ((*I)->Status == pkgAcquire::Item::StatDone)
       if ((*I)->Status == pkgAcquire::Item::StatDone)
 	 continue;
 	 continue;

+ 3 - 3
apt-pkg/aptconfiguration.cc

@@ -55,7 +55,7 @@ const Configuration::getCompressionTypes(bool const &Cached) {
 	// load the order setting into our vector
 	// load the order setting into our vector
 	std::vector<std::string> const order = _config->FindVector("Acquire::CompressionTypes::Order");
 	std::vector<std::string> const order = _config->FindVector("Acquire::CompressionTypes::Order");
 	for (std::vector<std::string>::const_iterator o = order.begin();
 	for (std::vector<std::string>::const_iterator o = order.begin();
-	     o != order.end(); o++) {
+	     o != order.end(); ++o) {
 		if ((*o).empty() == true)
 		if ((*o).empty() == true)
 			continue;
 			continue;
 		// ignore types we have no method ready to use
 		// ignore types we have no method ready to use
@@ -276,7 +276,7 @@ std::vector<std::string> const Configuration::getLanguages(bool const &All,
 	// then needed and ensure the codes are not listed twice.
 	// then needed and ensure the codes are not listed twice.
 	bool noneSeen = false;
 	bool noneSeen = false;
 	for (std::vector<string>::const_iterator l = lang.begin();
 	for (std::vector<string>::const_iterator l = lang.begin();
-	     l != lang.end(); l++) {
+	     l != lang.end(); ++l) {
 		if (*l == "environment") {
 		if (*l == "environment") {
 			for (std::vector<string>::const_iterator e = environment.begin();
 			for (std::vector<string>::const_iterator e = environment.begin();
 			     e != environment.end(); ++e) {
 			     e != environment.end(); ++e) {
@@ -354,7 +354,7 @@ std::vector<std::string> const Configuration::getArchitectures(bool const &Cache
 
 
 	if (archs.empty() == true ||
 	if (archs.empty() == true ||
 	    std::find(archs.begin(), archs.end(), arch) == archs.end())
 	    std::find(archs.begin(), archs.end(), arch) == archs.end())
-		archs.push_back(arch);
+		archs.insert(archs.begin(), arch);
 
 
 	// erase duplicates and empty strings
 	// erase duplicates and empty strings
 	for (std::vector<string>::reverse_iterator a = archs.rbegin();
 	for (std::vector<string>::reverse_iterator a = archs.rbegin();

+ 2 - 1
apt-pkg/aptconfiguration.h

@@ -13,6 +13,7 @@
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
 #include <string>
 #include <string>
 #include <vector>
 #include <vector>
+#include <limits>
 									/*}}}*/
 									/*}}}*/
 namespace APT {
 namespace APT {
 class Configuration {							/*{{{*/
 class Configuration {							/*{{{*/
@@ -94,7 +95,7 @@ public:									/*{{{*/
 		Compressor(char const *name, char const *extension, char const *binary,
 		Compressor(char const *name, char const *extension, char const *binary,
 			   char const *compressArg, char const *uncompressArg,
 			   char const *compressArg, char const *uncompressArg,
 			   unsigned short const cost);
 			   unsigned short const cost);
-		Compressor() {};
+		Compressor() : Cost(std::numeric_limits<unsigned short>::max()) {};
 	};
 	};
 
 
 	/** \brief Return a vector of Compressors supported for data.tar's
 	/** \brief Return a vector of Compressors supported for data.tar's

+ 14 - 22
apt-pkg/cdrom.cc

@@ -311,7 +311,7 @@ void pkgCdrom::ReduceSourcelist(string CD,vector<string> &List)
    sort(List.begin(),List.end());
    sort(List.begin(),List.end());
    
    
    // Collect similar entries
    // Collect similar entries
-   for (vector<string>::iterator I = List.begin(); I != List.end(); I++)
+   for (vector<string>::iterator I = List.begin(); I != List.end(); ++I)
    {
    {
       // Find a space..
       // Find a space..
       string::size_type Space = (*I).find(' ');
       string::size_type Space = (*I).find(' ');
@@ -323,7 +323,7 @@ void pkgCdrom::ReduceSourcelist(string CD,vector<string> &List)
 
 
       string Word1 = string(*I,Space,SSpace-Space);
       string Word1 = string(*I,Space,SSpace-Space);
       string Prefix = string(*I,0,Space);
       string Prefix = string(*I,0,Space);
-      for (vector<string>::iterator J = List.begin(); J != I; J++)
+      for (vector<string>::iterator J = List.begin(); J != I; ++J)
       {
       {
 	 // Find a space..
 	 // Find a space..
 	 string::size_type Space2 = (*J).find(' ');
 	 string::size_type Space2 = (*J).find(' ');
@@ -406,7 +406,7 @@ bool pkgCdrom::WriteDatabase(Configuration &Cnf)
    that were the same. */
    that were the same. */
 bool pkgCdrom::WriteSourceList(string Name,vector<string> &List,bool Source)
 bool pkgCdrom::WriteSourceList(string Name,vector<string> &List,bool Source)
 {
 {
-   if (List.size() == 0)
+   if (List.empty() == true)
       return true;
       return true;
 
 
    string File = _config->FindFile("Dir::Etc::sourcelist");
    string File = _config->FindFile("Dir::Etc::sourcelist");
@@ -456,7 +456,7 @@ bool pkgCdrom::WriteSourceList(string Name,vector<string> &List,bool Source)
 
 
       if (First == true)
       if (First == true)
       {
       {
-	 for (vector<string>::iterator I = List.begin(); I != List.end(); I++)
+	 for (vector<string>::iterator I = List.begin(); I != List.end(); ++I)
 	 {
 	 {
 	    string::size_type Space = (*I).find(' ');
 	    string::size_type Space = (*I).find(' ');
 	    if (Space == string::npos)
 	    if (Space == string::npos)
@@ -490,7 +490,7 @@ bool pkgCdrom::WriteSourceList(string Name,vector<string> &List,bool Source)
    // Just in case the file was empty
    // Just in case the file was empty
    if (First == true)
    if (First == true)
    {
    {
-      for (vector<string>::iterator I = List.begin(); I != List.end(); I++)
+      for (vector<string>::iterator I = List.begin(); I != List.end(); ++I)
       {
       {
 	 string::size_type Space = (*I).find(' ');
 	 string::size_type Space = (*I).find(' ');
 	 if (Space == string::npos)
 	 if (Space == string::npos)
@@ -662,13 +662,13 @@ bool pkgCdrom::Add(pkgCdromStatus *log)					/*{{{*/
    if (_config->FindB("Debug::aptcdrom",false) == true)
    if (_config->FindB("Debug::aptcdrom",false) == true)
    {
    {
       cout << "I found (binary):" << endl;
       cout << "I found (binary):" << endl;
-      for (vector<string>::iterator I = List.begin(); I != List.end(); I++)
+      for (vector<string>::iterator I = List.begin(); I != List.end(); ++I)
 	 cout << *I << endl;
 	 cout << *I << endl;
       cout << "I found (source):" << endl;
       cout << "I found (source):" << endl;
-      for (vector<string>::iterator I = SourceList.begin(); I != SourceList.end(); I++)
+      for (vector<string>::iterator I = SourceList.begin(); I != SourceList.end(); ++I)
 	 cout << *I << endl;
 	 cout << *I << endl;
       cout << "I found (Signatures):" << endl;
       cout << "I found (Signatures):" << endl;
-      for (vector<string>::iterator I = SigList.begin(); I != SigList.end(); I++)
+      for (vector<string>::iterator I = SigList.begin(); I != SigList.end(); ++I)
 	 cout << *I << endl;
 	 cout << *I << endl;
    }   
    }   
 
 
@@ -689,7 +689,7 @@ bool pkgCdrom::Add(pkgCdromStatus *log)					/*{{{*/
       log->Update(msg.str(), STEP_SCAN);
       log->Update(msg.str(), STEP_SCAN);
    }
    }
 
 
-   if (List.size() == 0 && SourceList.size() == 0) 
+   if (List.empty() == true && SourceList.empty() == true) 
    {
    {
       if (_config->FindB("APT::CDROM::NoMount",false) == false) 
       if (_config->FindB("APT::CDROM::NoMount",false) == false) 
 	 UnmountCdrom(CDROM);
 	 UnmountCdrom(CDROM);
@@ -713,7 +713,7 @@ bool pkgCdrom::Add(pkgCdromStatus *log)					/*{{{*/
 	 {
 	 {
 	    // Escape special characters
 	    // Escape special characters
 	    string::iterator J = Name.begin();
 	    string::iterator J = Name.begin();
-	    for (; J != Name.end(); J++)
+	    for (; J != Name.end(); ++J)
 	       if (*J == '"' || *J == ']' || *J == '[')
 	       if (*J == '"' || *J == ']' || *J == '[')
 		  *J = '_';
 		  *J = '_';
 	    
 	    
@@ -758,7 +758,7 @@ bool pkgCdrom::Add(pkgCdromStatus *log)					/*{{{*/
 
 
    // Escape special characters
    // Escape special characters
    string::iterator J = Name.begin();
    string::iterator J = Name.begin();
-   for (; J != Name.end(); J++)
+   for (; J != Name.end(); ++J)
       if (*J == '"' || *J == ']' || *J == '[')
       if (*J == '"' || *J == ']' || *J == '[')
 	 *J = '_';
 	 *J = '_';
    
    
@@ -805,7 +805,7 @@ bool pkgCdrom::Add(pkgCdromStatus *log)					/*{{{*/
    if(log != NULL)
    if(log != NULL)
       log->Update(_("Source list entries for this disc are:\n"));
       log->Update(_("Source list entries for this disc are:\n"));
 
 
-   for (vector<string>::iterator I = List.begin(); I != List.end(); I++)
+   for (vector<string>::iterator I = List.begin(); I != List.end(); ++I)
    {
    {
       string::size_type Space = (*I).find(' ');
       string::size_type Space = (*I).find(' ');
       if (Space == string::npos)
       if (Space == string::npos)
@@ -824,7 +824,7 @@ bool pkgCdrom::Add(pkgCdromStatus *log)					/*{{{*/
       }
       }
    }
    }
 
 
-   for (vector<string>::iterator I = SourceList.begin(); I != SourceList.end(); I++)
+   for (vector<string>::iterator I = SourceList.begin(); I != SourceList.end(); ++I)
    {
    {
       string::size_type Space = (*I).find(' ');
       string::size_type Space = (*I).find(' ');
       if (Space == string::npos)
       if (Space == string::npos)
@@ -875,9 +875,7 @@ pkgUdevCdromDevices::Dlopen()                     		        /*{{{*/
    libudev_handle = h;
    libudev_handle = h;
    udev_new = (udev* (*)(void)) dlsym(h, "udev_new");
    udev_new = (udev* (*)(void)) dlsym(h, "udev_new");
    udev_enumerate_add_match_property = (int (*)(udev_enumerate*, const char*, const char*))dlsym(h, "udev_enumerate_add_match_property");
    udev_enumerate_add_match_property = (int (*)(udev_enumerate*, const char*, const char*))dlsym(h, "udev_enumerate_add_match_property");
-#if 0 // FIXME: uncomment on next ABI break
    udev_enumerate_add_match_sysattr = (int (*)(udev_enumerate*, const char*, const char*))dlsym(h, "udev_enumerate_add_match_sysattr");
    udev_enumerate_add_match_sysattr = (int (*)(udev_enumerate*, const char*, const char*))dlsym(h, "udev_enumerate_add_match_sysattr");
-#endif
    udev_enumerate_scan_devices = (int (*)(udev_enumerate*))dlsym(h, "udev_enumerate_scan_devices");
    udev_enumerate_scan_devices = (int (*)(udev_enumerate*))dlsym(h, "udev_enumerate_scan_devices");
    udev_enumerate_get_list_entry = (udev_list_entry* (*)(udev_enumerate*))dlsym(h, "udev_enumerate_get_list_entry");
    udev_enumerate_get_list_entry = (udev_list_entry* (*)(udev_enumerate*))dlsym(h, "udev_enumerate_get_list_entry");
    udev_device_new_from_syspath = (udev_device* (*)(udev*, const char*))dlsym(h, "udev_device_new_from_syspath");
    udev_device_new_from_syspath = (udev_device* (*)(udev*, const char*))dlsym(h, "udev_device_new_from_syspath");
@@ -891,10 +889,8 @@ pkgUdevCdromDevices::Dlopen()                     		        /*{{{*/
    return true;
    return true;
 }
 }
 									/*}}}*/
 									/*}}}*/
-
                                                                         /*{{{*/
                                                                         /*{{{*/
-// compatiblity only with the old API/ABI, can be removed on the next
-// ABI break
+// convenience interface, this will just call ScanForRemovable
 vector<CdromDevice>
 vector<CdromDevice>
 pkgUdevCdromDevices::Scan()
 pkgUdevCdromDevices::Scan()
 { 
 { 
@@ -919,10 +915,6 @@ pkgUdevCdromDevices::ScanForRemovable(bool CdromOnly)
    if (CdromOnly)
    if (CdromOnly)
       udev_enumerate_add_match_property(enumerate, "ID_CDROM", "1");
       udev_enumerate_add_match_property(enumerate, "ID_CDROM", "1");
    else {
    else {
-#if 1 // FIXME: remove the next two lines on the next ABI break
-      int (*udev_enumerate_add_match_sysattr)(struct udev_enumerate *udev_enumerate, const char *property, const char *value);
-      udev_enumerate_add_match_sysattr = (int (*)(udev_enumerate*, const char*, const char*))dlsym(libudev_handle, "udev_enumerate_add_match_sysattr");
-#endif
       udev_enumerate_add_match_sysattr(enumerate, "removable", "1");
       udev_enumerate_add_match_sysattr(enumerate, "removable", "1");
    }
    }
 
 

+ 3 - 5
apt-pkg/cdrom.h

@@ -92,9 +92,7 @@ class pkgUdevCdromDevices						/*{{{*/
    struct udev_enumerate *(*udev_enumerate_new) (struct udev *udev);
    struct udev_enumerate *(*udev_enumerate_new) (struct udev *udev);
    struct udev_list_entry *(*udev_list_entry_get_next)(struct udev_list_entry *list_entry);
    struct udev_list_entry *(*udev_list_entry_get_next)(struct udev_list_entry *list_entry);
    const char* (*udev_device_get_property_value)(struct udev_device *udev_device, const char *key);
    const char* (*udev_device_get_property_value)(struct udev_device *udev_device, const char *key);
-#if 0 // FIXME: uncomment on next ABI break
    int (*udev_enumerate_add_match_sysattr)(struct udev_enumerate *udev_enumerate, const char *property, const char *value);
    int (*udev_enumerate_add_match_sysattr)(struct udev_enumerate *udev_enumerate, const char *property, const char *value);
-#endif 
    // end libudev dlopen
    // end libudev dlopen
    
    
  public:
  public:
@@ -104,11 +102,11 @@ class pkgUdevCdromDevices						/*{{{*/
    // try to open 
    // try to open 
    bool Dlopen();
    bool Dlopen();
 
 
-   // this is the new interface
-   vector<CdromDevice> ScanForRemovable(bool CdromOnly);
-   // FIXME: compat with the old interface/API/ABI only
+   // convenience interface, this will just call ScanForRemovable
+   // with "APT::cdrom::CdromOnly"
    vector<CdromDevice> Scan();
    vector<CdromDevice> Scan();
 
 
+   vector<CdromDevice> ScanForRemovable(bool CdromOnly);
 };
 };
 									/*}}}*/
 									/*}}}*/
 
 

+ 2 - 2
apt-pkg/clean.cc

@@ -87,12 +87,12 @@ bool pkgArchiveCleaner::Go(string Dir,pkgCache &Cache)
       if (P.end() != true)
       if (P.end() != true)
       {
       {
 	 pkgCache::VerIterator V = P.VersionList();
 	 pkgCache::VerIterator V = P.VersionList();
-	 for (; V.end() == false; V++)
+	 for (; V.end() == false; ++V)
 	 {
 	 {
 	    // See if we can fetch this version at all
 	    // See if we can fetch this version at all
 	    bool IsFetchable = false;
 	    bool IsFetchable = false;
 	    for (pkgCache::VerFileIterator J = V.FileList(); 
 	    for (pkgCache::VerFileIterator J = V.FileList(); 
-		 J.end() == false; J++)
+		 J.end() == false; ++J)
 	    {
 	    {
 	       if (CleanInstalled == true &&
 	       if (CleanInstalled == true &&
 		   (J.File()->Flags & pkgCache::Flag::NotSource) != 0)
 		   (J.File()->Flags & pkgCache::Flag::NotSource) != 0)

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

@@ -260,7 +260,9 @@ string FindMountPointForDevice(const char *devnode)
                if(TokSplitString(' ', buf, out, 10))
                if(TokSplitString(' ', buf, out, 10))
                {
                {
                   fclose(f);
                   fclose(f);
-                  return string(out[1]);
+                  // unescape the \0XXX chars in the path
+                  string mount_point = out[1];
+                  return DeEscapeString(mount_point);
                }
                }
             }
             }
          }
          }

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

@@ -348,7 +348,7 @@ void Configuration::Set(const char *Name,const string &Value)
 // Configuration::Set - Set an integer value				/*{{{*/
 // Configuration::Set - Set an integer value				/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-void Configuration::Set(const char *Name,int const Value)
+void Configuration::Set(const char *Name,int const &Value)
 {
 {
    Item *Itm = Lookup(Name,true);
    Item *Itm = Lookup(Name,true);
    if (Itm == 0)
    if (Itm == 0)
@@ -675,9 +675,9 @@ bool ReadConfigFile(Configuration &Conf,const string &FName,bool const &AsSectio
 	    // Put the last fragment into the buffer
 	    // Put the last fragment into the buffer
 	    std::string::const_iterator NonWhitespaceStart = Start;
 	    std::string::const_iterator NonWhitespaceStart = Start;
 	    std::string::const_iterator NonWhitespaceStop = I;
 	    std::string::const_iterator NonWhitespaceStop = I;
-	    for (; NonWhitespaceStart != I && isspace(*NonWhitespaceStart) != 0; NonWhitespaceStart++)
+	    for (; NonWhitespaceStart != I && isspace(*NonWhitespaceStart) != 0; ++NonWhitespaceStart)
 	      ;
 	      ;
-	    for (; NonWhitespaceStop != NonWhitespaceStart && isspace(NonWhitespaceStop[-1]) != 0; NonWhitespaceStop--)
+	    for (; NonWhitespaceStop != NonWhitespaceStart && isspace(NonWhitespaceStop[-1]) != 0; --NonWhitespaceStop)
 	      ;
 	      ;
 	    if (LineBuffer.empty() == false && NonWhitespaceStop - NonWhitespaceStart != 0)
 	    if (LineBuffer.empty() == false && NonWhitespaceStop - NonWhitespaceStart != 0)
 	       LineBuffer += ' ';
 	       LineBuffer += ' ';
@@ -853,7 +853,7 @@ bool ReadConfigDir(Configuration &Conf,const string &Dir,
    vector<string> const List = GetListOfFilesInDir(Dir, "conf", true, true);
    vector<string> const List = GetListOfFilesInDir(Dir, "conf", true, true);
 
 
    // Read the files
    // Read the files
-   for (vector<string>::const_iterator I = List.begin(); I != List.end(); I++)
+   for (vector<string>::const_iterator I = List.begin(); I != List.end(); ++I)
       if (ReadConfigFile(Conf,*I,AsSectional,Depth) == false)
       if (ReadConfigFile(Conf,*I,AsSectional,Depth) == false)
 	 return false;
 	 return false;
    return true;
    return true;

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

@@ -84,7 +84,7 @@ class Configuration
    void CndSet(const char *Name,const string &Value);
    void CndSet(const char *Name,const string &Value);
    void CndSet(const char *Name,const int Value);
    void CndSet(const char *Name,const int Value);
    void Set(const char *Name,const string &Value);
    void Set(const char *Name,const string &Value);
-   void Set(const char *Name,const int Value);
+   void Set(const char *Name,const int &Value);
    
    
    inline bool Exists(const string &Name) const {return Exists(Name.c_str());};
    inline bool Exists(const string &Name) const {return Exists(Name.c_str());};
    bool Exists(const char *Name) const;
    bool Exists(const char *Name) const;

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

@@ -194,7 +194,7 @@ bool GlobalError::PopMessage(std::string &Text) {
 
 
 	// check if another error message is pending
 	// check if another error message is pending
 	for (std::list<Item>::const_iterator m = Messages.begin();
 	for (std::list<Item>::const_iterator m = Messages.begin();
-	     m != Messages.end(); m++)
+	     m != Messages.end(); ++m)
 		if (m->Type == ERROR || m->Type == FATAL)
 		if (m->Type == ERROR || m->Type == FATAL)
 			return Ret;
 			return Ret;
 
 
@@ -211,7 +211,7 @@ void GlobalError::DumpErrors(std::ostream &out, MsgType const &threshold,
 			Messages.insert(Messages.begin(), s->Messages.begin(), s->Messages.end());
 			Messages.insert(Messages.begin(), s->Messages.begin(), s->Messages.end());
 
 
 	for (std::list<Item>::const_iterator m = Messages.begin();
 	for (std::list<Item>::const_iterator m = Messages.begin();
-	     m != Messages.end(); m++)
+	     m != Messages.end(); ++m)
 		if (m->Type >= threshold)
 		if (m->Type >= threshold)
 			out << (*m) << std::endl;
 			out << (*m) << std::endl;
 	Discard();
 	Discard();
@@ -232,7 +232,7 @@ bool GlobalError::empty(MsgType const &trashhold) const {
 		return true;
 		return true;
 
 
 	for (std::list<Item>::const_iterator m = Messages.begin();
 	for (std::list<Item>::const_iterator m = Messages.begin();
-	     m != Messages.end(); m++)
+	     m != Messages.end(); ++m)
 		if (m->Type >= trashhold)
 		if (m->Type >= trashhold)
 			return false;
 			return false;
 
 

+ 11 - 0
apt-pkg/contrib/fileutl.cc

@@ -447,6 +447,17 @@ string SafeGetCWD()
    return S;
    return S;
 }
 }
 									/*}}}*/
 									/*}}}*/
+// GetModificationTime - Get the mtime of the given file or -1 on error /*{{{*/
+// ---------------------------------------------------------------------
+/* We return / on failure. */
+time_t GetModificationTime(string const &Path)
+{
+   struct stat St;
+   if (stat(Path.c_str(), &St) < 0)
+      return -1;
+   return  St.st_mtime;
+}
+									/*}}}*/
 // flNotDir - Strip the directory from the filename			/*{{{*/
 // flNotDir - Strip the directory from the filename			/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */

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

@@ -112,6 +112,7 @@ bool FileExists(string File);
 bool RealFileExists(string File);
 bool RealFileExists(string File);
 bool DirectoryExists(string const &Path) __attrib_const;
 bool DirectoryExists(string const &Path) __attrib_const;
 bool CreateDirectory(string const &Parent, string const &Path);
 bool CreateDirectory(string const &Parent, string const &Path);
+time_t GetModificationTime(string const &Path);
 
 
 /** \brief Ensure the existence of the given Path
 /** \brief Ensure the existence of the given Path
  *
  *

+ 4 - 3
apt-pkg/contrib/netrc.cc

@@ -48,10 +48,7 @@ int parsenetrc (char *host, char *login, char *password, char *netrcfile = NULL)
   int specific_login = (login[0] != 0);
   int specific_login = (login[0] != 0);
   char *home = NULL;
   char *home = NULL;
   bool netrc_alloc = false;
   bool netrc_alloc = false;
-  int state = NOTHING;
 
 
-  char state_login = 0;        /* Found a login keyword */
-  char state_password = 0;     /* Found a password keyword */
   int state_our_login = false;  /* With specific_login,
   int state_our_login = false;  /* With specific_login,
                                    found *our* login name */
                                    found *our* login name */
 
 
@@ -82,6 +79,10 @@ int parsenetrc (char *host, char *login, char *password, char *netrcfile = NULL)
     bool done = false;
     bool done = false;
     char netrcbuffer[256];
     char netrcbuffer[256];
 
 
+    int state = NOTHING;
+    char state_login = 0;        /* Found a login keyword */
+    char state_password = 0;     /* Found a password keyword */
+
     while (!done && fgets(netrcbuffer, sizeof (netrcbuffer), file)) {
     while (!done && fgets(netrcbuffer, sizeof (netrcbuffer), file)) {
       tok = strtok_r (netrcbuffer, " \t\n", &tok_buf);
       tok = strtok_r (netrcbuffer, " \t\n", &tok_buf);
       while (!done && tok) {
       while (!done && tok) {

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

@@ -75,10 +75,9 @@ static void SHA1Transform(uint32_t state[5],uint8_t const buffer[64])
       uint32_t l[16];
       uint32_t l[16];
    }
    }
    CHAR64LONG16;
    CHAR64LONG16;
-   CHAR64LONG16 *block;
+   CHAR64LONG16 workspace, *block;
 
 
-   uint8_t workspace[64];
-   block = (CHAR64LONG16 *)workspace;
+   block = &workspace;
    memcpy(block,buffer,sizeof(workspace));
    memcpy(block,buffer,sizeof(workspace));
 
 
    /* Copy context->state[] to working vars */
    /* Copy context->state[] to working vars */

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

@@ -3,6 +3,6 @@
 
 
 #include "sha2.h"
 #include "sha2.h"
 
 
-#warn "This header is deprecated, please include sha2.h instead"
+#warning "This header is deprecated, please include sha2.h instead"
 
 
 #endif
 #endif

+ 0 - 9
apt-pkg/contrib/sha2_internal.h

@@ -35,11 +35,6 @@
 #ifndef __SHA2_H__
 #ifndef __SHA2_H__
 #define __SHA2_H__
 #define __SHA2_H__
 
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
 /*
 /*
  * Import u_intXX_t size_t type definitions from system headers.  You
  * Import u_intXX_t size_t type definitions from system headers.  You
  * may need to change this, or define these things yourself in this
  * may need to change this, or define these things yourself in this
@@ -189,9 +184,5 @@ char* SHA512_Data();
 
 
 #endif /* NOPROTO */
 #endif /* NOPROTO */
 
 
-#ifdef	__cplusplus
-}
-#endif /* __cplusplus */
-
 #endif /* __SHA2_H__ */
 #endif /* __SHA2_H__ */
 
 

+ 73 - 12
apt-pkg/contrib/strutl.cc

@@ -271,7 +271,7 @@ bool ParseCWord(const char *&String,string &Res)
 string QuoteString(const string &Str, const char *Bad)
 string QuoteString(const string &Str, const char *Bad)
 {
 {
    string Res;
    string Res;
-   for (string::const_iterator I = Str.begin(); I != Str.end(); I++)
+   for (string::const_iterator I = Str.begin(); I != Str.end(); ++I)
    {
    {
       if (strchr(Bad,*I) != 0 || isprint(*I) == 0 || 
       if (strchr(Bad,*I) != 0 || isprint(*I) == 0 || 
 	  *I == 0x25 || // percent '%' char
 	  *I == 0x25 || // percent '%' char
@@ -298,7 +298,7 @@ string DeQuoteString(string::const_iterator const &begin,
 			string::const_iterator const &end)
 			string::const_iterator const &end)
 {
 {
    string Res;
    string Res;
-   for (string::const_iterator I = begin; I != end; I++)
+   for (string::const_iterator I = begin; I != end; ++I)
    {
    {
       if (*I == '%' && I + 2 < end &&
       if (*I == '%' && I + 2 < end &&
 	  isxdigit(I[1]) && isxdigit(I[2]))
 	  isxdigit(I[1]) && isxdigit(I[2]))
@@ -632,7 +632,7 @@ string LookupTag(const string &Message,const char *Tag,const char *Default)
 {
 {
    // Look for a matching tag.
    // Look for a matching tag.
    int Length = strlen(Tag);
    int Length = strlen(Tag);
-   for (string::const_iterator I = Message.begin(); I + Length < Message.end(); I++)
+   for (string::const_iterator I = Message.begin(); I + Length < Message.end(); ++I)
    {
    {
       // Found the tag
       // Found the tag
       if (I[Length] == ':' && stringcasecmp(I,I+Length,Tag) == 0)
       if (I[Length] == ':' && stringcasecmp(I,I+Length,Tag) == 0)
@@ -640,14 +640,14 @@ string LookupTag(const string &Message,const char *Tag,const char *Default)
 	 // Find the end of line and strip the leading/trailing spaces
 	 // Find the end of line and strip the leading/trailing spaces
 	 string::const_iterator J;
 	 string::const_iterator J;
 	 I += Length + 1;
 	 I += Length + 1;
-	 for (; isspace(*I) != 0 && I < Message.end(); I++);
-	 for (J = I; *J != '\n' && J < Message.end(); J++);
-	 for (; J > I && isspace(J[-1]) != 0; J--);
+	 for (; isspace(*I) != 0 && I < Message.end(); ++I);
+	 for (J = I; *J != '\n' && J < Message.end(); ++J);
+	 for (; J > I && isspace(J[-1]) != 0; --J);
 	 
 	 
 	 return string(I,J);
 	 return string(I,J);
       }
       }
       
       
-      for (; *I != '\n' && I < Message.end(); I++);
+      for (; *I != '\n' && I < Message.end(); ++I);
    }   
    }   
    
    
    // Failed to find a match
    // Failed to find a match
@@ -1252,7 +1252,7 @@ int tolower_ascii(int const c)
 bool CheckDomainList(const string &Host,const string &List)
 bool CheckDomainList(const string &Host,const string &List)
 {
 {
    string::const_iterator Start = List.begin();
    string::const_iterator Start = List.begin();
-   for (string::const_iterator Cur = List.begin(); Cur <= List.end(); Cur++)
+   for (string::const_iterator Cur = List.begin(); Cur <= List.end(); ++Cur)
    {
    {
       if (Cur < List.end() && *Cur != ',')
       if (Cur < List.end() && *Cur != ',')
 	 continue;
 	 continue;
@@ -1268,7 +1268,68 @@ bool CheckDomainList(const string &Host,const string &List)
    return false;
    return false;
 }
 }
 									/*}}}*/
 									/*}}}*/
+// DeEscapeString - unescape (\0XX and \xXX) from a string      	/*{{{*/
+// ---------------------------------------------------------------------
+/* */
+string DeEscapeString(const string &input)
+{
+   char tmp[3];
+   string::const_iterator it, escape_start;
+   string output, octal, hex;
+   for (it = input.begin(); it != input.end(); ++it)
+   {
+      // just copy non-escape chars
+      if (*it != '\\')
+      {
+         output += *it;
+         continue;
+      }
 
 
+      // deal with double escape
+      if (*it == '\\' && 
+          (it + 1 < input.end()) &&  it[1] == '\\')
+      {
+         // copy
+         output += *it;
+         // advance iterator one step further
+         ++it;
+         continue;
+      }
+        
+      // ensure we have a char to read
+      if (it + 1 == input.end())
+         continue;
+
+      // read it
+      ++it;
+      switch (*it)
+      {
+         case '0':
+            if (it + 2 <= input.end()) {
+               tmp[0] = it[1];
+               tmp[1] = it[2];
+               tmp[2] = 0;
+               output += (char)strtol(tmp, 0, 8);
+               it += 2;
+            }
+            break;
+         case 'x':
+            if (it + 2 <= input.end()) {
+               tmp[0] = it[1];
+               tmp[1] = it[2];
+               tmp[2] = 0;
+               output += (char)strtol(tmp, 0, 16);
+               it += 2;
+            }
+            break;
+         default:
+            // FIXME: raise exception here?
+            break;
+      }
+   }
+   return output;
+}
+									/*}}}*/
 // URI::CopyFrom - Copy from an object					/*{{{*/
 // URI::CopyFrom - Copy from an object					/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* This parses the URI into all of its components */
 /* This parses the URI into all of its components */
@@ -1277,7 +1338,7 @@ void URI::CopyFrom(const string &U)
    string::const_iterator I = U.begin();
    string::const_iterator I = U.begin();
 
 
    // Locate the first colon, this separates the scheme
    // Locate the first colon, this separates the scheme
-   for (; I < U.end() && *I != ':' ; I++);
+   for (; I < U.end() && *I != ':' ; ++I);
    string::const_iterator FirstColon = I;
    string::const_iterator FirstColon = I;
 
 
    /* Determine if this is a host type URI with a leading double //
    /* Determine if this is a host type URI with a leading double //
@@ -1289,7 +1350,7 @@ void URI::CopyFrom(const string &U)
    /* Find the / indicating the end of the hostname, ignoring /'s in the
    /* Find the / indicating the end of the hostname, ignoring /'s in the
       square brackets */
       square brackets */
    bool InBracket = false;
    bool InBracket = false;
-   for (; SingleSlash < U.end() && (*SingleSlash != '/' || InBracket == true); SingleSlash++)
+   for (; SingleSlash < U.end() && (*SingleSlash != '/' || InBracket == true); ++SingleSlash)
    {
    {
       if (*SingleSlash == '[')
       if (*SingleSlash == '[')
 	 InBracket = true;
 	 InBracket = true;
@@ -1322,11 +1383,11 @@ void URI::CopyFrom(const string &U)
    I = FirstColon + 1;
    I = FirstColon + 1;
    if (I > SingleSlash)
    if (I > SingleSlash)
       I = SingleSlash;
       I = SingleSlash;
-   for (; I < SingleSlash && *I != ':'; I++);
+   for (; I < SingleSlash && *I != ':'; ++I);
    string::const_iterator SecondColon = I;
    string::const_iterator SecondColon = I;
    
    
    // Search for the @ after the colon
    // Search for the @ after the colon
-   for (; I < SingleSlash && *I != '@'; I++);
+   for (; I < SingleSlash && *I != '@'; ++I);
    string::const_iterator At = I;
    string::const_iterator At = I;
    
    
    // Now write the host and user/pass
    // Now write the host and user/pass

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

@@ -39,6 +39,10 @@ bool ParseCWord(const char *&String,string &Res);
 string QuoteString(const string &Str,const char *Bad);
 string QuoteString(const string &Str,const char *Bad);
 string DeQuoteString(const string &Str);
 string DeQuoteString(const string &Str);
 string DeQuoteString(string::const_iterator const &begin, string::const_iterator const &end);
 string DeQuoteString(string::const_iterator const &begin, string::const_iterator const &end);
+
+// unescape (\0XX and \xXX) from a string
+string DeEscapeString(const string &input);
+
 string SizeToStr(double Bytes);
 string SizeToStr(double Bytes);
 string TimeToStr(unsigned long Sec);
 string TimeToStr(unsigned long Sec);
 string Base64Encode(const string &Str);
 string Base64Encode(const string &Str);

+ 3 - 3
apt-pkg/deb/debindexfile.cc

@@ -354,7 +354,7 @@ pkgCache::PkgFileIterator debPackagesIndex::FindInCache(pkgCache &Cache) const
 {
 {
    string FileName = IndexFile("Packages");
    string FileName = IndexFile("Packages");
    pkgCache::PkgFileIterator File = Cache.FileBegin();
    pkgCache::PkgFileIterator File = Cache.FileBegin();
-   for (; File.end() == false; File++)
+   for (; File.end() == false; ++File)
    {
    {
        if (File.FileName() == NULL || FileName != File.FileName())
        if (File.FileName() == NULL || FileName != File.FileName())
 	 continue;
 	 continue;
@@ -542,7 +542,7 @@ pkgCache::PkgFileIterator debTranslationsIndex::FindInCache(pkgCache &Cache) con
    string FileName = IndexFile(Language);
    string FileName = IndexFile(Language);
    
    
    pkgCache::PkgFileIterator File = Cache.FileBegin();
    pkgCache::PkgFileIterator File = Cache.FileBegin();
-   for (; File.end() == false; File++)
+   for (; File.end() == false; ++File)
    {
    {
       if (FileName != File.FileName())
       if (FileName != File.FileName())
 	 continue;
 	 continue;
@@ -622,7 +622,7 @@ bool debStatusIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
 pkgCache::PkgFileIterator debStatusIndex::FindInCache(pkgCache &Cache) const
 pkgCache::PkgFileIterator debStatusIndex::FindInCache(pkgCache &Cache) const
 {
 {
    pkgCache::PkgFileIterator File = Cache.FileBegin();
    pkgCache::PkgFileIterator File = Cache.FileBegin();
-   for (; File.end() == false; File++)
+   for (; File.end() == false; ++File)
    {
    {
       if (this->File != File.FileName())
       if (this->File != File.FileName())
 	 continue;
 	 continue;

+ 26 - 9
apt-pkg/deb/deblistparser.cc

@@ -200,7 +200,7 @@ string debListParser::DescriptionLanguage()
 
 
    std::vector<string> const lang = APT::Configuration::getLanguages(true);
    std::vector<string> const lang = APT::Configuration::getLanguages(true);
    for (std::vector<string>::const_iterator l = lang.begin();
    for (std::vector<string>::const_iterator l = lang.begin();
-	l != lang.end(); l++)
+	l != lang.end(); ++l)
       if (Section.FindS(string("Description-").append(*l).c_str()).empty() == false)
       if (Section.FindS(string("Description-").append(*l).c_str()).empty() == false)
 	 return *l;
 	 return *l;
 
 
@@ -458,7 +458,7 @@ const char *debListParser::ConvertRelation(const char *I,unsigned int &Op)
  *
  *
  * The complete architecture, consisting of <kernel>-<cpu>.
  * The complete architecture, consisting of <kernel>-<cpu>.
  */
  */
-static string CompleteArch(std::string& arch) {
+static string CompleteArch(std::string const &arch) {
     if (arch == "armel")              return "linux-arm";
     if (arch == "armel")              return "linux-arm";
     if (arch == "armhf")              return "linux-arm";
     if (arch == "armhf")              return "linux-arm";
     if (arch == "lpia")               return "linux-i386";
     if (arch == "lpia")               return "linux-i386";
@@ -497,9 +497,13 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop,
    Package.assign(Start,I - Start);
    Package.assign(Start,I - Start);
 
 
    // We don't want to confuse library users which can't handle MultiArch
    // We don't want to confuse library users which can't handle MultiArch
+   string const arch = _config->Find("APT::Architecture");
    if (StripMultiArch == true) {
    if (StripMultiArch == true) {
       size_t const found = Package.rfind(':');
       size_t const found = Package.rfind(':');
-      if (found != string::npos)
+      if (found != string::npos &&
+	  (strcmp(Package.c_str() + found, ":any") == 0 ||
+	   strcmp(Package.c_str() + found, ":native") == 0 ||
+	   strcmp(Package.c_str() + found + 1, arch.c_str()) == 0))
 	 Package = Package.substr(0,found);
 	 Package = Package.substr(0,found);
    }
    }
 
 
@@ -540,7 +544,6 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop,
 
 
    if (ParseArchFlags == true)
    if (ParseArchFlags == true)
    {
    {
-      string arch = _config->Find("APT::Architecture");
       string completeArch = CompleteArch(arch);
       string completeArch = CompleteArch(arch);
 
 
       // Parse an architecture
       // Parse an architecture
@@ -778,7 +781,9 @@ bool debListParser::LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,
       size_t len = 0;
       size_t len = 0;
 
 
       // Skip empty lines
       // Skip empty lines
-      for (; buffer[len] == '\r' && buffer[len] == '\n'; ++len);
+      for (; buffer[len] == '\r' && buffer[len] == '\n'; ++len)
+         /* nothing */
+         ;
       if (buffer[len] == '\0')
       if (buffer[len] == '\0')
 	 continue;
 	 continue;
 
 
@@ -792,13 +797,25 @@ bool debListParser::LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,
       }
       }
 
 
       // seperate the tag from the data
       // seperate the tag from the data
-      for (; buffer[len] != ':' && buffer[len] != '\0'; ++len);
+      for (; buffer[len] != ':' && buffer[len] != '\0'; ++len)
+         /* nothing */
+         ;
       if (buffer[len] == '\0')
       if (buffer[len] == '\0')
 	 continue;
 	 continue;
       char* dataStart = buffer + len;
       char* dataStart = buffer + len;
-      for (++dataStart; *dataStart == ' '; ++dataStart);
+      for (++dataStart; *dataStart == ' '; ++dataStart)
+         /* nothing */
+         ;
       char* dataEnd = dataStart;
       char* dataEnd = dataStart;
-      for (++dataEnd; *dataEnd != '\0'; ++dataEnd);
+      for (++dataEnd; *dataEnd != '\0'; ++dataEnd)
+         /* nothing */
+         ;
+      // The last char should be a newline, but we can never be sure: #633350
+      char* lineEnd = dataEnd;
+      for (--lineEnd; *lineEnd == '\r' || *lineEnd == '\n'; --lineEnd)
+         /* nothing */
+         ;
+      ++lineEnd;
 
 
       // which datastorage need to be updated
       // which datastorage need to be updated
       map_ptrloc* writeTo = NULL;
       map_ptrloc* writeTo = NULL;
@@ -813,7 +830,7 @@ bool debListParser::LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,
       APT_PARSER_WRITETO(FileI->Label, "Label")
       APT_PARSER_WRITETO(FileI->Label, "Label")
       #undef APT_PARSER_WRITETO
       #undef APT_PARSER_WRITETO
       #define APT_PARSER_FLAGIT(X) else if (strncmp(#X, buffer, len) == 0) \
       #define APT_PARSER_FLAGIT(X) else if (strncmp(#X, buffer, len) == 0) \
-	 pkgTagSection::FindFlag(FileI->Flags, pkgCache::Flag:: X, dataStart, dataEnd-1);
+	 pkgTagSection::FindFlag(FileI->Flags, pkgCache::Flag:: X, dataStart, lineEnd);
       APT_PARSER_FLAGIT(NotAutomatic)
       APT_PARSER_FLAGIT(NotAutomatic)
       APT_PARSER_FLAGIT(ButAutomaticUpgrades)
       APT_PARSER_FLAGIT(ButAutomaticUpgrades)
       #undef APT_PARSER_FLAGIT
       #undef APT_PARSER_FLAGIT

+ 6 - 6
apt-pkg/deb/debmetaindex.cc

@@ -209,7 +209,7 @@ vector <struct IndexTarget *>* debReleaseIndex::ComputeIndexTargets() const {
 		for (std::set<std::string>::const_iterator s = sections.begin();
 		for (std::set<std::string>::const_iterator s = sections.begin();
 		     s != sections.end(); ++s) {
 		     s != sections.end(); ++s) {
 			for (std::vector<std::string>::const_iterator l = lang.begin();
 			for (std::vector<std::string>::const_iterator l = lang.begin();
-			     l != lang.end(); l++) {
+			     l != lang.end(); ++l) {
 				if (*l == "none") continue;
 				if (*l == "none") continue;
 				IndexTarget * Target = new OptionalIndexTarget();
 				IndexTarget * Target = new OptionalIndexTarget();
 				Target->ShortDesc = "Translation-" + *l;
 				Target->ShortDesc = "Translation-" + *l;
@@ -239,7 +239,7 @@ bool debReleaseIndex::GetIndexes(pkgAcquire *Owner, bool const &GetAll) const
    // special case for --print-uris
    // special case for --print-uris
    if (GetAll) {
    if (GetAll) {
       vector <struct IndexTarget *> *targets = ComputeIndexTargets();
       vector <struct IndexTarget *> *targets = ComputeIndexTargets();
-      for (vector <struct IndexTarget*>::const_iterator Target = targets->begin(); Target != targets->end(); Target++) {
+      for (vector <struct IndexTarget*>::const_iterator Target = targets->begin(); Target != targets->end(); ++Target) {
 	 new pkgAcqIndex(Owner, (*Target)->URI, (*Target)->Description,
 	 new pkgAcqIndex(Owner, (*Target)->URI, (*Target)->Description,
 			 (*Target)->ShortDesc, HashString());
 			 (*Target)->ShortDesc, HashString());
       }
       }
@@ -296,7 +296,7 @@ vector <pkgIndexFile *> *debReleaseIndex::GetIndexFiles() {
 	if (src != ArchEntries.end()) {
 	if (src != ArchEntries.end()) {
 		vector<debSectionEntry const*> const SectionEntries = src->second;
 		vector<debSectionEntry const*> const SectionEntries = src->second;
 		for (vector<debSectionEntry const*>::const_iterator I = SectionEntries.begin();
 		for (vector<debSectionEntry const*>::const_iterator I = SectionEntries.begin();
-		     I != SectionEntries.end(); I++)
+		     I != SectionEntries.end(); ++I)
 			Indexes->push_back(new debSourcesIndex (URI, Dist, (*I)->Section, IsTrusted()));
 			Indexes->push_back(new debSourcesIndex (URI, Dist, (*I)->Section, IsTrusted()));
 	}
 	}
 
 
@@ -311,7 +311,7 @@ vector <pkgIndexFile *> *debReleaseIndex::GetIndexFiles() {
 		if (a->first == "source")
 		if (a->first == "source")
 			continue;
 			continue;
 		for (vector<debSectionEntry const*>::const_iterator I = a->second.begin();
 		for (vector<debSectionEntry const*>::const_iterator I = a->second.begin();
-		     I != a->second.end(); I++) {
+		     I != a->second.end(); ++I) {
 			Indexes->push_back(new debPackagesIndex (URI, Dist, (*I)->Section, IsTrusted(), a->first));
 			Indexes->push_back(new debPackagesIndex (URI, Dist, (*I)->Section, IsTrusted(), a->first));
 			sections[(*I)->Section].insert(lang.begin(), lang.end());
 			sections[(*I)->Section].insert(lang.begin(), lang.end());
 		}
 		}
@@ -320,7 +320,7 @@ vector <pkgIndexFile *> *debReleaseIndex::GetIndexFiles() {
 	for (map<string, set<string> >::const_iterator s = sections.begin();
 	for (map<string, set<string> >::const_iterator s = sections.begin();
 	     s != sections.end(); ++s)
 	     s != sections.end(); ++s)
 		for (set<string>::const_iterator l = s->second.begin();
 		for (set<string>::const_iterator l = s->second.begin();
-		     l != s->second.end(); l++) {
+		     l != s->second.end(); ++l) {
 			if (*l == "none") continue;
 			if (*l == "none") continue;
 			Indexes->push_back(new debTranslationsIndex(URI,Dist,s->first,(*l).c_str()));
 			Indexes->push_back(new debTranslationsIndex(URI,Dist,s->first,(*l).c_str()));
 		}
 		}
@@ -369,7 +369,7 @@ class debSLTypeDebian : public pkgSourceList::Type
       map<string, string>::const_iterator const trusted = Options.find("trusted");
       map<string, string>::const_iterator const trusted = Options.find("trusted");
 
 
       for (vector<metaIndex *>::const_iterator I = List.begin();
       for (vector<metaIndex *>::const_iterator I = List.begin();
-	   I != List.end(); I++)
+	   I != List.end(); ++I)
       {
       {
 	 // We only worry about debian entries here
 	 // We only worry about debian entries here
 	 if (strcmp((*I)->GetType(), "deb") != 0)
 	 if (strcmp((*I)->GetType(), "deb") != 0)

+ 10 - 1
apt-pkg/deb/debrecords.cc

@@ -103,6 +103,15 @@ string debRecordParser::Maintainer()
    return Section.FindS("Maintainer");
    return Section.FindS("Maintainer");
 }
 }
 									/*}}}*/
 									/*}}}*/
+// RecordParser::RecordField - Return the value of an arbitrary field       /*{{*/
+// ---------------------------------------------------------------------
+/* */
+string debRecordParser::RecordField(const char *fieldName)
+{
+   return Section.FindS(fieldName);
+}
+
+                                                                        /*}}}*/
 // RecordParser::ShortDesc - Return a 1 line description		/*{{{*/
 // RecordParser::ShortDesc - Return a 1 line description		/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
@@ -128,7 +137,7 @@ string debRecordParser::LongDesc()
   {
   {
      vector<string> const lang = APT::Configuration::getLanguages();
      vector<string> const lang = APT::Configuration::getLanguages();
      for (vector<string>::const_iterator l = lang.begin();
      for (vector<string>::const_iterator l = lang.begin();
-	  orig.empty() && l != lang.end(); l++)
+	  orig.empty() && l != lang.end(); ++l)
 	orig = Section.FindS(string("Description-").append(*l).c_str());
 	orig = Section.FindS(string("Description-").append(*l).c_str());
   }
   }
 
 

+ 3 - 0
apt-pkg/deb/debrecords.h

@@ -50,6 +50,9 @@ class debRecordParser : public pkgRecords::Parser
    virtual string Name();
    virtual string Name();
    virtual string Homepage();
    virtual string Homepage();
 
 
+   // An arbitrary custom field
+   virtual string RecordField(const char *fieldName);
+
    virtual void GetRec(const char *&Start,const char *&Stop);
    virtual void GetRec(const char *&Start,const char *&Stop);
    
    
    debRecordParser(string FileName,pkgCache &Cache);
    debRecordParser(string FileName,pkgCache &Cache);

+ 10 - 10
apt-pkg/deb/dpkgpm.cc

@@ -230,7 +230,7 @@ bool pkgDPkgPM::SendV2Pkgs(FILE *F)
    fprintf(F,"\n");
    fprintf(F,"\n");
  
  
    // Write out the package actions in order.
    // Write out the package actions in order.
-   for (vector<Item>::iterator I = List.begin(); I != List.end(); I++)
+   for (vector<Item>::iterator I = List.begin(); I != List.end(); ++I)
    {
    {
       if(I->Pkg.end() == true)
       if(I->Pkg.end() == true)
 	 continue;
 	 continue;
@@ -352,7 +352,7 @@ bool pkgDPkgPM::RunScriptsWithPkgs(const char *Cnf)
       // Feed it the filenames.
       // Feed it the filenames.
       if (Version <= 1)
       if (Version <= 1)
       {
       {
-	 for (vector<Item>::iterator I = List.begin(); I != List.end(); I++)
+	 for (vector<Item>::iterator I = List.begin(); I != List.end(); ++I)
 	 {
 	 {
 	    // Only deal with packages to be installed from .deb
 	    // Only deal with packages to be installed from .deb
 	    if (I->Op != Item::Install)
 	    if (I->Op != Item::Install)
@@ -707,7 +707,7 @@ bool pkgDPkgPM::OpenLog()
       chmod(history_name.c_str(), 0644);
       chmod(history_name.c_str(), 0644);
       fprintf(d->history_out, "\nStart-Date: %s\n", timestr);
       fprintf(d->history_out, "\nStart-Date: %s\n", timestr);
       string remove, purge, install, reinstall, upgrade, downgrade;
       string remove, purge, install, reinstall, upgrade, downgrade;
-      for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
+      for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
       {
       {
 	 enum { CANDIDATE, CANDIDATE_AUTO, CURRENT_CANDIDATE, CURRENT } infostring;
 	 enum { CANDIDATE, CANDIDATE_AUTO, CURRENT_CANDIDATE, CURRENT } infostring;
 	 string *line = NULL;
 	 string *line = NULL;
@@ -885,14 +885,14 @@ bool pkgDPkgPM::Go(int OutStatusFd)
    // that will be [installed|configured|removed|purged] and add
    // that will be [installed|configured|removed|purged] and add
    // them to the PackageOps map (the dpkg states it goes through)
    // them to the PackageOps map (the dpkg states it goes through)
    // and the PackageOpsTranslations (human readable strings)
    // and the PackageOpsTranslations (human readable strings)
-   for (vector<Item>::const_iterator I = List.begin(); I != List.end();I++)
+   for (vector<Item>::const_iterator I = List.begin(); I != List.end(); ++I)
    {
    {
       if((*I).Pkg.end() == true)
       if((*I).Pkg.end() == true)
 	 continue;
 	 continue;
 
 
       string const name = (*I).Pkg.Name();
       string const name = (*I).Pkg.Name();
       PackageOpsDone[name] = 0;
       PackageOpsDone[name] = 0;
-      for(int i=0; (DpkgStatesOpMap[(*I).Op][i]).state != NULL;  i++) 
+      for(int i=0; (DpkgStatesOpMap[(*I).Op][i]).state != NULL; ++i)
       {
       {
 	 PackageOps[name].push_back(DpkgStatesOpMap[(*I).Op][i]);
 	 PackageOps[name].push_back(DpkgStatesOpMap[(*I).Op][i]);
 	 PackagesTotal++;
 	 PackagesTotal++;
@@ -910,7 +910,7 @@ bool pkgDPkgPM::Go(int OutStatusFd)
       // Do all actions with the same Op in one run
       // Do all actions with the same Op in one run
       vector<Item>::const_iterator J = I;
       vector<Item>::const_iterator J = I;
       if (TriggersPending == true)
       if (TriggersPending == true)
-	 for (; J != List.end(); J++)
+	 for (; J != List.end(); ++J)
 	 {
 	 {
 	    if (J->Op == I->Op)
 	    if (J->Op == I->Op)
 	       continue;
 	       continue;
@@ -922,7 +922,7 @@ bool pkgDPkgPM::Go(int OutStatusFd)
 	    break;
 	    break;
 	 }
 	 }
       else
       else
-	 for (; J != List.end() && J->Op == I->Op; J++)
+	 for (; J != List.end() && J->Op == I->Op; ++J)
 	    /* nothing */;
 	    /* nothing */;
 
 
       // Generate the argument list
       // Generate the argument list
@@ -1028,7 +1028,7 @@ bool pkgDPkgPM::Go(int OutStatusFd)
       // Write in the file or package names
       // Write in the file or package names
       if (I->Op == Item::Install)
       if (I->Op == Item::Install)
       {
       {
-	 for (;I != J && Size < MaxArgBytes; I++)
+	 for (;I != J && Size < MaxArgBytes; ++I)
 	 {
 	 {
 	    if (I->File[0] != '/')
 	    if (I->File[0] != '/')
 	       return _error->Error("Internal Error, Pathname to install is not absolute '%s'",I->File.c_str());
 	       return _error->Error("Internal Error, Pathname to install is not absolute '%s'",I->File.c_str());
@@ -1040,7 +1040,7 @@ bool pkgDPkgPM::Go(int OutStatusFd)
       {
       {
 	 string const nativeArch = _config->Find("APT::Architecture");
 	 string const nativeArch = _config->Find("APT::Architecture");
 	 unsigned long const oldSize = I->Op == Item::Configure ? Size : 0;
 	 unsigned long const oldSize = I->Op == Item::Configure ? Size : 0;
-	 for (;I != J && Size < MaxArgBytes; I++)
+	 for (;I != J && Size < MaxArgBytes; ++I)
 	 {
 	 {
 	    if((*I).Pkg.end() == true)
 	    if((*I).Pkg.end() == true)
 	       continue;
 	       continue;
@@ -1478,7 +1478,7 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg)
    // log the ordering 
    // log the ordering 
    const char *ops_str[] = {"Install", "Configure","Remove","Purge"};
    const char *ops_str[] = {"Install", "Configure","Remove","Purge"};
    fprintf(report, "AptOrdering:\n");
    fprintf(report, "AptOrdering:\n");
-   for (vector<Item>::iterator I = List.begin(); I != List.end(); I++)
+   for (vector<Item>::iterator I = List.begin(); I != List.end(); ++I)
       fprintf(report, " %s: %s\n", (*I).Pkg.Name(), ops_str[(*I).Op]);
       fprintf(report, " %s: %s\n", (*I).Pkg.Name(), ops_str[(*I).Op]);
 
 
    // attach dmesg log (to learn about segfaults)
    // attach dmesg log (to learn about segfaults)

+ 16 - 16
apt-pkg/depcache.cc

@@ -131,7 +131,7 @@ bool pkgDepCache::Init(OpProgress *Prog)
    /* Set the current state of everything. In this state all of the
    /* Set the current state of everything. In this state all of the
       packages are kept exactly as is. See AllUpgrade */
       packages are kept exactly as is. See AllUpgrade */
    int Done = 0;
    int Done = 0;
-   for (PkgIterator I = PkgBegin(); I.end() != true; I++,Done++)
+   for (PkgIterator I = PkgBegin(); I.end() != true; ++I, ++Done)
    {
    {
       if (Prog != 0 && Done%20 == 0)
       if (Prog != 0 && Done%20 == 0)
 	 Prog->Progress(Done);
 	 Prog->Progress(Done);
@@ -294,7 +294,7 @@ bool pkgDepCache::writeStateFile(OpProgress *prog, bool InstalledOnly)	/*{{{*/
    
    
    // then write the ones we have not seen yet
    // then write the ones we have not seen yet
    std::ostringstream ostr;
    std::ostringstream ostr;
-   for(pkgCache::PkgIterator pkg=Cache->PkgBegin(); !pkg.end(); pkg++) {
+   for(pkgCache::PkgIterator pkg=Cache->PkgBegin(); !pkg.end(); ++pkg) {
       StateCache const &P = PkgState[pkg->ID];
       StateCache const &P = PkgState[pkg->ID];
       if(P.Flags & Flag::Auto) {
       if(P.Flags & Flag::Auto) {
 	 if (pkgs_seen.find(pkg.FullName()) != pkgs_seen.end()) {
 	 if (pkgs_seen.find(pkg.FullName()) != pkgs_seen.end()) {
@@ -367,7 +367,7 @@ bool pkgDepCache::CheckDep(DepIterator Dep,int Type,PkgIterator &Res)
    // Check the providing packages
    // Check the providing packages
    PrvIterator P = Dep.TargetPkg().ProvidesList();
    PrvIterator P = Dep.TargetPkg().ProvidesList();
    PkgIterator Pkg = Dep.ParentPkg();
    PkgIterator Pkg = Dep.ParentPkg();
-   for (; P.end() != true; P++)
+   for (; P.end() != true; ++P)
    {
    {
       /* Provides may never be applied against the same package (or group)
       /* Provides may never be applied against the same package (or group)
          if it is a conflicts. See the comment above. */
          if it is a conflicts. See the comment above. */
@@ -536,7 +536,7 @@ void pkgDepCache::BuildGroupOrs(VerIterator const &V)
 {
 {
    unsigned char Group = 0;
    unsigned char Group = 0;
    
    
-   for (DepIterator D = V.DependsList(); D.end() != true; D++)
+   for (DepIterator D = V.DependsList(); D.end() != true; ++D)
    {
    {
       // Build the dependency state.
       // Build the dependency state.
       unsigned char &State = DepState[D->ID];
       unsigned char &State = DepState[D->ID];
@@ -576,7 +576,7 @@ unsigned char pkgDepCache::VersionState(DepIterator D,unsigned char Check,
       // Compute a single dependency element (glob or)
       // Compute a single dependency element (glob or)
       DepIterator Start = D;
       DepIterator Start = D;
       unsigned char State = 0;
       unsigned char State = 0;
-      for (bool LastOR = true; D.end() == false && LastOR == true; D++)
+      for (bool LastOR = true; D.end() == false && LastOR == true; ++D)
       {
       {
 	 State |= DepState[D->ID];
 	 State |= DepState[D->ID];
 	 LastOR = (D->CompareOp & Dep::Or) == Dep::Or;
 	 LastOR = (D->CompareOp & Dep::Or) == Dep::Or;
@@ -666,15 +666,15 @@ void pkgDepCache::Update(OpProgress *Prog)
 
 
    // Perform the depends pass
    // Perform the depends pass
    int Done = 0;
    int Done = 0;
-   for (PkgIterator I = PkgBegin(); I.end() != true; I++,Done++)
+   for (PkgIterator I = PkgBegin(); I.end() != true; ++I, ++Done)
    {
    {
       if (Prog != 0 && Done%20 == 0)
       if (Prog != 0 && Done%20 == 0)
 	 Prog->Progress(Done);
 	 Prog->Progress(Done);
-      for (VerIterator V = I.VersionList(); V.end() != true; V++)
+      for (VerIterator V = I.VersionList(); V.end() != true; ++V)
       {
       {
 	 unsigned char Group = 0;
 	 unsigned char Group = 0;
 
 
-	 for (DepIterator D = V.DependsList(); D.end() != true; D++)
+	 for (DepIterator D = V.DependsList(); D.end() != true; ++D)
 	 {
 	 {
 	    // Build the dependency state.
 	    // Build the dependency state.
 	    unsigned char &State = DepState[D->ID];
 	    unsigned char &State = DepState[D->ID];
@@ -711,7 +711,7 @@ void pkgDepCache::Update(OpProgress *Prog)
 void pkgDepCache::Update(DepIterator D)
 void pkgDepCache::Update(DepIterator D)
 {
 {
    // Update the reverse deps
    // Update the reverse deps
-   for (;D.end() != true; D++)
+   for (;D.end() != true; ++D)
    {      
    {      
       unsigned char &State = DepState[D->ID];
       unsigned char &State = DepState[D->ID];
       State = DependencyState(D);
       State = DependencyState(D);
@@ -744,13 +744,13 @@ void pkgDepCache::Update(PkgIterator const &Pkg)
    // Update the provides map for the current ver
    // Update the provides map for the current ver
    if (Pkg->CurrentVer != 0)
    if (Pkg->CurrentVer != 0)
       for (PrvIterator P = Pkg.CurrentVer().ProvidesList(); 
       for (PrvIterator P = Pkg.CurrentVer().ProvidesList(); 
-	   P.end() != true; P++)
+	   P.end() != true; ++P)
 	 Update(P.ParentPkg().RevDependsList());
 	 Update(P.ParentPkg().RevDependsList());
 
 
    // Update the provides map for the candidate ver
    // Update the provides map for the candidate ver
    if (PkgState[Pkg->ID].CandidateVer != 0)
    if (PkgState[Pkg->ID].CandidateVer != 0)
       for (PrvIterator P = PkgState[Pkg->ID].CandidateVerIter(*this).ProvidesList();
       for (PrvIterator P = PkgState[Pkg->ID].CandidateVerIter(*this).ProvidesList();
-	   P.end() != true; P++)
+	   P.end() != true; ++P)
 	 Update(P.ParentPkg().RevDependsList());
 	 Update(P.ParentPkg().RevDependsList());
 }
 }
 									/*}}}*/
 									/*}}}*/
@@ -1011,7 +1011,7 @@ bool pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
       DepIterator Start = Dep;
       DepIterator Start = Dep;
       bool Result = true;
       bool Result = true;
       unsigned Ors = 0;
       unsigned Ors = 0;
-      for (bool LastOR = true; Dep.end() == false && LastOR == true; Dep++,Ors++)
+      for (bool LastOR = true; Dep.end() == false && LastOR == true; ++Dep, ++Ors)
       {
       {
 	 LastOR = (Dep->CompareOp & Dep::Or) == Dep::Or;
 	 LastOR = (Dep->CompareOp & Dep::Or) == Dep::Or;
 
 
@@ -1477,12 +1477,12 @@ pkgCache::VerIterator pkgDepCache::Policy::GetCandidateVer(PkgIterator const &Pk
       unless they are already installed */
       unless they are already installed */
    VerIterator Last(*(pkgCache *)this,0);
    VerIterator Last(*(pkgCache *)this,0);
    
    
-   for (VerIterator I = Pkg.VersionList(); I.end() == false; I++)
+   for (VerIterator I = Pkg.VersionList(); I.end() == false; ++I)
    {
    {
       if (Pkg.CurrentVer() == I)
       if (Pkg.CurrentVer() == I)
 	 return I;
 	 return I;
       
       
-      for (VerFileIterator J = I.FileList(); J.end() == false; J++)
+      for (VerFileIterator J = I.FileList(); J.end() == false; ++J)
       {
       {
 	 if ((J.File()->Flags & Flag::NotSource) != 0)
 	 if ((J.File()->Flags & Flag::NotSource) != 0)
 	    continue;
 	    continue;
@@ -1513,7 +1513,7 @@ bool pkgDepCache::Policy::IsImportantDep(DepIterator const &Dep)
       return true;
       return true;
    else if(Dep->Type == pkgCache::Dep::Recommends) 
    else if(Dep->Type == pkgCache::Dep::Recommends) 
    {
    {
-      if ( _config->FindB("APT::Install-Recommends", false))
+      if (InstallRecommends)
 	 return true;
 	 return true;
       // we suport a special mode to only install-recommends for certain
       // we suport a special mode to only install-recommends for certain
       // sections
       // sections
@@ -1524,7 +1524,7 @@ bool pkgDepCache::Policy::IsImportantDep(DepIterator const &Dep)
 	 return true;
 	 return true;
    }
    }
    else if(Dep->Type == pkgCache::Dep::Suggests)
    else if(Dep->Type == pkgCache::Dep::Suggests)
-     return _config->FindB("APT::Install-Suggests", false);
+      return InstallSuggests;
 
 
    return false;
    return false;
 }
 }

+ 11 - 3
apt-pkg/depcache.h

@@ -258,13 +258,21 @@ class pkgDepCache : protected pkgCache::Namespace
    class Policy
    class Policy
    {
    {
       public:
       public:
-      
+      Policy() {
+         InstallRecommends = _config->FindB("APT::Install-Recommends", false);
+         InstallSuggests = _config->FindB("APT::Install-Suggests", false);
+      }
+
       virtual VerIterator GetCandidateVer(PkgIterator const &Pkg);
       virtual VerIterator GetCandidateVer(PkgIterator const &Pkg);
       virtual bool IsImportantDep(DepIterator const &Dep);
       virtual bool IsImportantDep(DepIterator const &Dep);
       virtual signed short GetPriority(PkgIterator const &Pkg);
       virtual signed short GetPriority(PkgIterator const &Pkg);
       virtual signed short GetPriority(PkgFileIterator const &File);
       virtual signed short GetPriority(PkgFileIterator const &File);
 
 
       virtual ~Policy() {};
       virtual ~Policy() {};
+
+      private:
+      bool InstallRecommends;
+      bool InstallSuggests;
    };
    };
 
 
    private:
    private:
@@ -392,7 +400,7 @@ class pkgDepCache : protected pkgCache::Namespace
    // @{
    // @{
    bool MarkKeep(PkgIterator const &Pkg, bool Soft = false,
    bool MarkKeep(PkgIterator const &Pkg, bool Soft = false,
 		 bool FromUser = true, unsigned long Depth = 0);
 		 bool FromUser = true, unsigned long Depth = 0);
-   bool MarkDelete(PkgIterator const &Pkg, bool Purge = false,
+   bool MarkDelete(PkgIterator const &Pkg, bool MarkPurge = false,
                    unsigned long Depth = 0, bool FromUser = true);
                    unsigned long Depth = 0, bool FromUser = true);
    bool MarkInstall(PkgIterator const &Pkg,bool AutoInst = true,
    bool MarkInstall(PkgIterator const &Pkg,bool AutoInst = true,
 		    unsigned long Depth = 0, bool FromUser = true,
 		    unsigned long Depth = 0, bool FromUser = true,
@@ -460,7 +468,7 @@ class pkgDepCache : protected pkgCache::Namespace
     *  \param Depth     recursive deep of this Marker call
     *  \param Depth     recursive deep of this Marker call
     *  \param FromUser  was the remove requested by the user?
     *  \param FromUser  was the remove requested by the user?
     */
     */
-   virtual bool IsDeleteOk(const PkgIterator &Pkg,bool Purge = false,
+   virtual bool IsDeleteOk(const PkgIterator &Pkg,bool MarkPurge = false,
 			    unsigned long Depth = 0, bool FromUser = true);
 			    unsigned long Depth = 0, bool FromUser = true);
 
 
    // read persistent states
    // read persistent states

+ 10 - 11
apt-pkg/indexcopy.cc

@@ -46,7 +46,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector<string> &List,
 			     pkgCdromStatus *log)
 			     pkgCdromStatus *log)
 {
 {
    OpProgress *Progress = NULL;
    OpProgress *Progress = NULL;
-   if (List.size() == 0)
+   if (List.empty() == true)
       return true;
       return true;
    
    
    if(log) 
    if(log) 
@@ -57,7 +57,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector<string> &List,
    
    
    // Prepare the progress indicator
    // Prepare the progress indicator
    off_t 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;
       if (stat(string(*I + GetFileName()).c_str(),&Buf) != 0 &&
       if (stat(string(*I + GetFileName()).c_str(),&Buf) != 0 &&
@@ -71,7 +71,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector<string> &List,
    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());
       off_t FileSize = 0;
       off_t FileSize = 0;
@@ -586,13 +586,13 @@ bool SigVerify::CopyMetaIndex(string CDROM, string CDName,		/*{{{*/
 bool SigVerify::CopyAndVerify(string CDROM,string Name,vector<string> &SigList,	/*{{{*/
 bool SigVerify::CopyAndVerify(string CDROM,string Name,vector<string> &SigList,	/*{{{*/
 			      vector<string> PkgList,vector<string> SrcList)
 			      vector<string> PkgList,vector<string> SrcList)
 {
 {
-   if (SigList.size() == 0)
+   if (SigList.empty() == true)
       return true;
       return true;
 
 
    bool Debug = _config->FindB("Debug::aptcdrom",false);
    bool Debug = _config->FindB("Debug::aptcdrom",false);
 
 
    // Read all Release files
    // Read all Release files
-   for (vector<string>::iterator I = SigList.begin(); I != SigList.end(); I++)
+   for (vector<string>::iterator I = SigList.begin(); I != SigList.end(); ++I)
    { 
    { 
       if(Debug)
       if(Debug)
 	 cout << "Signature verify for: " << *I << endl;
 	 cout << "Signature verify for: " << *I << endl;
@@ -636,7 +636,7 @@ bool SigVerify::CopyAndVerify(string CDROM,string Name,vector<string> &SigList,
       // go over the Indexfiles and see if they verify
       // go over the Indexfiles and see if they verify
       // if so, remove them from our copy of the lists
       // if so, remove them from our copy of the lists
       vector<string> keys = MetaIndex->MetaKeys();
       vector<string> keys = MetaIndex->MetaKeys();
-      for (vector<string>::iterator I = keys.begin(); I != keys.end(); I++)
+      for (vector<string>::iterator I = keys.begin(); I != keys.end(); ++I)
       { 
       { 
 	 if(!Verify(prefix,*I, MetaIndex)) {
 	 if(!Verify(prefix,*I, MetaIndex)) {
 	    // something went wrong, don't copy the Release.gpg
 	    // something went wrong, don't copy the Release.gpg
@@ -779,7 +779,7 @@ bool TranslationsCopy::CopyTranslations(string CDROM,string Name,	/*{{{*/
 				vector<string> &List, pkgCdromStatus *log)
 				vector<string> &List, pkgCdromStatus *log)
 {
 {
    OpProgress *Progress = NULL;
    OpProgress *Progress = NULL;
-   if (List.size() == 0)
+   if (List.empty() == true)
       return true;
       return true;
    
    
    if(log) 
    if(log) 
@@ -789,7 +789,7 @@ bool TranslationsCopy::CopyTranslations(string CDROM,string Name,	/*{{{*/
    
    
    // Prepare the progress indicator
    // Prepare the progress indicator
    off_t 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;
       if (stat(string(*I).c_str(),&Buf) != 0 &&
       if (stat(string(*I).c_str(),&Buf) != 0 &&
@@ -803,7 +803,7 @@ bool TranslationsCopy::CopyTranslations(string CDROM,string Name,	/*{{{*/
    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());
       off_t FileSize = 0;
       off_t FileSize = 0;
@@ -888,7 +888,6 @@ bool TranslationsCopy::CopyTranslations(string CDROM,string Name,	/*{{{*/
       this->Section = &Section;
       this->Section = &Section;
       string Prefix;
       string Prefix;
       unsigned long Hits = 0;
       unsigned long Hits = 0;
-      unsigned long Chop = 0;
       while (Parser.Step(Section) == true)
       while (Parser.Step(Section) == true)
       {
       {
 	 if(Progress)
 	 if(Progress)
@@ -906,7 +905,7 @@ bool TranslationsCopy::CopyTranslations(string CDROM,string Name,	/*{{{*/
       fclose(TargetFl);
       fclose(TargetFl);
 
 
       if (Debug == true)
       if (Debug == true)
-	 cout << " Processed by using Prefix '" << Prefix << "' and chop " << Chop << endl;
+	 cout << " Processed by using Prefix '" << Prefix << "' and chop " << endl;
 	 
 	 
       if (_config->FindB("APT::CDROM::NoAct",false) == false)
       if (_config->FindB("APT::CDROM::NoAct",false) == false)
       {
       {

+ 2 - 1
apt-pkg/indexfile.cc

@@ -29,7 +29,8 @@ unsigned long pkgIndexFile::Type::GlobalListLen = 0;
 pkgIndexFile::Type::Type()
 pkgIndexFile::Type::Type()
 {
 {
    ItmList[GlobalListLen] = this;
    ItmList[GlobalListLen] = this;
-   GlobalListLen++;   
+   GlobalListLen++;
+   Label = NULL;
 }
 }
 									/*}}}*/
 									/*}}}*/
 // Type::GetType - Locate the type by name				/*{{{*/
 // Type::GetType - Locate the type by name				/*{{{*/

+ 1 - 1
apt-pkg/makefile

@@ -26,7 +26,7 @@ SOURCE = contrib/mmap.cc contrib/error.cc contrib/strutl.cc \
 	 contrib/cdromutl.cc contrib/crc-16.cc contrib/netrc.cc \
 	 contrib/cdromutl.cc contrib/crc-16.cc contrib/netrc.cc \
 	 contrib/fileutl.cc 
 	 contrib/fileutl.cc 
 HEADERS = mmap.h error.h configuration.h fileutl.h  cmndline.h netrc.h\
 HEADERS = mmap.h error.h configuration.h fileutl.h  cmndline.h netrc.h\
-	  md5.h crc-16.h cdromutl.h strutl.h sptr.h sha1.h sha2.h \
+	  md5.h crc-16.h cdromutl.h strutl.h sptr.h sha1.h sha2.h sha256.h\
 	  sha2_internal.h \
 	  sha2_internal.h \
           hashes.h hashsum_template.h\
           hashes.h hashsum_template.h\
 	  macros.h weakptr.h
 	  macros.h weakptr.h

+ 13 - 13
apt-pkg/orderlist.cc

@@ -147,13 +147,13 @@ bool pkgOrderList::DoRun()
    Depth = 0;
    Depth = 0;
    WipeFlags(Added | AddPending | Loop | InList);
    WipeFlags(Added | AddPending | Loop | InList);
 
 
-   for (iterator I = List; I != End; I++)
+   for (iterator I = List; I != End; ++I)
       Flag(*I,InList);
       Flag(*I,InList);
 
 
    // Rebuild the main list into the temp list.
    // Rebuild the main list into the temp list.
    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)) == false)
       {
       {
 	 End = OldEnd;
 	 End = OldEnd;
@@ -199,7 +199,7 @@ bool pkgOrderList::OrderCritical()
    {
    {
       clog << "** Critical Unpack ordering done" << endl;
       clog << "** Critical Unpack ordering done" << endl;
 
 
-      for (iterator I = List; I != End; I++)
+      for (iterator I = List; I != End; ++I)
       {
       {
 	 PkgIterator P(Cache,*I);
 	 PkgIterator P(Cache,*I);
 	 if (IsNow(P) == true)
 	 if (IsNow(P) == true)
@@ -224,7 +224,7 @@ bool pkgOrderList::OrderUnpack(string *FileList)
       WipeFlags(After);
       WipeFlags(After);
 
 
       // Set the inlist flag
       // Set the inlist flag
-      for (iterator I = List; I != End; I++)
+      for (iterator I = List; I != End; ++I)
       {
       {
 	 PkgIterator P(Cache,*I);
 	 PkgIterator P(Cache,*I);
 	 if (IsMissing(P) == true && IsNow(P) == true)
 	 if (IsMissing(P) == true && IsNow(P) == true)
@@ -272,7 +272,7 @@ bool pkgOrderList::OrderUnpack(string *FileList)
    {
    {
       clog << "** Unpack ordering done" << endl;
       clog << "** Unpack ordering done" << endl;
 
 
-      for (iterator I = List; I != End; I++)
+      for (iterator I = List; I != End; ++I)
       {
       {
 	 PkgIterator P(Cache,*I);
 	 PkgIterator P(Cache,*I);
 	 if (IsNow(P) == true)
 	 if (IsNow(P) == true)
@@ -325,7 +325,7 @@ int pkgOrderList::Score(PkgIterator Pkg)
       Score += ScoreImmediate;
       Score += ScoreImmediate;
 
 
    for (DepIterator D = Cache[Pkg].InstVerIter(Cache).DependsList();
    for (DepIterator D = Cache[Pkg].InstVerIter(Cache).DependsList();
-	D.end() == false; D++)
+	D.end() == false; ++D)
       if (D->Type == pkgCache::Dep::PreDepends)
       if (D->Type == pkgCache::Dep::PreDepends)
       {
       {
 	 Score += ScorePreDepends;
 	 Score += ScorePreDepends;
@@ -490,7 +490,7 @@ bool pkgOrderList::VisitRProvides(DepFunc F,VerIterator Ver)
       return true;
       return true;
    
    
    bool Res = true;
    bool Res = true;
-   for (PrvIterator P = Ver.ProvidesList(); P.end() == false; P++)
+   for (PrvIterator P = Ver.ProvidesList(); P.end() == false; ++P)
       Res &= (this->*F)(P.ParentPkg().RevDependsList());
       Res &= (this->*F)(P.ParentPkg().RevDependsList());
    return Res;
    return Res;
 }
 }
@@ -617,7 +617,7 @@ bool pkgOrderList::VisitNode(PkgIterator Pkg)
    Loops are preprocessed and logged. */
    Loops are preprocessed and logged. */
 bool pkgOrderList::DepUnPackCrit(DepIterator D)
 bool pkgOrderList::DepUnPackCrit(DepIterator D)
 {
 {
-   for (; D.end() == false; D++)
+   for (; D.end() == false; ++D)
    {
    {
       if (D.Reverse() == true)
       if (D.Reverse() == true)
       {
       {
@@ -695,7 +695,7 @@ bool pkgOrderList::DepUnPackPreD(DepIterator D)
    if (D.Reverse() == true)
    if (D.Reverse() == true)
       return DepUnPackCrit(D);
       return DepUnPackCrit(D);
    
    
-   for (; D.end() == false; D++)
+   for (; D.end() == false; ++D)
    {
    {
       if (D.IsCritical() == false)
       if (D.IsCritical() == false)
 	 continue;
 	 continue;
@@ -738,7 +738,7 @@ bool pkgOrderList::DepUnPackPre(DepIterator D)
    if (D.Reverse() == true)
    if (D.Reverse() == true)
       return true;
       return true;
    
    
-   for (; D.end() == false; D++)
+   for (; D.end() == false; ++D)
    {
    {
       /* Only consider the PreDepends or Depends. Depends are only
       /* Only consider the PreDepends or Depends. Depends are only
        	 considered at the lowest depth or in the case of immediate
        	 considered at the lowest depth or in the case of immediate
@@ -793,7 +793,7 @@ bool pkgOrderList::DepUnPackPre(DepIterator D)
 bool pkgOrderList::DepUnPackDep(DepIterator D)
 bool pkgOrderList::DepUnPackDep(DepIterator D)
 {
 {
    
    
-   for (; D.end() == false; D++)
+   for (; D.end() == false; ++D)
       if (D.IsCritical() == true)
       if (D.IsCritical() == true)
       {
       {
 	 if (D.Reverse() == true)
 	 if (D.Reverse() == true)
@@ -848,7 +848,7 @@ bool pkgOrderList::DepConfigure(DepIterator D)
    if (D.Reverse() == true)
    if (D.Reverse() == true)
       return true;
       return true;
    
    
-   for (; D.end() == false; D++)
+   for (; D.end() == false; ++D)
       if (D->Type == pkgCache::Dep::Depends)
       if (D->Type == pkgCache::Dep::Depends)
 	 if (VisitProvides(D,false) == false)
 	 if (VisitProvides(D,false) == false)
 	    return false;
 	    return false;
@@ -870,7 +870,7 @@ bool pkgOrderList::DepRemove(DepIterator D)
 {
 {
    if (D.Reverse() == false)
    if (D.Reverse() == false)
       return true;
       return true;
-   for (; D.end() == false; D++)
+   for (; D.end() == false; ++D)
       if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends)
       if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends)
       {
       {
 	 // Duplication elimination, consider the current version only
 	 // Duplication elimination, consider the current version only

+ 16 - 16
apt-pkg/packagemanager.cc

@@ -65,7 +65,7 @@ bool pkgPackageManager::GetArchives(pkgAcquire *Owner,pkgSourceList *Sources,
    if (ordering == false)
    if (ordering == false)
       return _error->Error("Internal ordering error");
       return _error->Error("Internal ordering error");
 
 
-   for (pkgOrderList::iterator I = List->begin(); I != List->end(); I++)
+   for (pkgOrderList::iterator I = List->begin(); I != List->end(); ++I)
    {
    {
       PkgIterator Pkg(Cache,*I);
       PkgIterator Pkg(Cache,*I);
       FileNames[Pkg->ID] = string();
       FileNames[Pkg->ID] = string();
@@ -101,7 +101,7 @@ bool pkgPackageManager::FixMissing()
    List->SetFileList(FileNames);
    List->SetFileList(FileNames);
 
 
    bool Bad = false;
    bool Bad = false;
-   for (PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
+   for (PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
    {
    {
       if (List->IsMissing(I) == false)
       if (List->IsMissing(I) == false)
 	 continue;
 	 continue;
@@ -142,7 +142,7 @@ void pkgPackageManager::ImmediateAdd(PkgIterator I, bool UseInstallVer, unsigned
       D = I.CurrentVer().DependsList(); 
       D = I.CurrentVer().DependsList(); 
    }
    }
 
 
-   for ( /* nothing */  ; D.end() == false; D++)
+   for ( /* nothing */  ; D.end() == false; ++D)
       if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends)
       if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends)
       {
       {
 	 if(!List->IsFlag(D.TargetPkg(), pkgOrderList::Immediate))
 	 if(!List->IsFlag(D.TargetPkg(), pkgOrderList::Immediate))
@@ -171,7 +171,7 @@ bool pkgPackageManager::CreateOrderList()
    static bool const NoImmConfigure = !_config->FindB("APT::Immediate-Configure",true);
    static bool const NoImmConfigure = !_config->FindB("APT::Immediate-Configure",true);
    
    
    // Generate the list of affected packages and sort it
    // Generate the list of affected packages and sort it
-   for (PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
+   for (PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
    {
    {
       // Ignore no-version packages
       // Ignore no-version packages
       if (I->VersionList == 0)
       if (I->VersionList == 0)
@@ -231,7 +231,7 @@ bool pkgPackageManager::DepAlwaysTrue(DepIterator D)
 bool pkgPackageManager::CheckRConflicts(PkgIterator Pkg,DepIterator D,
 bool pkgPackageManager::CheckRConflicts(PkgIterator Pkg,DepIterator D,
 					const char *Ver)
 					const char *Ver)
 {
 {
-   for (;D.end() == false; D++)
+   for (;D.end() == false; ++D)
    {
    {
       if (D->Type != pkgCache::Dep::Conflicts &&
       if (D->Type != pkgCache::Dep::Conflicts &&
 	  D->Type != pkgCache::Dep::Obsoletes)
 	  D->Type != pkgCache::Dep::Obsoletes)
@@ -264,7 +264,7 @@ bool pkgPackageManager::ConfigureAll()
    pkgOrderList OList(&Cache);
    pkgOrderList OList(&Cache);
    
    
    // Populate the order list
    // Populate the order list
-   for (pkgOrderList::iterator I = List->begin(); I != List->end(); I++)
+   for (pkgOrderList::iterator I = List->begin(); I != List->end(); ++I)
       if (List->IsFlag(pkgCache::PkgIterator(Cache,*I),
       if (List->IsFlag(pkgCache::PkgIterator(Cache,*I),
 		       pkgOrderList::UnPacked) == true)
 		       pkgOrderList::UnPacked) == true)
 	 OList.push_back(*I);
 	 OList.push_back(*I);
@@ -276,7 +276,7 @@ bool pkgPackageManager::ConfigureAll()
    bool const ConfigurePkgs = (conf == "all");
    bool const ConfigurePkgs = (conf == "all");
 
 
    // Perform the configuring
    // Perform the configuring
-   for (pkgOrderList::iterator I = OList.begin(); I != OList.end(); I++)
+   for (pkgOrderList::iterator I = OList.begin(); I != OList.end(); ++I)
    {
    {
       PkgIterator Pkg(Cache,*I);
       PkgIterator Pkg(Cache,*I);
 
 
@@ -311,7 +311,7 @@ bool pkgPackageManager::SmartConfigure(PkgIterator Pkg)
 	 return false;
 	 return false;
 
 
    // Perform the configuring
    // Perform the configuring
-   for (pkgOrderList::iterator I = OList.begin(); I != OList.end(); I++)
+   for (pkgOrderList::iterator I = OList.begin(); I != OList.end(); ++I)
    {
    {
       PkgIterator Pkg(Cache,*I);
       PkgIterator Pkg(Cache,*I);
       
       
@@ -366,13 +366,13 @@ bool pkgPackageManager::DepAdd(pkgOrderList &OList,PkgIterator Pkg,int Depth)
    {
    {
       if (D->Type != pkgCache::Dep::Depends && D->Type != pkgCache::Dep::PreDepends)
       if (D->Type != pkgCache::Dep::Depends && D->Type != pkgCache::Dep::PreDepends)
       {
       {
-	 D++;
+	 ++D;
 	 continue;
 	 continue;
       }
       }
       
       
       // Grok or groups
       // Grok or groups
       Bad = true;
       Bad = true;
-      for (bool LastOR = true; D.end() == false && LastOR == true; D++)
+      for (bool LastOR = true; D.end() == false && LastOR == true; ++D)
       {
       {
 	 LastOR = (D->CompareOp & pkgCache::Dep::Or) == pkgCache::Dep::Or;
 	 LastOR = (D->CompareOp & pkgCache::Dep::Or) == pkgCache::Dep::Or;
 	 
 	 
@@ -380,7 +380,7 @@ bool pkgPackageManager::DepAdd(pkgOrderList &OList,PkgIterator Pkg,int Depth)
 	    continue;
 	    continue;
 
 
 	 SPtrArray<Version *> VList = D.AllTargets();
 	 SPtrArray<Version *> VList = D.AllTargets();
-	 for (Version **I = VList; *I != 0 && Bad == true; I++)
+	 for (Version **I = VList; *I != 0 && Bad == true; ++I)
 	 {
 	 {
 	    VerIterator Ver(Cache,*I);
 	    VerIterator Ver(Cache,*I);
 	    PkgIterator Pkg = Ver.ParentPkg();
 	    PkgIterator Pkg = Ver.ParentPkg();
@@ -446,7 +446,7 @@ bool pkgPackageManager::EarlyRemove(PkgIterator Pkg)
    if (Pkg->CurrentVer != 0)
    if (Pkg->CurrentVer != 0)
    {
    {
       for (DepIterator D = Pkg.RevDependsList(); D.end() == false &&
       for (DepIterator D = Pkg.RevDependsList(); D.end() == false &&
-	   IsEssential == false; D++)
+	   IsEssential == false; ++D)
 	 if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends)
 	 if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends)
 	    if ((D.ParentPkg()->Flags & pkgCache::Flag::Essential) != 0)
 	    if ((D.ParentPkg()->Flags & pkgCache::Flag::Essential) != 0)
 	       IsEssential = true;
 	       IsEssential = true;
@@ -566,7 +566,7 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate)
 	       return _error->Error("Couldn't configure pre-depend %s for %s, "
 	       return _error->Error("Couldn't configure pre-depend %s for %s, "
 				    "probably a dependency cycle.",
 				    "probably a dependency cycle.",
 				    End.TargetPkg().Name(),Pkg.Name());
 				    End.TargetPkg().Name(),Pkg.Name());
-	    Start++;
+	    ++Start;
 	 }
 	 }
 	 else
 	 else
 	    break;
 	    break;
@@ -599,7 +599,7 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate)
       return false;
       return false;
    
    
    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());
       CheckRConflicts(Pkg,P.ParentPkg().RevDependsList(),P.ProvideVersion());
 
 
    List->Flag(Pkg,pkgOrderList::UnPacked,pkgOrderList::States);
    List->Flag(Pkg,pkgOrderList::UnPacked,pkgOrderList::States);
@@ -654,7 +654,7 @@ pkgPackageManager::OrderResult pkgPackageManager::OrderInstall()
       clog << "Done ordering" << endl;
       clog << "Done ordering" << endl;
 
 
    bool DoneSomething = false;
    bool DoneSomething = false;
-   for (pkgOrderList::iterator I = List->begin(); I != List->end(); I++)
+   for (pkgOrderList::iterator I = List->begin(); I != List->end(); ++I)
    {
    {
       PkgIterator Pkg(Cache,*I);
       PkgIterator Pkg(Cache,*I);
 
 
@@ -703,7 +703,7 @@ pkgPackageManager::OrderResult pkgPackageManager::OrderInstall()
       return Failed;
       return Failed;
 
 
    // Sanity check
    // Sanity check
-   for (pkgOrderList::iterator I = List->begin(); I != List->end(); I++)
+   for (pkgOrderList::iterator I = List->begin(); I != List->end(); ++I)
    {
    {
       if (List->IsFlag(*I,pkgOrderList::Configured) == false)
       if (List->IsFlag(*I,pkgOrderList::Configured) == false)
       {
       {

+ 18 - 13
apt-pkg/pkgcache.cc

@@ -85,6 +85,8 @@ pkgCache::Header::Header()
    memset(PkgHashTable,0,sizeof(PkgHashTable));
    memset(PkgHashTable,0,sizeof(PkgHashTable));
    memset(GrpHashTable,0,sizeof(GrpHashTable));
    memset(GrpHashTable,0,sizeof(GrpHashTable));
    memset(Pools,0,sizeof(Pools));
    memset(Pools,0,sizeof(Pools));
+
+   CacheFileSize = 0;
 }
 }
 									/*}}}*/
 									/*}}}*/
 // Cache::Header::CheckSizes - Check if the two headers have same *sz	/*{{{*/
 // Cache::Header::CheckSizes - Check if the two headers have same *sz	/*{{{*/
@@ -156,6 +158,9 @@ bool pkgCache::ReMap(bool const &Errorchecks)
        HeaderP->CheckSizes(DefHeader) == false)
        HeaderP->CheckSizes(DefHeader) == false)
       return _error->Error(_("The package cache file is an incompatible version"));
       return _error->Error(_("The package cache file is an incompatible version"));
 
 
+   if (Map.Size() < HeaderP->CacheFileSize)
+      return _error->Error(_("The package cache file is corrupted, it is too small"));
+
    // Locate our VS..
    // Locate our VS..
    if (HeaderP->VerSysName == 0 ||
    if (HeaderP->VerSysName == 0 ||
        (VS = pkgVersioningSystem::GetVS(StrP + HeaderP->VerSysName)) == 0)
        (VS = pkgVersioningSystem::GetVS(StrP + HeaderP->VerSysName)) == 0)
@@ -176,7 +181,7 @@ bool pkgCache::ReMap(bool const &Errorchecks)
 unsigned long pkgCache::sHash(const string &Str) const
 unsigned long pkgCache::sHash(const string &Str) const
 {
 {
    unsigned long Hash = 0;
    unsigned long Hash = 0;
-   for (string::const_iterator I = Str.begin(); I != Str.end(); I++)
+   for (string::const_iterator I = Str.begin(); I != Str.end(); ++I)
       Hash = 5*Hash + tolower_ascii(*I);
       Hash = 5*Hash + tolower_ascii(*I);
    return Hash % _count(HeaderP->PkgHashTable);
    return Hash % _count(HeaderP->PkgHashTable);
 }
 }
@@ -184,7 +189,7 @@ unsigned long pkgCache::sHash(const string &Str) const
 unsigned long pkgCache::sHash(const char *Str) const
 unsigned long pkgCache::sHash(const char *Str) const
 {
 {
    unsigned long Hash = 0;
    unsigned long Hash = 0;
-   for (const char *I = Str; *I != 0; I++)
+   for (const char *I = Str; *I != 0; ++I)
       Hash = 5*Hash + tolower_ascii(*I);
       Hash = 5*Hash + tolower_ascii(*I);
    return Hash % _count(HeaderP->PkgHashTable);
    return Hash % _count(HeaderP->PkgHashTable);
 }
 }
@@ -570,7 +575,7 @@ bool pkgCache::DepIterator::SmartTargetPkg(PkgIterator &Result) const
       virtual package libc-dev which is provided by libc5-dev and libc6-dev
       virtual package libc-dev which is provided by libc5-dev and libc6-dev
       we must ignore libc5-dev when considering the provides list. */ 
       we must ignore libc5-dev when considering the provides list. */ 
    PrvIterator PStart = Result.ProvidesList();
    PrvIterator PStart = Result.ProvidesList();
-   for (; PStart.end() != true && PStart.OwnerPkg() == ParentPkg(); PStart++);
+   for (; PStart.end() != true && PStart.OwnerPkg() == ParentPkg(); ++PStart);
 
 
    // Nothing but indirect self provides
    // Nothing but indirect self provides
    if (PStart.end() == true)
    if (PStart.end() == true)
@@ -578,7 +583,7 @@ bool pkgCache::DepIterator::SmartTargetPkg(PkgIterator &Result) const
    
    
    // Check for single packages in the provides list
    // Check for single packages in the provides list
    PrvIterator P = PStart;
    PrvIterator P = PStart;
-   for (; P.end() != true; P++)
+   for (; P.end() != true; ++P)
    {
    {
       // Skip over self provides
       // Skip over self provides
       if (P.OwnerPkg() == ParentPkg())
       if (P.OwnerPkg() == ParentPkg())
@@ -612,7 +617,7 @@ pkgCache::Version **pkgCache::DepIterator::AllTargets() const
       PkgIterator DPkg = TargetPkg();
       PkgIterator DPkg = TargetPkg();
 
 
       // Walk along the actual package providing versions
       // Walk along the actual package providing versions
-      for (VerIterator I = DPkg.VersionList(); I.end() == false; I++)
+      for (VerIterator I = DPkg.VersionList(); I.end() == false; ++I)
       {
       {
 	 if (Owner->VS->CheckDep(I.VerStr(),S->CompareOp,TargetVer()) == false)
 	 if (Owner->VS->CheckDep(I.VerStr(),S->CompareOp,TargetVer()) == false)
 	    continue;
 	    continue;
@@ -627,7 +632,7 @@ pkgCache::Version **pkgCache::DepIterator::AllTargets() const
       }
       }
       
       
       // Follow all provides
       // Follow all provides
-      for (PrvIterator I = DPkg.ProvidesList(); I.end() == false; I++)
+      for (PrvIterator I = DPkg.ProvidesList(); I.end() == false; ++I)
       {
       {
 	 if (Owner->VS->CheckDep(I.ProvideVersion(),S->CompareOp,TargetVer()) == false)
 	 if (Owner->VS->CheckDep(I.ProvideVersion(),S->CompareOp,TargetVer()) == false)
 	    continue;
 	    continue;
@@ -718,7 +723,7 @@ int pkgCache::VerIterator::CompareVer(const VerIterator &B) const
    /* Start at A and look for B. If B is found then A > B otherwise
    /* Start at A and look for B. If B is found then A > B otherwise
       B was before A so A < B */
       B was before A so A < B */
    VerIterator I = *this;
    VerIterator I = *this;
-   for (;I.end() == false; I++)
+   for (;I.end() == false; ++I)
       if (I == B)
       if (I == B)
 	 return 1;
 	 return 1;
    return -1;
    return -1;
@@ -730,7 +735,7 @@ int pkgCache::VerIterator::CompareVer(const VerIterator &B) const
 bool pkgCache::VerIterator::Downloadable() const
 bool pkgCache::VerIterator::Downloadable() const
 {
 {
    VerFileIterator Files = FileList();
    VerFileIterator Files = FileList();
-   for (; Files.end() == false; Files++)
+   for (; Files.end() == false; ++Files)
       if ((Files.File()->Flags & pkgCache::Flag::NotSource) != pkgCache::Flag::NotSource)
       if ((Files.File()->Flags & pkgCache::Flag::NotSource) != pkgCache::Flag::NotSource)
 	 return true;
 	 return true;
    return false;
    return false;
@@ -743,7 +748,7 @@ bool pkgCache::VerIterator::Downloadable() const
 bool pkgCache::VerIterator::Automatic() const
 bool pkgCache::VerIterator::Automatic() const
 {
 {
    VerFileIterator Files = FileList();
    VerFileIterator Files = FileList();
-   for (; Files.end() == false; Files++)
+   for (; Files.end() == false; ++Files)
       // Do not check ButAutomaticUpgrades here as it is kind of automatic…
       // Do not check ButAutomaticUpgrades here as it is kind of automatic…
       if ((Files.File()->Flags & pkgCache::Flag::NotAutomatic) != pkgCache::Flag::NotAutomatic)
       if ((Files.File()->Flags & pkgCache::Flag::NotAutomatic) != pkgCache::Flag::NotAutomatic)
 	 return true;
 	 return true;
@@ -758,7 +763,7 @@ pkgCache::VerFileIterator pkgCache::VerIterator::NewestFile() const
 {
 {
    VerFileIterator Files = FileList();
    VerFileIterator Files = FileList();
    VerFileIterator Highest = Files;
    VerFileIterator Highest = Files;
-   for (; Files.end() == false; Files++)
+   for (; Files.end() == false; ++Files)
    {
    {
       if (Owner->VS->CmpReleaseVer(Files.File().Version(),Highest.File().Version()) > 0)
       if (Owner->VS->CmpReleaseVer(Files.File().Version(),Highest.File().Version()) > 0)
 	 Highest = Files;
 	 Highest = Files;
@@ -775,7 +780,7 @@ string pkgCache::VerIterator::RelStr() const
 {
 {
    bool First = true;
    bool First = true;
    string Res;
    string Res;
-   for (pkgCache::VerFileIterator I = this->FileList(); I.end() == false; I++)
+   for (pkgCache::VerFileIterator I = this->FileList(); I.end() == false; ++I)
    {
    {
       // Do not print 'not source' entries'
       // Do not print 'not source' entries'
       pkgCache::PkgFileIterator File = I.File();
       pkgCache::PkgFileIterator File = I.File();
@@ -784,7 +789,7 @@ string pkgCache::VerIterator::RelStr() const
 
 
       // See if we have already printed this out..
       // See if we have already printed this out..
       bool Seen = false;
       bool Seen = false;
-      for (pkgCache::VerFileIterator J = this->FileList(); I != J; J++)
+      for (pkgCache::VerFileIterator J = this->FileList(); I != J; ++J)
       {
       {
 	 pkgCache::PkgFileIterator File2 = J.File();
 	 pkgCache::PkgFileIterator File2 = J.File();
 	 if (File2->Label == 0 || File->Label == 0)
 	 if (File2->Label == 0 || File->Label == 0)
@@ -885,7 +890,7 @@ pkgCache::DescIterator pkgCache::VerIterator::TranslatedDescription() const
 {
 {
    std::vector<string> const lang = APT::Configuration::getLanguages();
    std::vector<string> const lang = APT::Configuration::getLanguages();
    for (std::vector<string>::const_iterator l = lang.begin();
    for (std::vector<string>::const_iterator l = lang.begin();
-	l != lang.end(); l++)
+	l != lang.end(); ++l)
    {
    {
       pkgCache::DescIterator Desc = DescriptionList();
       pkgCache::DescIterator Desc = DescriptionList();
       for (; Desc.end() == false; ++Desc)
       for (; Desc.end() == false; ++Desc)

+ 3 - 0
apt-pkg/pkgcache.h

@@ -314,6 +314,9 @@ struct pkgCache::Header
    map_ptrloc PkgHashTable[2*1048];
    map_ptrloc PkgHashTable[2*1048];
    map_ptrloc GrpHashTable[2*1048];
    map_ptrloc GrpHashTable[2*1048];
 
 
+   /** \brief Size of the complete cache file */
+   unsigned long  CacheFileSize;
+
    bool CheckSizes(Header &Against) const;
    bool CheckSizes(Header &Against) const;
    Header();
    Header();
 };
 };

+ 37 - 21
apt-pkg/pkgcachegen.cc

@@ -97,6 +97,7 @@ pkgCacheGenerator::~pkgCacheGenerator()
       return;
       return;
    
    
    Cache.HeaderP->Dirty = false;
    Cache.HeaderP->Dirty = false;
+   Cache.HeaderP->CacheFileSize = Map.Size();
    Map.Sync(0,sizeof(pkgCache::Header));
    Map.Sync(0,sizeof(pkgCache::Header));
 }
 }
 									/*}}}*/
 									/*}}}*/
@@ -104,6 +105,9 @@ void pkgCacheGenerator::ReMap(void const * const oldMap, void const * const newM
    if (oldMap == newMap)
    if (oldMap == newMap)
       return;
       return;
 
 
+   if (_config->FindB("Debug::pkgCacheGen", false))
+      std::clog << "Remaping from " << oldMap << " to " << newMap << std::endl;
+
    Cache.ReMap(false);
    Cache.ReMap(false);
 
 
    CurrentFile += (pkgCache::PackageFile*) newMap - (pkgCache::PackageFile*) oldMap;
    CurrentFile += (pkgCache::PackageFile*) newMap - (pkgCache::PackageFile*) oldMap;
@@ -216,7 +220,7 @@ bool pkgCacheGenerator::MergeList(ListParser &List,
 
 
 	    // don't add a new description if we have one for the given
 	    // don't add a new description if we have one for the given
 	    // md5 && language
 	    // md5 && language
-	    for ( ; Desc.end() == false; Desc++)
+	    for ( ; Desc.end() == false; ++Desc)
 	       if (MD5SumValue(Desc.md5()) == CurMd5 && 
 	       if (MD5SumValue(Desc.md5()) == CurMd5 && 
 	           Desc.LanguageCode() == List.DescriptionLanguage())
 	           Desc.LanguageCode() == List.DescriptionLanguage())
 		  duplicate=true;
 		  duplicate=true;
@@ -225,7 +229,7 @@ bool pkgCacheGenerator::MergeList(ListParser &List,
 	    
 	    
  	    for (Desc = Ver.DescriptionList();
  	    for (Desc = Ver.DescriptionList();
 		 Desc.end() == false;
 		 Desc.end() == false;
-		 LastDesc = &Desc->NextDesc, Desc++)
+		 LastDesc = &Desc->NextDesc, ++Desc)
 	    {
 	    {
  	       if (MD5SumValue(Desc.md5()) == CurMd5) 
  	       if (MD5SumValue(Desc.md5()) == CurMd5) 
                {
                {
@@ -391,7 +395,7 @@ bool pkgCacheGenerator::MergeFileProvides(ListParser &List)
       unsigned long Hash = List.VersionHash();
       unsigned long Hash = List.VersionHash();
       pkgCache::VerIterator Ver = Pkg.VersionList();
       pkgCache::VerIterator Ver = Pkg.VersionList();
       Dynamic<pkgCache::VerIterator> DynVer(Ver);
       Dynamic<pkgCache::VerIterator> DynVer(Ver);
-      for (; Ver.end() == false; Ver++)
+      for (; Ver.end() == false; ++Ver)
       {
       {
 	 if (Ver->Hash == Hash && Version.c_str() == Ver.VerStr())
 	 if (Ver->Hash == Hash && Version.c_str() == Ver.VerStr())
 	 {
 	 {
@@ -507,7 +511,7 @@ bool pkgCacheGenerator::NewFileVer(pkgCache::VerIterator &Ver,
    
    
    // Link it to the end of the list
    // Link it to the end of the list
    map_ptrloc *Last = &Ver->FileList;
    map_ptrloc *Last = &Ver->FileList;
-   for (pkgCache::VerFileIterator V = Ver.FileList(); V.end() == false; V++)
+   for (pkgCache::VerFileIterator V = Ver.FileList(); V.end() == false; ++V)
       Last = &V->NextFile;
       Last = &V->NextFile;
    VF->NextFile = *Last;
    VF->NextFile = *Last;
    *Last = VF.Index();
    *Last = VF.Index();
@@ -564,7 +568,7 @@ bool pkgCacheGenerator::NewFileDesc(pkgCache::DescIterator &Desc,
 
 
    // Link it to the end of the list
    // Link it to the end of the list
    map_ptrloc *Last = &Desc->FileList;
    map_ptrloc *Last = &Desc->FileList;
-   for (pkgCache::DescFileIterator D = Desc.FileList(); D.end() == false; D++)
+   for (pkgCache::DescFileIterator D = Desc.FileList(); D.end() == false; ++D)
       Last = &D->NextFile;
       Last = &D->NextFile;
 
 
    DF->NextFile = *Last;
    DF->NextFile = *Last;
@@ -619,7 +623,7 @@ bool pkgCacheGenerator::FinishCache(OpProgress *Progress)
       // Create Conflicts in between the group
       // Create Conflicts in between the group
       pkgCache::GrpIterator G = GetCache().GrpBegin();
       pkgCache::GrpIterator G = GetCache().GrpBegin();
       Dynamic<pkgCache::GrpIterator> DynG(G);
       Dynamic<pkgCache::GrpIterator> DynG(G);
-      for (; G.end() != true; G++)
+      for (; G.end() != true; ++G)
       {
       {
 	 string const PkgName = G.Name();
 	 string const PkgName = G.Name();
 	 pkgCache::PkgIterator P = G.PackageList();
 	 pkgCache::PkgIterator P = G.PackageList();
@@ -630,9 +634,11 @@ bool pkgCacheGenerator::FinishCache(OpProgress *Progress)
 	    Dynamic<pkgCache::PkgIterator> DynallPkg(allPkg);
 	    Dynamic<pkgCache::PkgIterator> DynallPkg(allPkg);
 	    pkgCache::VerIterator V = P.VersionList();
 	    pkgCache::VerIterator V = P.VersionList();
 	    Dynamic<pkgCache::VerIterator> DynV(V);
 	    Dynamic<pkgCache::VerIterator> DynV(V);
-	    for (; V.end() != true; V++)
+	    for (; V.end() != true; ++V)
 	    {
 	    {
-	       char const * const Arch = P.Arch();
+               // copy P.Arch() into a string here as a cache remap
+               // in NewDepends() later may alter the pointer location
+	       string Arch = P.Arch() == NULL ? "" : P.Arch();
 	       map_ptrloc *OldDepLast = NULL;
 	       map_ptrloc *OldDepLast = NULL;
 	       /* MultiArch handling introduces a lot of implicit Dependencies:
 	       /* MultiArch handling introduces a lot of implicit Dependencies:
 		- MultiArch: same → Co-Installable if they have the same version
 		- MultiArch: same → Co-Installable if they have the same version
@@ -641,7 +647,7 @@ bool pkgCacheGenerator::FinishCache(OpProgress *Progress)
 	       bool const coInstall = ((V->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same);
 	       bool const coInstall = ((V->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same);
 	       for (vector<string>::const_iterator A = archs.begin(); A != archs.end(); ++A)
 	       for (vector<string>::const_iterator A = archs.begin(); A != archs.end(); ++A)
 	       {
 	       {
-		  if (Arch == 0 || *A == Arch)
+		  if (*A == Arch)
 		     continue;
 		     continue;
 		  /* We allow only one installed arch at the time
 		  /* We allow only one installed arch at the time
 		     per group, therefore each group member conflicts
 		     per group, therefore each group member conflicts
@@ -683,7 +689,7 @@ bool pkgCacheGenerator::NewDepends(pkgCache::PkgIterator &Pkg,
 				   string const &Version,
 				   string const &Version,
 				   unsigned int const &Op,
 				   unsigned int const &Op,
 				   unsigned int const &Type,
 				   unsigned int const &Type,
-				   map_ptrloc *OldDepLast)
+				   map_ptrloc* &OldDepLast)
 {
 {
    void const * const oldMap = Map.Data();
    void const * const oldMap = Map.Data();
    // Get a structure
    // Get a structure
@@ -722,7 +728,7 @@ bool pkgCacheGenerator::NewDepends(pkgCache::PkgIterator &Pkg,
    if (OldDepLast == NULL)
    if (OldDepLast == NULL)
    {
    {
       OldDepLast = &Ver->DependsList;
       OldDepLast = &Ver->DependsList;
-      for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false; D++)
+      for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false; ++D)
 	 OldDepLast = &D->NextDepends;
 	 OldDepLast = &D->NextDepends;
    } else if (oldMap != Map.Data())
    } else if (oldMap != Map.Data())
       OldDepLast += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap;
       OldDepLast += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap;
@@ -914,8 +920,11 @@ unsigned long pkgCacheGenerator::WriteUniqString(const char *S,
 /* This just verifies that each file in the list of index files exists,
 /* This just verifies that each file in the list of index files exists,
    has matching attributes with the cache and the cache does not have
    has matching attributes with the cache and the cache does not have
    any extra files. */
    any extra files. */
-static bool CheckValidity(const string &CacheFile, FileIterator Start, 
-                          FileIterator End,MMap **OutMap = 0)
+static bool CheckValidity(const string &CacheFile, 
+                          pkgSourceList &List,
+                          FileIterator Start, 
+                          FileIterator End,
+                          MMap **OutMap = 0)
 {
 {
    bool const Debug = _config->FindB("Debug::pkgCacheGen", false);
    bool const Debug = _config->FindB("Debug::pkgCacheGen", false);
    // No file, certainly invalid
    // No file, certainly invalid
@@ -926,6 +935,13 @@ static bool CheckValidity(const string &CacheFile, FileIterator Start,
       return false;
       return false;
    }
    }
 
 
+   if (List.GetLastModifiedTime() > GetModificationTime(CacheFile))
+   {
+      if (Debug == true)
+	 std::clog << "sources.list is newer than the cache" << std::endl;
+      return false;
+   }
+
    // Map it
    // Map it
    FileFd CacheF(CacheFile,FileFd::ReadOnly);
    FileFd CacheF(CacheFile,FileFd::ReadOnly);
    SPtr<MMap> Map = new MMap(CacheF,0);
    SPtr<MMap> Map = new MMap(CacheF,0);
@@ -942,7 +958,7 @@ static bool CheckValidity(const string &CacheFile, FileIterator Start,
       verify the IMS data and check that it is on the disk too.. */
       verify the IMS data and check that it is on the disk too.. */
    SPtrArray<bool> Visited = new bool[Cache.HeaderP->PackageFileCount];
    SPtrArray<bool> Visited = new bool[Cache.HeaderP->PackageFileCount];
    memset(Visited,0,sizeof(*Visited)*Cache.HeaderP->PackageFileCount);
    memset(Visited,0,sizeof(*Visited)*Cache.HeaderP->PackageFileCount);
-   for (; Start != End; Start++)
+   for (; Start != End; ++Start)
    {
    {
       if (Debug == true)
       if (Debug == true)
 	 std::clog << "Checking PkgFile " << (*Start)->Describe() << ": ";
 	 std::clog << "Checking PkgFile " << (*Start)->Describe() << ": ";
@@ -1009,7 +1025,7 @@ static bool CheckValidity(const string &CacheFile, FileIterator Start,
 static unsigned long ComputeSize(FileIterator Start,FileIterator End)
 static unsigned long ComputeSize(FileIterator Start,FileIterator End)
 {
 {
    unsigned long TotalSize = 0;
    unsigned long TotalSize = 0;
-   for (; Start != End; Start++)
+   for (; Start != End; ++Start)
    {
    {
       if ((*Start)->HasPackages() == false)
       if ((*Start)->HasPackages() == false)
 	 continue;      
 	 continue;      
@@ -1027,7 +1043,7 @@ static bool BuildCache(pkgCacheGenerator &Gen,
 		       FileIterator Start, FileIterator End)
 		       FileIterator Start, FileIterator End)
 {
 {
    FileIterator I;
    FileIterator I;
-   for (I = Start; I != End; I++)
+   for (I = Start; I != End; ++I)
    {
    {
       if ((*I)->HasPackages() == false)
       if ((*I)->HasPackages() == false)
 	 continue;
 	 continue;
@@ -1057,7 +1073,7 @@ static bool BuildCache(pkgCacheGenerator &Gen,
 	 Progress->Done();
 	 Progress->Done();
       TotalSize = ComputeSize(Start, End);
       TotalSize = ComputeSize(Start, End);
       CurrentSize = 0;
       CurrentSize = 0;
-      for (I = Start; I != End; I++)
+      for (I = Start; I != End; ++I)
       {
       {
 	 unsigned long Size = (*I)->Size();
 	 unsigned long Size = (*I)->Size();
 	 if (Progress != NULL)
 	 if (Progress != NULL)
@@ -1104,12 +1120,12 @@ bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress
    vector<pkgIndexFile *> Files;
    vector<pkgIndexFile *> Files;
    for (vector<metaIndex *>::const_iterator i = List.begin();
    for (vector<metaIndex *>::const_iterator i = List.begin();
         i != List.end();
         i != List.end();
-        i++)
+        ++i)
    {
    {
       vector <pkgIndexFile *> *Indexes = (*i)->GetIndexFiles();
       vector <pkgIndexFile *> *Indexes = (*i)->GetIndexFiles();
       for (vector<pkgIndexFile *>::const_iterator j = Indexes->begin();
       for (vector<pkgIndexFile *>::const_iterator j = Indexes->begin();
 	   j != Indexes->end();
 	   j != Indexes->end();
-	   j++)
+	   ++j)
          Files.push_back (*j);
          Files.push_back (*j);
    }
    }
    
    
@@ -1151,7 +1167,7 @@ bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress
       Progress->OverallProgress(0,1,1,_("Reading package lists"));
       Progress->OverallProgress(0,1,1,_("Reading package lists"));
 
 
    // Cache is OK, Fin.
    // Cache is OK, Fin.
-   if (CheckValidity(CacheFile,Files.begin(),Files.end(),OutMap) == true)
+   if (CheckValidity(CacheFile, List, Files.begin(),Files.end(),OutMap) == true)
    {
    {
       if (Progress != NULL)
       if (Progress != NULL)
 	 Progress->OverallProgress(1,1,1,_("Reading package lists"));
 	 Progress->OverallProgress(1,1,1,_("Reading package lists"));
@@ -1204,7 +1220,7 @@ bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress
    // Lets try the source cache.
    // Lets try the source cache.
    unsigned long CurrentSize = 0;
    unsigned long CurrentSize = 0;
    unsigned long TotalSize = 0;
    unsigned long TotalSize = 0;
-   if (CheckValidity(SrcCacheFile,Files.begin(),
+   if (CheckValidity(SrcCacheFile, List, Files.begin(),
 		     Files.begin()+EndOfSource) == true)
 		     Files.begin()+EndOfSource) == true)
    {
    {
       if (Debug == true)
       if (Debug == true)

+ 1 - 1
apt-pkg/pkgcachegen.h

@@ -75,7 +75,7 @@ class pkgCacheGenerator							/*{{{*/
    bool NewFileDesc(pkgCache::DescIterator &Desc,ListParser &List);
    bool NewFileDesc(pkgCache::DescIterator &Desc,ListParser &List);
    bool NewDepends(pkgCache::PkgIterator &Pkg, pkgCache::VerIterator &Ver,
    bool NewDepends(pkgCache::PkgIterator &Pkg, pkgCache::VerIterator &Ver,
 		   string const &Version, unsigned int const &Op,
 		   string const &Version, unsigned int const &Op,
-		   unsigned int const &Type, map_ptrloc *OldDepLast);
+		   unsigned int const &Type, map_ptrloc* &OldDepLast);
    unsigned long NewVersion(pkgCache::VerIterator &Ver,const string &VerStr,unsigned long Next);
    unsigned long NewVersion(pkgCache::VerIterator &Ver,const string &VerStr,unsigned long Next);
    map_ptrloc NewDescription(pkgCache::DescIterator &Desc,const string &Lang,const MD5SumValue &md5sum,map_ptrloc Next);
    map_ptrloc NewDescription(pkgCache::DescIterator &Desc,const string &Lang,const MD5SumValue &md5sum,map_ptrloc Next);
 
 

+ 1 - 1
apt-pkg/pkgrecords.cc

@@ -26,7 +26,7 @@ pkgRecords::pkgRecords(pkgCache &Cache) : Cache(Cache),
   Files(Cache.HeaderP->PackageFileCount)
   Files(Cache.HeaderP->PackageFileCount)
 {
 {
    for (pkgCache::PkgFileIterator I = Cache.FileBegin();
    for (pkgCache::PkgFileIterator I = Cache.FileBegin();
-        I.end() == false; I++)
+        I.end() == false; ++I)
    {
    {
       const pkgIndexFile::Type *Type = pkgIndexFile::Type::GetType(I.IndexType());
       const pkgIndexFile::Type *Type = pkgIndexFile::Type::GetType(I.IndexType());
       if (Type == 0)
       if (Type == 0)

+ 4 - 1
apt-pkg/pkgrecords.h

@@ -68,7 +68,10 @@ class pkgRecords::Parser						/*{{{*/
    virtual string LongDesc() {return string();};
    virtual string LongDesc() {return string();};
    virtual string Name() {return string();};
    virtual string Name() {return string();};
    virtual string Homepage() {return string();}
    virtual string Homepage() {return string();}
-   
+
+   // An arbitrary custom field
+   virtual string RecordField(const char *fieldName) { return string();};
+
    // The record in binary form
    // The record in binary form
    virtual void GetRec(const char *&Start,const char *&Stop) {Start = Stop = 0;};
    virtual void GetRec(const char *&Start,const char *&Stop) {Start = Stop = 0;};
    
    

+ 23 - 9
apt-pkg/policy.cc

@@ -58,8 +58,22 @@ pkgPolicy::pkgPolicy(pkgCache *Owner) : Pins(0), PFPriority(0), Cache(Owner)
    // The config file has a master override.
    // The config file has a master override.
    string DefRel = _config->Find("APT::Default-Release");
    string DefRel = _config->Find("APT::Default-Release");
    if (DefRel.empty() == false)
    if (DefRel.empty() == false)
-      CreatePin(pkgVersionMatch::Release,"",DefRel,990);
-      
+   {
+      bool found = false;
+      // FIXME: make ExpressionMatches static to use it here easily
+      pkgVersionMatch vm("", pkgVersionMatch::None);
+      for (pkgCache::PkgFileIterator F = Cache->FileBegin(); F != Cache->FileEnd(); ++F)
+      {
+	 if ((F->Archive != 0 && vm.ExpressionMatches(DefRel, F.Archive()) == true) ||
+	     (F->Codename != 0 && vm.ExpressionMatches(DefRel, F.Codename()) == true) ||
+	     (F->Version != 0 && vm.ExpressionMatches(DefRel, F.Version()) == true))
+	    found = true;
+      }
+      if (found == false)
+	 _error->Error(_("The value '%s' is invalid for APT::Default-Release as such a release is not available in the sources"), DefRel.c_str());
+      else
+	 CreatePin(pkgVersionMatch::Release,"",DefRel,990);
+   }
    InitDefaults();
    InitDefaults();
 }
 }
 									/*}}}*/
 									/*}}}*/
@@ -69,7 +83,7 @@ pkgPolicy::pkgPolicy(pkgCache *Owner) : Pins(0), PFPriority(0), Cache(Owner)
 bool pkgPolicy::InitDefaults()
 bool pkgPolicy::InitDefaults()
 {   
 {   
    // Initialize the priorities based on the status of the package file
    // Initialize the priorities based on the status of the package file
-   for (pkgCache::PkgFileIterator I = Cache->FileBegin(); I != Cache->FileEnd(); I++)
+   for (pkgCache::PkgFileIterator I = Cache->FileBegin(); I != Cache->FileEnd(); ++I)
    {
    {
       PFPriority[I->ID] = 500;
       PFPriority[I->ID] = 500;
       if ((I->Flags & pkgCache::Flag::NotSource) == pkgCache::Flag::NotSource)
       if ((I->Flags & pkgCache::Flag::NotSource) == pkgCache::Flag::NotSource)
@@ -86,10 +100,10 @@ bool pkgPolicy::InitDefaults()
    signed Cur = 989;
    signed Cur = 989;
    StatusOverride = false;
    StatusOverride = false;
    for (vector<Pin>::const_iterator I = Defaults.begin(); I != Defaults.end();
    for (vector<Pin>::const_iterator I = Defaults.begin(); I != Defaults.end();
-	I++, Cur--)
+	++I, --Cur)
    {
    {
       pkgVersionMatch Match(I->Data,I->Type);
       pkgVersionMatch Match(I->Data,I->Type);
-      for (pkgCache::PkgFileIterator F = Cache->FileBegin(); F != Cache->FileEnd(); F++)
+      for (pkgCache::PkgFileIterator F = Cache->FileBegin(); F != Cache->FileEnd(); ++F)
       {
       {
 	 if (Match.FileMatch(F) == true && Fixed[F->ID] == false)
 	 if (Match.FileMatch(F) == true && Fixed[F->ID] == false)
 	 {
 	 {
@@ -110,7 +124,7 @@ bool pkgPolicy::InitDefaults()
    }
    }
 
 
    if (_config->FindB("Debug::pkgPolicy",false) == true)
    if (_config->FindB("Debug::pkgPolicy",false) == true)
-      for (pkgCache::PkgFileIterator F = Cache->FileBegin(); F != Cache->FileEnd(); F++)
+      for (pkgCache::PkgFileIterator F = Cache->FileBegin(); F != Cache->FileEnd(); ++F)
 	 std::clog << "Prio of " << F.FileName() << ' ' << PFPriority[F->ID] << std::endl; 
 	 std::clog << "Prio of " << F.FileName() << ' ' << PFPriority[F->ID] << std::endl; 
    
    
    return true;   
    return true;   
@@ -150,12 +164,12 @@ pkgCache::VerIterator pkgPolicy::GetCandidateVer(pkgCache::PkgIterator const &Pk
       tracks the default when the default is taken away, and a permanent
       tracks the default when the default is taken away, and a permanent
       pin that stays at that setting.
       pin that stays at that setting.
     */
     */
-   for (pkgCache::VerIterator Ver = Pkg.VersionList(); Ver.end() == false; Ver++)
+   for (pkgCache::VerIterator Ver = Pkg.VersionList(); Ver.end() == false; ++Ver)
    {
    {
       /* Lets see if this version is the installed version */
       /* Lets see if this version is the installed version */
       bool instVer = (Pkg.CurrentVer() == Ver);
       bool instVer = (Pkg.CurrentVer() == Ver);
 
 
-      for (pkgCache::VerFileIterator VF = Ver.FileList(); VF.end() == false; VF++)
+      for (pkgCache::VerFileIterator VF = Ver.FileList(); VF.end() == false; ++VF)
       {
       {
 	 /* If this is the status file, and the current version is not the
 	 /* If this is the status file, and the current version is not the
 	    version in the status file (ie it is not installed, or somesuch)
 	    version in the status file (ie it is not installed, or somesuch)
@@ -348,7 +362,7 @@ bool ReadPinDir(pkgPolicy &Plcy,string Dir)
    vector<string> const List = GetListOfFilesInDir(Dir, "pref", true, true);
    vector<string> const List = GetListOfFilesInDir(Dir, "pref", true, true);
 
 
    // Read the files
    // Read the files
-   for (vector<string>::const_iterator I = List.begin(); I != List.end(); I++)
+   for (vector<string>::const_iterator I = List.begin(); I != List.end(); ++I)
       if (ReadPinFile(Plcy, *I) == false)
       if (ReadPinFile(Plcy, *I) == false)
 	 return false;
 	 return false;
    return true;
    return true;

+ 28 - 6
apt-pkg/sourcelist.cc

@@ -175,7 +175,7 @@ pkgSourceList::pkgSourceList(string File)
 /* */
 /* */
 pkgSourceList::~pkgSourceList()
 pkgSourceList::~pkgSourceList()
 {
 {
-   for (const_iterator I = SrcList.begin(); I != SrcList.end(); I++)
+   for (const_iterator I = SrcList.begin(); I != SrcList.end(); ++I)
       delete *I;
       delete *I;
 }
 }
 									/*}}}*/
 									/*}}}*/
@@ -220,7 +220,7 @@ bool pkgSourceList::ReadMainList()
 /* */
 /* */
 void pkgSourceList::Reset()
 void pkgSourceList::Reset()
 {
 {
-   for (const_iterator I = SrcList.begin(); I != SrcList.end(); I++)
+   for (const_iterator I = SrcList.begin(); I != SrcList.end(); ++I)
       delete *I;
       delete *I;
    SrcList.erase(SrcList.begin(),SrcList.end());
    SrcList.erase(SrcList.begin(),SrcList.end());
 }
 }
@@ -298,11 +298,11 @@ bool pkgSourceList::ReadAppend(string File)
 bool pkgSourceList::FindIndex(pkgCache::PkgFileIterator File,
 bool pkgSourceList::FindIndex(pkgCache::PkgFileIterator File,
 			      pkgIndexFile *&Found) const
 			      pkgIndexFile *&Found) const
 {
 {
-   for (const_iterator I = SrcList.begin(); I != SrcList.end(); I++)
+   for (const_iterator I = SrcList.begin(); I != SrcList.end(); ++I)
    {
    {
       vector<pkgIndexFile *> *Indexes = (*I)->GetIndexFiles();
       vector<pkgIndexFile *> *Indexes = (*I)->GetIndexFiles();
       for (vector<pkgIndexFile *>::const_iterator J = Indexes->begin();
       for (vector<pkgIndexFile *>::const_iterator J = Indexes->begin();
-	   J != Indexes->end(); J++)
+	   J != Indexes->end(); ++J)
       {
       {
          if ((*J)->FindInCache(*File.Cache()) == File)
          if ((*J)->FindInCache(*File.Cache()) == File)
          {
          {
@@ -320,7 +320,7 @@ bool pkgSourceList::FindIndex(pkgCache::PkgFileIterator File,
 /* */
 /* */
 bool pkgSourceList::GetIndexes(pkgAcquire *Owner, bool GetAll) const
 bool pkgSourceList::GetIndexes(pkgAcquire *Owner, bool GetAll) const
 {
 {
-   for (const_iterator I = SrcList.begin(); I != SrcList.end(); I++)
+   for (const_iterator I = SrcList.begin(); I != SrcList.end(); ++I)
       if ((*I)->GetIndexes(Owner,GetAll) == false)
       if ((*I)->GetIndexes(Owner,GetAll) == false)
 	 return false;
 	 return false;
    return true;
    return true;
@@ -336,11 +336,33 @@ bool pkgSourceList::ReadSourceDir(string Dir)
    vector<string> const List = GetListOfFilesInDir(Dir, "list", true);
    vector<string> const List = GetListOfFilesInDir(Dir, "list", true);
 
 
    // Read the files
    // Read the files
-   for (vector<string>::const_iterator I = List.begin(); I != List.end(); I++)
+   for (vector<string>::const_iterator I = List.begin(); I != List.end(); ++I)
       if (ReadAppend(*I) == false)
       if (ReadAppend(*I) == false)
 	 return false;
 	 return false;
    return true;
    return true;
 
 
 }
 }
 									/*}}}*/
 									/*}}}*/
+// GetLastModified()						/*{{{*/
+// ---------------------------------------------------------------------
+/* */
+time_t pkgSourceList::GetLastModifiedTime()
+{
+   vector<string> List;
+
+   string Main = _config->FindFile("Dir::Etc::sourcelist");
+   string Parts = _config->FindDir("Dir::Etc::sourceparts");
+
+   // go over the parts
+   if (DirectoryExists(Parts) == true)
+      List = GetListOfFilesInDir(Parts, "list", true);
+
+   // calculate the time
+   time_t mtime_sources = GetModificationTime(Main);
+   for (vector<string>::const_iterator I = List.begin(); I != List.end(); ++I)
+      mtime_sources = std::max(mtime_sources, GetModificationTime(*I));
+
+   return mtime_sources;
+}
+									/*}}}*/
 
 

+ 3 - 0
apt-pkg/sourcelist.h

@@ -92,6 +92,9 @@ class pkgSourceList
 		  pkgIndexFile *&Found) const;
 		  pkgIndexFile *&Found) const;
    bool GetIndexes(pkgAcquire *Owner, bool GetAll=false) const;
    bool GetIndexes(pkgAcquire *Owner, bool GetAll=false) const;
    
    
+   // query last-modified time
+   time_t GetLastModifiedTime();
+
    pkgSourceList();
    pkgSourceList();
    pkgSourceList(string File);
    pkgSourceList(string File);
    ~pkgSourceList();      
    ~pkgSourceList();      

+ 5 - 5
apt-pkg/srcrecords.cc

@@ -26,11 +26,11 @@
 /* Open all the source index files */
 /* Open all the source index files */
 pkgSrcRecords::pkgSrcRecords(pkgSourceList &List) : Files(0), Current(0)
 pkgSrcRecords::pkgSrcRecords(pkgSourceList &List) : Files(0), Current(0)
 {
 {
-   for (pkgSourceList::const_iterator I = List.begin(); I != List.end(); I++)
+   for (pkgSourceList::const_iterator I = List.begin(); I != List.end(); ++I)
    {
    {
       vector<pkgIndexFile *> *Indexes = (*I)->GetIndexFiles();
       vector<pkgIndexFile *> *Indexes = (*I)->GetIndexFiles();
       for (vector<pkgIndexFile *>::const_iterator J = Indexes->begin();
       for (vector<pkgIndexFile *>::const_iterator J = Indexes->begin();
-	   J != Indexes->end(); J++)
+	   J != Indexes->end(); ++J)
       {
       {
          Parser* P = (*J)->CreateSrcParser();
          Parser* P = (*J)->CreateSrcParser();
 	 if (_error->PendingError() == true)
 	 if (_error->PendingError() == true)
@@ -68,7 +68,7 @@ bool pkgSrcRecords::Restart()
 {
 {
    Current = Files.begin();
    Current = Files.begin();
    for (vector<Parser*>::iterator I = Files.begin();
    for (vector<Parser*>::iterator I = Files.begin();
-        I != Files.end(); I++)
+        I != Files.end(); ++I)
       (*I)->Restart();
       (*I)->Restart();
    
    
    return true;
    return true;
@@ -91,7 +91,7 @@ pkgSrcRecords::Parser *pkgSrcRecords::Find(const char *Package,bool const &SrcOn
       {
       {
 	 if (_error->PendingError() == true)
 	 if (_error->PendingError() == true)
 	    return 0;
 	    return 0;
-	 Current++;
+	 ++Current;
 	 if (Current == Files.end())
 	 if (Current == Files.end())
 	    return 0;
 	    return 0;
       }
       }
@@ -109,7 +109,7 @@ pkgSrcRecords::Parser *pkgSrcRecords::Find(const char *Package,bool const &SrcOn
       
       
       // Check for a binary hit
       // Check for a binary hit
       const char **I = (*Current)->Binaries();
       const char **I = (*Current)->Binaries();
-      for (; I != 0 && *I != 0; I++)
+      for (; I != 0 && *I != 0; ++I)
 	 if (strcmp(Package,*I) == 0)
 	 if (strcmp(Package,*I) == 0)
 	    return *Current;
 	    return *Current;
    }
    }

+ 1 - 1
apt-pkg/tagfile.h

@@ -78,7 +78,7 @@ class pkgTagSection
       Stop = this->Stop;
       Stop = this->Stop;
    };
    };
    
    
-   pkgTagSection() : Section(0), Stop(0) {};
+   pkgTagSection() : Section(0), TagCount(0), Stop(0) {};
    virtual ~pkgTagSection() {};
    virtual ~pkgTagSection() {};
 };
 };
 
 

+ 3 - 3
apt-pkg/vendorlist.cc

@@ -13,7 +13,7 @@
 pkgVendorList::~pkgVendorList()
 pkgVendorList::~pkgVendorList()
 {
 {
    for (vector<const Vendor *>::const_iterator I = VendorList.begin(); 
    for (vector<const Vendor *>::const_iterator I = VendorList.begin(); 
-        I != VendorList.end(); I++)
+        I != VendorList.end(); ++I)
       delete *I;
       delete *I;
 }
 }
 
 
@@ -51,7 +51,7 @@ bool pkgVendorList::Read(string File)					/*{{{*/
 bool pkgVendorList::CreateList(Configuration& Cnf)			/*{{{*/
 bool pkgVendorList::CreateList(Configuration& Cnf)			/*{{{*/
 {
 {
    for (vector<const Vendor *>::const_iterator I = VendorList.begin(); 
    for (vector<const Vendor *>::const_iterator I = VendorList.begin(); 
-	I != VendorList.end(); I++)
+	I != VendorList.end(); ++I)
       delete *I;
       delete *I;
    VendorList.erase(VendorList.begin(),VendorList.end());
    VendorList.erase(VendorList.begin(),VendorList.end());
 
 
@@ -131,7 +131,7 @@ const Vendor* pkgVendorList::LookupFingerprint(string Fingerprint)	/*{{{*/
 									/*}}}*/
 									/*}}}*/
 const Vendor* pkgVendorList::FindVendor(const std::vector<string> GPGVOutput)	/*{{{*/
 const Vendor* pkgVendorList::FindVendor(const std::vector<string> GPGVOutput)	/*{{{*/
 {
 {
-   for (std::vector<string>::const_iterator I = GPGVOutput.begin(); I != GPGVOutput.end(); I++)
+   for (std::vector<string>::const_iterator I = GPGVOutput.begin(); I != GPGVOutput.end(); ++I)
    {
    {
       string::size_type pos = (*I).find("VALIDSIG ");
       string::size_type pos = (*I).find("VALIDSIG ");
       if (_config->FindB("Debug::Vendor", false))
       if (_config->FindB("Debug::Vendor", false))

+ 3 - 3
apt-pkg/versionmatch.cc

@@ -60,7 +60,7 @@ pkgVersionMatch::pkgVersionMatch(string Data,MatchType Type) : Type(Type)
       
       
       // Are we a simple specification?
       // Are we a simple specification?
       string::const_iterator I = Data.begin();
       string::const_iterator I = Data.begin();
-      for (; I != Data.end() && *I != '='; I++);
+      for (; I != Data.end() && *I != '='; ++I);
       if (I == Data.end())
       if (I == Data.end())
       {
       {
 	 // Temporary
 	 // Temporary
@@ -152,7 +152,7 @@ bool pkgVersionMatch::MatchVer(const char *A,string B,bool Prefix)
 pkgCache::VerIterator pkgVersionMatch::Find(pkgCache::PkgIterator Pkg)
 pkgCache::VerIterator pkgVersionMatch::Find(pkgCache::PkgIterator Pkg)
 {
 {
    pkgCache::VerIterator Ver = Pkg.VersionList();
    pkgCache::VerIterator Ver = Pkg.VersionList();
-   for (; Ver.end() == false; Ver++)
+   for (; Ver.end() == false; ++Ver)
    {
    {
       if (Type == Version)
       if (Type == Version)
       {
       {
@@ -163,7 +163,7 @@ pkgCache::VerIterator pkgVersionMatch::Find(pkgCache::PkgIterator Pkg)
 	 continue;
 	 continue;
       }
       }
       
       
-      for (pkgCache::VerFileIterator VF = Ver.FileList(); VF.end() == false; VF++)
+      for (pkgCache::VerFileIterator VF = Ver.FileList(); VF.end() == false; ++VF)
 	 if (FileMatch(VF.File()) == true)
 	 if (FileMatch(VF.File()) == true)
 	    return Ver;
 	    return Ver;
    }
    }

+ 52 - 52
cmdline/apt-cache.cc

@@ -141,7 +141,7 @@ bool ShowUnMet(pkgCache::VerIterator const &V, bool const &Important)
 	       
 	       
 	       if (Start == End)
 	       if (Start == End)
 		  break;
 		  break;
-	       Start++;
+	       ++Start;
 	    }
 	    }
 	    while (1);
 	    while (1);
 
 
@@ -169,7 +169,7 @@ bool ShowUnMet(pkgCache::VerIterator const &V, bool const &Important)
 	       if (Start == End)
 	       if (Start == End)
 		  break;
 		  break;
 	       cout << " | ";
 	       cout << " | ";
-	       Start++;
+	       ++Start;
 	    }
 	    }
 	    while (1);
 	    while (1);
 	    
 	    
@@ -187,7 +187,7 @@ bool UnMet(CommandLine &CmdL)
 
 
    if (CmdL.FileSize() <= 1)
    if (CmdL.FileSize() <= 1)
    {
    {
-      for (pkgCache::PkgIterator P = CacheFile.GetPkgCache()->PkgBegin(); P.end() == false; P++)
+      for (pkgCache::PkgIterator P = CacheFile.GetPkgCache()->PkgBegin(); P.end() == false; ++P)
 	 for (pkgCache::VerIterator V = P.VersionList(); V.end() == false; ++V)
 	 for (pkgCache::VerIterator V = P.VersionList(); V.end() == false; ++V)
 	    if (ShowUnMet(V, Important) == false)
 	    if (ShowUnMet(V, Important) == false)
 	       return false;
 	       return false;
@@ -217,13 +217,13 @@ bool DumpPackage(CommandLine &CmdL)
    {
    {
       cout << "Package: " << Pkg.FullName(true) << endl;
       cout << "Package: " << Pkg.FullName(true) << endl;
       cout << "Versions: " << endl;
       cout << "Versions: " << endl;
-      for (pkgCache::VerIterator Cur = Pkg.VersionList(); Cur.end() != true; Cur++)
+      for (pkgCache::VerIterator Cur = Pkg.VersionList(); Cur.end() != true; ++Cur)
       {
       {
 	 cout << Cur.VerStr();
 	 cout << Cur.VerStr();
-	 for (pkgCache::VerFileIterator Vf = Cur.FileList(); Vf.end() == false; Vf++)
+	 for (pkgCache::VerFileIterator Vf = Cur.FileList(); Vf.end() == false; ++Vf)
 	    cout << " (" << Vf.File().FileName() << ")";
 	    cout << " (" << Vf.File().FileName() << ")";
 	 cout << endl;
 	 cout << endl;
-	 for (pkgCache::DescIterator D = Cur.DescriptionList(); D.end() == false; D++)
+	 for (pkgCache::DescIterator D = Cur.DescriptionList(); D.end() == false; ++D)
 	 {
 	 {
 	    cout << " Description Language: " << D.LanguageCode() << endl
 	    cout << " Description Language: " << D.LanguageCode() << endl
 		 << "                 File: " << D.FileList().File().FileName() << endl
 		 << "                 File: " << D.FileList().File().FileName() << endl
@@ -235,7 +235,7 @@ bool DumpPackage(CommandLine &CmdL)
       cout << endl;
       cout << endl;
       
       
       cout << "Reverse Depends: " << endl;
       cout << "Reverse Depends: " << endl;
-      for (pkgCache::DepIterator D = Pkg.RevDependsList(); D.end() != true; D++)
+      for (pkgCache::DepIterator D = Pkg.RevDependsList(); D.end() != true; ++D)
       {
       {
 	 cout << "  " << D.ParentPkg().FullName(true) << ',' << D.TargetPkg().FullName(true);
 	 cout << "  " << D.ParentPkg().FullName(true) << ',' << D.TargetPkg().FullName(true);
 	 if (D->Version != 0)
 	 if (D->Version != 0)
@@ -245,24 +245,24 @@ bool DumpPackage(CommandLine &CmdL)
       }
       }
       
       
       cout << "Dependencies: " << endl;
       cout << "Dependencies: " << endl;
-      for (pkgCache::VerIterator Cur = Pkg.VersionList(); Cur.end() != true; Cur++)
+      for (pkgCache::VerIterator Cur = Pkg.VersionList(); Cur.end() != true; ++Cur)
       {
       {
 	 cout << Cur.VerStr() << " - ";
 	 cout << Cur.VerStr() << " - ";
-	 for (pkgCache::DepIterator Dep = Cur.DependsList(); Dep.end() != true; Dep++)
+	 for (pkgCache::DepIterator Dep = Cur.DependsList(); Dep.end() != true; ++Dep)
 	    cout << Dep.TargetPkg().FullName(true) << " (" << (int)Dep->CompareOp << " " << DeNull(Dep.TargetVer()) << ") ";
 	    cout << Dep.TargetPkg().FullName(true) << " (" << (int)Dep->CompareOp << " " << DeNull(Dep.TargetVer()) << ") ";
 	 cout << endl;
 	 cout << endl;
       }      
       }      
 
 
       cout << "Provides: " << endl;
       cout << "Provides: " << endl;
-      for (pkgCache::VerIterator Cur = Pkg.VersionList(); Cur.end() != true; Cur++)
+      for (pkgCache::VerIterator Cur = Pkg.VersionList(); Cur.end() != true; ++Cur)
       {
       {
 	 cout << Cur.VerStr() << " - ";
 	 cout << Cur.VerStr() << " - ";
-	 for (pkgCache::PrvIterator Prv = Cur.ProvidesList(); Prv.end() != true; Prv++)
+	 for (pkgCache::PrvIterator Prv = Cur.ProvidesList(); Prv.end() != true; ++Prv)
 	    cout << Prv.ParentPkg().FullName(true) << " ";
 	    cout << Prv.ParentPkg().FullName(true) << " ";
 	 cout << endl;
 	 cout << endl;
       }
       }
       cout << "Reverse Provides: " << endl;
       cout << "Reverse Provides: " << endl;
-      for (pkgCache::PrvIterator Prv = Pkg.ProvidesList(); Prv.end() != true; Prv++)
+      for (pkgCache::PrvIterator Prv = Pkg.ProvidesList(); Prv.end() != true; ++Prv)
 	 cout << Prv.OwnerPkg().FullName(true) << " " << Prv.OwnerVer().VerStr() << endl;
 	 cout << Prv.OwnerPkg().FullName(true) << " " << Prv.OwnerVer().VerStr() << endl;
    }
    }
 
 
@@ -290,7 +290,7 @@ bool Stats(CommandLine &Cmd)
    int DVirt = 0;
    int DVirt = 0;
    int Missing = 0;
    int Missing = 0;
    pkgCache::PkgIterator I = Cache->PkgBegin();
    pkgCache::PkgIterator I = Cache->PkgBegin();
-   for (;I.end() != true; I++)
+   for (;I.end() != true; ++I)
    {
    {
       if (I->VersionList != 0 && I->ProvidesList == 0)
       if (I->VersionList != 0 && I->ProvidesList == 0)
       {
       {
@@ -353,11 +353,11 @@ bool Stats(CommandLine &Cmd)
    cout << _("Total globbed strings: ") << Count << " (" << SizeToStr(Size) << ')' << endl;
    cout << _("Total globbed strings: ") << Count << " (" << SizeToStr(Size) << ')' << endl;
 
 
    unsigned long DepVerSize = 0;
    unsigned long DepVerSize = 0;
-   for (pkgCache::PkgIterator P = Cache->PkgBegin(); P.end() == false; P++)
+   for (pkgCache::PkgIterator P = Cache->PkgBegin(); P.end() == false; ++P)
    {
    {
-      for (pkgCache::VerIterator V = P.VersionList(); V.end() == false; V++)
+      for (pkgCache::VerIterator V = P.VersionList(); V.end() == false; ++V)
       {
       {
-	 for (pkgCache::DepIterator D = V.DependsList(); D.end() == false; D++)
+	 for (pkgCache::DepIterator D = V.DependsList(); D.end() == false; ++D)
 	 {
 	 {
 	    if (D->Version != 0)
 	    if (D->Version != 0)
 	       DepVerSize += strlen(D.TargetVer()) + 1;
 	       DepVerSize += strlen(D.TargetVer()) + 1;
@@ -394,17 +394,17 @@ bool Dump(CommandLine &Cmd)
 
 
    cout << "Using Versioning System: " << Cache->VS->Label << endl;
    cout << "Using Versioning System: " << Cache->VS->Label << endl;
    
    
-   for (pkgCache::PkgIterator P = Cache->PkgBegin(); P.end() == false; P++)
+   for (pkgCache::PkgIterator P = Cache->PkgBegin(); P.end() == false; ++P)
    {
    {
       cout << "Package: " << P.FullName(true) << endl;
       cout << "Package: " << P.FullName(true) << endl;
-      for (pkgCache::VerIterator V = P.VersionList(); V.end() == false; V++)
+      for (pkgCache::VerIterator V = P.VersionList(); V.end() == false; ++V)
       {
       {
 	 cout << " Version: " << V.VerStr() << endl;
 	 cout << " Version: " << V.VerStr() << endl;
 	 cout << "     File: " << V.FileList().File().FileName() << endl;
 	 cout << "     File: " << V.FileList().File().FileName() << endl;
-	 for (pkgCache::DepIterator D = V.DependsList(); D.end() == false; D++)
+	 for (pkgCache::DepIterator D = V.DependsList(); D.end() == false; ++D)
 	    cout << "  Depends: " << D.TargetPkg().FullName(true) << ' ' << 
 	    cout << "  Depends: " << D.TargetPkg().FullName(true) << ' ' << 
 	                     DeNull(D.TargetVer()) << endl;
 	                     DeNull(D.TargetVer()) << endl;
-	 for (pkgCache::DescIterator D = V.DescriptionList(); D.end() == false; D++)
+	 for (pkgCache::DescIterator D = V.DescriptionList(); D.end() == false; ++D)
 	 {
 	 {
 	    cout << " Description Language: " << D.LanguageCode() << endl
 	    cout << " Description Language: " << D.LanguageCode() << endl
 		 << "                 File: " << D.FileList().File().FileName() << endl
 		 << "                 File: " << D.FileList().File().FileName() << endl
@@ -413,7 +413,7 @@ bool Dump(CommandLine &Cmd)
       }      
       }      
    }
    }
 
 
-   for (pkgCache::PkgFileIterator F = Cache->FileBegin(); F.end() == false; F++)
+   for (pkgCache::PkgFileIterator F = Cache->FileBegin(); F.end() == false; ++F)
    {
    {
       cout << "File: " << F.FileName() << endl;
       cout << "File: " << F.FileName() << endl;
       cout << " Type: " << F.IndexType() << endl;
       cout << " Type: " << F.IndexType() << endl;
@@ -449,7 +449,7 @@ bool DumpAvail(CommandLine &Cmd)
    memset(VFList,0,sizeof(*VFList)*Count);
    memset(VFList,0,sizeof(*VFList)*Count);
    
    
    // Map versions that we want to write out onto the VerList array.
    // Map versions that we want to write out onto the VerList array.
-   for (pkgCache::PkgIterator P = Cache->PkgBegin(); P.end() == false; P++)
+   for (pkgCache::PkgIterator P = Cache->PkgBegin(); P.end() == false; ++P)
    {    
    {    
       if (P->VersionList == 0)
       if (P->VersionList == 0)
 	 continue;
 	 continue;
@@ -466,7 +466,7 @@ bool DumpAvail(CommandLine &Cmd)
       }
       }
       
       
       pkgCache::VerFileIterator VF = V.FileList();
       pkgCache::VerFileIterator VF = V.FileList();
-      for (; VF.end() == false ; VF++)
+      for (; VF.end() == false ; ++VF)
 	 if ((VF.File()->Flags & pkgCache::Flag::NotSource) == 0)
 	 if ((VF.File()->Flags & pkgCache::Flag::NotSource) == 0)
 	    break;
 	    break;
       
       
@@ -480,9 +480,9 @@ bool DumpAvail(CommandLine &Cmd)
          handling works OK. */
          handling works OK. */
       if (VF.end() == true)
       if (VF.end() == true)
       {
       {
-	 for (pkgCache::VerIterator Cur = P.VersionList(); Cur.end() != true; Cur++)
+	 for (pkgCache::VerIterator Cur = P.VersionList(); Cur.end() != true; ++Cur)
 	 {
 	 {
-	    for (VF = Cur.FileList(); VF.end() == false; VF++)
+	    for (VF = Cur.FileList(); VF.end() == false; ++VF)
 	    {	 
 	    {	 
 	       if ((VF.File()->Flags & pkgCache::Flag::NotSource) == 0)
 	       if ((VF.File()->Flags & pkgCache::Flag::NotSource) == 0)
 	       {
 	       {
@@ -615,7 +615,7 @@ bool ShowDepends(CommandLine &CmdL, bool const RevDepends)
 	 if (RevDepends == true)
 	 if (RevDepends == true)
 	    cout << "Reverse Depends:" << endl;
 	    cout << "Reverse Depends:" << endl;
 	 for (pkgCache::DepIterator D = RevDepends ? Pkg.RevDependsList() : Ver.DependsList();
 	 for (pkgCache::DepIterator D = RevDepends ? Pkg.RevDependsList() : Ver.DependsList();
-	      D.end() == false; D++)
+	      D.end() == false; ++D)
 	 {
 	 {
 	    switch (D->Type) {
 	    switch (D->Type) {
 	    case pkgCache::Dep::PreDepends: if (!ShowPreDepends) continue; break;
 	    case pkgCache::Dep::PreDepends: if (!ShowPreDepends) continue; break;
@@ -741,7 +741,7 @@ bool XVcg(CommandLine &CmdL)
    memset(Flags,0,sizeof(*Flags)*Cache->Head().PackageCount);
    memset(Flags,0,sizeof(*Flags)*Cache->Head().PackageCount);
    
    
    // Map the shapes
    // Map the shapes
-   for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); Pkg.end() == false; Pkg++)
+   for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); Pkg.end() == false; ++Pkg)
    {   
    {   
       if (Pkg->VersionList == 0)
       if (Pkg->VersionList == 0)
       {
       {
@@ -788,7 +788,7 @@ bool XVcg(CommandLine &CmdL)
    while (Act == true)
    while (Act == true)
    {
    {
       Act = false;
       Act = false;
-      for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); Pkg.end() == false; Pkg++)
+      for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); Pkg.end() == false; ++Pkg)
       {
       {
 	 // See we need to show this package
 	 // See we need to show this package
 	 if (Show[Pkg->ID] == None || Show[Pkg->ID] >= DoneNR)
 	 if (Show[Pkg->ID] == None || Show[Pkg->ID] >= DoneNR)
@@ -814,14 +814,14 @@ bool XVcg(CommandLine &CmdL)
 	    continue;
 	    continue;
 	 
 	 
 	 pkgCache::VerIterator Ver = Pkg.VersionList();
 	 pkgCache::VerIterator Ver = Pkg.VersionList();
-	 for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false; D++)
+	 for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false; ++D)
 	 {
 	 {
 	    // See if anything can meet this dep
 	    // See if anything can meet this dep
 	    // Walk along the actual package providing versions
 	    // Walk along the actual package providing versions
 	    bool Hit = false;
 	    bool Hit = false;
 	    pkgCache::PkgIterator DPkg = D.TargetPkg();
 	    pkgCache::PkgIterator DPkg = D.TargetPkg();
 	    for (pkgCache::VerIterator I = DPkg.VersionList();
 	    for (pkgCache::VerIterator I = DPkg.VersionList();
-		      I.end() == false && Hit == false; I++)
+		      I.end() == false && Hit == false; ++I)
 	    {
 	    {
 	       if (Cache->VS->CheckDep(I.VerStr(),D->CompareOp,D.TargetVer()) == true)
 	       if (Cache->VS->CheckDep(I.VerStr(),D->CompareOp,D.TargetVer()) == true)
 		  Hit = true;
 		  Hit = true;
@@ -829,7 +829,7 @@ bool XVcg(CommandLine &CmdL)
 	    
 	    
 	    // Follow all provides
 	    // Follow all provides
 	    for (pkgCache::PrvIterator I = DPkg.ProvidesList(); 
 	    for (pkgCache::PrvIterator I = DPkg.ProvidesList(); 
-		      I.end() == false && Hit == false; I++)
+		      I.end() == false && Hit == false; ++I)
 	    {
 	    {
 	       if (Cache->VS->CheckDep(I.ProvideVersion(),D->CompareOp,D.TargetVer()) == false)
 	       if (Cache->VS->CheckDep(I.ProvideVersion(),D->CompareOp,D.TargetVer()) == false)
 		  Hit = true;
 		  Hit = true;
@@ -889,7 +889,7 @@ bool XVcg(CommandLine &CmdL)
    
    
    /* Draw the box colours after the fact since we can not tell what colour
    /* Draw the box colours after the fact since we can not tell what colour
       they should be until everything is finished drawing */
       they should be until everything is finished drawing */
-   for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); Pkg.end() == false; Pkg++)
+   for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); Pkg.end() == false; ++Pkg)
    {
    {
       if (Show[Pkg->ID] < DoneNR)
       if (Show[Pkg->ID] < DoneNR)
 	 continue;
 	 continue;
@@ -953,7 +953,7 @@ bool Dotty(CommandLine &CmdL)
    memset(Flags,0,sizeof(*Flags)*Cache->Head().PackageCount);
    memset(Flags,0,sizeof(*Flags)*Cache->Head().PackageCount);
    
    
    // Map the shapes
    // Map the shapes
-   for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); Pkg.end() == false; Pkg++)
+   for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); Pkg.end() == false; ++Pkg)
    {   
    {   
       if (Pkg->VersionList == 0)
       if (Pkg->VersionList == 0)
       {
       {
@@ -1000,7 +1000,7 @@ bool Dotty(CommandLine &CmdL)
    while (Act == true)
    while (Act == true)
    {
    {
       Act = false;
       Act = false;
-      for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); Pkg.end() == false; Pkg++)
+      for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); Pkg.end() == false; ++Pkg)
       {
       {
 	 // See we need to show this package
 	 // See we need to show this package
 	 if (Show[Pkg->ID] == None || Show[Pkg->ID] >= DoneNR)
 	 if (Show[Pkg->ID] == None || Show[Pkg->ID] >= DoneNR)
@@ -1024,14 +1024,14 @@ bool Dotty(CommandLine &CmdL)
 	    continue;
 	    continue;
 	 
 	 
 	 pkgCache::VerIterator Ver = Pkg.VersionList();
 	 pkgCache::VerIterator Ver = Pkg.VersionList();
-	 for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false; D++)
+	 for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false; ++D)
 	 {
 	 {
 	    // See if anything can meet this dep
 	    // See if anything can meet this dep
 	    // Walk along the actual package providing versions
 	    // Walk along the actual package providing versions
 	    bool Hit = false;
 	    bool Hit = false;
 	    pkgCache::PkgIterator DPkg = D.TargetPkg();
 	    pkgCache::PkgIterator DPkg = D.TargetPkg();
 	    for (pkgCache::VerIterator I = DPkg.VersionList();
 	    for (pkgCache::VerIterator I = DPkg.VersionList();
-		      I.end() == false && Hit == false; I++)
+		      I.end() == false && Hit == false; ++I)
 	    {
 	    {
 	       if (Cache->VS->CheckDep(I.VerStr(),D->CompareOp,D.TargetVer()) == true)
 	       if (Cache->VS->CheckDep(I.VerStr(),D->CompareOp,D.TargetVer()) == true)
 		  Hit = true;
 		  Hit = true;
@@ -1039,7 +1039,7 @@ bool Dotty(CommandLine &CmdL)
 	    
 	    
 	    // Follow all provides
 	    // Follow all provides
 	    for (pkgCache::PrvIterator I = DPkg.ProvidesList(); 
 	    for (pkgCache::PrvIterator I = DPkg.ProvidesList(); 
-		      I.end() == false && Hit == false; I++)
+		      I.end() == false && Hit == false; ++I)
 	    {
 	    {
 	       if (Cache->VS->CheckDep(I.ProvideVersion(),D->CompareOp,D.TargetVer()) == false)
 	       if (Cache->VS->CheckDep(I.ProvideVersion(),D->CompareOp,D.TargetVer()) == false)
 		  Hit = true;
 		  Hit = true;
@@ -1094,7 +1094,7 @@ bool Dotty(CommandLine &CmdL)
    
    
    /* Draw the box colours after the fact since we can not tell what colour
    /* Draw the box colours after the fact since we can not tell what colour
       they should be until everything is finished drawing */
       they should be until everything is finished drawing */
-   for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); Pkg.end() == false; Pkg++)
+   for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); Pkg.end() == false; ++Pkg)
    {
    {
       if (Show[Pkg->ID] < DoneNR)
       if (Show[Pkg->ID] < DoneNR)
 	 continue;
 	 continue;
@@ -1127,7 +1127,7 @@ bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V)
 
 
    // Find an appropriate file
    // Find an appropriate file
    pkgCache::VerFileIterator Vf = V.FileList();
    pkgCache::VerFileIterator Vf = V.FileList();
-   for (; Vf.end() == false; Vf++)
+   for (; Vf.end() == false; ++Vf)
       if ((Vf.File()->Flags & pkgCache::Flag::NotSource) == 0)
       if ((Vf.File()->Flags & pkgCache::Flag::NotSource) == 0)
 	 break;
 	 break;
    if (Vf.end() == true)
    if (Vf.end() == true)
@@ -1272,7 +1272,7 @@ bool Search(CommandLine &CmdL)
 	 continue;
 	 continue;
 
 
       // Include all the packages that provide matching names too
       // Include all the packages that provide matching names too
-      for (pkgCache::PrvIterator Prv = P.ProvidesList() ; Prv.end() == false; Prv++)
+      for (pkgCache::PrvIterator Prv = P.ProvidesList() ; Prv.end() == false; ++Prv)
       {
       {
 	 pkgCache::VerIterator V = Plcy->GetCandidateVer(Prv.OwnerPkg());
 	 pkgCache::VerIterator V = Plcy->GetCandidateVer(Prv.OwnerPkg());
 	 if (V.end() == true)
 	 if (V.end() == true)
@@ -1341,13 +1341,13 @@ bool ShowAuto(CommandLine &CmdL)
    std::vector<string> packages;
    std::vector<string> packages;
    packages.reserve(Cache->HeaderP->PackageCount / 3);
    packages.reserve(Cache->HeaderP->PackageCount / 3);
    
    
-   for (pkgCache::PkgIterator P = Cache->PkgBegin(); P.end() == false; P++)
+   for (pkgCache::PkgIterator P = Cache->PkgBegin(); P.end() == false; ++P)
       if ((*DepCache)[P].Flags & pkgCache::Flag::Auto)
       if ((*DepCache)[P].Flags & pkgCache::Flag::Auto)
          packages.push_back(P.Name());
          packages.push_back(P.Name());
 
 
     std::sort(packages.begin(), packages.end());
     std::sort(packages.begin(), packages.end());
     
     
-    for (vector<string>::iterator I = packages.begin(); I != packages.end(); I++)
+    for (vector<string>::iterator I = packages.begin(); I != packages.end(); ++I)
             cout << *I << "\n";
             cout << *I << "\n";
 
 
    _error->Notice(_("This command is deprecated. Please use 'apt-mark showauto' instead."));
    _error->Notice(_("This command is deprecated. Please use 'apt-mark showauto' instead."));
@@ -1391,7 +1391,7 @@ bool ShowPkgNames(CommandLine &CmdL)
 
 
    if (CmdL.FileList[1] != 0)
    if (CmdL.FileList[1] != 0)
    {
    {
-      for (;I.end() != true; I++)
+      for (;I.end() != true; ++I)
       {
       {
 	 if (All == false && I->FirstPackage == 0)
 	 if (All == false && I->FirstPackage == 0)
 	    continue;
 	    continue;
@@ -1405,7 +1405,7 @@ bool ShowPkgNames(CommandLine &CmdL)
    }
    }
    
    
    // Show all pkgs
    // Show all pkgs
-   for (;I.end() != true; I++)
+   for (;I.end() != true; ++I)
    {
    {
       if (All == false && I->FirstPackage == 0)
       if (All == false && I->FirstPackage == 0)
 	 continue;
 	 continue;
@@ -1476,7 +1476,7 @@ bool Policy(CommandLine &CmdL)
    if (CmdL.FileList[1] == 0)
    if (CmdL.FileList[1] == 0)
    {
    {
       cout << _("Package files:") << endl;   
       cout << _("Package files:") << endl;   
-      for (pkgCache::PkgFileIterator F = Cache->FileBegin(); F.end() == false; F++)
+      for (pkgCache::PkgFileIterator F = Cache->FileBegin(); F.end() == false; ++F)
       {
       {
 	 // Locate the associated index files so we can derive a description
 	 // Locate the associated index files so we can derive a description
 	 pkgIndexFile *Indx;
 	 pkgIndexFile *Indx;
@@ -1498,7 +1498,7 @@ bool Policy(CommandLine &CmdL)
       // Show any packages have explicit pins
       // Show any packages have explicit pins
       cout << _("Pinned packages:") << endl;
       cout << _("Pinned packages:") << endl;
       pkgCache::PkgIterator I = Cache->PkgBegin();
       pkgCache::PkgIterator I = Cache->PkgBegin();
-      for (;I.end() != true; I++)
+      for (;I.end() != true; ++I)
       {
       {
 	 if (Plcy->GetPriority(I) == 0)
 	 if (Plcy->GetPriority(I) == 0)
 	    continue;
 	    continue;
@@ -1560,14 +1560,14 @@ bool Policy(CommandLine &CmdL)
       
       
       // Show the priority tables
       // Show the priority tables
       cout << _("  Version table:") << endl;
       cout << _("  Version table:") << endl;
-      for (V = Pkg.VersionList(); V.end() == false; V++)
+      for (V = Pkg.VersionList(); V.end() == false; ++V)
       {
       {
 	 if (Pkg.CurrentVer() == V)
 	 if (Pkg.CurrentVer() == V)
 	    cout << " *** " << V.VerStr();
 	    cout << " *** " << V.VerStr();
 	 else
 	 else
 	    cout << "     " << V.VerStr();
 	    cout << "     " << V.VerStr();
 	 cout << " " << Plcy->GetPriority(Pkg) << endl;
 	 cout << " " << Plcy->GetPriority(Pkg) << endl;
-	 for (pkgCache::VerFileIterator VF = V.FileList(); VF.end() == false; VF++)
+	 for (pkgCache::VerFileIterator VF = V.FileList(); VF.end() == false; ++VF)
 	 {
 	 {
 	    // Locate the associated index files so we can derive a description
 	    // Locate the associated index files so we can derive a description
 	    pkgIndexFile *Indx;
 	    pkgIndexFile *Indx;
@@ -1607,9 +1607,9 @@ bool Madison(CommandLine &CmdL)
       APT::PackageSet pkgset = APT::PackageSet::FromString(CacheFile, *I, helper);
       APT::PackageSet pkgset = APT::PackageSet::FromString(CacheFile, *I, helper);
       for (APT::PackageSet::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
       for (APT::PackageSet::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
       {
       {
-         for (pkgCache::VerIterator V = Pkg.VersionList(); V.end() == false; V++)
+         for (pkgCache::VerIterator V = Pkg.VersionList(); V.end() == false; ++V)
          {
          {
-            for (pkgCache::VerFileIterator VF = V.FileList(); VF.end() == false; VF++)
+            for (pkgCache::VerFileIterator VF = V.FileList(); VF.end() == false; ++VF)
             {
             {
 // This might be nice, but wouldn't uniquely identify the source -mdz
 // This might be nice, but wouldn't uniquely identify the source -mdz
 //                if (VF.File().Archive() != 0)
 //                if (VF.File().Archive() != 0)
@@ -1619,11 +1619,11 @@ bool Madison(CommandLine &CmdL)
 //                }
 //                }
 
 
                // Locate the associated index files so we can derive a description
                // Locate the associated index files so we can derive a description
-               for (pkgSourceList::const_iterator S = SrcList->begin(); S != SrcList->end(); S++)
+               for (pkgSourceList::const_iterator S = SrcList->begin(); S != SrcList->end(); ++S)
                {
                {
                     vector<pkgIndexFile *> *Indexes = (*S)->GetIndexFiles();
                     vector<pkgIndexFile *> *Indexes = (*S)->GetIndexFiles();
                     for (vector<pkgIndexFile *>::const_iterator IF = Indexes->begin();
                     for (vector<pkgIndexFile *>::const_iterator IF = Indexes->begin();
-                         IF != Indexes->end(); IF++)
+                         IF != Indexes->end(); ++IF)
                     {
                     {
                          if ((*IF)->FindInCache(*(VF.File().Cache())) == VF.File())
                          if ((*IF)->FindInCache(*(VF.File().Cache())) == VF.File())
                          {
                          {

+ 230 - 133
cmdline/apt-get.cc

@@ -363,7 +363,7 @@ void ShowBroken(ostream &out,CacheFile &Cache,bool Now)
 	    
 	    
 	    if (Start == End)
 	    if (Start == End)
 	       break;
 	       break;
-	    Start++;
+	    ++Start;
 	 }	 
 	 }	 
       }	    
       }	    
    }   
    }   
@@ -537,7 +537,7 @@ bool ShowEssential(ostream &out,CacheFile &Cache)
 	 continue;
 	 continue;
 
 
       // Print out any essential package depenendents that are to be removed
       // Print out any essential package depenendents that are to be removed
-      for (pkgCache::DepIterator D = I.CurrentVer().DependsList(); D.end() == false; D++)
+      for (pkgCache::DepIterator D = I.CurrentVer().DependsList(); D.end() == false; ++D)
       {
       {
 	 // Skip everything but depends
 	 // Skip everything but depends
 	 if (D->Type != pkgCache::Dep::PreDepends &&
 	 if (D->Type != pkgCache::Dep::PreDepends &&
@@ -574,7 +574,7 @@ void Stats(ostream &out,pkgDepCache &Dep)
    unsigned long Downgrade = 0;
    unsigned long Downgrade = 0;
    unsigned long Install = 0;
    unsigned long Install = 0;
    unsigned long ReInstall = 0;
    unsigned long ReInstall = 0;
-   for (pkgCache::PkgIterator I = Dep.PkgBegin(); I.end() == false; I++)
+   for (pkgCache::PkgIterator I = Dep.PkgBegin(); I.end() == false; ++I)
    {
    {
       if (Dep[I].NewInstall() == true)
       if (Dep[I].NewInstall() == true)
 	 Install++;
 	 Install++;
@@ -666,7 +666,7 @@ public:
 				}
 				}
 				// if we found no candidate which provide this package, show non-candidates
 				// if we found no candidate which provide this package, show non-candidates
 				if (provider == 0)
 				if (provider == 0)
-					for (I = Pkg.ProvidesList(); I.end() == false; I++)
+					for (I = Pkg.ProvidesList(); I.end() == false; ++I)
 						out << "  " << I.OwnerPkg().FullName(true) << " " << I.OwnerVer().VerStr()
 						out << "  " << I.OwnerPkg().FullName(true) << " " << I.OwnerVer().VerStr()
 						    << _(" [Not candidate version]") << endl;
 						    << _(" [Not candidate version]") << endl;
 				else
 				else
@@ -682,7 +682,7 @@ public:
 				SPtrArray<bool> Seen = new bool[Cache.GetPkgCache()->Head().PackageCount];
 				SPtrArray<bool> Seen = new bool[Cache.GetPkgCache()->Head().PackageCount];
 				memset(Seen,0,Cache.GetPkgCache()->Head().PackageCount*sizeof(*Seen));
 				memset(Seen,0,Cache.GetPkgCache()->Head().PackageCount*sizeof(*Seen));
 				for (pkgCache::DepIterator Dep = Pkg.RevDependsList();
 				for (pkgCache::DepIterator Dep = Pkg.RevDependsList();
-				     Dep.end() == false; Dep++) {
+				     Dep.end() == false; ++Dep) {
 					if (Dep->Type != pkgCache::Dep::Replaces)
 					if (Dep->Type != pkgCache::Dep::Replaces)
 						continue;
 						continue;
 					if (Seen[Dep.ParentPkg()->ID] == true)
 					if (Seen[Dep.ParentPkg()->ID] == true)
@@ -869,9 +869,7 @@ struct TryToInstall {
 struct TryToRemove {
 struct TryToRemove {
    pkgCacheFile* Cache;
    pkgCacheFile* Cache;
    pkgProblemResolver* Fix;
    pkgProblemResolver* Fix;
-   bool FixBroken;
    bool PurgePkgs;
    bool PurgePkgs;
-   unsigned long AutoMarkChanged;
 
 
    TryToRemove(pkgCacheFile &Cache, pkgProblemResolver *PM) : Cache(&Cache), Fix(PM),
    TryToRemove(pkgCacheFile &Cache, pkgProblemResolver *PM) : Cache(&Cache), Fix(PM),
 				PurgePkgs(_config->FindB("APT::Get::Purge", false)) {};
 				PurgePkgs(_config->FindB("APT::Get::Purge", false)) {};
@@ -923,7 +921,7 @@ void CacheFile::Sort()
    List = new pkgCache::Package *[Cache->Head().PackageCount];
    List = new pkgCache::Package *[Cache->Head().PackageCount];
    memset(List,0,sizeof(*List)*Cache->Head().PackageCount);
    memset(List,0,sizeof(*List)*Cache->Head().PackageCount);
    pkgCache::PkgIterator I = Cache->PkgBegin();
    pkgCache::PkgIterator I = Cache->PkgBegin();
-   for (;I.end() != true; I++)
+   for (;I.end() != true; ++I)
       List[I->ID] = I;
       List[I->ID] = I;
 
 
    SortCache = *this;
    SortCache = *this;
@@ -955,7 +953,7 @@ bool CacheFile::CheckDeps(bool AllowBroken)
       if ((DCache->PolicyBrokenCount() > 0))
       if ((DCache->PolicyBrokenCount() > 0))
       {
       {
 	 // upgrade all policy-broken packages with ForceImportantDeps=True
 	 // upgrade all policy-broken packages with ForceImportantDeps=True
-	 for (pkgCache::PkgIterator I = Cache->PkgBegin(); !I.end(); I++)
+	 for (pkgCache::PkgIterator I = Cache->PkgBegin(); !I.end(); ++I)
 	    if ((*DCache)[I].NowPolicyBroken() == true) 
 	    if ((*DCache)[I].NowPolicyBroken() == true) 
 	       DCache->MarkInstall(I,true,0, false, true);
 	       DCache->MarkInstall(I,true,0, false, true);
       }
       }
@@ -1046,7 +1044,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,
    if (_config->FindB("APT::Get::Purge",false) == true)
    if (_config->FindB("APT::Get::Purge",false) == true)
    {
    {
       pkgCache::PkgIterator I = Cache->PkgBegin();
       pkgCache::PkgIterator I = Cache->PkgBegin();
-      for (; I.end() == false; I++)
+      for (; I.end() == false; ++I)
       {
       {
 	 if (I.Purge() == false && Cache[I].Mode == pkgDepCache::ModeDelete)
 	 if (I.Purge() == false && Cache[I].Mode == pkgDepCache::ModeDelete)
 	    Cache->MarkDelete(I,true);
 	    Cache->MarkDelete(I,true);
@@ -1240,7 +1238,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,
    if (_config->FindB("APT::Get::Print-URIs") == true)
    if (_config->FindB("APT::Get::Print-URIs") == true)
    {
    {
       pkgAcquire::UriIterator I = Fetcher.UriBegin();
       pkgAcquire::UriIterator I = Fetcher.UriBegin();
-      for (; I != Fetcher.UriEnd(); I++)
+      for (; I != Fetcher.UriEnd(); ++I)
 	 cout << '\'' << I->URI << "' " << flNotDir(I->Owner->DestFile) << ' ' << 
 	 cout << '\'' << I->URI << "' " << flNotDir(I->Owner->DestFile) << ' ' << 
 	       I->Owner->FileSize << ' ' << I->Owner->HashSum() << endl;
 	       I->Owner->FileSize << ' ' << I->Owner->HashSum() << endl;
       return true;
       return true;
@@ -1264,7 +1262,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,
 	 {
 	 {
 	    if ((*I)->Local == true)
 	    if ((*I)->Local == true)
 	    {
 	    {
-	       I++;
+	       ++I;
 	       continue;
 	       continue;
 	    }
 	    }
 
 
@@ -1284,7 +1282,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,
       
       
       // Print out errors
       // Print out errors
       bool Failed = false;
       bool Failed = false;
-      for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); I++)
+      for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); ++I)
       {
       {
 	 if ((*I)->Status == pkgAcquire::Item::StatDone &&
 	 if ((*I)->Status == pkgAcquire::Item::StatDone &&
 	     (*I)->Complete == true)
 	     (*I)->Complete == true)
@@ -1388,6 +1386,14 @@ bool TryToInstallBuildDep(pkgCache::PkgIterator Pkg,pkgCacheFile &Cache,
 	 return AllowFail;
 	 return AllowFail;
    }
    }
 
 
+   if (_config->FindB("Debug::BuildDeps",false) == true)
+   {
+      if (Remove == true)
+	 cout << "  Trying to remove " << Pkg << endl;
+      else
+	 cout << "  Trying to install " << Pkg << endl;
+   }
+
    if (Remove == true)
    if (Remove == true)
    {
    {
       TryToRemove RemoveAction(Cache, &Fix);
       TryToRemove RemoveAction(Cache, &Fix);
@@ -1436,7 +1442,7 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs,
 	 // we have a default release, try to locate the pkg. we do it like
 	 // we have a default release, try to locate the pkg. we do it like
 	 // this because GetCandidateVer() will not "downgrade", that means
 	 // this because GetCandidateVer() will not "downgrade", that means
 	 // "apt-get source -t stable apt" won't work on a unstable system
 	 // "apt-get source -t stable apt" won't work on a unstable system
-	 for (pkgCache::VerIterator Ver = Pkg.VersionList();; Ver++)
+	 for (pkgCache::VerIterator Ver = Pkg.VersionList();; ++Ver)
 	 {
 	 {
 	    // try first only exact matches, later fuzzy matches
 	    // try first only exact matches, later fuzzy matches
 	    if (Ver.end() == true)
 	    if (Ver.end() == true)
@@ -1457,7 +1463,7 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs,
 	       continue;
 	       continue;
 
 
 	    for (pkgCache::VerFileIterator VF = Ver.FileList();
 	    for (pkgCache::VerFileIterator VF = Ver.FileList();
-		 VF.end() == false; VF++) 
+		 VF.end() == false; ++VF)
 	    {
 	    {
 	       /* If this is the status file, and the current version is not the
 	       /* If this is the status file, and the current version is not the
 		  version in the status file (ie it is not installed, or somesuch)
 		  version in the status file (ie it is not installed, or somesuch)
@@ -1609,7 +1615,7 @@ bool DoUpdate(CommandLine &CmdL)
 	 return false;
 	 return false;
 
 
       pkgAcquire::UriIterator I = Fetcher.UriBegin();
       pkgAcquire::UriIterator I = Fetcher.UriBegin();
-      for (; I != Fetcher.UriEnd(); I++)
+      for (; I != Fetcher.UriEnd(); ++I)
 	 cout << '\'' << I->URI << "' " << flNotDir(I->Owner->DestFile) << ' ' << 
 	 cout << '\'' << I->URI << "' " << flNotDir(I->Owner->DestFile) << ' ' << 
 	       I->Owner->FileSize << ' ' << I->Owner->HashSum() << endl;
 	       I->Owner->FileSize << ' ' << I->Owner->HashSum() << endl;
       return true;
       return true;
@@ -1994,7 +2000,7 @@ bool DoInstall(CommandLine &CmdL)
 	       if(Start.TargetPkg().ProvidesList() != 0)
 	       if(Start.TargetPkg().ProvidesList() != 0)
 	       {
 	       {
 		  pkgCache::PrvIterator I = Start.TargetPkg().ProvidesList();
 		  pkgCache::PrvIterator I = Start.TargetPkg().ProvidesList();
-		  for (; I.end() == false; I++)
+		  for (; I.end() == false; ++I)
 		  {
 		  {
 		     pkgCache::PkgIterator Pkg = I.OwnerPkg();
 		     pkgCache::PkgIterator Pkg = I.OwnerPkg();
 		     if (Cache[Pkg].CandidateVerIter(Cache) == I.OwnerVer() && 
 		     if (Cache[Pkg].CandidateVerIter(Cache) == I.OwnerVer() && 
@@ -2017,7 +2023,7 @@ bool DoInstall(CommandLine &CmdL)
 
 
 	       if (Start >= End)
 	       if (Start >= End)
 		  break;
 		  break;
-	       Start++;
+	       ++Start;
 	    }
 	    }
 	    
 	    
 	    if(foundInstalledInOrGroup == false)
 	    if(foundInstalledInOrGroup == false)
@@ -2131,7 +2137,7 @@ bool DoDSelectUpgrade(CommandLine &CmdL)
 
 
    // Install everything with the install flag set
    // Install everything with the install flag set
    pkgCache::PkgIterator I = Cache->PkgBegin();
    pkgCache::PkgIterator I = Cache->PkgBegin();
-   for (;I.end() != true; I++)
+   for (;I.end() != true; ++I)
    {
    {
       /* Install the package only if it is a new install, the autoupgrader
       /* Install the package only if it is a new install, the autoupgrader
          will deal with the rest */
          will deal with the rest */
@@ -2141,7 +2147,7 @@ bool DoDSelectUpgrade(CommandLine &CmdL)
 
 
    /* Now install their deps too, if we do this above then order of
    /* Now install their deps too, if we do this above then order of
       the status file is significant for | groups */
       the status file is significant for | groups */
-   for (I = Cache->PkgBegin();I.end() != true; I++)
+   for (I = Cache->PkgBegin();I.end() != true; ++I)
    {
    {
       /* Install the package only if it is a new install, the autoupgrader
       /* Install the package only if it is a new install, the autoupgrader
          will deal with the rest */
          will deal with the rest */
@@ -2150,7 +2156,7 @@ bool DoDSelectUpgrade(CommandLine &CmdL)
    }
    }
    
    
    // Apply erasures now, they override everything else.
    // Apply erasures now, they override everything else.
-   for (I = Cache->PkgBegin();I.end() != true; I++)
+   for (I = Cache->PkgBegin();I.end() != true; ++I)
    {
    {
       // Remove packages 
       // Remove packages 
       if (I->SelectedState == pkgCache::State::DeInstall ||
       if (I->SelectedState == pkgCache::State::DeInstall ||
@@ -2167,7 +2173,7 @@ bool DoDSelectUpgrade(CommandLine &CmdL)
       // Hold back held packages.
       // Hold back held packages.
       if (_config->FindB("APT::Ignore-Hold",false) == false)
       if (_config->FindB("APT::Ignore-Hold",false) == false)
       {
       {
-	 for (pkgCache::PkgIterator I = Cache->PkgBegin(); I.end() == false; I++)
+	 for (pkgCache::PkgIterator I = Cache->PkgBegin(); I.end() == false; ++I)
 	 {
 	 {
 	    if (I->SelectedState == pkgCache::State::Hold)
 	    if (I->SelectedState == pkgCache::State::Hold)
 	    {
 	    {
@@ -2275,7 +2281,7 @@ bool DoDownload(CommandLine &CmdL)
 
 
    pkgAcquire Fetcher;
    pkgAcquire Fetcher;
    AcqTextStatus Stat(ScreenWidth, _config->FindI("quiet",0));
    AcqTextStatus Stat(ScreenWidth, _config->FindI("quiet",0));
-   if (_config->FindB("APT::Get::Print-URIs") == true)
+   if (_config->FindB("APT::Get::Print-URIs") == false)
       Fetcher.Setup(&Stat);
       Fetcher.Setup(&Stat);
 
 
    pkgRecords Recs(Cache);
    pkgRecords Recs(Cache);
@@ -2315,7 +2321,7 @@ bool DoDownload(CommandLine &CmdL)
    if (_config->FindB("APT::Get::Print-URIs") == true)
    if (_config->FindB("APT::Get::Print-URIs") == true)
    {
    {
       pkgAcquire::UriIterator I = Fetcher.UriBegin();
       pkgAcquire::UriIterator I = Fetcher.UriBegin();
-      for (; I != Fetcher.UriEnd(); I++)
+      for (; I != Fetcher.UriEnd(); ++I)
 	 cout << '\'' << I->URI << "' " << flNotDir(I->Owner->DestFile) << ' ' << 
 	 cout << '\'' << I->URI << "' " << flNotDir(I->Owner->DestFile) << ' ' << 
 	       I->Owner->FileSize << ' ' << I->Owner->HashSum() << endl;
 	       I->Owner->FileSize << ' ' << I->Owner->HashSum() << endl;
       return true;
       return true;
@@ -2370,8 +2376,7 @@ bool DoSource(CommandLine &CmdL)
    // Create the download object
    // Create the download object
    AcqTextStatus Stat(ScreenWidth,_config->FindI("quiet",0));   
    AcqTextStatus Stat(ScreenWidth,_config->FindI("quiet",0));   
    pkgAcquire Fetcher;
    pkgAcquire Fetcher;
-   if (Fetcher.Setup(&Stat) == false)
-      return false;
+   Fetcher.SetLog(&Stat);
 
 
    DscFile *Dsc = new DscFile[CmdL.FileSize()];
    DscFile *Dsc = new DscFile[CmdL.FileSize()];
    
    
@@ -2434,7 +2439,7 @@ bool DoSource(CommandLine &CmdL)
 
 
       // Load them into the fetcher
       // Load them into the fetcher
       for (vector<pkgSrcRecords::File>::const_iterator I = Lst.begin();
       for (vector<pkgSrcRecords::File>::const_iterator I = Lst.begin();
-	   I != Lst.end(); I++)
+	   I != Lst.end(); ++I)
       {
       {
 	 // Try to guess what sort of file it is we are getting.
 	 // Try to guess what sort of file it is we are getting.
 	 if (I->Type == "dsc")
 	 if (I->Type == "dsc")
@@ -2536,7 +2541,7 @@ bool DoSource(CommandLine &CmdL)
    if (_config->FindB("APT::Get::Print-URIs") == true)
    if (_config->FindB("APT::Get::Print-URIs") == true)
    {
    {
       pkgAcquire::UriIterator I = Fetcher.UriBegin();
       pkgAcquire::UriIterator I = Fetcher.UriBegin();
-      for (; I != Fetcher.UriEnd(); I++)
+      for (; I != Fetcher.UriEnd(); ++I)
 	 cout << '\'' << I->URI << "' " << flNotDir(I->Owner->DestFile) << ' ' << 
 	 cout << '\'' << I->URI << "' " << flNotDir(I->Owner->DestFile) << ' ' << 
 	       I->Owner->FileSize << ' ' << I->Owner->HashSum() << endl;
 	       I->Owner->FileSize << ' ' << I->Owner->HashSum() << endl;
       delete[] Dsc;
       delete[] Dsc;
@@ -2552,7 +2557,7 @@ bool DoSource(CommandLine &CmdL)
 
 
    // Print error messages
    // Print error messages
    bool Failed = false;
    bool Failed = false;
-   for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); I++)
+   for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); ++I)
    {
    {
       if ((*I)->Status == pkgAcquire::Item::StatDone &&
       if ((*I)->Status == pkgAcquire::Item::StatDone &&
 	  (*I)->Complete == true)
 	  (*I)->Complete == true)
@@ -2581,7 +2586,7 @@ bool DoSource(CommandLine &CmdL)
    if (Process == 0)
    if (Process == 0)
    {
    {
       bool const fixBroken = _config->FindB("APT::Get::Fix-Broken", false);
       bool const fixBroken = _config->FindB("APT::Get::Fix-Broken", false);
-      for (unsigned I = 0; I != J; I++)
+      for (unsigned I = 0; I != J; ++I)
       {
       {
 	 string Dir = Dsc[I].Package + '-' + Cache->VS().UpstreamVersion(Dsc[I].Version.c_str());
 	 string Dir = Dsc[I].Package + '-' + Cache->VS().UpstreamVersion(Dsc[I].Version.c_str());
 	 
 	 
@@ -2617,12 +2622,17 @@ bool DoSource(CommandLine &CmdL)
 	 // Try to compile it with dpkg-buildpackage
 	 // Try to compile it with dpkg-buildpackage
 	 if (_config->FindB("APT::Get::Compile",false) == true)
 	 if (_config->FindB("APT::Get::Compile",false) == true)
 	 {
 	 {
+	    string buildopts = _config->Find("APT::Get::Host-Architecture");
+	    if (buildopts.empty() == false)
+	       buildopts = "-a " + buildopts + " ";
+	    buildopts.append(_config->Find("DPkg::Build-Options","-b -uc"));
+
 	    // Call dpkg-buildpackage
 	    // Call dpkg-buildpackage
 	    char S[500];
 	    char S[500];
 	    snprintf(S,sizeof(S),"cd %s && %s %s",
 	    snprintf(S,sizeof(S),"cd %s && %s %s",
 		     Dir.c_str(),
 		     Dir.c_str(),
 		     _config->Find("Dir::Bin::dpkg-buildpackage","dpkg-buildpackage").c_str(),
 		     _config->Find("Dir::Bin::dpkg-buildpackage","dpkg-buildpackage").c_str(),
-		     _config->Find("DPkg::Build-Options","-b -uc").c_str());
+		     buildopts.c_str());
 	    
 	    
 	    if (system(S) != 0)
 	    if (system(S) != 0)
 	    {
 	    {
@@ -2684,8 +2694,19 @@ bool DoBuildDep(CommandLine &CmdL)
    if (Fetcher.Setup(&Stat) == false)
    if (Fetcher.Setup(&Stat) == false)
       return false;
       return false;
 
 
+   bool StripMultiArch;
+   string hostArch = _config->Find("APT::Get::Host-Architecture");
+   if (hostArch.empty() == false)
+   {
+      std::vector<std::string> archs = APT::Configuration::getArchitectures();
+      if (std::find(archs.begin(), archs.end(), hostArch) == archs.end())
+	 return _error->Error(_("No architecture information available for %s. See apt.conf(5) APT::Architectures for setup"), hostArch.c_str());
+      StripMultiArch = false;
+   }
+   else
+      StripMultiArch = true;
+
    unsigned J = 0;
    unsigned J = 0;
-   bool const StripMultiArch = APT::Configuration::getArchitectures().size() <= 1;
    for (const char **I = CmdL.FileList + 1; *I != 0; I++, J++)
    for (const char **I = CmdL.FileList + 1; *I != 0; I++, J++)
    {
    {
       string Src;
       string Src;
@@ -2714,22 +2735,32 @@ bool DoBuildDep(CommandLine &CmdL)
 	 BuildDeps.push_back(rec);
 	 BuildDeps.push_back(rec);
       }
       }
 
 
-      if (BuildDeps.size() == 0)
+      if (BuildDeps.empty() == true)
       {
       {
 	 ioprintf(c1out,_("%s has no build depends.\n"),Src.c_str());
 	 ioprintf(c1out,_("%s has no build depends.\n"),Src.c_str());
 	 continue;
 	 continue;
       }
       }
-      
+
       // Install the requested packages
       // Install the requested packages
       vector <pkgSrcRecords::Parser::BuildDepRec>::iterator D;
       vector <pkgSrcRecords::Parser::BuildDepRec>::iterator D;
       pkgProblemResolver Fix(Cache);
       pkgProblemResolver Fix(Cache);
       bool skipAlternatives = false; // skip remaining alternatives in an or group
       bool skipAlternatives = false; // skip remaining alternatives in an or group
-      for (D = BuildDeps.begin(); D != BuildDeps.end(); D++)
+      for (D = BuildDeps.begin(); D != BuildDeps.end(); ++D)
       {
       {
          bool hasAlternatives = (((*D).Op & pkgCache::Dep::Or) == pkgCache::Dep::Or);
          bool hasAlternatives = (((*D).Op & pkgCache::Dep::Or) == pkgCache::Dep::Or);
 
 
          if (skipAlternatives == true)
          if (skipAlternatives == true)
          {
          {
+            /*
+             * if there are alternatives, we've already picked one, so skip
+             * the rest
+             *
+             * TODO: this means that if there's a build-dep on A|B and B is
+             * installed, we'll still try to install A; more importantly,
+             * if A is currently broken, we cannot go back and try B. To fix 
+             * this would require we do a Resolve cycle for each package we 
+             * add to the install list. Ugh
+             */
             if (!hasAlternatives)
             if (!hasAlternatives)
                skipAlternatives = false; // end of or group
                skipAlternatives = false; // end of or group
             continue;
             continue;
@@ -2738,27 +2769,117 @@ bool DoBuildDep(CommandLine &CmdL)
          if ((*D).Type == pkgSrcRecords::Parser::BuildConflict ||
          if ((*D).Type == pkgSrcRecords::Parser::BuildConflict ||
 	     (*D).Type == pkgSrcRecords::Parser::BuildConflictIndep)
 	     (*D).Type == pkgSrcRecords::Parser::BuildConflictIndep)
          {
          {
-            pkgCache::PkgIterator Pkg = Cache->FindPkg((*D).Package);
+            pkgCache::GrpIterator Grp = Cache->FindGrp((*D).Package);
             // Build-conflicts on unknown packages are silently ignored
             // Build-conflicts on unknown packages are silently ignored
-            if (Pkg.end() == true)
+            if (Grp.end() == true)
                continue;
                continue;
 
 
-            pkgCache::VerIterator IV = (*Cache)[Pkg].InstVerIter(*Cache);
-
-            /* 
-             * Remove if we have an installed version that satisfies the 
-             * version criteria
-             */
-            if (IV.end() == false && 
-                Cache->VS().CheckDep(IV.VerStr(),(*D).Op,(*D).Version.c_str()) == true)
-               TryToInstallBuildDep(Pkg,Cache,Fix,true,false);
+	    for (pkgCache::PkgIterator Pkg = Grp.PackageList(); Pkg.end() == false; Pkg = Grp.NextPkg(Pkg))
+	    {
+	       pkgCache::VerIterator IV = (*Cache)[Pkg].InstVerIter(*Cache);
+	       /*
+		* Remove if we have an installed version that satisfies the
+		* version criteria
+		*/
+	       if (IV.end() == false &&
+		   Cache->VS().CheckDep(IV.VerStr(),(*D).Op,(*D).Version.c_str()) == true)
+		  TryToInstallBuildDep(Pkg,Cache,Fix,true,false);
+	    }
          }
          }
 	 else // BuildDep || BuildDepIndep
 	 else // BuildDep || BuildDepIndep
          {
          {
-	    pkgCache::PkgIterator Pkg = Cache->FindPkg((*D).Package);
             if (_config->FindB("Debug::BuildDeps",false) == true)
             if (_config->FindB("Debug::BuildDeps",false) == true)
                  cout << "Looking for " << (*D).Package << "...\n";
                  cout << "Looking for " << (*D).Package << "...\n";
 
 
+	    pkgCache::PkgIterator Pkg;
+
+	    // Cross-Building?
+	    if (StripMultiArch == false)
+	    {
+	       size_t const colon = D->Package.find(":");
+	       if (colon != string::npos &&
+		   (strcmp(D->Package.c_str() + colon, ":any") == 0 || strcmp(D->Package.c_str() + colon, ":native") == 0))
+		  Pkg = Cache->FindPkg(D->Package.substr(0,colon));
+	       else
+		  Pkg = Cache->FindPkg(D->Package);
+
+	       // We need to decide if host or build arch, so find a version we can look at
+	       pkgCache::VerIterator Ver;
+
+	       // a bad version either is invalid or doesn't satify dependency
+	       #define BADVER(Ver) Ver.end() == true || \
+				   (Ver.end() == false && D->Version.empty() == false && \
+				    Cache->VS().CheckDep(Ver.VerStr(),D->Op,D->Version.c_str()) == false)
+
+	       if (Pkg.end() == false)
+	       {
+		  Ver = (*Cache)[Pkg].InstVerIter(*Cache);
+		  if (BADVER(Ver))
+		     Ver = (*Cache)[Pkg].CandidateVerIter(*Cache);
+	       }
+	       if (BADVER(Ver))
+	       {
+		  pkgCache::PkgIterator HostPkg = Cache->FindPkg(D->Package, hostArch);
+		  if (HostPkg.end() == false)
+		  {
+		     Ver = (*Cache)[HostPkg].InstVerIter(*Cache);
+		     if (BADVER(Ver))
+		        Ver = (*Cache)[HostPkg].CandidateVerIter(*Cache);
+		  }
+	       }
+	       if ((BADVER(Ver)) == false)
+	       {
+		  string forbidden;
+		  if (Ver->MultiArch == pkgCache::Version::None || Ver->MultiArch == pkgCache::Version::All);
+		  else if (Ver->MultiArch == pkgCache::Version::Same)
+		  {
+		     if (colon != string::npos)
+			Pkg = Ver.ParentPkg().Group().FindPkg(hostArch);
+		     else if (strcmp(D->Package.c_str() + colon, ":any") == 0)
+			forbidden = "Multi-Arch: same";
+		     // :native gets the buildArch
+		  }
+		  else if (Ver->MultiArch == pkgCache::Version::Foreign || Ver->MultiArch == pkgCache::Version::AllForeign)
+		  {
+		     if (colon != string::npos)
+			forbidden = "Multi-Arch: foreign";
+		  }
+		  else if (Ver->MultiArch == pkgCache::Version::Allowed || Ver->MultiArch == pkgCache::Version::AllAllowed)
+		  {
+		     if (colon == string::npos)
+			Pkg = Ver.ParentPkg().Group().FindPkg(hostArch);
+		     else if (strcmp(D->Package.c_str() + colon, ":any") == 0)
+		     {
+			// prefer any installed over preferred non-installed architectures
+			pkgCache::GrpIterator Grp = Ver.ParentPkg().Group();
+			// we don't check for version here as we are better of with upgrading than remove and install
+			for (Pkg = Grp.PackageList(); Pkg.end() == false; Pkg = Grp.NextPkg(Pkg))
+			   if (Pkg.CurrentVer().end() == false)
+			      break;
+			if (Pkg.end() == true)
+			   Pkg = Grp.FindPreferredPkg(true);
+		     }
+		     // native gets buildArch
+		  }
+		  if (forbidden.empty() == false)
+		  {
+		     if (_config->FindB("Debug::BuildDeps",false) == true)
+			cout << " :any is not allowed from M-A: same package " << (*D).Package << endl;
+		     if (hasAlternatives)
+			continue;
+		     return _error->Error(_("%s dependency for %s can't be satisfied "
+					    "because %s is not allowed on '%s' packages"),
+					  Last->BuildDepType(D->Type), Src.c_str(),
+					  D->Package.c_str(), "Multi-Arch: same");
+		  }
+	       }
+	       else if (_config->FindB("Debug::BuildDeps",false) == true)
+		  cout << " No multiarch info as we have no satisfying installed nor candidate for " << D->Package << " on build or host arch" << endl;
+	       #undef BADVER
+	    }
+	    else
+	       Pkg = Cache->FindPkg(D->Package);
+
 	    if (Pkg.end() == true)
 	    if (Pkg.end() == true)
             {
             {
                if (_config->FindB("Debug::BuildDeps",false) == true)
                if (_config->FindB("Debug::BuildDeps",false) == true)
@@ -2773,99 +2894,74 @@ bool DoBuildDep(CommandLine &CmdL)
                                     (*D).Package.c_str());
                                     (*D).Package.c_str());
             }
             }
 
 
-            /*
-             * if there are alternatives, we've already picked one, so skip
-             * the rest
-             *
-             * TODO: this means that if there's a build-dep on A|B and B is
-             * installed, we'll still try to install A; more importantly,
-             * if A is currently broken, we cannot go back and try B. To fix 
-             * this would require we do a Resolve cycle for each package we 
-             * add to the install list. Ugh
-             */
-                       
-	    /* 
-	     * If this is a virtual package, we need to check the list of
-	     * packages that provide it and see if any of those are
-	     * installed
-	     */
-            pkgCache::PrvIterator Prv = Pkg.ProvidesList();
-            for (; Prv.end() != true; Prv++)
-	    {
-               if (_config->FindB("Debug::BuildDeps",false) == true)
-                    cout << "  Checking provider " << Prv.OwnerPkg().FullName() << endl;
-
-	       if ((*Cache)[Prv.OwnerPkg()].InstVerIter(*Cache).end() == false)
-	          break;
-            }
-            
-            // Get installed version and version we are going to install
 	    pkgCache::VerIterator IV = (*Cache)[Pkg].InstVerIter(*Cache);
 	    pkgCache::VerIterator IV = (*Cache)[Pkg].InstVerIter(*Cache);
+	    if (IV.end() == false)
+	    {
+	       if (_config->FindB("Debug::BuildDeps",false) == true)
+		  cout << "  Is installed\n";
 
 
-            if ((*D).Version[0] != '\0') {
-                 // Versioned dependency
-
-                 pkgCache::VerIterator CV = (*Cache)[Pkg].CandidateVerIter(*Cache);
-
-                 for (; CV.end() != true; CV++)
-                 {
-                      if (Cache->VS().CheckDep(CV.VerStr(),(*D).Op,(*D).Version.c_str()) == true)
-                           break;
-                 }
-                 if (CV.end() == true)
-		 {
-		   if (hasAlternatives)
-		   {
-		      continue;
-		   }
-		   else
-		   {
-                      return _error->Error(_("%s dependency for %s cannot be satisfied "
-                                             "because no available versions of package %s "
-                                             "can satisfy version requirements"),
-                                           Last->BuildDepType((*D).Type),Src.c_str(),
-                                           (*D).Package.c_str());
-		   }
-		 }
-            }
-            else
-            {
-               // Only consider virtual packages if there is no versioned dependency
-               if (Prv.end() == false)
-               {
-                  if (_config->FindB("Debug::BuildDeps",false) == true)
-                     cout << "  Is provided by installed package " << Prv.OwnerPkg().FullName() << endl;
-                  skipAlternatives = hasAlternatives;
-                  continue;
-               }
-            }
+	       if (D->Version.empty() == true ||
+		   Cache->VS().CheckDep(IV.VerStr(),(*D).Op,(*D).Version.c_str()) == true)
+	       {
+		  skipAlternatives = hasAlternatives;
+		  continue;
+	       }
 
 
-            if (IV.end() == false)
-            {
-               if (_config->FindB("Debug::BuildDeps",false) == true)
-                  cout << "  Is installed\n";
+	       if (_config->FindB("Debug::BuildDeps",false) == true)
+		  cout << "    ...but the installed version doesn't meet the version requirement\n";
 
 
-               if (Cache->VS().CheckDep(IV.VerStr(),(*D).Op,(*D).Version.c_str()) == true)
-               {
-                  skipAlternatives = hasAlternatives;
-                  continue;
-               }
+	       if (((*D).Op & pkgCache::Dep::LessEq) == pkgCache::Dep::LessEq)
+		  return _error->Error(_("Failed to satisfy %s dependency for %s: Installed package %s is too new"),
+					Last->BuildDepType((*D).Type), Src.c_str(), Pkg.FullName(true).c_str());
+	    }
 
 
-               if (_config->FindB("Debug::BuildDeps",false) == true)
-                  cout << "    ...but the installed version doesn't meet the version requirement\n";
-
-               if (((*D).Op & pkgCache::Dep::LessEq) == pkgCache::Dep::LessEq)
-               {
-                  return _error->Error(_("Failed to satisfy %s dependency for %s: Installed package %s is too new"),
-                                       Last->BuildDepType((*D).Type),
-                                       Src.c_str(),
-                                       Pkg.FullName(true).c_str());
-               }
-            }
+	    // Only consider virtual packages if there is no versioned dependency
+	    if ((*D).Version.empty() == true)
+	    {
+	       /*
+		* If this is a virtual package, we need to check the list of
+		* packages that provide it and see if any of those are
+		* installed
+		*/
+	       pkgCache::PrvIterator Prv = Pkg.ProvidesList();
+	       for (; Prv.end() != true; ++Prv)
+	       {
+		  if (_config->FindB("Debug::BuildDeps",false) == true)
+		     cout << "  Checking provider " << Prv.OwnerPkg().FullName() << endl;
 
 
+		  if ((*Cache)[Prv.OwnerPkg()].InstVerIter(*Cache).end() == false)
+		     break;
+	       }
 
 
-            if (_config->FindB("Debug::BuildDeps",false) == true)
-               cout << "  Trying to install " << (*D).Package << endl;
+	       if (Prv.end() == false)
+	       {
+		  if (_config->FindB("Debug::BuildDeps",false) == true)
+		     cout << "  Is provided by installed package " << Prv.OwnerPkg().FullName() << endl;
+		  skipAlternatives = hasAlternatives;
+		  continue;
+	       }
+	    }
+	    else // versioned dependency
+	    {
+	       pkgCache::VerIterator CV = (*Cache)[Pkg].CandidateVerIter(*Cache);
+	       if (CV.end() == true ||
+		   Cache->VS().CheckDep(CV.VerStr(),(*D).Op,(*D).Version.c_str()) == false)
+	       {
+		  if (hasAlternatives)
+		     continue;
+		  else if (CV.end() == false)
+		     return _error->Error(_("%s dependency for %s cannot be satisfied "
+					    "because candidate version of package %s "
+					    "can't satisfy version requirements"),
+					  Last->BuildDepType(D->Type), Src.c_str(),
+					  D->Package.c_str());
+		  else
+		     return _error->Error(_("%s dependency for %s cannot be satisfied "
+					    "because package %s has no candidate version"),
+					  Last->BuildDepType(D->Type), Src.c_str(),
+					  D->Package.c_str());
+	       }
+	    }
 
 
             if (TryToInstallBuildDep(Pkg,Cache,Fix,false,false) == true)
             if (TryToInstallBuildDep(Pkg,Cache,Fix,false,false) == true)
             {
             {
@@ -3252,6 +3348,7 @@ int main(int argc,const char *argv[])					/*{{{*/
       {'m',"ignore-missing","APT::Get::Fix-Missing",0},
       {'m',"ignore-missing","APT::Get::Fix-Missing",0},
       {'t',"target-release","APT::Default-Release",CommandLine::HasArg},
       {'t',"target-release","APT::Default-Release",CommandLine::HasArg},
       {'t',"default-release","APT::Default-Release",CommandLine::HasArg},
       {'t',"default-release","APT::Default-Release",CommandLine::HasArg},
+      {'a',"host-architecture","APT::Get::Host-Architecture",CommandLine::HasArg},
       {0,"download","APT::Get::Download",0},
       {0,"download","APT::Get::Download",0},
       {0,"fix-missing","APT::Get::Fix-Missing",0},
       {0,"fix-missing","APT::Get::Fix-Missing",0},
       {0,"ignore-hold","APT::Ignore-Hold",0},      
       {0,"ignore-hold","APT::Ignore-Hold",0},      

+ 4 - 1
cmdline/apt-key

@@ -5,9 +5,12 @@ unset GREP_OPTIONS
 
 
 # We don't use a secret keyring, of course, but gpg panics and
 # We don't use a secret keyring, of course, but gpg panics and
 # implodes if there isn't one available
 # implodes if there isn't one available
-GPG_CMD='gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /etc/apt/secring.gpg'
+SECRETKEYRING="$(mktemp)"
+trap "rm -f '${SECRETKEYRING}'" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
+GPG_CMD="gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring ${SECRETKEYRING}"
 
 
 if [ "$(id -u)" -eq 0 ]; then
 if [ "$(id -u)" -eq 0 ]; then
+	# we could use a tmpfile here too, but creation of this tends to be time-consuming
 	GPG_CMD="$GPG_CMD --trustdb-name /etc/apt/trustdb.gpg"
 	GPG_CMD="$GPG_CMD --trustdb-name /etc/apt/trustdb.gpg"
 fi
 fi
 
 

+ 1 - 1
cmdline/apt-sortpkgs.cc

@@ -107,7 +107,7 @@ bool DoIt(string InFile)
    
    
    // Emit
    // Emit
    unsigned char *Buffer = new unsigned char[Largest+1];
    unsigned char *Buffer = new unsigned char[Largest+1];
-   for (vector<PkgName>::iterator I = List.begin(); I != List.end(); I++)
+   for (vector<PkgName>::iterator I = List.begin(); I != List.end(); ++I)
    {
    {
       // Read in the Record.
       // Read in the Record.
       if (Fd.Seek(I->Offset) == false || Fd.Read(Buffer,I->Length) == false)
       if (Fd.Seek(I->Offset) == false || Fd.Read(Buffer,I->Length) == false)

+ 1 - 1
cmdline/makefile

@@ -73,7 +73,7 @@ LIB_MAKES = apt-pkg/makefile
 SOURCE = apt-internal-solver.cc
 SOURCE = apt-internal-solver.cc
 include $(PROGRAM_H)
 include $(PROGRAM_H)
 
 
-# The internal solver acting as an external
+# This just dumps out the state
 PROGRAM=apt-dump-solver
 PROGRAM=apt-dump-solver
 SLIBS = -lapt-pkg $(INTLLIBS)
 SLIBS = -lapt-pkg $(INTLLIBS)
 LIB_MAKES = apt-pkg/makefile
 LIB_MAKES = apt-pkg/makefile

+ 1 - 1
configure.in

@@ -18,7 +18,7 @@ AC_CONFIG_AUX_DIR(buildlib)
 AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in)
 AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in)
 
 
 dnl -- SET THIS TO THE RELEASE VERSION --
 dnl -- SET THIS TO THE RELEASE VERSION --
-AC_DEFINE_UNQUOTED(VERSION,"0.8.15")
+AC_DEFINE_UNQUOTED(VERSION,"0.8.16~exp5")
 PACKAGE="apt"
 PACKAGE="apt"
 AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE")
 AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE")
 AC_SUBST(PACKAGE)
 AC_SUBST(PACKAGE)

+ 5 - 0
debian/apt.postinst

@@ -15,6 +15,11 @@ set -e
 
 
 case "$1" in
 case "$1" in
     configure)
     configure)
+	SECRING='/etc/apt/secring.gpg'
+	# test if secring is an empty normal file
+	if test -f $SECRING -a ! -s $SECRING; then
+		rm -f $SECRING
+	fi
 	apt-key update
 	apt-key update
     ;;
     ;;
 
 

+ 129 - 4
debian/changelog

@@ -1,11 +1,64 @@
-apt (0.8.16~exp3+nmu1) experimental; urgency=low
+apt (0.8.16~exp6) experimental; urgency=low
 
 
   [ David Kalnischkies ]
   [ David Kalnischkies ]
   * Support large files in the complete toolset. Indexes of this
   * Support large files in the complete toolset. Indexes of this
     size are pretty unlikely for now, but we need it for deb
     size are pretty unlikely for now, but we need it for deb
     packages which could become bigger than 4GB now (LP: #815895)
     packages which could become bigger than 4GB now (LP: #815895)
 
 
- -- David Kalnischkies <kalnischkies@gmail.com>  Tue, 13 Sep 2011 17:44:00 +0200
+ -- David Kalnischkies <kalnischkies@gmail.com>  Tue, 13 Sep 2011 17:51:49 +0200
+
+apt (0.8.16~exp5) experimental; urgency=low
+
+  * merged the latest debian-sid fixes
+  * apt-pkg/makefile:
+    - install sha256.h compat header
+  * apt-pkg/pkgcachegen.{cc,h}:
+    - use ref-to-ptr semantic in NewDepends() to ensure that the   
+      libapt does not segfault if the cache is remapped in between
+      (LP: #812862)
+    - fix crash when P.Arch() was used but the cache got remapped
+  * apt-pkg/acquire-item.{cc,h}:
+    - do not check for a "Package" tag in optional index targets
+      like the translations index
+  * apt-pkg/acquire.cc:
+    - fix potential divide-by-zero
+  * methods/mirror.cc:
+    - include the architecture(s) in the query string as well so 
+      that the server can make better decisions
+
+ -- Michael Vogt <mvo@debian.org>  Mon, 15 Aug 2011 14:52:54 +0200
+
+apt (0.8.16~exp4) experimental; urgency=low
+
+  [ Julian Andres Klode ]
+  * apt-pkg/pkgcache.h:
+    - [ABI break] Add pkgCache::Header::CacheFileSize, storing the cache size
+  * apt-pkg/pkgcachegen.cc:
+    - Write the file size to the cache
+  * apt-pkg/pkgcache.cc:
+    - Check that cache is at least CacheFileSize bytes large (LP: #16467)
+  
+  [ Michael Vogt ]
+  * merged latest fixes from debian-sid
+  * apt-pkg/cdrom.{cc,h}:
+    - cleanup old ABI break avoidance hacks
+  * [ABI break] apt-pkg/acquire-item.{cc,h}:
+    - cleanup around OptionalIndexTarget and SubIndexTarget
+  * [ABI break] merged patch from Jonathan Thomas to have a new
+    RecordField() function in the pkgRecorder parser. Many thanks
+    Thomas
+  * [ABI break] merge patch from Jonathan Thomas to speed up the
+    depcache by caching the install-recommends and install-suggests
+    values
+  * apt-pkg/contrib/fileutl.{cc,h}:
+    - add GetModificationTime() helper
+  * apt-pkg/pkgcachegen.cc:
+    - regenerate the cache if the sources.list changes to ensure
+      that changes in the ordering there will be honored by apt
+  * apt-pkg/sourcelist.{cc,h}:
+    - add pkgSourceList::GetLastModifiedTime() helper
+
+ -- Michael Vogt <mvo@debian.org>  Thu, 28 Jul 2011 16:57:08 +0200
 
 
 apt (0.8.16~exp3) experimental; urgency=low
 apt (0.8.16~exp3) experimental; urgency=low
 
 
@@ -71,7 +124,59 @@ 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.3) UNRELEASED; urgency=low
+apt (0.8.15.6) unstable; urgency=low
+
+  [ Michael Vogt ]
+  * apt-pkg/contrib/fileutl.{cc,h}:
+    - add GetModificationTime() helper
+  * apt-pkg/pkgcachegen.cc:
+    - regenerate the cache if the sources.list changes to ensure
+      that changes in the ordering there will be honored by apt
+  * apt-pkg/sourcelist.{cc,h}:
+    - add pkgSourceList::GetLastModifiedTime() helper
+  * apt-pkg/pkgcachegen.{cc,h}:
+    - use ref-to-ptr semantic in NewDepends() to ensure that the   
+      libapt does not segfault if the cache is remapped in between
+      (LP: #812862)
+    - fix crash when P.Arch() was used but the cache got remapped
+  * test/integration/test-hashsum-verification:
+    - add regression test for hashsum verification
+  * apt-pkg/acquire-item.cc:
+    - if no Release.gpg file is found, still load the hashes for
+      verification (closes: #636314) and add test
+  
+  [ David Kalnischkies ]
+  * lots of cppcheck fixes
+
+ -- Michael Vogt <mvo@debian.org>  Mon, 15 Aug 2011 09:20:35 +0200
+
+apt (0.8.15.5) unstable; urgency=low
+
+  [ David Kalnischkies ]
+  * apt-pkg/deb/deblistparser.cc:
+    - do not assume that the last char on a line is a \n (Closes: #633350)
+
+ -- Michael Vogt <mvo@debian.org>  Thu, 28 Jul 2011 16:49:15 +0200
+
+apt (0.8.15.4) unstable; urgency=low
+
+  [ David Miller ]
+  * apt-pkg/contrib/sha1.cc:
+    - fix illegally casts of on-stack buffer to a type requiring more
+      alignment than it has resulting in segfaults on sparc (Closes: #634696)
+
+  [ Michael Vogt ]
+  * apt-pkg/contrib/cdromutl.cc:
+    - fix escape problem when looking for the mounted devices
+  * apt-pkg/contrib/strutl.{h,cc}, test/libapt/strutil_test.cc:
+    - add new DeEscapeString() similar to DeQuoteString but
+      unescape character escapes like \0XX and \xXX (plus added
+      test)
+  * refresh po/*
+  
+ -- Michael Vogt <mvo@debian.org>  Tue, 26 Jul 2011 12:12:27 +0200
+
+apt (0.8.15.3) unstable; urgency=low
 
 
   [ Michael Vogt ]
   [ Michael Vogt ]
   * apt-pkg/acquire-item.cc:
   * apt-pkg/acquire-item.cc:
@@ -79,6 +184,8 @@ apt (0.8.15.3) UNRELEASED; urgency=low
   * apt-pkg/algorithms.cc:
   * apt-pkg/algorithms.cc:
     - Hold back packages that would enter "policy-broken" state on upgrade
     - Hold back packages that would enter "policy-broken" state on upgrade
       when doing a "apt-get upgrade"
       when doing a "apt-get upgrade"
+  * cmdline/apt-get.cc:
+    - fix missing download progress in apt-get download
 
 
   [ David Kalnischkies ]
   [ David Kalnischkies ]
   * apt-pkg/pkgcachegen.cc:
   * apt-pkg/pkgcachegen.cc:
@@ -90,12 +197,30 @@ apt (0.8.15.3) UNRELEASED; urgency=low
     - document APT::Architectures list (Closes: #612102)
     - document APT::Architectures list (Closes: #612102)
   * cmdline/apt-get.cc:
   * cmdline/apt-get.cc:
     - restore all important dependencies for garbage packages (LP: #806274)
     - restore all important dependencies for garbage packages (LP: #806274)
+    - do not require unused partial dirs in 'source' (Closes: #633510)
+    - buildconflicts effect all architectures
+    - implement MultiarchCross for build-dep and source (Closes: #632221)
   * apt-pkg/init.cc:
   * apt-pkg/init.cc:
     - use CndSet in pkgInitConfig (Closes: #629617)
     - use CndSet in pkgInitConfig (Closes: #629617)
   * apt-pkg/depcache.cc:
   * apt-pkg/depcache.cc:
     - change default of APT::AutoRemove::SuggestsImportant to true
     - change default of APT::AutoRemove::SuggestsImportant to true
+  * cmdline/apt-key:
+    - use a tmpfile instead of /etc/apt/secring.gpg (Closes: #632596)
+  * debian/apt.postinst:
+    - remove /etc/apt/secring.gpg if it is an empty file
+  * doc/apt-cache.8.xml:
+    - apply madison typofix from John Feuerstein, thanks! (Closes: #633455)
+  * apt-pkg/policy.cc:
+    - emit an error on unknown APT::Default-Release value (Closes: #407511)
+  * apt-pkg/aptconfiguration.cc:
+    - ensure that native architecture is if not specified otherwise the
+      first architecture in the Architectures vector
+  * apt-pkg/deb/deblistparser.cc:
+    - Strip only :any and :native if MultiArch should be stripped as it is
+      save to ignore them in non-MultiArch contexts but if the dependency
+      is a specific architecture (and not the native) do not strip
 
 
- -- David Kalnischkies <kalnischkies@gmail.com>  Fri, 15 Jul 2011 09:29:37 +0200
+ -- Michael Vogt <mvo@debian.org>  Mon, 25 Jul 2011 15:04:43 +0200
 
 
 apt (0.8.15.2) unstable; urgency=high
 apt (0.8.15.2) unstable; urgency=high
 
 

+ 1 - 1
doc/apt-cache.8.xml

@@ -263,7 +263,7 @@ Reverse Provides:
      about the priority selection of the named package.</para></listitem>
      about the priority selection of the named package.</para></listitem>
      </varlistentry>
      </varlistentry>
 
 
-     <varlistentry><term>madison <replaceable>/[ pkg(s) ]</replaceable></term>
+     <varlistentry><term>madison <replaceable>[ pkg(s) ]</replaceable></term>
      <listitem><para><literal>apt-cache</literal>'s <literal>madison</literal> command attempts to mimic
      <listitem><para><literal>apt-cache</literal>'s <literal>madison</literal> command attempts to mimic
      the output format and a subset of the functionality of the Debian
      the output format and a subset of the functionality of the Debian
      archive management tool, <literal>madison</literal>.  It displays
      archive management tool, <literal>madison</literal>.  It displays

+ 24 - 3
doc/apt-get.8.xml

@@ -54,6 +54,13 @@
 			<replaceable>target_release</replaceable>
 			<replaceable>target_release</replaceable>
 		</arg>
 		</arg>
       </arg>
       </arg>
+      <arg>
+		<option>-a=</option>
+		<arg choice='plain'>
+			<replaceable>default_architecture</replaceable>
+		</arg>
+      </arg>
+
 
 
       <group choice="req">
       <group choice="req">
          <arg choice='plain'>update</arg>
          <arg choice='plain'>update</arg>
@@ -254,8 +261,10 @@
 
 
      <para>If the <option>--compile</option> option is specified
      <para>If the <option>--compile</option> option is specified
      then the package will be compiled to a binary .deb using
      then the package will be compiled to a binary .deb using
-     <command>dpkg-buildpackage</command>, if <option>--download-only</option>
-     is specified then the source package will not be unpacked.</para>
+     <command>dpkg-buildpackage</command> for the architecture as
+     defined by the <command>--host-architecture</command> option.
+     If <option>--download-only</option> is specified then the source package
+     will not be unpacked.</para>
 
 
      <para>A specific source version can be retrieved by postfixing the source name
      <para>A specific source version can be retrieved by postfixing the source name
      with an equals and then the version to fetch, similar to the mechanism
      with an equals and then the version to fetch, similar to the mechanism
@@ -270,7 +279,9 @@
 
 
      <varlistentry><term>build-dep</term>
      <varlistentry><term>build-dep</term>
      <listitem><para><literal>build-dep</literal> causes apt-get to install/remove packages in an 
      <listitem><para><literal>build-dep</literal> causes apt-get to install/remove packages in an 
-     attempt to satisfy the build dependencies for a source package.</para></listitem>
+     attempt to satisfy the build dependencies for a source package. By default the dependencies are
+     satisfied to build the package nativly. If desired a host-architecture can be specified
+     with the <option>--host-architecture</option> option instead.</para></listitem>
      </varlistentry>
      </varlistentry>
 
 
      <varlistentry><term>check</term>
      <varlistentry><term>check</term>
@@ -438,6 +449,16 @@
      Configuration Item: <literal>APT::Get::Show-Versions</literal>.</para></listitem>
      Configuration Item: <literal>APT::Get::Show-Versions</literal>.</para></listitem>
      </varlistentry>
      </varlistentry>
 
 
+     <varlistentry><term><option>-a</option></term>
+                   <term><option>--host-architecture</option></term>
+     <listitem><para>This option controls the architecture packages are built for
+     by <command>apt-get source --compile</command> and how cross-builddependencies
+     are satisfied. By default is not set which means that the host architecture
+     is the same as the build architecture (which is defined by <literal>APT::Architecture</literal>)
+     Configuration Item: <literal>APT::Get::Host-Architecture</literal>
+     </para></listitem>
+     </varlistentry>
+
      <varlistentry><term><option>-b</option></term><term><option>--compile</option></term>
      <varlistentry><term><option>-b</option></term><term><option>--compile</option></term>
                    <term><option>--build</option></term>
                    <term><option>--build</option></term>
      <listitem><para>Compile source packages after downloading them.
      <listitem><para>Compile source packages after downloading them.

+ 1 - 0
doc/examples/configure-index

@@ -32,6 +32,7 @@ APT
   // Options for apt-get
   // Options for apt-get
   Get 
   Get 
   {
   {
+     Host-Architecture "armel";
      Arch-Only "false";
      Arch-Only "false";
      AllowUnauthenticated "false";
      AllowUnauthenticated "false";
      AutomaticRemove "false";       
      AutomaticRemove "false";       

+ 1 - 1
doc/po/apt-doc.pot

@@ -928,7 +928,7 @@ msgstr ""
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><term>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><term>
 #: apt-cache.8.xml:266
 #: apt-cache.8.xml:266
-msgid "madison <replaceable>/[ pkg(s) ]</replaceable>"
+msgid "madison <replaceable>[ pkg(s) ]</replaceable>"
 msgstr ""
 msgstr ""
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>

+ 2 - 2
doc/po/de.po

@@ -1230,8 +1230,8 @@ msgstr ""
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><term>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><term>
 #: apt-cache.8.xml:266
 #: apt-cache.8.xml:266
-msgid "madison <replaceable>/[ pkg(s) ]</replaceable>"
-msgstr "madison <replaceable>/[ Paket(e) ]</replaceable>"
+msgid "madison <replaceable>[ pkg(s) ]</replaceable>"
+msgstr "madison <replaceable>[ Paket(e) ]</replaceable>"
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt-cache.8.xml:267
 #: apt-cache.8.xml:267

+ 1 - 1
doc/po/es.po

@@ -1303,7 +1303,7 @@ msgstr ""
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><term>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><term>
 #: apt-cache.8.xml:266
 #: apt-cache.8.xml:266
-msgid "madison <replaceable>/[ pkg(s) ]</replaceable>"
+msgid "madison <replaceable>[ pkg(s) ]</replaceable>"
 msgstr "madison <replaceable>[ paquete(s) ]</replaceable>"
 msgstr "madison <replaceable>[ paquete(s) ]</replaceable>"
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>

+ 1 - 1
doc/po/fr.po

@@ -1225,7 +1225,7 @@ msgstr ""
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><term>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><term>
 #: apt-cache.8.xml:266
 #: apt-cache.8.xml:266
-msgid "madison <replaceable>/[ pkg(s) ]</replaceable>"
+msgid "madison <replaceable>[ pkg(s) ]</replaceable>"
 msgstr "madison <replaceable>[ paquet(s) ]</replaceable>"
 msgstr "madison <replaceable>[ paquet(s) ]</replaceable>"
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>

+ 1 - 1
doc/po/it.po

@@ -893,7 +893,7 @@ msgstr ""
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><term>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><term>
 #: apt-cache.8.xml:266
 #: apt-cache.8.xml:266
-msgid "madison <replaceable>/[ pkg(s) ]</replaceable>"
+msgid "madison <replaceable>[ pkg(s) ]</replaceable>"
 msgstr ""
 msgstr ""
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>

+ 2 - 2
doc/po/ja.po

@@ -1304,8 +1304,8 @@ msgstr ""
 # type: Content of: <refentry><refsect1><refsect2><para><programlisting>
 # type: Content of: <refentry><refsect1><refsect2><para><programlisting>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><term>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><term>
 #: apt-cache.8.xml:266
 #: apt-cache.8.xml:266
-msgid "madison <replaceable>/[ pkg(s) ]</replaceable>"
-msgstr "madison <replaceable>/[ pkg(s) ]</replaceable>"
+msgid "madison <replaceable>[ pkg(s) ]</replaceable>"
+msgstr "madison <replaceable>[ pkg(s) ]</replaceable>"
 
 
 # type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 # type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>

+ 2 - 2
doc/po/pl.po

@@ -1311,8 +1311,8 @@ msgstr ""
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><term>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><term>
 #: apt-cache.8.xml:266
 #: apt-cache.8.xml:266
-msgid "madison <replaceable>/[ pkg(s) ]</replaceable>"
-msgstr "madison <replaceable>/[ pakiet(y) ]</replaceable>"
+msgid "madison <replaceable>[ pkg(s) ]</replaceable>"
+msgstr "madison <replaceable>[ pakiet(y) ]</replaceable>"
 
 
 #
 #
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>

+ 2 - 2
doc/po/pt.po

@@ -1255,8 +1255,8 @@ msgstr ""
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><term>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><term>
 #: apt-cache.8.xml:266
 #: apt-cache.8.xml:266
-msgid "madison <replaceable>/[ pkg(s) ]</replaceable>"
-msgstr "madison <replaceable>/[ pacote(s) ]</replaceable>"
+msgid "madison <replaceable>[ pkg(s) ]</replaceable>"
+msgstr "madison <replaceable>[ pacote(s) ]</replaceable>"
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt-cache.8.xml:267
 #: apt-cache.8.xml:267

+ 4 - 1
doc/po/pt_BR.po

@@ -943,8 +943,11 @@ msgstr ""
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><term>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><term>
 #: apt-cache.8.xml:266
 #: apt-cache.8.xml:266
-msgid "madison <replaceable>/[ pkg(s) ]</replaceable>"
+#, fuzzy
+msgid "madison <replaceable>[ pkg(s) ]</replaceable>"
 msgstr ""
 msgstr ""
+"<programlisting>\n"
+"apt-get install <replaceable>pacote</replaceable>/testing\n"
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt-cache.8.xml:267
 #: apt-cache.8.xml:267

+ 8 - 8
ftparchive/apt-ftparchive.cc

@@ -385,7 +385,7 @@ bool PackageMap::GenContents(Configuration &Setup,
       files associated with this contents file into one great big honking
       files associated with this contents file into one great big honking
       memory structure, then dump the sorted version */
       memory structure, then dump the sorted version */
    c0out << ' ' << this->Contents << ":" << flush;
    c0out << ' ' << this->Contents << ":" << flush;
-   for (vector<PackageMap>::iterator I = Begin; I != End; I++)
+   for (vector<PackageMap>::iterator I = Begin; I != End; ++I)
    {
    {
       if (I->Contents != this->Contents)
       if (I->Contents != this->Contents)
 	 continue;
 	 continue;
@@ -771,10 +771,10 @@ bool Generate(CommandLine &CmdL)
    // Generate packages
    // Generate packages
    if (CmdL.FileSize() <= 2)
    if (CmdL.FileSize() <= 2)
    {
    {
-      for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); I++)
+      for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); ++I)
 	 if (I->GenPackages(Setup,Stats) == false)
 	 if (I->GenPackages(Setup,Stats) == false)
 	    _error->DumpErrors();
 	    _error->DumpErrors();
-      for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); I++)
+      for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); ++I)
 	 if (I->GenSources(Setup,SrcStats) == false)
 	 if (I->GenSources(Setup,SrcStats) == false)
 	    _error->DumpErrors();
 	    _error->DumpErrors();
    }
    }
@@ -783,7 +783,7 @@ bool Generate(CommandLine &CmdL)
       // Make a choice list out of the package list..
       // Make a choice list out of the package list..
       RxChoiceList *List = new RxChoiceList[2*PkgList.size()+1];
       RxChoiceList *List = new RxChoiceList[2*PkgList.size()+1];
       RxChoiceList *End = List;
       RxChoiceList *End = List;
-      for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); I++)
+      for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); ++I)
       {
       {
 	 End->UserData = &(*I);
 	 End->UserData = &(*I);
 	 End->Str = I->BaseDir.c_str();
 	 End->Str = I->BaseDir.c_str();
@@ -833,7 +833,7 @@ bool Generate(CommandLine &CmdL)
    }
    }
 
 
    // close the Translation master files
    // close the Translation master files
-   for (vector<PackageMap>::reverse_iterator I = PkgList.rbegin(); I != PkgList.rend(); I++)
+   for (vector<PackageMap>::reverse_iterator I = PkgList.rbegin(); I != PkgList.rend(); ++I)
       if (I->TransWriter != NULL && I->TransWriter->DecreaseRefCounter() == 0)
       if (I->TransWriter != NULL && I->TransWriter->DecreaseRefCounter() == 0)
 	 delete I->TransWriter;
 	 delete I->TransWriter;
 
 
@@ -844,7 +844,7 @@ bool Generate(CommandLine &CmdL)
 
 
    // Sort the contents file list by date
    // Sort the contents file list by date
    string ArchiveDir = Setup.FindDir("Dir::ArchiveDir");
    string ArchiveDir = Setup.FindDir("Dir::ArchiveDir");
-   for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); I++)
+   for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); ++I)
    {
    {
       struct stat A;
       struct stat A;
       if (MultiCompress::GetStat(flCombine(ArchiveDir,I->Contents),
       if (MultiCompress::GetStat(flCombine(ArchiveDir,I->Contents),
@@ -861,7 +861,7 @@ bool Generate(CommandLine &CmdL)
       hashes of the .debs this means they have not changed either so the 
       hashes of the .debs this means they have not changed either so the 
       contents must be up to date. */
       contents must be up to date. */
    unsigned long MaxContentsChange = Setup.FindI("Default::MaxContentsChange",UINT_MAX)*1024;
    unsigned long MaxContentsChange = Setup.FindI("Default::MaxContentsChange",UINT_MAX)*1024;
-   for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); I++)
+   for (vector<PackageMap>::iterator I = PkgList.begin(); I != PkgList.end(); ++I)
    {
    {
       // This record is not relevent
       // This record is not relevent
       if (I->ContentsDone == true ||
       if (I->ContentsDone == true ||
@@ -937,7 +937,7 @@ bool Clean(CommandLine &CmdL)
 	 _error->DumpErrors();
 	 _error->DumpErrors();
       
       
       string CacheDB = I->BinCacheDB;
       string CacheDB = I->BinCacheDB;
-      for (; I != PkgList.end() && I->BinCacheDB == CacheDB; I++);
+      for (; I != PkgList.end() && I->BinCacheDB == CacheDB; ++I);
    }
    }
    
    
    return true;
    return true;

+ 4 - 4
ftparchive/multicompress.cc

@@ -50,11 +50,11 @@ MultiCompress::MultiCompress(string const &Output,string const &Compress,
    string::const_iterator I = Compress.begin();
    string::const_iterator I = Compress.begin();
    for (; I != Compress.end();)
    for (; I != Compress.end();)
    {
    {
-      for (; I != Compress.end() && isspace(*I); I++);
+      for (; I != Compress.end() && isspace(*I); ++I);
       
       
       // Grab a word
       // Grab a word
       string::const_iterator Start = I;
       string::const_iterator Start = I;
-      for (; I != Compress.end() && !isspace(*I); I++);
+      for (; I != Compress.end() && !isspace(*I); ++I);
 
 
       // Find the matching compressor
       // Find the matching compressor
       std::vector<APT::Configuration::Compressor> Compressors = APT::Configuration::getCompressors();
       std::vector<APT::Configuration::Compressor> Compressors = APT::Configuration::getCompressors();
@@ -131,11 +131,11 @@ bool MultiCompress::GetStat(string const &Output,string const &Compress,struct s
    bool DidStat = false;
    bool DidStat = false;
    for (; I != Compress.end();)
    for (; I != Compress.end();)
    {
    {
-      for (; I != Compress.end() && isspace(*I); I++);
+      for (; I != Compress.end() && isspace(*I); ++I);
       
       
       // Grab a word
       // Grab a word
       string::const_iterator Start = I;
       string::const_iterator Start = I;
-      for (; I != Compress.end() && !isspace(*I); I++);
+      for (; I != Compress.end() && !isspace(*I); ++I);
 
 
       // Find the matching compressor
       // Find the matching compressor
       std::vector<APT::Configuration::Compressor> Compressors = APT::Configuration::getCompressors();
       std::vector<APT::Configuration::Compressor> Compressors = APT::Configuration::getCompressors();

+ 3 - 3
ftparchive/override.cc

@@ -231,7 +231,7 @@ Override::Item* Override::GetItem(string const &Package, string const &Architect
 	 if (R->OldMaint != "") result->OldMaint = R->OldMaint;
 	 if (R->OldMaint != "") result->OldMaint = R->OldMaint;
 	 if (R->NewMaint != "") result->NewMaint = R->NewMaint;
 	 if (R->NewMaint != "") result->NewMaint = R->NewMaint;
 	 for (map<string,string>::const_iterator foI = R->FieldOverride.begin();
 	 for (map<string,string>::const_iterator foI = R->FieldOverride.begin();
-	      foI != R->FieldOverride.end(); foI++)
+	      foI != R->FieldOverride.end(); ++foI)
          {
          {
 	    result->FieldOverride[foI->first] = foI->second;
 	    result->FieldOverride[foI->first] = foI->second;
 	 }
 	 }
@@ -268,7 +268,7 @@ string Override::Item::SwapMaint(string const &Orig,bool &Failed)
       string::const_iterator Start = End;      
       string::const_iterator Start = End;      
       for (; End < OldMaint.end() &&
       for (; End < OldMaint.end() &&
 	   (End + 3 >= OldMaint.end() || End[0] != ' ' || 
 	   (End + 3 >= OldMaint.end() || End[0] != ' ' || 
-	    End[1] != '/' || End[2] != '/'); End++);
+	    End[1] != '/' || End[2] != '/'); ++End);
       if (stringcasecmp(Start,End,Orig.begin(),Orig.end()) == 0)
       if (stringcasecmp(Start,End,Orig.begin(),Orig.end()) == 0)
 	 return NewMaint;
 	 return NewMaint;
       
       
@@ -276,7 +276,7 @@ string Override::Item::SwapMaint(string const &Orig,bool &Failed)
 	 break;
 	 break;
 
 
       // Skip the divider and white space
       // Skip the divider and white space
-      for (; End < OldMaint.end() && (*End == '/' || *End == ' '); End++);
+      for (; End < OldMaint.end() && (*End == '/' || *End == ' '); ++End);
    }
    }
 #else
 #else
    if (stringcasecmp(OldMaint.begin(),OldMaint.end(),Orig.begin(),Orig.end()) == 0)
    if (stringcasecmp(OldMaint.begin(),OldMaint.end(),Orig.begin(),Orig.end()) == 0)

+ 2 - 2
ftparchive/writer.cc

@@ -496,7 +496,7 @@ bool PackagesWriter::DoPackage(string FileName)
    }
    }
 
 
    for (map<string,string>::const_iterator I = OverItem->FieldOverride.begin(); 
    for (map<string,string>::const_iterator I = OverItem->FieldOverride.begin(); 
-        I != OverItem->FieldOverride.end(); I++) 
+        I != OverItem->FieldOverride.end(); ++I)
       SetTFRewriteData(Changes[End++],I->first.c_str(),I->second.c_str());
       SetTFRewriteData(Changes[End++],I->first.c_str(),I->second.c_str());
 
 
    SetTFRewriteData(Changes[End++], 0, 0);
    SetTFRewriteData(Changes[End++], 0, 0);
@@ -832,7 +832,7 @@ bool SourcesWriter::DoPackage(string FileName)
       SetTFRewriteData(Changes[End++], "Maintainer", NewMaint.c_str());
       SetTFRewriteData(Changes[End++], "Maintainer", NewMaint.c_str());
    
    
    for (map<string,string>::const_iterator I = SOverItem->FieldOverride.begin(); 
    for (map<string,string>::const_iterator I = SOverItem->FieldOverride.begin(); 
-        I != SOverItem->FieldOverride.end(); I++) 
+        I != SOverItem->FieldOverride.end(); ++I)
       SetTFRewriteData(Changes[End++],I->first.c_str(),I->second.c_str());
       SetTFRewriteData(Changes[End++],I->first.c_str(),I->second.c_str());
 
 
    SetTFRewriteData(Changes[End++], 0, 0);
    SetTFRewriteData(Changes[End++], 0, 0);

+ 2 - 1
methods/cdrom.cc

@@ -56,7 +56,8 @@ class CDROMMethod : public pkgAcqMethod
 CDROMMethod::CDROMMethod() : pkgAcqMethod("1.0",SingleInstance | LocalOnly |
 CDROMMethod::CDROMMethod() : pkgAcqMethod("1.0",SingleInstance | LocalOnly |
 					  SendConfig | NeedsCleanup |
 					  SendConfig | NeedsCleanup |
 					  Removable), 
 					  Removable), 
-                                          DatabaseLoaded(false), 
+                                          DatabaseLoaded(false),
+					  Debug(false),
                                           MountedByApt(false)
                                           MountedByApt(false)
 {
 {
    UdevCdroms.Dlopen();
    UdevCdroms.Dlopen();

+ 3 - 2
methods/ftp.cc

@@ -71,7 +71,8 @@ time_t FtpMethod::FailTime = 0;
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
 FTPConn::FTPConn(URI Srv) : Len(0), ServerFd(-1), DataFd(-1), 
 FTPConn::FTPConn(URI Srv) : Len(0), ServerFd(-1), DataFd(-1), 
-                            DataListenFd(-1), ServerName(Srv)
+                            DataListenFd(-1), ServerName(Srv),
+			    ForceExtended(false), TryPassive(true)
 {
 {
    Debug = _config->FindB("Debug::Acquire::Ftp",false);
    Debug = _config->FindB("Debug::Acquire::Ftp",false);
    PasvAddr = 0;
    PasvAddr = 0;
@@ -561,7 +562,7 @@ bool FTPConn::ExtGoPasv()
    string::const_iterator List[4];
    string::const_iterator List[4];
    unsigned Count = 0;
    unsigned Count = 0;
    Pos++;
    Pos++;
-   for (string::const_iterator I = Msg.begin() + Pos; I < Msg.end(); I++)
+   for (string::const_iterator I = Msg.begin() + Pos; I < Msg.end(); ++I)
    {
    {
       if (*I != Msg[Pos])
       if (*I != Msg[Pos])
 	 continue;
 	 continue;

+ 3 - 3
methods/gpgv.cc

@@ -215,21 +215,21 @@ bool GPGVMethod::Fetch(FetchItem *Itm)
          {
          {
             errmsg += _("The following signatures were invalid:\n");
             errmsg += _("The following signatures were invalid:\n");
             for (vector<string>::iterator I = BadSigners.begin();
             for (vector<string>::iterator I = BadSigners.begin();
-		 I != BadSigners.end(); I++)
+		 I != BadSigners.end(); ++I)
                errmsg += (*I + "\n");
                errmsg += (*I + "\n");
          }
          }
          if (!WorthlessSigners.empty())
          if (!WorthlessSigners.empty())
          {
          {
             errmsg += _("The following signatures were invalid:\n");
             errmsg += _("The following signatures were invalid:\n");
             for (vector<string>::iterator I = WorthlessSigners.begin();
             for (vector<string>::iterator I = WorthlessSigners.begin();
-		 I != WorthlessSigners.end(); I++)
+		 I != WorthlessSigners.end(); ++I)
                errmsg += (*I + "\n");
                errmsg += (*I + "\n");
          }
          }
          if (!NoPubKeySigners.empty())
          if (!NoPubKeySigners.empty())
          {
          {
              errmsg += _("The following signatures couldn't be verified because the public key is not available:\n");
              errmsg += _("The following signatures couldn't be verified because the public key is not available:\n");
             for (vector<string>::iterator I = NoPubKeySigners.begin();
             for (vector<string>::iterator I = NoPubKeySigners.begin();
-		 I != NoPubKeySigners.end(); I++)
+		 I != NoPubKeySigners.end(); ++I)
                errmsg += (*I + "\n");
                errmsg += (*I + "\n");
          }
          }
       }
       }

+ 3 - 3
methods/http.cc

@@ -404,10 +404,10 @@ ServerState::RunHeadersResult ServerState::RunHeaders()
       if (Debug == true)
       if (Debug == true)
 	 clog << Data;
 	 clog << Data;
       
       
-      for (string::const_iterator I = Data.begin(); I < Data.end(); I++)
+      for (string::const_iterator I = Data.begin(); I < Data.end(); ++I)
       {
       {
 	 string::const_iterator J = I;
 	 string::const_iterator J = I;
-	 for (; J != Data.end() && *J != '\n' && *J != '\r';J++);
+	 for (; J != Data.end() && *J != '\n' && *J != '\r'; ++J);
 	 if (HeaderLine(string(I,J)) == false)
 	 if (HeaderLine(string(I,J)) == false)
 	    return RUN_HEADERS_PARSE_ERROR;
 	    return RUN_HEADERS_PARSE_ERROR;
 	 I = J;
 	 I = J;
@@ -1327,7 +1327,7 @@ int HttpMethod::Loop()
                StopRedirects = true;
                StopRedirects = true;
             else
             else
             {
             {
-               for (StringVectorIterator I = R.begin(); I != R.end(); I++)
+               for (StringVectorIterator I = R.begin(); I != R.end(); ++I)
                   if (Queue->Uri == *I)
                   if (Queue->Uri == *I)
                   {
                   {
                      R[0] = "STOP";
                      R[0] = "STOP";

+ 7 - 7
methods/http.h

@@ -36,14 +36,14 @@ class CircleBuf
    static struct timeval BwReadTick;
    static struct timeval BwReadTick;
    static const unsigned int BW_HZ;
    static const unsigned int BW_HZ;
 
 
-   unsigned long long LeftRead()
+   unsigned long long LeftRead() const
    {
    {
       unsigned long long Sz = Size - (InP - OutP);
       unsigned long long Sz = Size - (InP - OutP);
       if (Sz > Size - (InP%Size))
       if (Sz > Size - (InP%Size))
 	 Sz = Size - (InP%Size);
 	 Sz = Size - (InP%Size);
       return Sz;
       return Sz;
    }
    }
-   unsigned long long LeftWrite()
+   unsigned long long LeftWrite() const
    {
    {
       unsigned long long Sz = InP - OutP;
       unsigned long long Sz = InP - OutP;
       if (InP > MaxGet)
       if (InP > MaxGet)
@@ -68,12 +68,12 @@ class CircleBuf
    
    
    // Control the write limit
    // Control the write limit
    void Limit(long long Max) {if (Max == -1) MaxGet = 0-1; else MaxGet = OutP + Max;}   
    void Limit(long long Max) {if (Max == -1) MaxGet = 0-1; else MaxGet = OutP + Max;}   
-   bool IsLimit() {return MaxGet == OutP;};
-   void Print() {cout << MaxGet << ',' << OutP << endl;};
+   bool IsLimit() const {return MaxGet == OutP;};
+   void Print() const {cout << MaxGet << ',' << OutP << endl;};
 
 
    // Test for free space in the buffer
    // Test for free space in the buffer
-   bool ReadSpace() {return Size - (InP - OutP) > 0;};
-   bool WriteSpace() {return InP - OutP > 0;};
+   bool ReadSpace() const {return Size - (InP - OutP) > 0;};
+   bool WriteSpace() const {return InP - OutP > 0;};
 
 
    // Dump everything
    // Dump everything
    void Reset();
    void Reset();
@@ -113,7 +113,7 @@ struct ServerState
    URI ServerName;
    URI ServerName;
   
   
    bool HeaderLine(string Line);
    bool HeaderLine(string Line);
-   bool Comp(URI Other) {return Other.Host == ServerName.Host && Other.Port == ServerName.Port;};
+   bool Comp(URI Other) const {return Other.Host == ServerName.Host && Other.Port == ServerName.Port;};
    void Reset() {Major = 0; Minor = 0; Result = 0; Size = 0; StartPos = 0;
    void Reset() {Major = 0; Minor = 0; Result = 0; Size = 0; StartPos = 0;
                  Encoding = Closes; time(&Date); ServerFd = -1; 
                  Encoding = Closes; time(&Date); ServerFd = -1; 
                  Pipeline = true;};
                  Pipeline = true;};

+ 20 - 4
methods/mirror.cc

@@ -10,6 +10,7 @@
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
 #include <config.h>
 #include <config.h>
 
 
+#include <apt-pkg/aptconfiguration.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/acquire-method.h>
 #include <apt-pkg/acquire-method.h>
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/acquire-item.h>
@@ -56,7 +57,7 @@ using namespace std;
  */
  */
 
 
 MirrorMethod::MirrorMethod()
 MirrorMethod::MirrorMethod()
-   : HttpMethod(), DownloadedMirrorFile(false)
+   : HttpMethod(), DownloadedMirrorFile(false), Debug(false)
 {
 {
 };
 };
 
 
@@ -109,7 +110,7 @@ bool MirrorMethod::Clean(string Dir)
 	 continue;
 	 continue;
 
 
       // see if we have that uri
       // see if we have that uri
-      for(I=list.begin(); I != list.end(); I++)
+      for(I=list.begin(); I != list.end(); ++I)
       {
       {
 	 string uri = (*I)->GetURI();
 	 string uri = (*I)->GetURI();
 	 if(uri.find("mirror://") != 0)
 	 if(uri.find("mirror://") != 0)
@@ -136,9 +137,24 @@ bool MirrorMethod::DownloadMirrorFile(string mirror_uri_str)
    string fetch = BaseUri;
    string fetch = BaseUri;
    fetch.replace(0,strlen("mirror://"),"http://");
    fetch.replace(0,strlen("mirror://"),"http://");
 
 
+#if 0 // no need for this, the getArchitectures() will also include the main 
+      // arch
+   // append main architecture
+   fetch += "?arch=" + _config->Find("Apt::Architecture");
+#endif
+
+   // append all architectures
+   std::vector<std::string> vec = APT::Configuration::getArchitectures();
+   for (std::vector<std::string>::const_iterator I = vec.begin();
+        I != vec.end(); I++)
+      if (I == vec.begin())
+         fetch += "?arch" + (*I);
+      else
+         fetch += "&arch=" + (*I);
+
    // append the dist as a query string
    // append the dist as a query string
    if (Dist != "")
    if (Dist != "")
-      fetch += "?dist=" + Dist;
+      fetch += "&dist=" + Dist;
 
 
    if(Debug)
    if(Debug)
       clog << "MirrorMethod::DownloadMirrorFile(): '" << fetch << "'"
       clog << "MirrorMethod::DownloadMirrorFile(): '" << fetch << "'"
@@ -332,7 +348,7 @@ string MirrorMethod::GetMirrorFileName(string mirror_uri_str)
    vector<metaIndex *>::const_iterator I;
    vector<metaIndex *>::const_iterator I;
    pkgSourceList list;
    pkgSourceList list;
    list.ReadMainList();
    list.ReadMainList();
-   for(I=list.begin(); I != list.end(); I++)
+   for(I=list.begin(); I != list.end(); ++I)
    {
    {
       string uristr = (*I)->GetURI();
       string uristr = (*I)->GetURI();
       if(Debug)
       if(Debug)

+ 5 - 2
methods/rred.cc

@@ -53,7 +53,7 @@ protected:
 	virtual bool Fetch(FetchItem *Itm);
 	virtual bool Fetch(FetchItem *Itm);
 
 
 public:
 public:
-	RredMethod() : pkgAcqMethod("1.1",SingleInstance | SendConfig) {};
+	RredMethod() : pkgAcqMethod("1.1",SingleInstance | SendConfig), Debug(false) {};
 };
 };
 										/*}}}*/
 										/*}}}*/
 /** \brief applyFile - in reverse order with a tail recursion			{{{
 /** \brief applyFile - in reverse order with a tail recursion			{{{
@@ -241,7 +241,9 @@ RredMethod::State RredMethod::patchFile(FileFd &Patch, FileFd &From,		/*{{{*/
    return result;
    return result;
 }
 }
 										/*}}}*/
 										/*}}}*/
-struct EdCommand {								/*{{{*/
+/* struct EdCommand								{{{*/
+#ifdef _POSIX_MAPPED_FILES
+struct EdCommand {
   size_t data_start;
   size_t data_start;
   size_t data_end;
   size_t data_end;
   size_t data_lines;
   size_t data_lines;
@@ -250,6 +252,7 @@ struct EdCommand {								/*{{{*/
   char type;
   char type;
 };
 };
 #define IOV_COUNT 1024 /* Don't really want IOV_MAX since it can be arbitrarily large */
 #define IOV_COUNT 1024 /* Don't really want IOV_MAX since it can be arbitrarily large */
+#endif
 										/*}}}*/
 										/*}}}*/
 RredMethod::State RredMethod::patchMMap(FileFd &Patch, FileFd &From,		/*{{{*/
 RredMethod::State RredMethod::patchMMap(FileFd &Patch, FileFd &From,		/*{{{*/
 					FileFd &out_file, Hashes *hash) const {
 					FileFd &out_file, Hashes *hash) const {

+ 1 - 1
methods/rsh.h

@@ -34,7 +34,7 @@ class RSHConn
    // Raw connection IO
    // Raw connection IO
    bool WriteMsg(string &Text,bool Sync,const char *Fmt,...);
    bool WriteMsg(string &Text,bool Sync,const char *Fmt,...);
    bool Connect(string Host, string User);
    bool Connect(string Host, string User);
-   bool Comp(URI Other) {return Other.Host == ServerName.Host && Other.Port == ServerName.Port;};
+   bool Comp(URI Other) const {return Other.Host == ServerName.Host && Other.Port == ServerName.Port;};
 
 
    // Connection control
    // Connection control
    bool Open();
    bool Open();

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 519 - 416
po/ar.po


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 533 - 420
po/ast.po


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 535 - 421
po/bg.po


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 515 - 415
po/bs.po


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 620 - 631
po/ca.po


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 529 - 420
po/cs.po


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 527 - 420
po/cy.po


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 531 - 420
po/da.po


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 533 - 420
po/de.po


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 523 - 420
po/dz.po


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 524 - 419
po/el.po


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 534 - 420
po/es.po


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 524 - 419
po/eu.po


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 524 - 419
po/fi.po


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 536 - 420
po/fr.po


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 596 - 559
po/gl.po


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 526 - 419
po/hu.po


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 597 - 562
po/it.po


+ 0 - 0
po/ja.po


Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio