Browse Source

merged from lp:~donkult/apt/debian-experimental

Michael Vogt 14 years ago
parent
commit
ad2d0cef57
100 changed files with 41686 additions and 49889 deletions
  1. 1 0
      .bzrignore
  2. 0 1
      COMPILING
  3. 6 3
      Makefile
  4. 1 1
      apt-inst/contrib/extracttar.cc
  5. 4 0
      apt-inst/deb/debfile.h
  6. 12 1
      apt-pkg/acquire-item.cc
  7. 13 28
      apt-pkg/acquire-method.cc
  8. 3 0
      apt-pkg/acquire-method.h
  9. 34 33
      apt-pkg/acquire-worker.cc
  10. 34 5
      apt-pkg/acquire.cc
  11. 62 16
      apt-pkg/algorithms.cc
  12. 4 1
      apt-pkg/algorithms.h
  13. 35 28
      apt-pkg/aptconfiguration.cc
  14. 53 2
      apt-pkg/cachefilter.cc
  15. 30 0
      apt-pkg/cachefilter.h
  16. 3 1
      apt-pkg/cacheiterators.h
  17. 55 6
      apt-pkg/cacheset.cc
  18. 3 2
      apt-pkg/cacheset.h
  19. 2 19
      apt-pkg/cdrom.cc
  20. 5 3
      apt-pkg/contrib/cmndline.cc
  21. 111 38
      apt-pkg/contrib/configuration.cc
  22. 2 0
      apt-pkg/contrib/configuration.h
  23. 202 78
      apt-pkg/contrib/fileutl.cc
  24. 5 0
      apt-pkg/contrib/fileutl.h
  25. 12 9
      apt-pkg/contrib/mmap.cc
  26. 6 2
      apt-pkg/contrib/sha2_internal.cc
  27. 40 22
      apt-pkg/contrib/strutl.cc
  28. 5 4
      apt-pkg/deb/debindexfile.cc
  29. 82 69
      apt-pkg/deb/deblistparser.cc
  30. 5 1
      apt-pkg/deb/dpkgpm.cc
  31. 14 13
      apt-pkg/depcache.cc
  32. 4 8
      apt-pkg/edsp.cc
  33. 2 1
      apt-pkg/edsp/edspindexfile.cc
  34. 1 1
      apt-pkg/edsp/edspsystem.cc
  35. 1 5
      apt-pkg/indexcopy.cc
  36. 6 5
      apt-pkg/packagemanager.cc
  37. 29 0
      apt-pkg/pkgcache.cc
  38. 13 6
      apt-pkg/pkgcachegen.cc
  39. 1 0
      apt-pkg/srcrecords.h
  40. 3 14
      buildlib/config.h.in
  41. 33 7
      buildlib/configure.mak
  42. 1 1
      buildlib/copy.mak
  43. 4 2
      buildlib/debiandoc.mak
  44. 1 1
      buildlib/defaults.mak
  45. 1 1
      buildlib/environment.mak.in
  46. 0 50
      buildlib/inttypes.h.in
  47. 0 5
      buildlib/makefile.in
  48. 2 1
      buildlib/manpage.mak
  49. 0 14
      buildlib/mkChangeLog
  50. 9 3
      buildlib/po4a_manpage.mak
  51. 2 2
      buildlib/podomain.mak
  52. 0 25
      buildlib/sizetable
  53. 9 1
      cmdline/apt-config.cc
  54. 4 2
      cmdline/apt-extracttemplates.cc
  55. 84 32
      cmdline/apt-get.cc
  56. 7 8
      cmdline/apt-internal-solver.cc
  57. 2 1
      cmdline/apt-key
  58. 1 1
      cmdline/apt-mark.cc
  59. 5 45
      configure.in
  60. 0 1
      debian/apt-utils.links
  61. 386 0
      debian/changelog
  62. 5 2
      debian/control
  63. 1 1
      debian/libapt-inst1.5.symbols
  64. 0 1
      debian/libapt-pkg4.12.symbols
  65. 16 9
      debian/rules
  66. 33 36
      doc/apt-cache.8.xml
  67. 17 18
      doc/apt-cdrom.8.xml
  68. 28 13
      doc/apt-config.8.xml
  69. 8 7
      doc/apt-extracttemplates.1.xml
  70. 79 79
      doc/apt-ftparchive.1.xml
  71. 73 84
      doc/apt-get.8.xml
  72. 29 22
      doc/apt-key.8.xml
  73. 18 19
      doc/apt-mark.8.xml
  74. 42 36
      doc/apt-secure.8.xml
  75. 6 6
      doc/apt-sortpkgs.1.xml
  76. 40 3
      doc/apt-verbatim.ent
  77. 1 1
      doc/apt.8
  78. 401 355
      doc/apt.conf.5.xml
  79. 10 20
      doc/apt.ent
  80. 37 36
      doc/apt_preferences.5.xml
  81. 1 1
      doc/design.sgml
  82. 2 2
      doc/dpkg-tech.sgml
  83. 3 3
      doc/examples/apt-ftparchive.conf
  84. 1 1
      doc/examples/configure-index
  85. 0 9
      doc/examples/sources.list
  86. 8 0
      doc/examples/sources.list.in
  87. 2 2
      doc/files.sgml
  88. 4 4
      doc/guide.sgml
  89. 52 21
      doc/makefile
  90. 8 0
      doc/manpage-style.xsl
  91. 3 3
      doc/method.sgml
  92. 1 1
      doc/offline.sgml
  93. 3669 5036
      doc/po/apt-doc.pot
  94. 6632 7910
      doc/po/de.po
  95. 6586 7837
      doc/po/es.po
  96. 6638 7920
      doc/po/fr.po
  97. 3728 5112
      doc/po/it.po
  98. 6497 7748
      doc/po/ja.po
  99. 5552 6902
      doc/po/pl.po
  100. 0 0
      doc/po/pt.po

+ 1 - 0
.bzrignore

@@ -26,4 +26,5 @@ abicheck/tests/
 # apt man pages and other documentation
 ./doc/*/
 !./doc/examples/
+./doc/examples/sources.list
 !./doc/po/

+ 0 - 1
COMPILING

@@ -36,7 +36,6 @@ functionality. Patches to make autoconf detect these cases and generate the
 required shims are OK.
 
 Current shims:
-  * C99 integer types 'inttypes.h' 
   * sys/statvfs.h to convert from BSD/old-glibc statfs to SUS statvfs
   * rfc2553 hostname resolution (methods/rfc*), shims to normal gethostbyname.
     The more adventurous could steal the KAME IPv6 enabled resolvers for those

+ 6 - 3
Makefile

@@ -10,7 +10,7 @@ endif
 default: startup all
 
 .PHONY: headers library clean veryclean all binary program doc test update-po
-startup all headers library clean veryclean binary program doc dirs test update-po:
+all headers library clean veryclean binary program doc manpages debiandoc test update-po startup dirs:
 	$(MAKE) -C apt-pkg $@
 	$(MAKE) -C apt-inst $@
 	$(MAKE) -C methods $@
@@ -21,11 +21,14 @@ startup all headers library clean veryclean binary program doc dirs test update-
 	$(MAKE) -C po $@
 	$(MAKE) -C test $@
 
-update-po: startup
+all headers library clean veryclean binary program doc manpages debiandoc test update-po: startup dirs
+
+dirs: startup
 
 # Some very common aliases
-.PHONY: maintainer-clean dist-clean distclean pristine sanity 
+.PHONY: maintainer-clean dist-clean distclean pristine sanity
 maintainer-clean dist-clean distclean pristine sanity: veryclean
+veryclean: clean
 
 # The startup target builds the necessary configure scripts. It should
 # be used after a CVS checkout.

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

@@ -146,7 +146,7 @@ bool ExtractTar::StartGzip()
    }
 
    // Fix up our FDs
-   InFd.Fd(Pipes[0]);
+   InFd.OpenDescriptor(Pipes[0], FileFd::ReadOnly, FileFd::None, true);
    close(Pipes[1]);
    return true;
 }

+ 4 - 0
apt-inst/deb/debfile.h

@@ -29,6 +29,10 @@
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/pkgcache.h>
 
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/md5.h>
+#endif
+
 class FileFd;
 
 class debDebFile

+ 12 - 1
apt-pkg/acquire-item.cc

@@ -1235,9 +1235,20 @@ void pkgAcqMetaIndex::Done(string Message,unsigned long long Size,string Hash,	/
       }
       else
       {
+         // FIXME: move this into pkgAcqMetaClearSig::Done on the next
+         //        ABI break
+
+         // if we expect a ClearTextSignature (InRelase), ensure that
+         // this is what we get and if not fail to queue a 
+         // Release/Release.gpg, see #346386
+         if (SigFile == DestFile && !StartsWithGPGClearTextSignature(DestFile))
+         {
+            Failed(Message, Cfg);
+            return;
+         }
+
          // There was a signature file, so pass it to gpgv for
          // verification
-
          if (_config->FindB("Debug::pkgAcquire::Auth", false))
             std::cerr << "Metaindex acquired, queueing gpg verification ("
                       << SigFile << "," << DestFile << ")\n";

+ 13 - 28
apt-pkg/acquire-method.cc

@@ -95,12 +95,7 @@ void pkgAcqMethod::Fail(string Err,bool Transient)
    {
       std::cout << "400 URI Failure\nURI: " << Queue->Uri << "\n"
 		<< "Message: " << Err << " " << IP << "\n";
-      // Dequeue
-      FetchItem *Tmp = Queue;
-      Queue = Queue->Next;
-      delete Tmp;
-      if (Tmp == QueueBack)
-	 QueueBack = Queue;
+      Dequeue();
    }
    else
       std::cout << "400 URI Failure\nURI: <UNKNOWN>\nMessage: " << Err << "\n";
@@ -211,13 +206,7 @@ void pkgAcqMethod::URIDone(FetchResult &Res, FetchResult *Alt)
    }
 
    std::cout << "\n" << std::flush;
-
-   // Dequeue
-   FetchItem *Tmp = Queue;
-   Queue = Queue->Next;
-   delete Tmp;
-   if (Tmp == QueueBack)
-      QueueBack = Queue;
+   Dequeue();
 }
 									/*}}}*/
 // AcqMethod::MediaFail - Syncronous request for new media		/*{{{*/
@@ -423,26 +412,14 @@ void pkgAcqMethod::Status(const char *Format,...)
 									/*}}}*/
 // AcqMethod::Redirect - Send a redirect message                       /*{{{*/
 // ---------------------------------------------------------------------
-/* This method sends the redirect message and also manipulates the queue
-   to keep the pipeline synchronized. */
+/* This method sends the redirect message and dequeues the item as
+ * the worker will enqueue again later on to the right queue */
 void pkgAcqMethod::Redirect(const string &NewURI)
 {
    std::cout << "103 Redirect\nURI: " << Queue->Uri << "\n"
 	     << "New-URI: " << NewURI << "\n"
 	     << "\n" << std::flush;
-
-   // Change the URI for the request.
-   Queue->Uri = NewURI;
-
-   /* To keep the pipeline synchronized, move the current request to
-      the end of the queue, past the end of the current pipeline. */
-   FetchItem *I;
-   for (I = Queue; I->Next != 0; I = I->Next) ;
-   I->Next = Queue;
-   Queue = Queue->Next;
-   I->Next->Next = 0;
-   if (QueueBack == 0)
-      QueueBack = I->Next;
+   Dequeue();
 }
                                                                         /*}}}*/
 // AcqMethod::FetchResult::FetchResult - Constructor			/*{{{*/
@@ -465,3 +442,11 @@ void pkgAcqMethod::FetchResult::TakeHashes(Hashes &Hash)
    SHA512Sum = Hash.SHA512.Result();
 }
 									/*}}}*/
+void pkgAcqMethod::Dequeue() {						/*{{{*/
+   FetchItem const * const Tmp = Queue;
+   Queue = Queue->Next;
+   if (Tmp == QueueBack)
+      QueueBack = Queue;
+   delete Tmp;
+}
+									/*}}}*/

+ 3 - 0
apt-pkg/acquire-method.h

@@ -104,6 +104,9 @@ class pkgAcqMethod
    
    pkgAcqMethod(const char *Ver,unsigned long Flags = 0);
    virtual ~pkgAcqMethod() {};
+
+   private:
+   void Dequeue();
 };
 
 /** @} */

+ 34 - 33
apt-pkg/acquire-worker.cc

@@ -244,6 +244,21 @@ bool pkgAcquire::Worker::RunMessages()
  
             string NewURI = LookupTag(Message,"New-URI",URI.c_str());
             Itm->URI = NewURI;
+
+	    ItemDone();
+
+	    pkgAcquire::Item *Owner = Itm->Owner;
+	    pkgAcquire::ItemDesc Desc = *Itm;
+
+	    // Change the status so that it can be dequeued
+	    Owner->Status = pkgAcquire::Item::StatIdle;
+	    // Mark the item as done (taking care of all queues)
+	    // and then put it in the main queue again
+	    OwnerQ->ItemDone(Itm);
+	    OwnerQ->Owner->Enqueue(Desc);
+
+	    if (Log != 0)
+	       Log->Done(Desc);
             break;
          }
    
@@ -467,40 +482,19 @@ bool pkgAcquire::Worker::SendConfiguration()
 
    if (OutFd == -1)
       return false;
-   
-   string Message = "601 Configuration\n";
-   Message.reserve(2000);
 
-   /* Write out all of the configuration directives by walking the 
+   /* Write out all of the configuration directives by walking the
       configuration tree */
-   const Configuration::Item *Top = _config->Tree(0);
-   for (; Top != 0;)
-   {
-      if (Top->Value.empty() == false)
-      {
-	 string Line = "Config-Item: " + QuoteString(Top->FullTag(),"=\"\n") + "=";
-	 Line += QuoteString(Top->Value,"\n") + '\n';
-	 Message += Line;
-      }
-      
-      if (Top->Child != 0)
-      {
-	 Top = Top->Child;
-	 continue;
-      }
-      
-      while (Top != 0 && Top->Next == 0)
-	 Top = Top->Parent;
-      if (Top != 0)
-	 Top = Top->Next;
-   }   
-   Message += '\n';
+   std::ostringstream Message;
+   Message << "601 Configuration\n";
+   _config->Dump(Message, NULL, "Config-Item: %F=%V\n", false);
+   Message << '\n';
 
    if (Debug == true)
-      clog << " -> " << Access << ':' << QuoteString(Message,"\n") << endl;
-   OutQueue += Message;
-   OutReady = true; 
-   
+      clog << " -> " << Access << ':' << QuoteString(Message.str(),"\n") << endl;
+   OutQueue += Message.str();
+   OutReady = true;
+
    return true;
 }
 									/*}}}*/
@@ -532,10 +526,17 @@ bool pkgAcquire::Worker::QueueItem(pkgAcquire::Queue::QItem *Item)
 /* */
 bool pkgAcquire::Worker::OutFdReady()
 {
-   if (FileFd::Write(OutFd,OutQueue.c_str(),OutQueue.length()) == false)
+   int Res;
+   do
+   {
+      Res = write(OutFd,OutQueue.c_str(),OutQueue.length());
+   }
+   while (Res < 0 && errno == EINTR);
+
+   if (Res <= 0)
       return MethodFailure();
-   
-   OutQueue.clear();
+
+   OutQueue.erase(0,Res);
    if (OutQueue.empty() == true)
       OutReady = false;
    

+ 34 - 5
apt-pkg/acquire.cc

@@ -244,11 +244,19 @@ void pkgAcquire::Dequeue(Item *Itm)
 {
    Queue *I = Queues;
    bool Res = false;
-   for (; I != 0; I = I->Next)
-      Res |= I->Dequeue(Itm);
-   
    if (Debug == true)
       clog << "Dequeuing " << Itm->DestFile << endl;
+
+   for (; I != 0; I = I->Next)
+   {
+      if (I->Dequeue(Itm))
+      {
+         Res = true;
+	 if (Debug == true)
+	    clog << "Dequeued from " << I->Name << endl;
+      }
+   }
+
    if (Res == true)
       ToFetch--;
 }
@@ -269,9 +277,30 @@ string pkgAcquire::QueueName(string Uri,MethodConfig const *&Config)
    /* Single-Instance methods get exactly one queue per URI. This is
       also used for the Access queue method  */
    if (Config->SingleInstance == true || QueueMode == QueueAccess)
-       return U.Access;
+      return U.Access;
+
+   string AccessSchema = U.Access + ':',
+	FullQueueName = AccessSchema + U.Host;
+   unsigned int Instances = 0, SchemaLength = AccessSchema.length();
+
+   Queue *I = Queues;
+   for (; I != 0; I = I->Next) {
+      // if the queue already exists, re-use it
+      if (I->Name == FullQueueName)
+	 return FullQueueName;
+
+      if (I->Name.compare(0, SchemaLength, AccessSchema) == 0)
+	 Instances++;
+   }
+
+   if (Debug) {
+      clog << "Found " << Instances << " instances of " << U.Access << endl;
+   }
+
+   if (Instances >= (unsigned int)_config->FindI("Acquire::QueueHost::Limit",10))
+      return U.Access;
 
-   return U.Access + ':' + U.Host;
+   return FullQueueName;
 }
 									/*}}}*/
 // Acquire::GetConfig - Fetch the configuration information		/*{{{*/

+ 62 - 16
apt-pkg/algorithms.cc

@@ -58,6 +58,12 @@ pkgSimulate::pkgSimulate(pkgDepCache *Cache) : pkgPackageManager(Cache),
       FileNames[I] = Jnk;
 }
 									/*}}}*/
+// Simulate::~Simulate - Destructor					/*{{{*/
+pkgSimulate::~pkgSimulate()
+{
+   delete[] Flags;
+}
+									/*}}}*/
 // Simulate::Describe - Describe a package				/*{{{*/
 // ---------------------------------------------------------------------
 /* Parameter Current == true displays the current package version,
@@ -356,11 +362,36 @@ bool pkgDistUpgrade(pkgDepCache &Cache)
       if (I->CurrentVer != 0)
 	 Cache.MarkInstall(I, true, 0, false);
 
-   /* Now, auto upgrade all essential packages - this ensures that
-      the essential packages are present and working */
-   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
-      if ((I->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential)
-	 Cache.MarkInstall(I, true, 0, false);
+   /* Now, install each essential package which is not installed
+      (and not provided by another package in the same name group) */
+   std::string essential = _config->Find("pkgCacheGen::Essential", "all");
+   if (essential == "all")
+   {
+      for (pkgCache::GrpIterator G = Cache.GrpBegin(); G.end() == false; ++G)
+      {
+	 bool isEssential = false;
+	 bool instEssential = false;
+	 for (pkgCache::PkgIterator P = G.PackageList(); P.end() == false; P = G.NextPkg(P))
+	 {
+	    if ((P->Flags & pkgCache::Flag::Essential) != pkgCache::Flag::Essential)
+	       continue;
+	    isEssential = true;
+	    if (Cache[P].Install() == true)
+	    {
+	       instEssential = true;
+	       break;
+	    }
+	 }
+	 if (isEssential == false || instEssential == true)
+	    continue;
+	 pkgCache::PkgIterator P = G.FindPreferredPkg();
+	 Cache.MarkInstall(P, true, 0, false);
+      }
+   }
+   else if (essential != "none")
+      for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; ++I)
+	 if ((I->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential)
+	    Cache.MarkInstall(I, true, 0, false);
    
    /* We do it again over all previously installed packages to force 
       conflict resolution on them all. */
@@ -1453,7 +1484,7 @@ void pkgPrioSortList(pkgCache &Cache,pkgCache::Version **List)
    qsort(List,Count,sizeof(*List),PrioComp);
 }
 									/*}}}*/
-// ListUpdate - update the cache files					/*{{{*/
+// ListUpdate - construct Fetcher and update the cache files		/*{{{*/
 // ---------------------------------------------------------------------
 /* This is a simple wrapper to update the cache. it will fetch stuff
  * from the network (or any other sources defined in sources.list)
@@ -1462,7 +1493,6 @@ bool ListUpdate(pkgAcquireStatus &Stat,
 		pkgSourceList &List, 
 		int PulseInterval)
 {
-   pkgAcquire::RunResult res;
    pkgAcquire Fetcher;
    if (Fetcher.Setup(&Stat, _config->FindDir("Dir::State::Lists")) == false)
       return false;
@@ -1471,11 +1501,24 @@ bool ListUpdate(pkgAcquireStatus &Stat,
    if (List.GetIndexes(&Fetcher) == false)
 	 return false;
 
+   return AcquireUpdate(Fetcher, PulseInterval, true);
+}
+									/*}}}*/
+// AcquireUpdate - take Fetcher and update the cache files		/*{{{*/
+// ---------------------------------------------------------------------
+/* This is a simple wrapper to update the cache with a provided acquire
+ * If you only need control over Status and the used SourcesList use
+ * ListUpdate method instead.
+ */
+bool AcquireUpdate(pkgAcquire &Fetcher, int const PulseInterval,
+		   bool const RunUpdateScripts, bool const ListCleanup)
+{
    // Run scripts
-   RunScripts("APT::Update::Pre-Invoke");
-   
-   // check arguments
-   if(PulseInterval>0)
+   if (RunUpdateScripts == true)
+      RunScripts("APT::Update::Pre-Invoke");
+
+   pkgAcquire::RunResult res;
+   if(PulseInterval > 0)
       res = Fetcher.Run(PulseInterval);
    else
       res = Fetcher.Run();
@@ -1512,7 +1555,7 @@ bool ListUpdate(pkgAcquireStatus &Stat,
    // Clean out any old list files
    // Keep "APT::Get::List-Cleanup" name for compatibility, but
    // this is really a global option for the APT library now
-   if (!TransientNetworkFailure && !Failed &&
+   if (!TransientNetworkFailure && !Failed && ListCleanup == true &&
        (_config->FindB("APT::Get::List-Cleanup",true) == true &&
 	_config->FindB("APT::List-Cleanup",true) == true))
    {
@@ -1529,11 +1572,14 @@ bool ListUpdate(pkgAcquireStatus &Stat,
 
 
    // Run the success scripts if all was fine
-   if(!TransientNetworkFailure && !Failed)
-      RunScripts("APT::Update::Post-Invoke-Success");
+   if (RunUpdateScripts == true)
+   {
+      if(!TransientNetworkFailure && !Failed)
+	 RunScripts("APT::Update::Post-Invoke-Success");
 
-   // Run the other scripts
-   RunScripts("APT::Update::Post-Invoke");
+      // Run the other scripts
+      RunScripts("APT::Update::Post-Invoke");
+   }
    return true;
 }
 									/*}}}*/

+ 4 - 1
apt-pkg/algorithms.h

@@ -78,6 +78,7 @@ private:
    public:
 
    pkgSimulate(pkgDepCache *Cache);
+   ~pkgSimulate();
 };
 									/*}}}*/
 class pkgProblemResolver						/*{{{*/
@@ -147,5 +148,7 @@ bool pkgMinimizeUpgrade(pkgDepCache &Cache);
 void pkgPrioSortList(pkgCache &Cache,pkgCache::Version **List);
 
 bool ListUpdate(pkgAcquireStatus &progress, pkgSourceList &List, int PulseInterval=0);
-		     
+bool AcquireUpdate(pkgAcquire &Fetcher, int const PulseInterval = 0,
+		   bool const RunUpdateScripts = true, bool const ListCleanup = true);
+
 #endif

+ 35 - 28
apt-pkg/aptconfiguration.cc

@@ -47,6 +47,7 @@ const Configuration::getCompressionTypes(bool const &Cached) {
 	_config->CndSet("Acquire::CompressionTypes::gz","gzip");
 
 	setDefaultConfigurationForCompressors();
+	std::vector<APT::Configuration::Compressor> const compressors = getCompressors();
 
 	// accept non-list order as override setting for config settings on commandline
 	std::string const overrideOrder = _config->Find("Acquire::CompressionTypes::Order","");
@@ -60,15 +61,17 @@ const Configuration::getCompressionTypes(bool const &Cached) {
 		if ((*o).empty() == true)
 			continue;
 		// ignore types we have no method ready to use
-		if (_config->Exists(std::string("Acquire::CompressionTypes::").append(*o)) == false)
+		std::string const method = std::string("Acquire::CompressionTypes::").append(*o);
+		if (_config->Exists(method) == false)
 			continue;
 		// ignore types we have no app ready to use
-		std::string const appsetting = std::string("Dir::Bin::").append(*o);
-		if (_config->Exists(appsetting) == true) {
-			std::string const app = _config->FindFile(appsetting.c_str(), "");
-			if (app.empty() == false && FileExists(app) == false)
-				continue;
-		}
+		std::string const app = _config->Find(method);
+		std::vector<APT::Configuration::Compressor>::const_iterator c = compressors.begin();
+		for (; c != compressors.end(); ++c)
+			if (c->Name == app)
+				break;
+		if (c == compressors.end())
+			continue;
 		types.push_back(*o);
 	}
 
@@ -84,12 +87,12 @@ const Configuration::getCompressionTypes(bool const &Cached) {
 		if (std::find(types.begin(),types.end(),Types->Tag) != types.end())
 			continue;
 		// ignore types we have no app ready to use
-		std::string const appsetting = std::string("Dir::Bin::").append(Types->Value);
-		if (appsetting.empty() == false && _config->Exists(appsetting) == true) {
-			std::string const app = _config->FindFile(appsetting.c_str(), "");
-			if (app.empty() == false && FileExists(app) == false)
-				continue;
-		}
+		std::vector<APT::Configuration::Compressor>::const_iterator c = compressors.begin();
+		for (; c != compressors.end(); ++c)
+			if (c->Name == Types->Value)
+				break;
+		if (c == compressors.end())
+			continue;
 		types.push_back(Types->Tag);
 	}
 
@@ -141,7 +144,7 @@ std::vector<std::string> const Configuration::getLanguages(bool const &All,
 	if (D != 0) {
 		builtin.push_back("none");
 		for (struct dirent *Ent = readdir(D); Ent != 0; Ent = readdir(D)) {
-			string const name = Ent->d_name;
+			string const name = SubstVar(Ent->d_name, "%5f", "_");
 			size_t const foundDash = name.rfind("-");
 			size_t const foundUnderscore = name.rfind("_", foundDash);
 			if (foundDash == string::npos || foundUnderscore == string::npos ||
@@ -231,17 +234,21 @@ std::vector<std::string> const Configuration::getLanguages(bool const &All,
 	// override the configuration settings vector of languages.
 	string const forceLang = _config->Find("Acquire::Languages","");
 	if (forceLang.empty() == false) {
-		if (forceLang == "environment") {
-			codes = environment;
-		} else if (forceLang != "none")
-			codes.push_back(forceLang);
-		else //if (forceLang == "none")
-			builtin.clear();
-		allCodes = codes;
-		for (std::vector<string>::const_iterator b = builtin.begin();
-		     b != builtin.end(); ++b)
-			if (std::find(allCodes.begin(), allCodes.end(), *b) == allCodes.end())
-				allCodes.push_back(*b);
+		if (forceLang == "none") {
+			codes.clear();
+			allCodes.clear();
+			allCodes.push_back("none");
+		} else {
+			if (forceLang == "environment")
+				codes = environment;
+			else
+				codes.push_back(forceLang);
+			allCodes = codes;
+			for (std::vector<string>::const_iterator b = builtin.begin();
+			     b != builtin.end(); ++b)
+				if (std::find(allCodes.begin(), allCodes.end(), *b) == allCodes.end())
+					allCodes.push_back(*b);
+		}
 		if (All == true)
 			return allCodes;
 		else
@@ -474,18 +481,18 @@ const Configuration::getCompressors(bool const Cached) {
 
 	setDefaultConfigurationForCompressors();
 
-	compressors.push_back(Compressor(".", "", "", "", "", 1));
+	compressors.push_back(Compressor(".", "", "", NULL, NULL, 1));
 	if (_config->Exists("Dir::Bin::gzip") == false || FileExists(_config->FindFile("Dir::Bin::gzip")) == true)
 		compressors.push_back(Compressor("gzip",".gz","gzip","-9n","-d",2));
 #ifdef HAVE_ZLIB
 	else
-		compressors.push_back(Compressor("gzip",".gz","false", "", "", 2));
+		compressors.push_back(Compressor("gzip",".gz","false", NULL, NULL, 2));
 #endif
 	if (_config->Exists("Dir::Bin::bzip2") == false || FileExists(_config->FindFile("Dir::Bin::bzip2")) == true)
 		compressors.push_back(Compressor("bzip2",".bz2","bzip2","-9","-d",3));
 #ifdef HAVE_BZ2
 	else
-		compressors.push_back(Compressor("bzip2",".bz2","false", "", "", 3));
+		compressors.push_back(Compressor("bzip2",".bz2","false", NULL, NULL, 3));
 #endif
 	if (_config->Exists("Dir::Bin::xz") == false || FileExists(_config->FindFile("Dir::Bin::xz")) == true)
 		compressors.push_back(Compressor("xz",".xz","xz","-6","-d",4));

+ 53 - 2
apt-pkg/cachefilter.cc

@@ -9,12 +9,14 @@
 #include <apt-pkg/cachefilter.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/pkgcache.h>
-
-#include <apti18n.h>
+#include <apt-pkg/strutl.h>
 
 #include <string>
 
 #include <regex.h>
+#include <fnmatch.h>
+
+#include <apti18n.h>
 									/*}}}*/
 namespace APT {
 namespace CacheFilter {
@@ -52,5 +54,54 @@ PackageNameMatchesRegEx::~PackageNameMatchesRegEx() {			/*{{{*/
 	delete pattern;
 }
 									/*}}}*/
+
+// CompleteArch to <kernel>-<cpu> tuple					/*{{{*/
+//----------------------------------------------------------------------
+/* The complete architecture, consisting of <kernel>-<cpu>. */
+static std::string CompleteArch(std::string const &arch) {
+	if (arch.find('-') != std::string::npos) {
+		// ensure that only -any- is replaced and not something like company-
+		std::string complete = std::string("-").append(arch).append("-");
+		complete = SubstVar(complete, "-any-", "-*-");
+		complete = complete.substr(1, complete.size()-2);
+		return complete;
+	}
+	else if (arch == "armel")		return "linux-arm";
+	else if (arch == "armhf")		return "linux-arm";
+	else if (arch == "lpia")		return "linux-i386";
+	else if (arch == "powerpcspe")		return "linux-powerpc";
+	else if (arch == "uclibc-linux-armel")	return "linux-arm";
+	else if (arch == "uclinux-armel")	return "uclinux-arm";
+	else if (arch == "any")			return "*-*";
+	else					return "linux-" + arch;
+}
+									/*}}}*/
+PackageArchitectureMatchesSpecification::PackageArchitectureMatchesSpecification(std::string const &pattern, bool const isPattern) :/*{{{*/
+					literal(pattern), isPattern(isPattern), d(NULL) {
+	complete = CompleteArch(pattern);
+}
+									/*}}}*/
+bool PackageArchitectureMatchesSpecification::operator() (char const * const &arch) {/*{{{*/
+	if (strcmp(literal.c_str(), arch) == 0 ||
+	    strcmp(complete.c_str(), arch) == 0)
+		return true;
+	std::string const pkgarch = CompleteArch(arch);
+	if (isPattern == true)
+		return fnmatch(complete.c_str(), pkgarch.c_str(), 0) == 0;
+	return fnmatch(pkgarch.c_str(), complete.c_str(), 0) == 0;
+}
+									/*}}}*/
+bool PackageArchitectureMatchesSpecification::operator() (pkgCache::PkgIterator const &Pkg) {/*{{{*/
+	return (*this)(Pkg.Arch());
+}
+									/*}}}*/
+bool PackageArchitectureMatchesSpecification::operator() (pkgCache::VerIterator const &Ver) {/*{{{*/
+	return (*this)(Ver.ParentPkg());
+}
+									/*}}}*/
+PackageArchitectureMatchesSpecification::~PackageArchitectureMatchesSpecification() {	/*{{{*/
+}
+									/*}}}*/
+
 }
 }

+ 30 - 0
apt-pkg/cachefilter.h

@@ -26,6 +26,36 @@ public:
 	~PackageNameMatchesRegEx();
 };
 									/*}}}*/
+// PackageArchitectureMatchesSpecification				/*{{{*/
+/** \class PackageArchitectureMatchesSpecification
+   \brief matching against architecture specification strings
+
+   The strings are of the format <kernel>-<cpu> where either component,
+   or the whole string, can be the wildcard "any" as defined in
+   debian-policy §11.1 "Architecture specification strings".
+
+   Examples: i386, mipsel, linux-any, any-amd64, any */
+class PackageArchitectureMatchesSpecification {
+	std::string literal;
+	std::string complete;
+	bool isPattern;
+	/** \brief dpointer placeholder (for later in case we need it) */
+	void *d;
+public:
+	/** \brief matching against architecture specification strings
+	 *
+	 * @param pattern is the architecture specification string
+	 * @param isPattern defines if the given \b pattern is a
+	 *        architecture specification pattern to match others against
+	 *        or if it is the fixed string and matched against patterns
+	 */
+	PackageArchitectureMatchesSpecification(std::string const &pattern, bool const isPattern = true);
+	bool operator() (char const * const &arch);
+	bool operator() (pkgCache::PkgIterator const &Pkg);
+	bool operator() (pkgCache::VerIterator const &Ver);
+	~PackageArchitectureMatchesSpecification();
+};
+									/*}}}*/
 }
 }
 #endif

+ 3 - 1
apt-pkg/cacheiterators.h

@@ -285,6 +285,7 @@ class pkgCache::DepIterator : public Iterator<Dependency, DepIterator> {
 	bool IsNegative() const;
 	bool IsIgnorable(PrvIterator const &Prv) const;
 	bool IsIgnorable(PkgIterator const &Pkg) const;
+	bool IsMultiArchImplicit() const;
 	void GlobOr(DepIterator &Start,DepIterator &End);
 	Version **AllTargets() const;
 	bool SmartTargetPkg(PkgIterator &Result) const;
@@ -329,8 +330,9 @@ class pkgCache::PrvIterator : public Iterator<Provides, PrvIterator> {
 	inline VerIterator OwnerVer() const {return VerIterator(*Owner,Owner->VerP + S->Version);};
 	inline PkgIterator OwnerPkg() const {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[S->Version].ParentPkg);};
 
-	inline PrvIterator() : Iterator<Provides, PrvIterator>(), Type(PrvVer) {};
+	bool IsMultiArchImplicit() const;
 
+	inline PrvIterator() : Iterator<Provides, PrvIterator>(), Type(PrvVer) {};
 	inline PrvIterator(pkgCache &Owner, Provides *Trg, Version*) :
 		Iterator<Provides, PrvIterator>(Owner, Trg), Type(PrvVer) {
 		if (S == 0)

+ 55 - 6
apt-pkg/cacheset.cc

@@ -182,15 +182,61 @@ pkgCache::PkgIterator PackageContainerInterface::FromName(pkgCacheFile &Cache,
 	return Pkg;
 }
 									/*}}}*/
+// FromGroup - Returns the package defined  by this string		/*{{{*/
+bool PackageContainerInterface::FromGroup(PackageContainerInterface * const pci, pkgCacheFile &Cache,
+			std::string pkg, CacheSetHelper &helper) {
+	if (unlikely(Cache.GetPkgCache() == 0))
+		return false;
+
+	size_t const archfound = pkg.find_last_of(':');
+	std::string arch;
+	if (archfound != std::string::npos) {
+		arch = pkg.substr(archfound+1);
+		pkg.erase(archfound);
+	}
+
+	pkgCache::GrpIterator Grp = Cache.GetPkgCache()->FindGrp(pkg);
+	if (Grp.end() == false) {
+		if (arch.empty() == true) {
+			pkgCache::PkgIterator Pkg = Grp.FindPreferredPkg();
+			if (Pkg.end() == false)
+			{
+			   pci->insert(Pkg);
+			   return true;
+			}
+		} else {
+			bool found = false;
+			// for 'linux-any' return the first package matching, for 'linux-*' return all matches
+			bool const isGlobal = arch.find('*') != std::string::npos;
+			APT::CacheFilter::PackageArchitectureMatchesSpecification pams(arch);
+			for (pkgCache::PkgIterator Pkg = Grp.PackageList(); Pkg.end() == false; Pkg = Grp.NextPkg(Pkg)) {
+				if (pams(Pkg) == false)
+					continue;
+				pci->insert(Pkg);
+				found = true;
+				if (isGlobal == false)
+					break;
+			}
+			if (found == true)
+				return true;
+		}
+	}
+
+	pkgCache::PkgIterator Pkg = helper.canNotFindPkgName(Cache, pkg);
+	if (Pkg.end() == true)
+	   return false;
+
+	pci->insert(Pkg);
+	return true;
+}
+									/*}}}*/
 // FromString - Return all packages matching a specific string		/*{{{*/
 bool PackageContainerInterface::FromString(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &str, CacheSetHelper &helper) {
 	bool found = true;
 	_error->PushToStack();
 
-	pkgCache::PkgIterator Pkg = FromName(Cache, str, helper);
-	if (Pkg.end() == false)
-		pci->insert(Pkg);
-	else if (FromTask(pci, Cache, str, helper) == false &&
+	if (FromGroup(pci, Cache, str, helper) == false &&
+		 FromTask(pci, Cache, str, helper) == false &&
 		 FromRegEx(pci, Cache, str, helper) == false)
 	{
 		helper.canNotFindPackage(pci, Cache, str);
@@ -217,6 +263,7 @@ bool PackageContainerInterface::FromModifierCommandLine(unsigned short &modID, P
 							pkgCacheFile &Cache, const char * cmdline,
 							std::list<Modifier> const &mods, CacheSetHelper &helper) {
 	std::string str = cmdline;
+	unsigned short fallback = modID;
 	bool modifierPresent = false;
 	for (std::list<Modifier>::const_iterator mod = mods.begin();
 	     mod != mods.end(); ++mod) {
@@ -243,6 +290,7 @@ bool PackageContainerInterface::FromModifierCommandLine(unsigned short &modID, P
 		helper.showErrors(errors);
 		if (Pkg.end() == false) {
 			pci->insert(Pkg);
+			modID = fallback;
 			return true;
 		}
 	}
@@ -281,13 +329,14 @@ bool VersionContainerInterface::FromModifierCommandLine(unsigned short &modID,
 		modifierPresent = true;
 		break;
 	}
-
 	if (modifierPresent == true) {
 		bool const errors = helper.showErrors(false);
 		bool const found = VersionContainerInterface::FromString(vci, Cache, cmdline, select, helper, true);
 		helper.showErrors(errors);
-		if (found == true)
+		if (found == true) {
+			modID = fallback;
 			return true;
+		}
 	}
 	return FromString(vci, Cache, str, select, helper);
 }

+ 3 - 2
apt-pkg/cacheset.h

@@ -139,6 +139,7 @@ public:
 	static bool FromTask(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper);
 	static bool FromRegEx(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper);
 	static pkgCache::PkgIterator FromName(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper);
+	static bool FromGroup(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper);
 	static bool FromString(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper);
 	static bool FromCommandLine(PackageContainerInterface * const pci, pkgCacheFile &Cache, const char **cmdline, CacheSetHelper &helper);
 
@@ -186,7 +187,7 @@ public:									/*{{{*/
 		pkgCache::PkgIterator getPkg(void) const { return *_iter; }
 		inline pkgCache::PkgIterator operator*(void) const { return *_iter; };
 		operator typename Container::iterator(void) const { return _iter; }
-		operator typename PackageContainer<Container>::const_iterator() { return PackageContainer<Container>::const_iterator(_iter); }
+		operator typename PackageContainer<Container>::const_iterator() { return typename PackageContainer<Container>::const_iterator(_iter); }
 		inline iterator& operator++() { ++_iter; return *this; }
 		inline iterator operator++(int) { iterator tmp(*this); operator++(); return tmp; }
 		inline bool operator!=(iterator const &i) const { return _iter != i._iter; };
@@ -506,7 +507,7 @@ public:									/*{{{*/
 		pkgCache::VerIterator getVer(void) const { return *_iter; }
 		inline pkgCache::VerIterator operator*(void) const { return *_iter; };
 		operator typename Container::iterator(void) const { return _iter; }
-		operator typename VersionContainer<Container>::const_iterator() { return VersionContainer<Container>::const_iterator(_iter); }
+		operator typename VersionContainer<Container>::const_iterator() { return typename VersionContainer<Container>::const_iterator(_iter); }
 		inline iterator& operator++() { ++_iter; return *this; }
 		inline iterator operator++(int) { iterator tmp(*this); operator++(); return tmp; }
 		inline bool operator!=(iterator const &i) const { return _iter != i._iter; };

+ 2 - 19
apt-pkg/cdrom.cc

@@ -409,27 +409,10 @@ bool pkgCdrom::WriteDatabase(Configuration &Cnf)
    
    /* Write out all of the configuration directives by walking the
       configuration tree */
-   const Configuration::Item *Top = Cnf.Tree(0);
-   for (; Top != 0;)
-   {
-      // Print the config entry
-      if (Top->Value.empty() == false)
-	 Out <<  Top->FullTag() + " \"" << Top->Value << "\";" << endl;
-      
-      if (Top->Child != 0)
-      {
-	 Top = Top->Child;
-	 continue;
-      }
-      
-      while (Top != 0 && Top->Next == 0)
-	 Top = Top->Parent;
-      if (Top != 0)
-	 Top = Top->Next;
-   }   
+   Cnf.Dump(Out, NULL, "%f \"%v\";\n", false);
 
    Out.close();
-   
+
    if (FileExists(DFile) == true && link(DFile.c_str(),string(DFile + '~').c_str()) != 0)
       return _error->Errno("link", "Failed to link %s to %s~", DFile.c_str(), DFile.c_str());
    if (rename(NewFile.c_str(),DFile.c_str()) != 0)

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

@@ -92,8 +92,9 @@ bool CommandLine::Parse(int argc,const char **argv)
       // Match up to a = against the list
       Args *A;
       const char *OptEnd = strchrnul(Opt, '=');
-      for (A = ArgList; A->end() == false && 
-	   stringcasecmp(Opt,OptEnd,A->LongOpt) != 0; A++);
+      for (A = ArgList; A->end() == false &&
+	   (A->LongOpt == 0 || stringcasecmp(Opt,OptEnd,A->LongOpt) != 0);
+	   ++A);
       
       // Failed, look for a word after the first - (no-foo)
       bool PreceedMatch = false;
@@ -105,7 +106,8 @@ bool CommandLine::Parse(int argc,const char **argv)
 	 Opt++;
 	 
 	 for (A = ArgList; A->end() == false &&
-	      stringcasecmp(Opt,OptEnd,A->LongOpt) != 0; A++);
+	      (A->LongOpt == 0 || stringcasecmp(Opt,OptEnd,A->LongOpt) != 0);
+	      ++A);
 
 	 // Failed again..
 	 if (A->end() == true && OptEnd - Opt != 1)

+ 111 - 38
apt-pkg/contrib/configuration.cc

@@ -171,48 +171,60 @@ string Configuration::Find(const char *Name,const char *Default) const
 string Configuration::FindFile(const char *Name,const char *Default) const
 {
    const Item *RootItem = Lookup("RootDir");
-   std::string rootDir =  (RootItem == 0) ? "" : RootItem->Value;
-   if(rootDir.size() > 0 && rootDir[rootDir.size() - 1] != '/')
-     rootDir.push_back('/');
+   std::string result =  (RootItem == 0) ? "" : RootItem->Value;
+   if(result.empty() == false && result[result.size() - 1] != '/')
+     result.push_back('/');
 
    const Item *Itm = Lookup(Name);
    if (Itm == 0 || Itm->Value.empty() == true)
    {
-      if (Default == 0)
-	 return rootDir;
-      else
-	 return rootDir + Default;
+      if (Default != 0)
+	 result.append(Default);
    }
-   
-   string val = Itm->Value;
-   while (Itm->Parent != 0)
+   else
    {
-      if (Itm->Parent->Value.empty() == true)
+      string val = Itm->Value;
+      while (Itm->Parent != 0)
       {
-	 Itm = Itm->Parent;
-	 continue;
-      }
+	 if (Itm->Parent->Value.empty() == true)
+	 {
+	    Itm = Itm->Parent;
+	    continue;
+	 }
+
+	 // Absolute
+	 if (val.length() >= 1 && val[0] == '/')
+	 {
+	    if (val.compare(0, 9, "/dev/null") == 0)
+	       val.erase(9);
+	    break;
+	 }
 
-      // Absolute
-      if (val.length() >= 1 && val[0] == '/')
-         break;
+	 // ~/foo or ./foo
+	 if (val.length() >= 2 && (val[0] == '~' || val[0] == '.') && val[1] == '/')
+	    break;
 
-      // ~/foo or ./foo 
-      if (val.length() >= 2 && (val[0] == '~' || val[0] == '.') && val[1] == '/')
-	 break;
-	 
-      // ../foo 
-      if (val.length() >= 3 && val[0] == '.' && val[1] == '.' && val[2] == '/')
-	 break;
-      
-      if (Itm->Parent->Value.end()[-1] != '/')
-	 val.insert(0, "/");
+	 // ../foo
+	 if (val.length() >= 3 && val[0] == '.' && val[1] == '.' && val[2] == '/')
+	    break;
+
+	 if (Itm->Parent->Value.end()[-1] != '/')
+	    val.insert(0, "/");
 
-      val.insert(0, Itm->Parent->Value);
-      Itm = Itm->Parent;
+	 val.insert(0, Itm->Parent->Value);
+	 Itm = Itm->Parent;
+      }
+      result.append(val);
    }
 
-   return rootDir + val;
+   // do some normalisation by removing // and /./ from the path
+   size_t found = string::npos;
+   while ((found = result.find("/./")) != string::npos)
+      result.replace(found, 3, "/");
+   while ((found = result.find("//")) != string::npos)
+      result.replace(found, 2, "/");
+
+   return result;
 }
 									/*}}}*/
 // Configuration::FindDir - Find a directory name			/*{{{*/
@@ -222,7 +234,12 @@ string Configuration::FindDir(const char *Name,const char *Default) const
 {
    string Res = FindFile(Name,Default);
    if (Res.end()[-1] != '/')
+   {
+      size_t const found = Res.rfind("/dev/null");
+      if (found != string::npos && found == Res.size() - 9)
+	 return Res; // /dev/null returning
       return Res + '/';
+   }
    return Res;
 }
 									/*}}}*/
@@ -482,24 +499,80 @@ bool Configuration::ExistsAny(const char *Name) const
 /* Dump the entire configuration space */
 void Configuration::Dump(ostream& str)
 {
-   /* Write out all of the configuration directives by walking the 
+   Dump(str, NULL, "%f \"%v\";\n", true);
+}
+void Configuration::Dump(ostream& str, char const * const root,
+			 char const * const formatstr, bool const emptyValue)
+{
+   const Configuration::Item* Top = Tree(root);
+   if (Top == 0)
+      return;
+   const Configuration::Item* const Root = (root == NULL) ? NULL : Top;
+   std::vector<std::string> const format = VectorizeString(formatstr, '%');
+
+   /* Write out all of the configuration directives by walking the
       configuration tree */
-   const Configuration::Item *Top = Tree(0);
-   for (; Top != 0;)
-   {
-      str << Top->FullTag() << " \"" << Top->Value << "\";" << endl;
-      
+   do {
+      if (emptyValue == true || Top->Value.empty() == emptyValue)
+      {
+	 std::vector<std::string>::const_iterator f = format.begin();
+	 str << *f;
+	 for (++f; f != format.end(); ++f)
+	 {
+	    if (f->empty() == true)
+	    {
+	       ++f;
+	       str << '%' << *f;
+	       continue;
+	    }
+	    char const type = (*f)[0];
+	    if (type == 'f')
+	       str << Top->FullTag();
+	    else if (type == 't')
+	       str << Top->Tag;
+	    else if (type == 'v')
+	       str << Top->Value;
+	    else if (type == 'F')
+	       str << QuoteString(Top->FullTag(), "=\"\n");
+	    else if (type == 'T')
+	       str << QuoteString(Top->Tag, "=\"\n");
+	    else if (type == 'V')
+	       str << QuoteString(Top->Value, "=\"\n");
+	    else if (type == 'n')
+	       str << "\n";
+	    else if (type == 'N')
+	       str << "\t";
+	    else
+	       str << '%' << type;
+	    str << f->c_str() + 1;
+	 }
+      }
+
       if (Top->Child != 0)
       {
 	 Top = Top->Child;
 	 continue;
       }
-      
+
       while (Top != 0 && Top->Next == 0)
 	 Top = Top->Parent;
       if (Top != 0)
 	 Top = Top->Next;
-   }
+
+      if (Root != NULL)
+      {
+	 const Configuration::Item* I = Top;
+	 while(I != 0)
+	 {
+	    if (I == Root)
+	       break;
+	    else
+	       I = I->Parent;
+	 }
+	 if (I == 0)
+	    break;
+      }
+   } while (Top != 0);
 }
 									/*}}}*/
 

+ 2 - 0
apt-pkg/contrib/configuration.h

@@ -103,6 +103,8 @@ class Configuration
 
    inline void Dump() { Dump(std::clog); };
    void Dump(std::ostream& str);
+   void Dump(std::ostream& str, char const * const root,
+	     char const * const format, bool const emptyValue);
 
    Configuration(const Item *Root);
    Configuration();

+ 202 - 78
apt-pkg/contrib/fileutl.cc

@@ -81,6 +81,31 @@ class FileFdPrivate {
 	FileFdPrivate() : gz(NULL), bz2(NULL),
 			  compressed_fd(-1), compressor_pid(-1), pipe(false),
 			  openmode(0), seekpos(0) {};
+	bool CloseDown(std::string const &FileName)
+	{
+	   bool Res = true;
+#ifdef HAVE_ZLIB
+	   if (gz != NULL) {
+	      int const e = gzclose(gz);
+	      gz = NULL;
+	      // gzdclose() on empty files always fails with "buffer error" here, ignore that
+	      if (e != 0 && e != Z_BUF_ERROR)
+		 Res &= _error->Errno("close",_("Problem closing the gzip file %s"), FileName.c_str());
+	   }
+#endif
+#ifdef HAVE_BZ2
+	   if (bz2 != NULL) {
+	      BZ2_bzclose(bz2);
+	      bz2 = NULL;
+	   }
+#endif
+	   if (compressor_pid > 0)
+	      ExecWait(compressor_pid, "FileFdCompressor", true);
+	   compressor_pid = -1;
+
+	   return Res;
+	}
+	~FileFdPrivate() { CloseDown(""); }
 };
 
 // RunScripts - Run a set of scripts from a configuration subtree	/*{{{*/
@@ -827,6 +852,26 @@ bool ExecWait(pid_t Pid,const char *Name,bool Reap)
 }
 									/*}}}*/
 
+// StartsWithGPGClearTextSignature - Check if a file is Pgp/GPG clearsigned     /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+bool StartsWithGPGClearTextSignature(string const &FileName)
+{
+   static const char* SIGMSG = "-----BEGIN PGP SIGNED MESSAGE-----\n";
+   char buffer[strlen(SIGMSG)+1];
+   FILE* gpg = fopen(FileName.c_str(), "r");
+   if (gpg == NULL)
+      return false;
+
+   char const * const test = fgets(buffer, sizeof(buffer), gpg);
+   fclose(gpg);
+   if (test == NULL || strcmp(buffer, SIGMSG) != 0)
+      return false;
+
+   return true;
+}
+
+
 // FileFd::Open - Open a file						/*{{{*/
 // ---------------------------------------------------------------------
 /* The most commonly used open mode combinations are given with Mode */
@@ -905,8 +950,6 @@ bool FileFd::Open(string FileName,unsigned int const Mode,CompressMode Compress,
 bool FileFd::Open(string FileName,unsigned int const Mode,APT::Configuration::Compressor const &compressor, unsigned long const Perms)
 {
    Close();
-   d = new FileFdPrivate;
-   d->openmode = Mode;
    Flags = AutoClose;
 
    if ((Mode & WriteOnly) != WriteOnly && (Mode & (Atomic | Create | Empty | Exclusive)) != 0)
@@ -1000,10 +1043,21 @@ bool FileFd::OpenDescriptor(int Fd, unsigned int const Mode, CompressMode Compre
 bool FileFd::OpenDescriptor(int Fd, unsigned int const Mode, APT::Configuration::Compressor const &compressor, bool AutoClose)
 {
    Close();
-   d = new FileFdPrivate;
-   d->openmode = Mode;
    Flags = (AutoClose) ? FileFd::AutoClose : 0;
-   iFd = Fd;
+   if (AutoClose == false && (
+#ifdef HAVE_ZLIB
+	compressor.Name == "gzip" ||
+#endif
+#ifdef HAVE_BZ2
+	compressor.Name == "bzip2" ||
+#endif
+	false))
+   {
+      // Need to duplicate fd here or gzclose for cleanup will close the fd as well
+      iFd = dup(Fd);
+   }
+   else
+      iFd = Fd;
    this->FileName = "";
    if (OpenInternDescriptor(Mode, compressor) == false)
    {
@@ -1015,12 +1069,24 @@ bool FileFd::OpenDescriptor(int Fd, unsigned int const Mode, APT::Configuration:
 }
 bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::Compressor const &compressor)
 {
-   d->compressor = compressor;
    if (compressor.Name == "." || compressor.Binary.empty() == true)
       return true;
+
+   if (d == NULL)
+   {
+      d = new FileFdPrivate();
+      d->openmode = Mode;
+      d->compressor = compressor;
+   }
+
 #ifdef HAVE_ZLIB
-   else if (compressor.Name == "gzip")
+   if (compressor.Name == "gzip")
    {
+      if (d->gz != NULL)
+      {
+	 gzclose(d->gz);
+	 d->gz = NULL;
+      }
       if ((Mode & ReadWrite) == ReadWrite)
 	 d->gz = gzdopen(iFd, "r+");
       else if ((Mode & WriteOnly) == WriteOnly)
@@ -1034,8 +1100,13 @@ bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::C
    }
 #endif
 #ifdef HAVE_BZ2
-   else if (compressor.Name == "bzip2")
+   if (compressor.Name == "bzip2")
    {
+      if (d->bz2 != NULL)
+      {
+	 BZ2_bzclose(d->bz2);
+	 d->bz2 = NULL;
+      }
       if ((Mode & ReadWrite) == ReadWrite)
 	 d->bz2 = BZ2_bzdopen(iFd, "r+");
       else if ((Mode & WriteOnly) == WriteOnly)
@@ -1049,14 +1120,20 @@ bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::C
    }
 #endif
 
+   // collect zombies here in case we reopen
+   if (d->compressor_pid > 0)
+      ExecWait(d->compressor_pid, "FileFdCompressor", true);
 
    if ((Mode & ReadWrite) == ReadWrite)
+   {
+      Flags |= Fail;
       return _error->Error("ReadWrite mode is not supported for file %s", FileName.c_str());
+   }
 
    bool const Comp = (Mode & WriteOnly) == WriteOnly;
-   // Handle 'decompression' of empty files
    if (Comp == false)
    {
+      // Handle 'decompression' of empty files
       struct stat Buf;
       fstat(iFd, &Buf);
       if (Buf.st_size == 0 && S_ISFIFO(Buf.st_mode) == false)
@@ -1065,13 +1142,19 @@ bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::C
       // We don't need the file open - instead let the compressor open it
       // as he properly knows better how to efficiently read from 'his' file
       if (FileName.empty() == false)
+      {
 	 close(iFd);
+	 iFd = -1;
+      }
    }
 
    // Create a data pipe
    int Pipe[2] = {-1,-1};
    if (pipe(Pipe) != 0)
+   {
+      Flags |= Fail;
       return _error->Errno("pipe",_("Failed to create subprocess IPC"));
+   }
    for (int J = 0; J != 2; J++)
       SetCloseExec(Pipe[J],true);
 
@@ -1098,6 +1181,12 @@ bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::C
 	    dup2(d->compressed_fd,STDIN_FILENO);
 	 dup2(Pipe[1],STDOUT_FILENO);
       }
+      int const nullfd = open("/dev/null", O_WRONLY);
+      if (nullfd != -1)
+      {
+	 dup2(nullfd,STDERR_FILENO);
+	 close(nullfd);
+      }
 
       SetCloseExec(STDOUT_FILENO,false);
       SetCloseExec(STDIN_FILENO,false);
@@ -1127,8 +1216,6 @@ bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::C
       close(Pipe[0]);
    else
       close(Pipe[1]);
-   if (Comp == true || FileName.empty() == true)
-      close(d->compressed_fd);
 
    return true;
 }
@@ -1140,6 +1227,12 @@ bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::C
 FileFd::~FileFd()
 {
    Close();
+   if (d != NULL)
+   {
+      d->CloseDown(FileName);
+      delete d;
+      d = NULL;
+   }
 }
 									/*}}}*/
 // FileFd::Read - Read a bit of the file				/*{{{*/
@@ -1156,12 +1249,12 @@ bool FileFd::Read(void *To,unsigned long long Size,unsigned long long *Actual)
    do
    {
 #ifdef HAVE_ZLIB
-      if (d->gz != NULL)
+      if (d != NULL && d->gz != NULL)
 	 Res = gzread(d->gz,To,Size);
       else
 #endif
 #ifdef HAVE_BZ2
-      if (d->bz2 != NULL)
+      if (d != NULL && d->bz2 != NULL)
 	 Res = BZ2_bzread(d->bz2,To,Size);
       else
 #endif
@@ -1173,7 +1266,7 @@ bool FileFd::Read(void *To,unsigned long long Size,unsigned long long *Actual)
 	    continue;
 	 Flags |= Fail;
 #ifdef HAVE_ZLIB
-	 if (d->gz != NULL)
+	 if (d != NULL && d->gz != NULL)
 	 {
 	    int err;
 	    char const * const errmsg = gzerror(d->gz, &err);
@@ -1182,7 +1275,7 @@ bool FileFd::Read(void *To,unsigned long long Size,unsigned long long *Actual)
 	 }
 #endif
 #ifdef HAVE_BZ2
-	 if (d->bz2 != NULL)
+	 if (d != NULL && d->bz2 != NULL)
 	 {
 	    int err;
 	    char const * const errmsg = BZ2_bzerror(d->bz2, &err);
@@ -1195,7 +1288,8 @@ bool FileFd::Read(void *To,unsigned long long Size,unsigned long long *Actual)
       
       To = (char *)To + Res;
       Size -= Res;
-      d->seekpos += Res;
+      if (d != NULL)
+	 d->seekpos += Res;
       if (Actual != 0)
 	 *Actual += Res;
    }
@@ -1223,7 +1317,7 @@ char* FileFd::ReadLine(char *To, unsigned long long const Size)
 {
    *To = '\0';
 #ifdef HAVE_ZLIB
-   if (d->gz != NULL)
+   if (d != NULL && d->gz != NULL)
       return gzgets(d->gz, To, Size);
 #endif
 
@@ -1254,12 +1348,12 @@ bool FileFd::Write(const void *From,unsigned long long Size)
    do
    {
 #ifdef HAVE_ZLIB
-      if (d->gz != NULL)
+      if (d != NULL && d->gz != NULL)
          Res = gzwrite(d->gz,From,Size);
       else
 #endif
 #ifdef HAVE_BZ2
-      if (d->bz2 != NULL)
+      if (d != NULL && d->bz2 != NULL)
          Res = BZ2_bzwrite(d->bz2,(void*)From,Size);
       else
 #endif
@@ -1270,7 +1364,7 @@ bool FileFd::Write(const void *From,unsigned long long Size)
       {
 	 Flags |= Fail;
 #ifdef HAVE_ZLIB
-	 if (d->gz != NULL)
+	 if (d != NULL && d->gz != NULL)
 	 {
 	    int err;
 	    char const * const errmsg = gzerror(d->gz, &err);
@@ -1279,7 +1373,7 @@ bool FileFd::Write(const void *From,unsigned long long Size)
 	 }
 #endif
 #ifdef HAVE_BZ2
-	 if (d->bz2 != NULL)
+	 if (d != NULL && d->bz2 != NULL)
 	 {
 	    int err;
 	    char const * const errmsg = BZ2_bzerror(d->bz2, &err);
@@ -1292,7 +1386,8 @@ bool FileFd::Write(const void *From,unsigned long long Size)
       
       From = (char *)From + Res;
       Size -= Res;
-      d->seekpos += Res;
+      if (d != NULL)
+	 d->seekpos += Res;
    }
    while (Res > 0 && Size > 0);
    
@@ -1330,11 +1425,11 @@ bool FileFd::Write(int Fd, const void *From, unsigned long long Size)
 /* */
 bool FileFd::Seek(unsigned long long To)
 {
-   if (d->pipe == true
+   if (d != NULL && (d->pipe == true
 #ifdef HAVE_BZ2
-	|| d->bz2 != NULL
+			|| d->bz2 != NULL
 #endif
-	)
+	))
    {
       // Our poor man seeking in pipes is costly, so try to avoid it
       unsigned long long seekpos = Tell();
@@ -1344,13 +1439,17 @@ bool FileFd::Seek(unsigned long long To)
 	 return Skip(To - seekpos);
 
       if ((d->openmode & ReadOnly) != ReadOnly)
+      {
+	 Flags |= Fail;
 	 return _error->Error("Reopen is only implemented for read-only files!");
+      }
 #ifdef HAVE_BZ2
       if (d->bz2 != NULL)
 	 BZ2_bzclose(d->bz2);
 #endif
-      close(iFd);
-      iFd = 0;
+      if (iFd != -1)
+	 close(iFd);
+      iFd = -1;
       if (TemporaryFileName.empty() == false)
 	 iFd = open(TemporaryFileName.c_str(), O_RDONLY);
       else if (FileName.empty() == false)
@@ -1360,12 +1459,18 @@ bool FileFd::Seek(unsigned long long To)
 	 if (d->compressed_fd > 0)
 	    if (lseek(d->compressed_fd, 0, SEEK_SET) != 0)
 	       iFd = d->compressed_fd;
-	 if (iFd <= 0)
+	 if (iFd < 0)
+	 {
+	    Flags |= Fail;
 	    return _error->Error("Reopen is not implemented for pipes opened with FileFd::OpenDescriptor()!");
+	 }
       }
 
       if (OpenInternDescriptor(d->openmode, d->compressor) == false)
+      {
+	 Flags |= Fail;
 	 return _error->Error("Seek on file %s because it couldn't be reopened", FileName.c_str());
+      }
 
       if (To != 0)
 	 return Skip(To);
@@ -1375,7 +1480,7 @@ bool FileFd::Seek(unsigned long long To)
    }
    int res;
 #ifdef HAVE_ZLIB
-   if (d->gz)
+   if (d != NULL && d->gz)
       res = gzseek(d->gz,To,SEEK_SET);
    else
 #endif
@@ -1386,7 +1491,8 @@ bool FileFd::Seek(unsigned long long To)
       return _error->Error("Unable to seek to %llu", To);
    }
 
-   d->seekpos = To;
+   if (d != NULL)
+      d->seekpos = To;
    return true;
 }
 									/*}}}*/
@@ -1395,11 +1501,11 @@ bool FileFd::Seek(unsigned long long To)
 /* */
 bool FileFd::Skip(unsigned long long Over)
 {
-   if (d->pipe == true
+   if (d != NULL && (d->pipe == true
 #ifdef HAVE_BZ2
-	|| d->bz2 != NULL
+			|| d->bz2 != NULL
 #endif
-	)
+	))
    {
       d->seekpos += Over;
       char buffer[1024];
@@ -1407,7 +1513,10 @@ bool FileFd::Skip(unsigned long long Over)
       {
 	 unsigned long long toread = std::min((unsigned long long) sizeof(buffer), Over);
 	 if (Read(buffer, toread) == false)
+	 {
+	    Flags |= Fail;
 	    return _error->Error("Unable to seek ahead %llu",Over);
+	 }
 	 Over -= toread;
       }
       return true;
@@ -1415,7 +1524,7 @@ bool FileFd::Skip(unsigned long long Over)
 
    int res;
 #ifdef HAVE_ZLIB
-   if (d->gz != NULL)
+   if (d != NULL && d->gz != NULL)
       res = gzseek(d->gz,Over,SEEK_CUR);
    else
 #endif
@@ -1425,7 +1534,8 @@ bool FileFd::Skip(unsigned long long Over)
       Flags |= Fail;
       return _error->Error("Unable to seek ahead %llu",Over);
    }
-   d->seekpos = res;
+   if (d != NULL)
+      d->seekpos = res;
 
    return true;
 }
@@ -1436,7 +1546,7 @@ bool FileFd::Skip(unsigned long long Over)
 bool FileFd::Truncate(unsigned long long To)
 {
 #if defined HAVE_ZLIB || defined HAVE_BZ2
-   if (d->gz != NULL || d->bz2 != NULL)
+   if (d != NULL && (d->gz != NULL || d->bz2 != NULL))
    {
       Flags |= Fail;
       return _error->Error("Truncating compressed files is not implemented (%s)", FileName.c_str());
@@ -1460,23 +1570,27 @@ unsigned long long FileFd::Tell()
    // seeking around, but not all users of FileFd use always Seek() and co
    // so d->seekpos isn't always true and we can just use it as a hint if
    // we have nothing else, but not always as an authority…
-   if (d->pipe == true
+   if (d != NULL && (d->pipe == true
 #ifdef HAVE_BZ2
-	|| d->bz2 != NULL
+			|| d->bz2 != NULL
 #endif
-	)
+	))
       return d->seekpos;
 
    off_t Res;
 #ifdef HAVE_ZLIB
-   if (d->gz != NULL)
+   if (d != NULL && d->gz != NULL)
      Res = gztell(d->gz);
    else
 #endif
      Res = lseek(iFd,0,SEEK_CUR);
    if (Res == (off_t)-1)
+   {
+      Flags |= Fail;
       _error->Errno("lseek","Failed to determine the current file position");
-   d->seekpos = Res;
+   }
+   if (d != NULL)
+      d->seekpos = Res;
    return Res;
 }
 									/*}}}*/
@@ -1486,17 +1600,24 @@ unsigned long long FileFd::Tell()
 unsigned long long FileFd::FileSize()
 {
    struct stat Buf;
-   if (d->pipe == false && fstat(iFd,&Buf) != 0)
+   if ((d == NULL || d->pipe == false) && fstat(iFd,&Buf) != 0)
+   {
+      Flags |= Fail;
       return _error->Errno("fstat","Unable to determine the file size");
+   }
 
    // for compressor pipes st_size is undefined and at 'best' zero
-   if (d->pipe == true || S_ISFIFO(Buf.st_mode))
+   if ((d != NULL && d->pipe == true) || S_ISFIFO(Buf.st_mode))
    {
       // we set it here, too, as we get the info here for free
       // in theory the Open-methods should take care of it already
-      d->pipe = true;
+      if (d != NULL)
+	 d->pipe = true;
       if (stat(FileName.c_str(), &Buf) != 0)
+      {
+	 Flags |= Fail;
 	 return _error->Errno("stat","Unable to determine the file size");
+      }
    }
 
    return Buf.st_size;
@@ -1511,11 +1632,11 @@ unsigned long long FileFd::Size()
 
    // for compressor pipes st_size is undefined and at 'best' zero,
    // so we 'read' the content and 'seek' back - see there
-   if (d->pipe == true
+   if (d != NULL && (d->pipe == true
 #ifdef HAVE_BZ2
-	|| (d->bz2 && size > 0)
+			|| (d->bz2 && size > 0)
 #endif
-	)
+	))
    {
       unsigned long long const oldSeek = Tell();
       char ignore[1000];
@@ -1530,7 +1651,7 @@ unsigned long long FileFd::Size()
    // only check gzsize if we are actually a gzip file, just checking for
    // "gz" is not sufficient as uncompressed files could be opened with
    // gzopen in "direct" mode as well
-   else if (d->gz && !gzdirect(d->gz) && size > 0)
+   else if (d != NULL && d->gz && !gzdirect(d->gz) && size > 0)
    {
        off_t const oldPos = lseek(iFd,0,SEEK_CUR);
        /* unfortunately zlib.h doesn't provide a gzsize(), so we have to do
@@ -1538,10 +1659,16 @@ unsigned long long FileFd::Size()
 	* bits of the file */
        // FIXME: Size for gz-files is limited by 32bit… no largefile support
        if (lseek(iFd, -4, SEEK_END) < 0)
-	   return _error->Errno("lseek","Unable to seek to end of gzipped file");
+       {
+	  Flags |= Fail;
+	  return _error->Errno("lseek","Unable to seek to end of gzipped file");
+       }
        size = 0L;
        if (read(iFd, &size, 4) != 4)
-	   return _error->Errno("read","Unable to read original size of gzipped file");
+       {
+	  Flags |= Fail;
+	  return _error->Errno("read","Unable to read original size of gzipped file");
+       }
 
 #ifdef WORDS_BIGENDIAN
        uint32_t tmp_size = size;
@@ -1551,7 +1678,10 @@ unsigned long long FileFd::Size()
 #endif
 
        if (lseek(iFd, oldPos, SEEK_SET) < 0)
-	   return _error->Errno("lseek","Unable to seek in gzipped file");
+       {
+	  Flags |= Fail;
+	  return _error->Errno("lseek","Unable to seek in gzipped file");
+       }
 
        return size;
    }
@@ -1566,20 +1696,23 @@ unsigned long long FileFd::Size()
 time_t FileFd::ModificationTime()
 {
    struct stat Buf;
-   if (d->pipe == false && fstat(iFd,&Buf) != 0)
+   if ((d == NULL || d->pipe == false) && fstat(iFd,&Buf) != 0)
    {
+      Flags |= Fail;
       _error->Errno("fstat","Unable to determine the modification time of file %s", FileName.c_str());
       return 0;
    }
 
    // for compressor pipes st_size is undefined and at 'best' zero
-   if (d->pipe == true || S_ISFIFO(Buf.st_mode))
+   if ((d != NULL && d->pipe == true) || S_ISFIFO(Buf.st_mode))
    {
       // we set it here, too, as we get the info here for free
       // in theory the Open-methods should take care of it already
-      d->pipe = true;
+      if (d != NULL)
+	 d->pipe = true;
       if (stat(FileName.c_str(), &Buf) != 0)
       {
+	 Flags |= Fail;
 	 _error->Errno("fstat","Unable to determine the modification time of file %s", FileName.c_str());
 	 return 0;
       }
@@ -1599,24 +1732,18 @@ bool FileFd::Close()
    bool Res = true;
    if ((Flags & AutoClose) == AutoClose)
    {
-#ifdef HAVE_ZLIB
-      if (d != NULL && d->gz != NULL) {
-	 int const e = gzclose(d->gz);
-	 // gzdclose() on empty files always fails with "buffer error" here, ignore that
-	 if (e != 0 && e != Z_BUF_ERROR)
-	    Res &= _error->Errno("close",_("Problem closing the gzip file %s"), FileName.c_str());
-      } else
-#endif
-#ifdef HAVE_BZ2
-      if (d != NULL && d->bz2 != NULL)
-	 BZ2_bzclose(d->bz2);
-      else
-#endif
-	 if (iFd > 0 && close(iFd) != 0)
-	    Res &= _error->Errno("close",_("Problem closing the file %s"), FileName.c_str());
+      if ((Flags & Compressed) != Compressed && iFd > 0 && close(iFd) != 0)
+	 Res &= _error->Errno("close",_("Problem closing the file %s"), FileName.c_str());
+
+      if (d != NULL)
+      {
+	 Res &= d->CloseDown(FileName);
+	 delete d;
+	 d = NULL;
+      }
    }
 
-   if ((Flags & Replace) == Replace && iFd >= 0) {
+   if ((Flags & Replace) == Replace) {
       if (rename(TemporaryFileName.c_str(), FileName.c_str()) != 0)
 	 Res &= _error->Errno("rename",_("Problem renaming the file %s to %s"), TemporaryFileName.c_str(), FileName.c_str());
 
@@ -1631,14 +1758,8 @@ bool FileFd::Close()
       if (unlink(FileName.c_str()) != 0)
 	 Res &= _error->WarningE("unlnk",_("Problem unlinking the file %s"), FileName.c_str());
 
-   if (d != NULL)
-   {
-      if (d->compressor_pid > 0)
-	 ExecWait(d->compressor_pid, "FileFdCompressor", true);
-      delete d;
-      d = NULL;
-   }
-
+   if (Res == false)
+      Flags |= Fail;
    return Res;
 }
 									/*}}}*/
@@ -1649,7 +1770,10 @@ bool FileFd::Sync()
 {
 #ifdef _POSIX_SYNCHRONIZED_IO
    if (fsync(iFd) != 0)
+   {
+      Flags |= Fail;
       return _error->Errno("sync",_("Problem syncing the file"));
+   }
 #endif
    return true;
 }

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

@@ -180,6 +180,9 @@ bool WaitFd(int Fd,bool write = false,unsigned long timeout = 0);
 pid_t ExecFork();
 bool ExecWait(pid_t Pid,const char *Name,bool Reap = false);
 
+// check if the given file starts with a PGP cleartext signature
+bool StartsWithGPGClearTextSignature(std::string const &FileName);
+
 // File string manipulators
 std::string flNotDir(std::string File);
 std::string flNotFile(std::string File);
@@ -187,4 +190,6 @@ std::string flNoLink(std::string File);
 std::string flExtension(std::string File);
 std::string flCombine(std::string Dir,std::string File);
 
+
+
 #endif

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

@@ -83,24 +83,25 @@ bool MMap::Map(FileFd &Fd)
    {
       if ((Flags & ReadOnly) != ReadOnly)
 	 return _error->Error("Compressed file %s can only be mapped readonly", Fd.Name().c_str());
-      Base = new unsigned char[iSize];
+      Base = malloc(iSize);
+      SyncToFd = new FileFd();
       if (Fd.Seek(0L) == false || Fd.Read(Base, iSize) == false)
 	 return _error->Error("Compressed file %s can't be read into mmap", Fd.Name().c_str());
       return true;
    }
 
    // Map it.
-   Base = mmap(0,iSize,Prot,Map,Fd.Fd(),0);
+   Base = (Flags & Fallback) ? MAP_FAILED : mmap(0,iSize,Prot,Map,Fd.Fd(),0);
    if (Base == (void *)-1)
    {
-      if (errno == ENODEV || errno == EINVAL)
+      if (errno == ENODEV || errno == EINVAL || (Flags & Fallback))
       {
 	 // The filesystem doesn't support this particular kind of mmap.
 	 // So we allocate a buffer and read the whole file into it.
 	 if ((Flags & ReadOnly) == ReadOnly)
 	 {
 	    // for readonly, we don't need sync, so make it simple
-	    Base = new unsigned char[iSize];
+	    Base = malloc(iSize);
 	    return Fd.Read(Base, iSize);
 	 }
 	 // FIXME: Writing to compressed fd's ?
@@ -108,7 +109,7 @@ bool MMap::Map(FileFd &Fd)
 	 if (dupped_fd == -1)
 	    return _error->Errno("mmap", _("Couldn't duplicate file descriptor %i"), Fd.Fd());
 
-	 Base = new unsigned char[iSize];
+	 Base = calloc(iSize, 1);
 	 SyncToFd = new FileFd (dupped_fd);
 	 if (!SyncToFd->Seek(0L) || !SyncToFd->Read(Base, iSize))
 	    return false;
@@ -134,7 +135,7 @@ bool MMap::Close(bool DoSync)
 
    if (SyncToFd != NULL)
    {
-      delete[] (char *)Base;
+      free(Base);
       delete SyncToFd;
       SyncToFd = NULL;
    }
@@ -282,8 +283,7 @@ DynamicMMap::DynamicMMap(unsigned long Flags,unsigned long const &WorkSpace,
 	}
 #endif
 	// fallback to a static allocated space
-	Base = new unsigned char[WorkSpace];
-	memset(Base,0,WorkSpace);
+	Base = calloc(WorkSpace, 1);
 	iSize = 0;
 }
 									/*}}}*/
@@ -299,7 +299,7 @@ DynamicMMap::~DynamicMMap()
 #ifdef _POSIX_MAPPED_FILES
       munmap(Base, WorkSpace);
 #else
-      delete [] (unsigned char *)Base;
+      free(Base);
 #endif
       return;
    }
@@ -463,6 +463,9 @@ bool DynamicMMap::Grow() {
 		Base = realloc(Base, newSize);
 		if (Base == NULL)
 			return false;
+		else
+			/* Set new memory to 0 */
+			memset((char*)Base + WorkSpace, 0, newSize - WorkSpace);
 	}
 
 	Pools =(Pool*) Base + poolOffset;

+ 6 - 2
apt-pkg/contrib/sha2_internal.cc

@@ -552,7 +552,9 @@ void SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) {
 	}
 	while (len >= SHA256_BLOCK_LENGTH) {
 		/* Process as many complete blocks as we can */
-		SHA256_Transform(context, (sha2_word32*)data);
+		sha2_byte buffer[SHA256_BLOCK_LENGTH];
+		MEMCPY_BCOPY(buffer, data, SHA256_BLOCK_LENGTH);
+		SHA256_Transform(context, (sha2_word32*)buffer);
 		context->bitcount += SHA256_BLOCK_LENGTH << 3;
 		len -= SHA256_BLOCK_LENGTH;
 		data += SHA256_BLOCK_LENGTH;
@@ -879,7 +881,9 @@ void SHA512_Update(SHA512_CTX* context, const sha2_byte *data, size_t len) {
 	}
 	while (len >= SHA512_BLOCK_LENGTH) {
 		/* Process as many complete blocks as we can */
-		SHA512_Transform(context, (sha2_word64*)data);
+		sha2_byte buffer[SHA512_BLOCK_LENGTH];
+		MEMCPY_BCOPY(buffer, data, SHA512_BLOCK_LENGTH);
+		SHA512_Transform(context, (sha2_word64*)buffer);
 		ADDINC128(context->bitcount, SHA512_BLOCK_LENGTH << 3);
 		len -= SHA512_BLOCK_LENGTH;
 		data += SHA512_BLOCK_LENGTH;

+ 40 - 22
apt-pkg/contrib/strutl.cc

@@ -23,6 +23,7 @@
 
 #include <ctype.h>
 #include <string.h>
+#include <sstream>
 #include <stdio.h>
 #include <algorithm>
 #include <unistd.h>
@@ -751,7 +752,8 @@ bool ReadMessages(int Fd, vector<string> &List)
       // Look for the end of the message
       for (char *I = Buffer; I + 1 < End; I++)
       {
-	 if (I[0] != '\n' || I[1] != '\n')
+	 if (I[1] != '\n' ||
+	     (strncmp(I, "\n\n", 2) != 0 && strncmp(I, "\r\n\r\n", 4) != 0))
 	    continue;
 	 
 	 // Pull the message out
@@ -759,7 +761,7 @@ bool ReadMessages(int Fd, vector<string> &List)
 	 PartialMessage += Message;
 
 	 // Fix up the buffer
-	 for (; I < End && *I == '\n'; I++);
+	 for (; I < End && (*I == '\r' || *I == '\n'); ++I);
 	 End -= I-Buffer;	 
 	 memmove(Buffer,I,End-Buffer);
 	 I = Buffer;
@@ -1168,34 +1170,50 @@ unsigned long RegexChoice(RxChoiceList *Rxs,const char **ListBegin,
    return Hits;
 }
 									/*}}}*/
-// ioprintf - C format string outputter to C++ iostreams		/*{{{*/
+// {str,io}printf - C format string outputter to C++ strings/iostreams	/*{{{*/
 // ---------------------------------------------------------------------
 /* This is used to make the internationalization strings easier to translate
    and to allow reordering of parameters */
-void ioprintf(ostream &out,const char *format,...) 
+static bool iovprintf(ostream &out, const char *format,
+		      va_list &args, ssize_t &size) {
+   char *S = (char*)malloc(size);
+   ssize_t const n = vsnprintf(S, size, format, args);
+   if (n > -1 && n < size) {
+      out << S;
+      free(S);
+      return true;
+   } else {
+      if (n > -1)
+	 size = n + 1;
+      else
+	 size *= 2;
+   }
+   free(S);
+   return false;
+}
+void ioprintf(ostream &out,const char *format,...)
 {
    va_list args;
-   va_start(args,format);
-   
-   // sprintf the description
-   char S[4096];
-   vsnprintf(S,sizeof(S),format,args);
-   out << S;
+   ssize_t size = 400;
+   while (true) {
+      va_start(args,format);
+      if (iovprintf(out, format, args, size) == true)
+	 return;
+      va_end(args);
+   }
 }
-									/*}}}*/
-// strprintf - C format string outputter to C++ strings 		/*{{{*/
-// ---------------------------------------------------------------------
-/* This is used to make the internationalization strings easier to translate
-   and to allow reordering of parameters */
-void strprintf(string &out,const char *format,...) 
+void strprintf(string &out,const char *format,...)
 {
    va_list args;
-   va_start(args,format);
-   
-   // sprintf the description
-   char S[4096];
-   vsnprintf(S,sizeof(S),format,args);
-   out = string(S);
+   ssize_t size = 400;
+   std::ostringstream outstr;
+   while (true) {
+      va_start(args,format);
+      if (iovprintf(outstr, format, args, size) == true)
+	 break;
+      va_end(args);
+   }
+   out = outstr.str();
 }
 									/*}}}*/
 // safe_snprintf - Safer snprintf					/*{{{*/

+ 5 - 4
apt-pkg/deb/debindexfile.cc

@@ -161,7 +161,7 @@ unsigned long debSourcesIndex::Size() const
    /* we need to ignore errors here; if the lists are absent, just return 0 */
    _error->PushToStack();
 
-   FileFd f = FileFd (IndexFile("Sources"), FileFd::ReadOnly, FileFd::Extension);
+   FileFd f(IndexFile("Sources"), FileFd::ReadOnly, FileFd::Extension);
    if (!f.Failed())
       size = f.Size();
 
@@ -290,7 +290,7 @@ unsigned long debPackagesIndex::Size() const
    /* we need to ignore errors here; if the lists are absent, just return 0 */
    _error->PushToStack();
 
-   FileFd f = FileFd (IndexFile("Packages"), FileFd::ReadOnly, FileFd::Extension);
+   FileFd f(IndexFile("Packages"), FileFd::ReadOnly, FileFd::Extension);
    if (!f.Failed())
       size = f.Size();
 
@@ -488,7 +488,7 @@ unsigned long debTranslationsIndex::Size() const
    /* we need to ignore errors here; if the lists are absent, just return 0 */
    _error->PushToStack();
 
-   FileFd f = FileFd (IndexFile(Language), FileFd::ReadOnly, FileFd::Extension);
+   FileFd f(IndexFile(Language), FileFd::ReadOnly, FileFd::Extension);
    if (!f.Failed())
       size = f.Size();
 
@@ -602,7 +602,8 @@ bool debStatusIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
    pkgCache::PkgFileIterator CFile = Gen.GetCurFile();
    CFile->Size = Pkg.FileSize();
    CFile->mtime = Pkg.ModificationTime();
-   CFile->Archive = Gen.WriteUniqString("now");
+   map_ptrloc const storage = Gen.WriteUniqString("now");
+   CFile->Archive = storage;
    
    if (Gen.MergeList(Parser) == false)
       return _error->Error("Problem with MergeList %s",File.c_str());   

+ 82 - 69
apt-pkg/deb/deblistparser.cc

@@ -15,6 +15,7 @@
 #include <apt-pkg/deblistparser.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/configuration.h>
+#include <apt-pkg/cachefilter.h>
 #include <apt-pkg/aptconfiguration.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/fileutl.h>
@@ -22,7 +23,6 @@
 #include <apt-pkg/md5.h>
 #include <apt-pkg/macros.h>
 
-#include <fnmatch.h>
 #include <ctype.h>
 									/*}}}*/
 
@@ -215,15 +215,22 @@ string debListParser::DescriptionLanguage()
  */
 MD5SumValue debListParser::Description_md5()
 {
-   string value = Section.FindS("Description-md5");
-
-   if (value.empty()) 
+   string const value = Section.FindS("Description-md5");
+   if (value.empty() == true)
    {
       MD5Summation md5;
       md5.Add((Description() + "\n").c_str());
       return md5.Result();
-   } else
-      return MD5SumValue(value);
+   }
+   else if (likely(value.size() == 32))
+   {
+      if (likely(value.find_first_not_of("0123456789abcdefABCDEF") == string::npos))
+	 return MD5SumValue(value);
+      _error->Error("Malformed Description-md5 line; includes invalid character '%s'", value.c_str());
+      return MD5SumValue();
+   }
+   _error->Error("Malformed Description-md5 line; doesn't have the required length (32 != %d) '%s'", (int)value.size(), value.c_str());
+   return MD5SumValue();
 }
                                                                         /*}}}*/
 // ListParser::UsePackage - Update a package structure			/*{{{*/
@@ -236,21 +243,26 @@ bool debListParser::UsePackage(pkgCache::PkgIterator &Pkg,
    if (Pkg->Section == 0)
       Pkg->Section = UniqFindTagWrite("Section");
 
-   // Packages which are not from the "native" arch doesn't get the essential flag
-   // in the default "native" mode - it is also possible to mark "all" or "none".
-   // The "installed" mode is handled by ParseStatus(), See #544481 and friends.
    string const static myArch = _config->Find("APT::Architecture");
-   string const static essential = _config->Find("pkgCacheGen::Essential", "native");
-   if ((essential == "native" && Pkg->Arch != 0 && myArch == Pkg.Arch()) ||
-       essential == "all")
+   // Possible values are: "all", "native", "installed" and "none"
+   // The "installed" mode is handled by ParseStatus(), See #544481 and friends.
+   string const static essential = _config->Find("pkgCacheGen::Essential", "all");
+   if (essential == "all" ||
+       (essential == "native" && Pkg->Arch != 0 && myArch == Pkg.Arch()))
       if (Section.FindFlag("Essential",Pkg->Flags,pkgCache::Flag::Essential) == false)
 	 return false;
    if (Section.FindFlag("Important",Pkg->Flags,pkgCache::Flag::Important) == false)
       return false;
 
    if (strcmp(Pkg.Name(),"apt") == 0)
-      Pkg->Flags |= pkgCache::Flag::Essential | pkgCache::Flag::Important;
-   
+   {
+      if ((essential == "native" && Pkg->Arch != 0 && myArch == Pkg.Arch()) ||
+	  essential == "all")
+	 Pkg->Flags |= pkgCache::Flag::Essential | pkgCache::Flag::Important;
+      else
+	 Pkg->Flags |= pkgCache::Flag::Important;
+   }
+
    if (ParseStatus(Pkg,Ver) == false)
       return false;
    return true;
@@ -452,22 +464,6 @@ const char *debListParser::ConvertRelation(const char *I,unsigned int &Op)
    }
    return I;
 }
-
-/*
- * CompleteArch:
- *
- * The complete architecture, consisting of <kernel>-<cpu>.
- */
-static string CompleteArch(std::string const &arch) {
-    if (arch == "armel")              return "linux-arm";
-    if (arch == "armhf")              return "linux-arm";
-    if (arch == "lpia")               return "linux-i386";
-    if (arch == "powerpcspe")         return "linux-powerpc";
-    if (arch == "uclibc-linux-armel") return "linux-arm";
-    if (arch == "uclinux-armel")      return "uclinux-arm";
-
-    return (arch.find("-") != string::npos) ? arch : "linux-" + arch;
-}
 									/*}}}*/
 // ListParser::ParseDepends - Parse a dependency element		/*{{{*/
 // ---------------------------------------------------------------------
@@ -544,58 +540,59 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop,
 
    if (ParseArchFlags == true)
    {
-      string completeArch = CompleteArch(arch);
+      APT::CacheFilter::PackageArchitectureMatchesSpecification matchesArch(arch, false);
 
       // Parse an architecture
       if (I != Stop && *I == '[')
       {
+	 ++I;
 	 // malformed
-         I++;
-         if (I == Stop)
-	    return 0; 
-	 
-         const char *End = I;
-         bool Found = false;
-      	 bool NegArch = false;
-         while (I != Stop) 
+	 if (unlikely(I == Stop))
+	    return 0;
+
+	 const char *End = I;
+	 bool Found = false;
+	 bool NegArch = false;
+	 while (I != Stop)
 	 {
-            // look for whitespace or ending ']'
-	    while (End != Stop && !isspace(*End) && *End != ']') 
-	       End++;
-	 
-	    if (End == Stop) 
+	    // look for whitespace or ending ']'
+	    for (;End != Stop && !isspace(*End) && *End != ']'; ++End);
+
+	    if (unlikely(End == Stop))
 	       return 0;
 
 	    if (*I == '!')
-            {
+	    {
 	       NegArch = true;
-	       I++;
-            }
+	       ++I;
+	    }
 
-	    if (stringcmp(arch,I,End) == 0) {
+	    std::string arch(I, End);
+	    if (arch.empty() == false && matchesArch(arch.c_str()) == true)
+	    {
 	       Found = true;
-	    } else {
-	       std::string wildcard = SubstVar(string(I, End), "any", "*");
-	       if (fnmatch(wildcard.c_str(), completeArch.c_str(), 0) == 0)
-	          Found = true;
+	       if (I[-1] != '!')
+		  NegArch = false;
+	       // we found a match, so fast-forward to the end of the wildcards
+	       for (; End != Stop && *End != ']'; ++End);
 	    }
-	    
+
 	    if (*End++ == ']') {
 	       I = End;
 	       break;
 	    }
-	    
+
 	    I = End;
 	    for (;I != Stop && isspace(*I) != 0; I++);
-         }
+	 }
 
-	 if (NegArch)
+	 if (NegArch == true)
 	    Found = !Found;
-	 
-         if (Found == false)
+
+	 if (Found == false)
 	    Package = ""; /* not for this arch */
       }
-      
+
       // Skip whitespace
       for (;I != Stop && isspace(*I) != 0; I++);
    }
@@ -625,16 +622,18 @@ bool debListParser::ParseDepends(pkgCache::VerIterator &Ver,
    if (Section.Find(Tag,Start,Stop) == false)
       return true;
 
-   string Package;
    string const pkgArch = Ver.Arch();
-   string Version;
-   unsigned int Op;
 
    while (1)
    {
+      string Package;
+      string Version;
+      unsigned int Op;
+
       Start = ParseDepends(Start,Stop,Package,Version,Op,false,!MultiArchEnabled);
       if (Start == 0)
 	 return _error->Error("Problem parsing dependency %s",Tag);
+      size_t const found = Package.rfind(':');
 
       if (MultiArchEnabled == true &&
 	  (Type == pkgCache::Dep::Conflicts ||
@@ -646,6 +645,18 @@ bool debListParser::ParseDepends(pkgCache::VerIterator &Ver,
 	    if (NewDepends(Ver,Package,*a,Version,Op,Type) == false)
 	       return false;
       }
+      else if (MultiArchEnabled == true && found != string::npos &&
+	       strcmp(Package.c_str() + found, ":any") != 0)
+      {
+	 string Arch = Package.substr(found+1, string::npos);
+	 Package = Package.substr(0, found);
+	 // Such dependencies are not supposed to be accepted …
+	 // … but this is probably the best thing to do.
+	 if (Arch == "native")
+	    Arch = _config->Find("APT::Architecture");
+	 if (NewDepends(Ver,Package,Arch,Version,Op,Type) == false)
+	    return false;
+      }
       else if (NewDepends(Ver,Package,pkgArch,Version,Op,Type) == false)
 	 return false;
       if (Start == Stop)
@@ -771,7 +782,8 @@ bool debListParser::LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,
 {
    // apt-secure does no longer download individual (per-section) Release
    // file. to provide Component pinning we use the section name now
-   FileI->Component = WriteUniqString(component);
+   map_ptrloc const storage = WriteUniqString(component);
+   FileI->Component = storage;
 
    // FIXME: Code depends on the fact that Release files aren't compressed
    FILE* release = fdopen(dup(File.Fd()), "r");
@@ -858,13 +870,14 @@ bool debListParser::LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,
 	       break;
 	    *s = '\0';
 	 }
+	 map_ptrloc const storage = WriteUniqString(data);
 	 switch (writeTo) {
-	 case Suite: FileI->Archive = WriteUniqString(data); break;
-	 case Component: FileI->Component = WriteUniqString(data); break;
-	 case Version: FileI->Version = WriteUniqString(data); break;
-	 case Origin: FileI->Origin = WriteUniqString(data); break;
-	 case Codename: FileI->Codename = WriteUniqString(data); break;
-	 case Label: FileI->Label = WriteUniqString(data); break;
+	 case Suite: FileI->Archive = storage; break;
+	 case Component: FileI->Component = storage; break;
+	 case Version: FileI->Version = storage; break;
+	 case Origin: FileI->Origin = storage; break;
+	 case Codename: FileI->Codename = storage; break;
+	 case Label: FileI->Label = storage; break;
 	 case None: break;
 	 }
       }

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

@@ -738,6 +738,7 @@ bool pkgDPkgPM::OpenLog()
       d->history_out = fopen(history_name.c_str(),"a");
       if (d->history_out == NULL)
 	 return _error->WarningE("OpenLog", _("Could not open file '%s'"), history_name.c_str());
+      SetCloseExec(fileno(d->history_out), true);
       chmod(history_name.c_str(), 0644);
       fprintf(d->history_out, "\nStart-Date: %s\n", timestr);
       string remove, purge, install, reinstall, upgrade, downgrade;
@@ -1596,7 +1597,10 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg)
    const char *ops_str[] = {"Install", "Configure","Remove","Purge"};
    fprintf(report, "AptOrdering:\n");
    for (vector<Item>::iterator I = List.begin(); I != List.end(); ++I)
-      fprintf(report, " %s: %s\n", (*I).Pkg.Name(), ops_str[(*I).Op]);
+      if ((*I).Pkg != NULL)
+         fprintf(report, " %s: %s\n", (*I).Pkg.Name(), ops_str[(*I).Op]);
+      else
+         fprintf(report, " %s: %s\n", "NULL", ops_str[(*I).Op]);
 
    // attach dmesg log (to learn about segfaults)
    if (FileExists("/bin/dmesg"))

+ 14 - 13
apt-pkg/depcache.cc

@@ -1152,9 +1152,8 @@ bool pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
       }
 
       /* This bit is for processing the possibilty of an install/upgrade
-         fixing the problem */
-      if (Start->Type != Dep::DpkgBreaks &&
-	  (DepState[Start->ID] & DepCVer) == DepCVer)
+         fixing the problem for "positive" dependencies */
+      if (Start.IsNegative() == false && (DepState[Start->ID] & DepCVer) == DepCVer)
       {
 	 APT::VersionList verlist;
 	 pkgCache::VerIterator Cand = PkgState[Start.TargetPkg()->ID].CandidateVerIter(*this);
@@ -1165,7 +1164,7 @@ bool pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
 	    pkgCache::VerIterator V = Prv.OwnerVer();
 	    pkgCache::VerIterator Cand = PkgState[Prv.OwnerPkg()->ID].CandidateVerIter(*this);
 	    if (Cand.end() == true || V != Cand ||
-		VS().CheckDep(Cand.VerStr(), Start->CompareOp, Start.TargetVer()) == false)
+		VS().CheckDep(Prv.ProvideVersion(), Start->CompareOp, Start.TargetVer()) == false)
 	       continue;
 	    verlist.insert(Cand);
 	 }
@@ -1198,13 +1197,13 @@ bool pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
 	 }
 	 continue;
       }
-
-      /* For conflicts we just de-install the package and mark as auto,
-         Conflicts may not have or groups.  For dpkg's Breaks we try to
-         upgrade the package. */
-      if (Start.IsNegative() == true)
+      /* Negative dependencies have no or-group
+	 If the dependency isn't versioned, we try if an upgrade might solve the problem.
+	 Otherwise we remove the offender if needed */
+      else if (Start.IsNegative() == true && Start->Type != pkgCache::Dep::Obsoletes)
       {
 	 SPtrArray<Version *> List = Start.AllTargets();
+	 pkgCache::PkgIterator TrgPkg = Start.TargetPkg();
 	 for (Version **I = List; *I != 0; I++)
 	 {
 	    VerIterator Ver(*this,*I);
@@ -1215,15 +1214,17 @@ bool pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
 	    if (PkgState[Pkg->ID].InstallVer == 0)
 	       continue;
 
-	    if (PkgState[Pkg->ID].CandidateVer != *I &&
-		Start->Type == Dep::DpkgBreaks &&
+	    if ((Start->Version != 0 || TrgPkg != Pkg) &&
+		PkgState[Pkg->ID].CandidateVer != PkgState[Pkg->ID].InstallVer &&
+		PkgState[Pkg->ID].CandidateVer != *I &&
 		MarkInstall(Pkg,true,Depth + 1, false, ForceImportantDeps) == true)
 	       continue;
-	    else if (MarkDelete(Pkg,false,Depth + 1, false) == false)
+	    else if ((Start->Type == pkgCache::Dep::Conflicts || Start->Type == pkgCache::Dep::DpkgBreaks) &&
+		     MarkDelete(Pkg,false,Depth + 1, false) == false)
 	       break;
 	 }
 	 continue;
-      }      
+      }
    }
 
    return Dep.end() == true;

+ 4 - 8
apt-pkg/edsp.cc

@@ -118,8 +118,7 @@ void EDSP::WriteScenarioDependency(pkgDepCache &Cache, FILE* output, pkgCache::P
    bool orGroup = false;
    for (pkgCache::DepIterator Dep = Ver.DependsList(); Dep.end() == false; ++Dep)
    {
-      // Ignore implicit dependencies for multiarch here
-      if (strcmp(Pkg.Arch(), Dep.TargetPkg().Arch()) != 0)
+      if (Dep.IsMultiArchImplicit() == true)
 	 continue;
       if (orGroup == false)
 	 dependencies[Dep->Type].append(", ");
@@ -140,8 +139,7 @@ void EDSP::WriteScenarioDependency(pkgDepCache &Cache, FILE* output, pkgCache::P
    string provides;
    for (pkgCache::PrvIterator Prv = Ver.ProvidesList(); Prv.end() == false; ++Prv)
    {
-      // Ignore implicit provides for multiarch here
-      if (strcmp(Pkg.Arch(), Prv.ParentPkg().Arch()) != 0 || strcmp(Pkg.Name(),Prv.Name()) == 0)
+      if (Prv.IsMultiArchImplicit() == true)
 	 continue;
       provides.append(", ").append(Prv.Name());
    }
@@ -159,8 +157,7 @@ void EDSP::WriteScenarioLimitedDependency(pkgDepCache &Cache, FILE* output,
    bool orGroup = false;
    for (pkgCache::DepIterator Dep = Ver.DependsList(); Dep.end() == false; ++Dep)
    {
-      // Ignore implicit dependencies for multiarch here
-      if (strcmp(Pkg.Arch(), Dep.TargetPkg().Arch()) != 0)
+      if (Dep.IsMultiArchImplicit() == true)
 	 continue;
       if (orGroup == false)
       {
@@ -193,8 +190,7 @@ void EDSP::WriteScenarioLimitedDependency(pkgDepCache &Cache, FILE* output,
    string provides;
    for (pkgCache::PrvIterator Prv = Ver.ProvidesList(); Prv.end() == false; ++Prv)
    {
-      // Ignore implicit provides for multiarch here
-      if (strcmp(Pkg.Arch(), Prv.ParentPkg().Arch()) != 0 || strcmp(Pkg.Name(),Prv.Name()) == 0)
+      if (Prv.IsMultiArchImplicit() == true)
 	 continue;
       if (pkgset.find(Prv.ParentPkg()) == pkgset.end())
 	 continue;

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

@@ -51,7 +51,8 @@ bool edspIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
    pkgCache::PkgFileIterator CFile = Gen.GetCurFile();
    CFile->Size = Pkg.FileSize();
    CFile->mtime = Pkg.ModificationTime();
-   CFile->Archive = Gen.WriteUniqString("edsp::scenario");
+   map_ptrloc const storage = Gen.WriteUniqString("edsp::scenario");
+   CFile->Archive = storage;
 
    if (Gen.MergeList(Parser) == false)
       return _error->Error("Problem with MergeList %s",File.c_str());

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

@@ -91,7 +91,7 @@ signed edspSystem::Score(Configuration const &Cnf)
 {
    if (Cnf.Find("edsp::scenario", "") == "stdin")
       return 1000;
-   if (FileExists(Cnf.FindFile("edsp::scenario","")) == true)
+   if (RealFileExists(Cnf.FindFile("edsp::scenario","")) == true)
       return 1000;
    return -1000;
 }

+ 1 - 5
apt-pkg/indexcopy.cc

@@ -648,16 +648,12 @@ bool SigVerify::RunGPGV(std::string const &File, std::string const &FileGPG,
 {
    if (File == FileGPG)
    {
-      #define SIGMSG "-----BEGIN PGP SIGNED MESSAGE-----\n"
-      char buffer[sizeof(SIGMSG)];
       FILE* gpg = fopen(File.c_str(), "r");
       if (gpg == NULL)
 	 return _error->Errno("RunGPGV", _("Could not open file %s"), File.c_str());
-      char const * const test = fgets(buffer, sizeof(buffer), gpg);
       fclose(gpg);
-      if (test == NULL || strcmp(buffer, SIGMSG) != 0)
+      if (!StartsWithGPGClearTextSignature(File))
 	 return _error->Error(_("File %s doesn't start with a clearsigned message"), File.c_str());
-      #undef SIGMSG
    }
 
 

+ 6 - 5
apt-pkg/packagemanager.cc

@@ -25,9 +25,10 @@
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/sptr.h>
 
-#include <apti18n.h>
 #include <iostream>
 #include <fcntl.h>
+
+#include <apti18n.h>
 									/*}}}*/
 using namespace std;
 
@@ -602,7 +603,7 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c
       or by the ConfigureAll call at the end of the for loop in OrderInstall. */
    bool Changed = false;
    const unsigned int max_loops = _config->FindI("APT::pkgPackageManager::MaxLoopCount", 500);
-   unsigned int i;
+   unsigned int i = 0;
    do 
    {
       Changed = false;
@@ -621,7 +622,7 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c
 	    // Look for easy targets: packages that are already okay
 	    for (DepIterator Cur = Start; Bad == true; ++Cur)
 	    {
-	       SPtrArray<Version *> VList = Start.AllTargets();
+	       SPtrArray<Version *> VList = Cur.AllTargets();
 	       for (Version **I = VList; *I != 0; ++I)
 	       {
 		  VerIterator Ver(Cache,*I);
@@ -644,7 +645,7 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c
 	    // Look for something that could be configured.
 	    for (DepIterator Cur = Start; Bad == true; ++Cur)
 	    {
-	       SPtrArray<Version *> VList = Start.AllTargets();
+	       SPtrArray<Version *> VList = Cur.AllTargets();
 	       for (Version **I = VList; *I != 0; ++I)
 	       {
 		  VerIterator Ver(Cache,*I);
@@ -784,7 +785,7 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c
 			   VerIterator V(Cache,*I);
 			   PkgIterator P = V.ParentPkg();
 			   // we are checking for installation as an easy 'protection' against or-groups and (unchosen) providers
-			   if (P->CurrentVer == 0 || P != Pkg || (P.CurrentVer() != V && Cache[P].InstallVer != V))
+			   if (P != Pkg || (P.CurrentVer() != V && Cache[P].InstallVer != V))
 			      continue;
 			   circle = true;
 			   break;

+ 29 - 0
apt-pkg/pkgcache.cc

@@ -708,6 +708,21 @@ bool pkgCache::DepIterator::IsIgnorable(PrvIterator const &Prv) const
    return false;
 }
 									/*}}}*/
+// DepIterator::IsMultiArchImplicit - added by the cache generation	/*{{{*/
+// ---------------------------------------------------------------------
+/* MultiArch can be translated to SingleArch for an resolver and we did so,
+   by adding dependencies to help the resolver understand the problem, but
+   sometimes it is needed to identify these to ignore them… */
+bool pkgCache::DepIterator::IsMultiArchImplicit() const
+{
+   if (ParentPkg()->Arch != TargetPkg()->Arch &&
+       (S->Type == pkgCache::Dep::Replaces ||
+	S->Type == pkgCache::Dep::DpkgBreaks ||
+	S->Type == pkgCache::Dep::Conflicts))
+      return true;
+   return false;
+}
+									/*}}}*/
 // ostream operator to handle string representation of a dependecy	/*{{{*/
 // ---------------------------------------------------------------------
 /* */
@@ -946,3 +961,17 @@ pkgCache::DescIterator pkgCache::VerIterator::TranslatedDescription() const
 };
 
 									/*}}}*/
+// PrvIterator::IsMultiArchImplicit - added by the cache generation	/*{{{*/
+// ---------------------------------------------------------------------
+/* MultiArch can be translated to SingleArch for an resolver and we did so,
+   by adding provides to help the resolver understand the problem, but
+   sometimes it is needed to identify these to ignore them… */
+bool pkgCache::PrvIterator::IsMultiArchImplicit() const
+{
+   pkgCache::PkgIterator const Owner = OwnerPkg();
+   pkgCache::PkgIterator const Parent = ParentPkg();
+   if (strcmp(Owner.Arch(), Parent.Arch()) != 0 || Owner->Name == Parent->Name)
+      return true;
+   return false;
+}
+									/*}}}*/

+ 13 - 6
apt-pkg/pkgcachegen.cc

@@ -38,7 +38,7 @@
 typedef std::vector<pkgIndexFile *>::iterator FileIterator;
 template <typename Iter> std::vector<Iter*> pkgCacheGenerator::Dynamic<Iter>::toReMap;
 
-bool IsDuplicateDescription(pkgCache::DescIterator Desc,
+static bool IsDuplicateDescription(pkgCache::DescIterator Desc,
 			    MD5SumValue const &CurMd5, std::string const &CurLang);
 
 using std::string;
@@ -286,7 +286,7 @@ bool pkgCacheGenerator::MergeListPackage(ListParser &List, pkgCache::PkgIterator
       pkgCache::DescIterator Desc = Ver.DescriptionList();
 
       // a version can only have one md5 describing it
-      if (MD5SumValue(Desc.md5()) != CurMd5)
+      if (Desc.end() == true || MD5SumValue(Desc.md5()) != CurMd5)
 	 continue;
 
       // don't add a new description if we have one for the given
@@ -304,6 +304,9 @@ bool pkgCacheGenerator::MergeListPackage(ListParser &List, pkgCache::PkgIterator
 
       void const * const oldMap = Map.Data();
       map_ptrloc const descindex = NewDescription(Desc, CurLang, CurMd5, *LastDesc);
+      if (unlikely(descindex == 0 && _error->PendingError()))
+	 return _error->Error(_("Error occurred while processing %s (%s%d)"),
+			      Pkg.Name(), "NewDescription", 1);
       if (oldMap != Map.Data())
 	 LastDesc += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap;
       *LastDesc = descindex;
@@ -456,6 +459,9 @@ bool pkgCacheGenerator::MergeListVersion(ListParser &List, pkgCache::PkgIterator
 
    oldMap = Map.Data();
    map_ptrloc const descindex = NewDescription(Desc, CurLang, CurMd5, *LastDesc);
+   if (unlikely(descindex == 0 && _error->PendingError()))
+      return _error->Error(_("Error occurred while processing %s (%s%d)"),
+			   Pkg.Name(), "NewDescription", 2);
    if (oldMap != Map.Data())
        LastDesc += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap;
    *LastDesc = descindex;
@@ -1310,10 +1316,11 @@ bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress
 	 }
 	 _error->RevertToStack();
       }
-      else if (Debug == true)
+      else
       {
 	 _error->MergeWithStack();
-	 std::clog << "Open filebased MMap" << std::endl;
+	 if (Debug == true)
+	    std::clog << "Open filebased MMap" << std::endl;
       }
    }
    if (Writeable == false || CacheFile.empty() == true)
@@ -1449,11 +1456,11 @@ bool pkgCacheGenerator::MakeOnlyStatusCache(OpProgress *Progress,DynamicMMap **O
 }
 									/*}}}*/
 // IsDuplicateDescription						/*{{{*/
-bool IsDuplicateDescription(pkgCache::DescIterator Desc,
+static bool IsDuplicateDescription(pkgCache::DescIterator Desc,
 			    MD5SumValue const &CurMd5, std::string const &CurLang)
 {
    // Descriptions in the same link-list have all the same md5
-   if (MD5SumValue(Desc.md5()) != CurMd5)
+   if (Desc.end() == true || MD5SumValue(Desc.md5()) != CurMd5)
       return false;
    for (; Desc.end() == false; ++Desc)
       if (Desc.LanguageCode() == CurLang)

+ 1 - 0
apt-pkg/srcrecords.h

@@ -71,6 +71,7 @@ class pkgSrcRecords
       virtual std::string Section() const = 0;
       virtual const char **Binaries() = 0;   // Ownership does not transfer
 
+      //FIXME: Add a parameter to specify which architecture to use for [wildcard] matching
       virtual bool BuildDepends(std::vector<BuildDepRec> &BuildDeps, bool const &ArchOnly, bool const &StripMultiArch = true) = 0;
       static const char *BuildDepType(unsigned char const &Type);
 

+ 3 - 14
buildlib/config.h.in

@@ -2,20 +2,6 @@
    byte first (like Motorola and SPARC, unlike Intel and VAX).  */
 #undef WORDS_BIGENDIAN
 
-/* The following 4 are only used by inttypes.h shim if the system lacks
-   inttypes.h */
-/* The number of bytes in a usigned char.  */
-#undef SIZEOF_CHAR
-
-/* The number of bytes in a unsigned int.  */
-#undef SIZEOF_INT
-
-/* The number of bytes in a unsigned long.  */
-#undef SIZEOF_LONG
-
-/* The number of bytes in a unsigned short.  */
-#undef SIZEOF_SHORT
-
 /* Define if we have the timegm() function */
 #undef HAVE_TIMEGM
 
@@ -51,4 +37,7 @@
 /* The version number string */
 #undef PACKAGE_VERSION
 
+/* The mail address to reach upstream */
+#undef PACKAGE_MAIL
+
 #define APT_8_CLEANER_HEADERS

+ 33 - 7
buildlib/configure.mak

@@ -12,24 +12,50 @@
 # It would be a fairly good idea to run this after a cvs checkout.
 BUILDDIR=build
 
-.PHONY: startup
+.PHONY: startup missing-config-files
 startup: configure $(BUILDDIR)/config.status $(addprefix $(BUILDDIR)/,$(CONVERTED))
 
 # use the files provided from the system instead of carry around
 # and use (most of the time outdated) copycats
+ifeq (file-okay,$(shell test -r buildlib/config.sub && echo 'file-okay'))
+buildlib/config.sub:
+else
+   ifeq (file-okay,$(shell test -r /usr/share/misc/config.sub && echo 'file-okay'))
 buildlib/config.sub:
 	ln -sf /usr/share/misc/config.sub buildlib/config.sub
+   else
+buildlib/config.sub: missing-config-files
+   endif
+endif
+
+ifeq (file-okay,$(shell test -r buildlib/config.guess && echo 'file-okay'))
 buildlib/config.guess:
-	ln -sf /usr/share/misc/config.guess buildlib/config.guess	
+else
+   ifeq (file-okay,$(shell test -r /usr/share/misc/config.guess && echo 'file-okay'))
+buildlib/config.guess:
+	ln -sf /usr/share/misc/config.guess buildlib/config.guess
+   else
+buildlib/config.guess: missing-config-files
+   endif
+endif
+
+missing-config-files:
+	@echo "APT needs 'config.guess' and 'config.sub' in buildlib/ for configuration."
+	@echo "On Debian systems these are available in the 'autotools-dev' package."
+	@echo
+	@echo "The latest versions can be acquired from the upstream git repository:"
+	@echo "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD"
+	@echo "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD"
+	exit 100
+
 configure: aclocal.m4 configure.in buildlib/config.guess buildlib/config.sub
 	autoconf
 
 aclocal.m4: $(wildcard buildlib/*.m4)
 	aclocal -I buildlib
-	
+
 $(BUILDDIR)/config.status: configure
-	/usr/bin/test -e $(BUILDDIR) || mkdir $(BUILDDIR)	
+	/usr/bin/test -e $(BUILDDIR) || mkdir $(BUILDDIR)
 	(HERE=`pwd`; cd $(BUILDDIR) && $$HERE/configure)
-	
-$(addprefix $(BUILDDIR)/,$(CONVERTED)):
-	(cd $(BUILDDIR) && ./config.status)
+
+$(addprefix $(BUILDDIR)/,$(CONVERTED)): $(BUILDDIR)/config.status

+ 1 - 1
buildlib/copy.mak

@@ -21,7 +21,7 @@ veryclean: veryclean/$(LOCAL)
 
 MKDIRS += $(dir $($(LOCAL)-LIST))
 
-$($(LOCAL)-LIST) : $(TO)/% : %
+$($(LOCAL)-LIST) : $(TO)/% : % dirs
 	echo Installing $< to $(@D)
 	cp $< $(@D)
 

+ 4 - 2
buildlib/debiandoc.mak

@@ -14,13 +14,15 @@ LOCAL := debiandoc-$(firstword $(SOURCE))
 $(LOCAL)-HTML := $(addsuffix .html,$(addprefix $(DOC)/,$(basename $(SOURCE))))
 $(LOCAL)-TEXT := $(addsuffix .text,$(addprefix $(DOC)/,$(basename $(SOURCE))))
 
+debiandoc:
+
 #---------
 
 # Rules to build HTML documentations
 ifdef DEBIANDOC_HTML
 
 # Install generation hooks
-doc: $($(LOCAL)-HTML)
+debiandoc: $($(LOCAL)-HTML)
 veryclean: veryclean/html/$(LOCAL)
 
 vpath %.sgml $(SUBDIRS)
@@ -42,7 +44,7 @@ endif
 ifdef DEBIANDOC_TEXT
 
 # Install generation hooks
-doc: $($(LOCAL)-TEXT)
+debiandoc: $($(LOCAL)-TEXT)
 veryclean: veryclean/text/$(LOCAL)
 
 vpath %.sgml $(SUBDIRS)

+ 1 - 1
buildlib/defaults.mak

@@ -121,7 +121,7 @@ MKDIRS := $(BIN)
 all: dirs binary doc
 binary: library program
 maintainer-clean dist-clean distclean pristine sanity: veryclean
-startup headers library clean veryclean program test update-po:
+startup headers library clean veryclean program test update-po manpages debiandoc:
 
 veryclean:
 	echo Very Clean done for $(SUBDIR)

+ 1 - 1
buildlib/environment.mak.in

@@ -3,6 +3,7 @@
 
 PACKAGE = @PACKAGE@
 PACKAGE_VERSION = @PACKAGE_VERSION@
+PACKAGE_MAIL = @PACKAGE_MAIL@
 
 # C++ compiler options
 CC = @CC@
@@ -53,7 +54,6 @@ BDBLIB = @BDBLIB@
 INTLLIBS = @INTLLIBS@
 
 # Shim Headerfile control
-HAVE_C9X = @HAVE_C9X@
 HAVE_STATVFS = @HAVE_STATVFS@
 HAVE_ZLIB = @HAVE_ZLIB@
 HAVE_BZ2 = @HAVE_BZ2@

+ 0 - 50
buildlib/inttypes.h.in

@@ -1,50 +0,0 @@
-/* This is an ISO C 9X header file. We omit this copy to the include 
-   directory if the local platform does not have inttypes.h, it contains
-   [u]int[8,16,32]_t fixed width types */
-
-#include <config.h>
-
-#undef int32_t
-#undef uint32_t
-#undef int16_t
-#undef uint16_t
-#undef int8_t
-#undef uint8_t
-
-/* Generate the fixed bit size types */
-#if SIZEOF_INT == 4
-  typedef int int32_t;
-  typedef unsigned int uint32_t;
-#else
-# if SIZEOF_LONG == 4
-  typedef long int32_t;
-  typedef unsigned long uint32_t;
-# else
-#  if SIZEOF_SHORT == 4
-    typedef short int32_t;
-    typedef unsigned short uint32_t;
-#  else
-#   error Must have a form of 32-bit integer
-#  endif
-# endif
-#endif
-
-#if SIZEOF_INT == 2
-  typedef int int16_t;
-  typedef unsigned int uint16_t;
-#else
-# if SIZEOF_LONG == 2
-   typedef long int16_t;
-   typedef unsigned long uint16_t;
-# else
-#  if SIZEOF_SHORT == 2
-    typedef short int16_t;
-    typedef unsigned short uint16_t;
-#  else
-#   error Must have a form of 16-bit integer
-#  endif
-# endif
-#endif
-
-typedef signed char int8_t;
-typedef unsigned char uint8_t;

+ 0 - 5
buildlib/makefile.in

@@ -31,11 +31,6 @@ maintainer-clean dist-clean pristine sanity distclean:
 .PHONY: dirs
 dirs: 
 	$(MAKE) -C $(SRCDIR) -f Makefile $@
-ifeq ($(HAVE_C9X),yes)
-	@rm -f include/inttypes.h > /dev/null 2>&1
-else
-	@cp -p $(SRCDIR)/buildlib/inttypes.h.in include/inttypes.h
-endif
 ifeq ($(HAVE_STATVFS),yes)
 	@rm -f include/statvfs.h > /dev/null 2>&1
 else

+ 2 - 1
buildlib/manpage.mak

@@ -14,7 +14,8 @@ LOCAL := manpage-$(firstword $(SOURCE))
 $(LOCAL)-LIST := $(addprefix $(DOC)/,$(SOURCE))
 
 # Install generation hooks
-doc: $($(LOCAL)-LIST)
+doc: manpages
+manpages: $($(LOCAL)-LIST)
 veryclean: veryclean/$(LOCAL)
 
 MKDIRS += $(DOC)

+ 0 - 14
buildlib/mkChangeLog

@@ -1,14 +0,0 @@
-#!/bin/sh
-
-NAMES="`sed -ne 's/'\''/'\''\\\\'\'''\''/g;
-	         s/^.*CVS:\([^ ]\+\) \([^<]\+\) <\([^>]*\)>/\
-		    -u '\''\1:\2:\3'\''/gp' AUTHORS`"
-OPTIONS="-l 78"
-
-# Generate the standard ChangeLog
-echo CVSIGNORE=po rcs2log $OPTIONS $NAMES
-eval CVSIGNORE=po rcs2log $OPTIONS $NAMES >> ChangeLog
-
-# Generate the po ChangeLog
-#echo rcs2log $OPTIONS $NAMES po
-#eval rcs2log $OPTIONS $NAMES po >> po/ChangeLog

+ 9 - 3
buildlib/po4a_manpage.mak

@@ -13,22 +13,28 @@
 SOURCE = $(patsubst %.xml,%,$(wildcard *.$(LC).?.xml))
 INCLUDES = apt.ent apt-verbatim.ent
 
+manpages:
+
 # Do not use XMLTO, build the manpages directly with XSLTPROC
 ifdef XSLTPROC
 
-STYLESHEET=../manpage-style.xsl
+STYLESHEET=manpage-style.xsl
 
 LOCAL := po4a-manpage-$(firstword $(SOURCE))
 $(LOCAL)-LIST := $(SOURCE)
 
 # Install generation hooks
-doc: $($(LOCAL)-LIST)
+manpages: $($(LOCAL)-LIST)
 veryclean: veryclean/$(LOCAL)
 
 apt-verbatim.ent: ../apt-verbatim.ent
 	cp ../apt-verbatim.ent .
 
-$($(LOCAL)-LIST) :: % : %.xml $(INCLUDES)
+manpage-style.xsl: ../manpage-style.xsl
+	sed "/<!-- LANGUAGE -->/ i\
+<xsl:param name=\"l10n.gentext.default.language\" select=\"'$(LC)'\" />" ../manpage-style.xsl > manpage-style.xsl
+
+$($(LOCAL)-LIST) :: % : %.xml $(STYLESHEET) $(INCLUDES)
 	echo Creating man page $@
 	$(XSLTPROC) -o $@ $(STYLESHEET) $< || exit 200 # why xsltproc doesn't respect the -o flag here???
 	test -f $(subst .$(LC),,$@) || echo FIXME: xsltproc respect the -o flag now, workaround can be removed

+ 2 - 2
buildlib/podomain.mak

@@ -12,9 +12,9 @@ endif
 
 MKDIRS += $(PO_DOMAINS)/$(MY_DOMAIN)
 $(PO_DOMAINS)/$(MY_DOMAIN)/$(LOCAL).$(TYPE)list: SRC := $(addprefix $(SUBDIR)/,$(SOURCE))
-$(PO_DOMAINS)/$(MY_DOMAIN)/$(LOCAL).$(TYPE)list: makefile
+$(PO_DOMAINS)/$(MY_DOMAIN)/$(LOCAL).$(TYPE)list: makefile dirs
 	(echo $(SRC) | xargs -n1 echo) > $@
-startup binary program clean: $(PO_DOMAINS)/$(MY_DOMAIN)/$(LOCAL).$(TYPE)list
+startup binary program clean update-po: $(PO_DOMAINS)/$(MY_DOMAIN)/$(LOCAL).$(TYPE)list
 
 veryclean: veryclean/$(LOCAL)
 veryclean/po/$(LOCAL): LIST := $(PO_DOMAINS)/$(MY_DOMAIN)/$(LOCAL).$(TYPE)list

+ 0 - 25
buildlib/sizetable

@@ -1,25 +0,0 @@
-#
-# This file lists common architectures for cross-compilation (CPUs, not
-# OSs), and the endian-ness and relative type sizes. It is not needed for
-# native compilation.
-#
-# If you wish to cross-compile APT, and your architecture is not listed
-# here, you should add it, and submit it by email to the APT team at
-# <apt@packages.debian.org>.
-#
-# This is used primarily for the MD5 algorithm.
-# The format is:-
-# CPU endian sizeof: char, int, short, long
-i386    little  1 4 2 4
-amd64   little  1 4 2 8
-armeb   big     1 4 2 4
-arm     little  1 4 2 4
-alpha   little  1 4 2 8
-mipsel  little  1 4 2 4
-sparc   big     1 4 2 4
-sparc64 big     1 4 2 8
-m68k    big     1 4 2 4
-powerpc big     1 4 2 4
-mips    big     1 4 2 4
-hppa    big     1 4 2 4
-m32r	big	1 4 2 4

+ 9 - 1
cmdline/apt-config.cc

@@ -63,7 +63,13 @@ bool DoShell(CommandLine &CmdL)
 /* */
 bool DoDump(CommandLine &CmdL)
 {
-   _config->Dump(cout);
+   bool const empty = _config->FindB("APT::Config::Dump::EmptyValue", true);
+   std::string const format = _config->Find("APT::Config::Dump::Format", "%f \"%v\";\n");
+   if (CmdL.FileSize() == 1)
+      _config->Dump(cout, NULL, format.c_str(), empty);
+   else
+      for (const char **I = CmdL.FileList + 1; *I != 0; ++I)
+	 _config->Dump(cout, *I, format.c_str(), empty);
    return true;
 }
 									/*}}}*/
@@ -100,6 +106,8 @@ int main(int argc,const char *argv[])					/*{{{*/
       {'v',"version","version",0},
       {'c',"config-file",0,CommandLine::ConfigFile},
       {'o',"option",0,CommandLine::ArbItem},
+      {0,"empty","APT::Config::Dump::EmptyValue",CommandLine::Boolean},
+      {0,"format","APT::Config::Dump::Format",CommandLine::HasArg},
       {0,0,0,0}};
    CommandLine::Dispatch Cmds[] = {{"shell",&DoShell},
                                    {"dump",&DoDump},

+ 4 - 2
cmdline/apt-extracttemplates.cc

@@ -36,11 +36,13 @@
 #include <string.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <locale.h>
+
 #include <fstream>
 
-#include <locale.h>
-#include <apti18n.h>
 #include "apt-extracttemplates.h"
+
+#include <apti18n.h>
 									/*}}}*/
 
 using namespace std;

+ 84 - 32
cmdline/apt-get.cc

@@ -254,6 +254,9 @@ bool ShowList(ostream &out,string Title,string List,string VersionsList)
  */
 void ShowBroken(ostream &out,CacheFile &Cache,bool Now)
 {
+   if (Cache->BrokenCount() == 0)
+      return;
+
    out << _("The following packages have unmet dependencies:") << endl;
    for (unsigned J = 0; J < Cache->Head().PackageCount; J++)
    {
@@ -1679,10 +1682,13 @@ bool DoUpdate(CommandLine &CmdL)
        ListUpdate(Stat, *List);
 
    // Rebuild the cache.
-   pkgCacheFile::RemoveCaches();
-   if (Cache.BuildCaches() == false)
-      return false;
-   
+   if (_config->FindB("pkgCacheFile::Generate", true) == true)
+   {
+      pkgCacheFile::RemoveCaches();
+      if (Cache.BuildCaches() == false)
+	 return false;
+   }
+
    return true;
 }
 									/*}}}*/
@@ -2356,6 +2362,8 @@ bool DoDownload(CommandLine &CmdL)
 
    pkgRecords Recs(Cache);
    pkgSourceList *SrcList = Cache.GetSourceList();
+   bool gotAll = true;
+
    for (APT::VersionList::const_iterator Ver = verset.begin(); 
         Ver != verset.end(); 
         ++Ver) 
@@ -2366,11 +2374,19 @@ bool DoDownload(CommandLine &CmdL)
       pkgRecords::Parser &rec=Recs.Lookup(Ver.FileList());
       pkgCache::VerFileIterator Vf = Ver.FileList();
       if (Vf.end() == true)
-         return _error->Error("Can not find VerFile");
+      {
+	 _error->Error("Can not find VerFile for %s in version %s", Pkg.FullName().c_str(), Ver.VerStr());
+	 gotAll = false;
+	 continue;
+      }
       pkgCache::PkgFileIterator F = Vf.File();
       pkgIndexFile *index;
       if(SrcList->FindIndex(F, index) == false)
-         return _error->Error("FindIndex failed");
+      {
+	 _error->Error(_("Can't find a source to download version '%s' of '%s'"), Ver.VerStr(), Pkg.FullName().c_str());
+	 gotAll = false;
+	 continue;
+      }
       string uri = index->ArchiveURI(rec.FileName());
       strprintf(descr, _("Downloading %s %s"), Pkg.Name(), Ver.VerStr());
       // get the most appropriate hash
@@ -2386,6 +2402,8 @@ bool DoDownload(CommandLine &CmdL)
       // get the file
       new pkgAcqFile(&Fetcher, uri, hash.toStr(), (*Ver)->Size, descr, Pkg.Name(), ".");
    }
+   if (gotAll == false)
+      return false;
 
    // Just print out the uris and exit if the --print-uris flag was used
    if (_config->FindB("APT::Get::Print-URIs") == true)
@@ -2493,7 +2511,7 @@ bool DoSource(CommandLine &CmdL)
 		  Src.c_str(), vcs.c_str(), uri.c_str());
 	 if(vcs == "Bzr") 
 	    ioprintf(c1out,_("Please use:\n"
-			     "bzr get %s\n"
+			     "bzr branch %s\n"
 			     "to retrieve the latest (possibly unreleased) "
 			     "updates to the package.\n"),
 		     uri.c_str());
@@ -2786,8 +2804,18 @@ bool DoBuildDep(CommandLine &CmdL)
             
       // Process the build-dependencies
       vector<pkgSrcRecords::Parser::BuildDepRec> BuildDeps;
-      if (Last->BuildDepends(BuildDeps, _config->FindB("APT::Get::Arch-Only", false), StripMultiArch) == false)
-      	return _error->Error(_("Unable to get build-dependency information for %s"),Src.c_str());
+      // FIXME: Can't specify architecture to use for [wildcard] matching, so switch default arch temporary
+      if (hostArch.empty() == false)
+      {
+	 std::string nativeArch = _config->Find("APT::Architecture");
+	 _config->Set("APT::Architecture", hostArch);
+	 bool Success = Last->BuildDepends(BuildDeps, _config->FindB("APT::Get::Arch-Only", false), StripMultiArch);
+	 _config->Set("APT::Architecture", nativeArch);
+	 if (Success == false)
+	    return _error->Error(_("Unable to get build-dependency information for %s"),Src.c_str());
+      }
+      else if (Last->BuildDepends(BuildDeps, _config->FindB("APT::Get::Arch-Only", false), StripMultiArch) == false)
+	    return _error->Error(_("Unable to get build-dependency information for %s"),Src.c_str());
    
       // Also ensure that build-essential packages are present
       Configuration::Item const *Opts = _config->Tree("APT::Build-Essential");
@@ -2873,39 +2901,48 @@ bool DoBuildDep(CommandLine &CmdL)
 	       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)
+	       #define BADVER(Ver) (Ver.end() == true || \
+				    (D->Version.empty() == false && \
+				     Cache->VS().CheckDep(Ver.VerStr(),D->Op,D->Version.c_str()) == false))
 
+	       APT::VersionList verlist;
 	       if (Pkg.end() == false)
 	       {
-		  Ver = (*Cache)[Pkg].InstVerIter(*Cache);
-		  if (BADVER(Ver))
-		     Ver = (*Cache)[Pkg].CandidateVerIter(*Cache);
+		  pkgCache::VerIterator Ver = (*Cache)[Pkg].InstVerIter(*Cache);
+		  if (BADVER(Ver) == false)
+		     verlist.insert(Ver);
+		  Ver = (*Cache)[Pkg].CandidateVerIter(*Cache);
+		  if (BADVER(Ver) == false)
+		     verlist.insert(Ver);
 	       }
-	       if (BADVER(Ver))
+	       if (verlist.empty() == true)
 	       {
 		  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);
+		     pkgCache::VerIterator Ver = (*Cache)[HostPkg].InstVerIter(*Cache);
+		     if (BADVER(Ver) == false)
+			verlist.insert(Ver);
+		     Ver = (*Cache)[HostPkg].CandidateVerIter(*Cache);
+		     if (BADVER(Ver) == false)
+			verlist.insert(Ver);
 		  }
 	       }
-	       if ((BADVER(Ver)) == false)
+	       #undef BADVER
+
+	       string forbidden;
+	       // We need to decide if host or build arch, so find a version we can look at
+	       APT::VersionList::const_iterator Ver = verlist.begin();
+	       for (; Ver != verlist.end(); ++Ver)
 	       {
-		  string forbidden;
+		  forbidden.clear();
 		  if (Ver->MultiArch == pkgCache::Version::None || Ver->MultiArch == pkgCache::Version::All)
 		  {
 		     if (colon == string::npos)
-		     {
 			Pkg = Ver.ParentPkg().Group().FindPkg(hostArch);
-		     }
+		     else if (strcmp(D->Package.c_str() + colon, ":any") == 0)
+			forbidden = "Multi-Arch: none";
 		  }
 		  else if (Ver->MultiArch == pkgCache::Version::Same)
 		  {
@@ -2937,21 +2974,32 @@ bool DoBuildDep(CommandLine &CmdL)
 		     }
 		     // 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;
+			cout << D->Package.substr(colon, string::npos) << " is not allowed from " << forbidden << " package " << (*D).Package << " (" << Ver.VerStr() << ")" << endl;
+		     continue;
+		  }
+
+		  //we found a good version
+		  break;
+	       }
+	       if (Ver == verlist.end())
+	       {
+		  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;
+
+		  if (forbidden.empty() == false)
+		  {
 		     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");
+					  D->Package.c_str(), forbidden.c_str());
 		  }
 	       }
-	       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);
@@ -3228,9 +3276,13 @@ bool DoChangelog(CommandLine &CmdL)
    pkgAcquire Fetcher;
 
    if (_config->FindB("APT::Get::Print-URIs", false) == true)
+   {
+      bool Success = true;
       for (APT::VersionList::const_iterator Ver = verset.begin();
 	   Ver != verset.end(); ++Ver)
-	 return DownloadChangelog(Cache, Fetcher, Ver, "");
+	 Success &= DownloadChangelog(Cache, Fetcher, Ver, "");
+      return Success;
+   }
 
    AcqTextStatus Stat(ScreenWidth, _config->FindI("quiet",0));
    Fetcher.Setup(&Stat);

+ 7 - 8
cmdline/apt-internal-solver.cc

@@ -7,6 +7,8 @@
    ##################################################################### */
 									/*}}}*/
 // Include Files							/*{{{*/
+#include <config.h>
+
 #include <apt-pkg/error.h>
 #include <apt-pkg/cmndline.h>
 #include <apt-pkg/init.h>
@@ -18,11 +20,10 @@
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/pkgsystem.h>
 
-#include <config.h>
-#include <apti18n.h>
-
 #include <unistd.h>
 #include <cstdio>
+
+#include <apti18n.h>
 									/*}}}*/
 
 // ShowHelp - Show a help screen					/*{{{*/
@@ -33,18 +34,16 @@ bool ShowHelp(CommandLine &CmdL) {
 		 COMMON_ARCH,__DATE__,__TIME__);
 
 	std::cout <<
-		_("Usage: apt-internal-resolver\n"
+		_("Usage: apt-internal-solver\n"
 		"\n"
-		"apt-internal-resolver is an interface to use the current internal\n"
+		"apt-internal-solver is an interface to use the current internal\n"
 		"like an external resolver for the APT family for debugging or alike\n"
 		"\n"
 		"Options:\n"
 		"  -h  This help text.\n"
 		"  -q  Loggable output - no progress indicator\n"
 		"  -c=? Read this configuration file\n"
-		"  -o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp\n"
-		"apt.conf(5) manual pages for more information and options.\n"
-		"                       This APT has Super Cow Powers.\n");
+		"  -o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp\n");
 	return true;
 }
 									/*}}}*/

+ 2 - 1
cmdline/apt-key

@@ -11,7 +11,8 @@ GPG_CMD="gpg --ignore-time-conflict --no-options --no-default-keyring --secret-k
 
 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"
+	eval $(apt-config shell TRUSTDBDIR Dir::Etc/d)
+	GPG_CMD="$GPG_CMD --trustdb-name ${TRUSTDBDIR}/trustdb.gpg"
 fi
 
 GPG="$GPG_CMD"

+ 1 - 1
cmdline/apt-mark.cc

@@ -367,7 +367,7 @@ bool ShowHelp(CommandLine &CmdL)
     _("Usage: apt-mark [options] {auto|manual} pkg1 [pkg2 ...]\n"
       "\n"
       "apt-mark is a simple command line interface for marking packages\n"
-      "as manual or automatical installed. It can also list marks.\n"
+      "as manually or automatically installed. It can also list marks.\n"
       "\n"
       "Commands:\n"
       "   auto - Mark the given packages as automatically installed\n"

+ 5 - 45
configure.in

@@ -18,11 +18,14 @@ AC_CONFIG_AUX_DIR(buildlib)
 AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in)
 
 PACKAGE="apt"
-PACKAGE_VERSION="0.9.0"
+PACKAGE_VERSION="0.9.7.1"
+PACKAGE_MAIL="APT Development Team <deity@lists.debian.org>"
 AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE")
 AC_DEFINE_UNQUOTED(PACKAGE_VERSION,"$PACKAGE_VERSION")
+AC_DEFINE_UNQUOTED(PACKAGE_MAIL,"$PACKAGE_MAIL")
 AC_SUBST(PACKAGE)
 AC_SUBST(PACKAGE_VERSION)
+AC_SUBST(PACKAGE_MAIL)
 
 dnl Check the archs, we want the target type.
 AC_CANONICAL_SYSTEM
@@ -116,12 +119,6 @@ fi
 AC_MSG_RESULT($archset)
 AC_DEFINE_UNQUOTED(COMMON_ARCH,"$archset")
 
-dnl We use C99 types if at all possible
-AC_CACHE_CHECK([for C99 integer types],apt_cv_c9x_ints,[
-    AC_TRY_COMPILE([#include <inttypes.h>],
-                   [uint8_t Foo1;uint16_t Foo2;uint32_t Foo3;],
-		   apt_cv_c9x_ints=yes,apt_cv_c9x_ints=no)])
-
 dnl Single Unix Spec statvfs
 AC_CHECK_FUNC(statvfs,[HAVE_STATVFS=yes])
 AC_SUBST(HAVE_STATVFS)
@@ -141,46 +138,9 @@ dnl We should use the real timegm function if we have it.
 AC_CHECK_FUNC(timegm,AC_DEFINE(HAVE_TIMEGM))
 AC_SUBST(HAVE_TIMEGM)
 
-dnl Check the sizes etc. of the architecture
-dnl This is stupid, it should just use the AC macros like it does below
-dnl Cross compilers can either get a real C library or preload the cache
-dnl with their size values.
-changequote(,)
-archline="`awk \" ! /^#|^\\\$/ {if (match(\\\"$archset\\\",\\\$1)) {print; exit}}\" $srcdir/buildlib/sizetable | cut -f 2- -d ' '`"
-if test "x$archline" != "x"; then
-   changequote([,])
-   set $archline
-   if test "$1" = "little"; then
-      ac_cv_c_bigendian=no
-   else
-      ac_cv_c_bigendian=yes
-   fi
-   size_char=$2
-   size_int=$3
-   size_short=$4
-   size_long=$5
-fi
-
-dnl I wonder what AC_C_BIGENDIAN does if you cross compile...
-dnl This is probably bogus, as above we only care if we have to build our own
-dnl C9x types.
-if test "$cross_compiling" = "yes" -a "x$archline" = "x"; then
-  AC_MSG_ERROR(When cross compiling, architecture must be present in sizetable)
-fi
+dnl Check the architecture
 AC_C_BIGENDIAN
 
-dnl We do not need this if we have inttypes!
-HAVE_C9X=yes
-if test x"$apt_cv_c9x_ints" = x"no"; then
-   AC_CHECK_SIZEOF(char,$size_char)
-   AC_CHECK_SIZEOF(int,$size_int)
-   AC_CHECK_SIZEOF(short,$size_short)
-   AC_CHECK_SIZEOF(long,$size_long)
-  
-   HAVE_C9X=
-   AC_SUBST(HAVE_C9X)
-fi
-
 dnl HP-UX sux..
 AC_MSG_CHECKING(for missing socklen_t)
 AC_EGREP_HEADER(socklen_t, sys/socket.h,[AC_MSG_RESULT(no)],[

+ 0 - 1
debian/apt-utils.links

@@ -1 +0,0 @@
-usr/bin/apt-internal-solver usr/lib/apt/solvers/apt

+ 386 - 0
debian/changelog

@@ -1,3 +1,379 @@
+apt (0.9.8~exp1) UNRELEASED; urgency=low
+
+  [ David Kalnischkies ]
+  * apt-pkg/contrib/strutl.cc:
+    - support \n and \r\n line endings in ReadMessages
+
+ -- David Kalnischkies <kalnischkies@gmail.com>  Mon, 09 Jul 2012 17:36:40 +0200
+
+apt (0.9.7.1) unstable; urgency=low
+
+  [ Program translation updates ]
+  * Bulgarian (Damyan Ivanov) (Closes: #678983)
+  * Hungarian (Gabor Kelemen)
+  * Italian (Milo Casagrande)
+  * Slovenian (Andrej Znidarsic)
+  * German (Holger Wansing) (Closes: #679314)
+  * Slovak (Ivan Masár) (Closes: #679448)
+
+  [ David Kalnischkies ]
+  * cmdline/apt-internal-solver.cc, cmdline/apt-mark.cc:
+    - typo fixes and unfuzzy translations
+  * debian/control:
+    - libapt-{pkg,inst} packages should be in section 'libs' instead
+      of 'admin' as by ftp-master override request in #677596
+    - demote debiandoc-sgml to Build-Depends-Indep
+  * doc/makefile:
+    - separate translation building of debiandoc from manpages
+      so that we don't need to build debiandoc for binary packages
+
+ -- Michael Vogt <mvo@debian.org>  Fri, 29 Jun 2012 14:26:32 +0200
+
+apt (0.9.7) unstable; urgency=low
+
+  [ Julian Andres Klode ]
+  * apt-pkg/contrib/mmap.cc:
+    - Fix the Fallback option to work correctly, by not calling
+      realloc() on a map mapped by mmap(), and by using malloc
+      and friends instead of new[].
+    - Zero out the new memory allocated with realloc().
+
+  [ Daniel Hartwig ]
+  * apt-pkg/pkgcachegen.cc:
+    - always reset _error->StackCount in MakeStatusCache (Closes: #677175)
+
+  [ David Kalnischkies ]
+  * apt-pkg/deb/deblistparser.cc:
+    - ensure that mixed positive/negative architecture wildcards
+      are handled in the same way as dpkg handles them
+    - use PackageArchitectureMatchesSpecification filter
+  * apt-pkg/cachefilter.cc:
+    - add PackageArchitectureMatchesSpecification (Closes: #672603)
+  * apt-pkg/cacheset.cc:
+    - add PackageContainerInterface::FromGroup to support
+      architecture specifications with wildcards on the commandline
+  * apt-pkg/pkgcache.cc:
+    - do a string comparision for architecture checking in IsMultiArchImplicit
+      as 'unique' strings in the pkgcache aren't unique (Closes: #677454)
+  * buildlib/configure.mak:
+    - print a message detailing how to get config.guess and config.sub
+      in case they are not in /usr/share/misc (Closes: #677312)
+  * cmdline/apt-get.cc:
+    - print a friendly message in 'download' if a package can't be
+      downloaded (Closes: #677887)
+
+ -- Michael Vogt <mvo@debian.org>  Tue, 19 Jun 2012 16:42:43 +0200
+
+apt (0.9.6) unstable; urgency=low
+
+  [ David Kalnischkies ]
+  * apt-pkg/cdrom.cc:
+    - fix regression from 0.9.3 which dumped the main configuration
+      _config instead of the cdrom settings (Cnf) as identified and
+      tested by Milan Kupcevic, thanks! (Closes: #674100)
+  * cmdline/apt-get.cc:
+    - do not show 'list of broken packages' header if no package
+      is broken as it happens e.g. for external resolver errors
+    - print URIs for all changelogs in case of --print-uris,
+      thanks to Daniel Hartwig for the patch! (Closes: #674897)
+    - show 'bzr branch' as 'bzr get' is deprecated (LP: #1011032)
+    - check build-dep candidate if install is forbidden
+  * debian/apt-utils.links:
+    - the internal resolver 'apt' is now directly installed in
+      /usr/lib/apt/solvers, so don't instruct dh to create a broken link
+  * doc/apt-verbatim.ent:
+    - APT doesn't belong to the product 'Linux', so use 'APT' instead
+      as after all APT is a big suite of applications
+  * doc/examples/sources.list:
+    - use the codename instead of 'stable' in the examples sources.list
+      as we do in the manpage and as the debian-installer does
+  * doc/apt-get.8.xml:
+    - use apt-utils as package example instead of libc6
+  * apt-pkg/contrib/cmdline.cc:
+    - apply patch from Daniel Hartwig to fix a segfault in case
+      the LongOpt is empty (Closes: #676331)
+    - fix segfault with empty LongOpt in --no-* branch
+  * ftparchive/apt-ftparchive.cc:
+    - default to putting the Contents-* files below $(SECTION) as apt-file
+      expects them there - thanks Martin-Éric Racine! (Closes: #675827)
+  * apt-pkg/deb/deblistparser.cc:
+    - set pkgCacheGen::Essential to "all" again (Closes: #675449)
+  * apt-pkg/algorithms.cc:
+    - force install only for one essential package out of a group
+  * apt-pkg/aptconfiguration.cc:
+    - if APT::Languages=none save "none" in allCodes so that the detected
+      configuration is cached as intended (Closes: #674690, LP: #1004947)
+  * apt-pkg/cacheiterators.h:
+    - add an IsMultiArchImplicit() method for Dep- and PrvIterator
+
+  [ Justin B Rye ]
+  * doc/apt-cdrom.8.xml:
+    - replace CDROM with the proper CD-ROM in text
+    - correct disc vs. disk issues
+  * doc/apt-extracttemplates.1.xml:
+    - debconf is not DebConf
+  * doc/apt-get.8.xml:
+    - move dselect-upgrade below dist-upgrade
+    - review and fix spelling issues
+  * doc/apt-ftparchive.8.xml, doc/apt-config.8.xml,
+    doc/apt-key.8.xml, doc/apt-mark.8.xml,
+    doc/apt_preferences.5.xml, doc/apt-secure.8.xml,
+    doc/apt-sortpkgs.1.xml, sources.list.5.xml:
+    - review and fix typo, grammar and style issues
+  * doc/apt.conf.5.xml:
+    - review and fix typo, grammar and style issues
+    - rephrase APT::Immediate-Configuration and many others
+
+  [ Sebastian Heinlein ]
+  * cmdline/apt-key:
+    - do not hardcode /etc but use Dir::Etc instead
+
+  [ Robert Luberda ]
+  * Polish manpage translation update (Closes: #675603)
+  * doc/apt-mark.8.xml:
+    - in hold, the option name is --file not --filename
+
+  [ Christian Perrier ]
+  * French program and manpage translation update
+  * Danish program translation by Joe Hansen. Closes: #675605
+
+  [ Thibaut Girka ]
+  * cmdline/apt-get.cc:
+    - complain correctly about :any build-dep on M-A:none packages
+  * apt-pkg/deb/deblistparser.cc:
+    - add support for arch-specific qualifiers in dependencies
+
+ -- Michael Vogt <mvo@debian.org>  Mon, 11 Jun 2012 16:21:53 +0200
+
+apt (0.9.5.1) unstable; urgency=low
+
+  [ David Kalnischkies ]
+  * apt-pkg/contrib/fileutl.cc:
+    - dup() given compressed fd in OpenDescriptor if AutoClose
+      is disabled as otherwise gzclose() and co will close it
+  * doc/*.xml:
+    - mark even more stuff as untranslateable and improve the
+      markup here and there (no real text change)
+    - use docbook DTD 4.5 instead of 4.2 to have valid docs
+
+  [ Justin B Rye ]
+  * doc/*.xml:
+    - remove 'GNU/Linux' from 'Debian systems' strings as Debian
+      has more systems than just GNU/Linux nowadays
+  * doc/apt-cache.8.xml:
+    - fix a typo as well as adding missing literal markup
+    - three small rewordings for better english sentences
+
+ -- Michael Vogt <mvo@debian.org>  Thu, 24 May 2012 17:16:34 +0200
+
+apt (0.9.5) unstable; urgency=low
+
+  [ Chris Leick ]
+  * proofreading of the manpage pot
+  * German manpage translation update (Closes: #673294)
+
+  [ David Kalnischkies ]
+  * buildlib/podomain.mak:
+    - ensure that all sources end up in the srclist so that we don't
+      forget to extract half of the translation strings
+  * buildlib/inttypes.h.in:
+    - remove inttypes.h compatibility as providing such a c99 types
+      compatibility conflicts with the usage of c99 type long long
+  * apt-pkg/contrib/mmap.cc:
+    - have a dummy SyncToFd around in case of ReadOnly access to a
+      compressed file as we otherwise on Close() do not delete[] the
+      char buffer but munmap() it… (Closes: #673815)
+  * debian/control:
+    - moving debiandoc-sgml to Build-Depends-Indep was one step too much
+      for the buildds as we still build two sgml files in arch:any
+  * debian/rules:
+    - move internal-solver as 'apt' to his friend dump-solver in
+      /usr/lib/apt/solvers to avoid writing a manpage for it
+
+ -- Michael Vogt <mvo@debian.org>  Tue, 22 May 2012 16:14:22 +0200
+
+apt (0.9.4) unstable; urgency=low
+
+  [ David Kalnischkies ]
+  * methods/http.cc:
+    - after many years of pointless discussions disable http/1.1 pipelining
+      by default as many webservers and proxies seem to be unable to conform
+      to specification must's (rfc2616 section 8.1.2.2) (LP: #996151)
+    - add spaces around PACKAGE_VERSION to fix FTBFS with -std=c++11
+  * apt-pkg/pkgcachegen.cc:
+    - make IsDuplicatedDescription static so that it is really private
+      as we don't need a symbol for it as it is not in a header
+  * Makefile, buildlib/*.mak:
+    - reshuffle dependencies so that parallel building seems to work
+    - separate manpages from the rest of the doc building
+  * prepare-release:
+    - apt-inst version isn't apt versions, so don't override variable
+  * debian/rules:
+    - apt-utils packages manpages, so it should depend on build-doc
+    - make apt and apt-utils packages depend on manpages instead of full doc
+  * debian/control:
+    - move doxygen and debiandoc-sgml to Build-Depends-Indep as docs
+      are no longer build in the same target as the manpages
+  * apt-pkg/acquire-methods.cc:
+    - factor out into private Dequeue() to fix access to deleted pointer
+  * apt-pkg/contrib/fileutl.cc:
+    - ensure that we close compressed fds, wait for forks and such even if
+      the FileFd itself is set to not autoclose the given Fd
+  * cmdline/apt-get.cc:
+    - use the host architecture, not the build architecture for matching
+      of [architecture restrictions] in Build-Depends (Closes: #672927)
+  * doc/makefile:
+    - build manpages with the correct l10n.gentext.default.language setting
+      to get the correct section titles provided by docbook
+  * doc/po/de.po:
+    - updated german manpage translation by Chris Leick, thanks!
+  * apt-pkg/packagemanager.cc:
+    - do not run into loop on new-pre-depends-breaks (Closes: #673536)
+  * doc/*.xml:
+    - add a few translator notes and reword some paragraphs to ensure that
+      translators and users alike can better understand them (Closes: #669409)
+    - in <term> mark all options with <option> and mark <term><option>
+      as untranslated for po4a removing ~200 unless "translateable" strings
+  * apt-pkg/aptconfiguration.cc:
+    - longcode Translation files are saved with encoded underscore,
+      so make sure to pick these files up as well for Acquire::Languages
+  * ftparchive/writer.cc:
+    - include Contents-* files in Release files (Closes: #673647)
+
+  [ Michael Vogt ]
+  * merged updated de.po, thanks to Holger Wansing (closes: #672466)
+  
+  [ Raphael Geissert ]
+  * apt-pkg/acquire*.cc:
+    - handle redirections in the worker with the right method instead of
+      in the method the redirection occured in (Closes: #668111)
+  * methods/http.cc:
+    - forbid redirects to change protocol
+  * methods/mirror.cc:
+    - generate an equal sign also for the first arch (Closes: #669142)
+
+  [ Marius Vollmer ]
+  * apt-pkg/algorithms.cc:
+    - fix memory leak of Flags in pkgSimulate by a proper destructor
+
+ -- Michael Vogt <mvo@debian.org>  Mon, 21 May 2012 12:29:05 +0200
+
+apt (0.9.3) unstable; urgency=low
+
+  [ David Kalnischkies ]
+  * apt-pkg/contrib/strutl.cc:
+    - remove the message size limit from ioprintf and strprintf
+  * apt-pkg/contrib/configuration.cc:
+    - add a more versatile Dump() method
+    - normalize a bit by replacing // and /./ with / in FindFile
+    - /dev/null is a special absolute path as it has no subdirectories
+  * apt-pkg/acquire-worker.cc:
+    - use Dump() to generate the configuration message for sending
+  * cmdline/apt-config.cc:
+    - make it possible to limit dump to a subtree
+    - implement --empty and --format option for dump
+  * apt-pkg/cdrom.cc:
+    - use Dump() to generate the configuration output
+  * apt-pkg/depcache.cc:
+    - clearly separate 'positive' and 'negative' dependencies and
+      their upgrade-resolution tries in MarkInstall and especially don't
+      treat Conflicts differently compared to Breaks here
+    - provider is only a possible solution if the provides has the right
+      version (or none as we have no versioned provides in debian) and not
+      if the version of the provider matches
+  * edsp/edspsystem.cc:
+    - check with RealFileExists for scenario file as otherwise a directory
+      like one provided with RootDir triggers the usage of EDSP
+  * debian/libapt-inst1.5.symbols:
+    - use the correct library name the symbols header
+  * apt-pkg/pkgcachegen.cc:
+    - check if NewDescription allocation has failed and error out accordingly
+    - check if we work on a valid description in IsDuplicateDescription as
+      we end up working on dangling pointers otherwise which segfaults on
+      s390x and ppc64 (Closes: #669427)
+  * apt-pkg/deb/deblistparser.cc:
+    - check length and containing chars for a given description md5sum
+  * ensure that apti18n.h is included last as advertised (Closes: #671623)
+  * apt-pkg/acquire-worker.cc:
+    - revert the use of FileFd::Write in OutFdReady as we don't want error
+      reports about EAGAIN here as we retry later. Thanks to YOSHINO Yoshihito
+      for the report. (Closes: #671721)
+  * apt-pkg/contrib/fileutl.cc:
+    - check that the fd which are closed are valid
+    - ensure that we do init d only once and especially not with its own
+      content as this causes some "interesting" hickups resulting in segfaults
+      as it seems (Closes: #554387, #670979)
+    - collect zombie (de)compressor processes on reopen
+    - ensure that in error conditions the Fail flag is set
+    - ensure that d is set before accessing it
+  * apt-pkg/aptconfiguration.cc:
+    - use NULL instead of "" for no (un)compress parameters
+  * apt-pkg/algorithms.cc:
+    - factor out of ListUpdate a AcquireUpdate to be able to provide your
+      own pkgAcquire fetcher to the wrapper
+  * apt-inst/deb/debfile.h:
+    - readd 'md5.h' to the uncleaned header includes to make qapt build
+      against us again unchanged to unblock transition (Closes: #669163)
+
+ -- Michael Vogt <mvo@debian.org>  Fri, 11 May 2012 17:16:22 +0200
+
+apt (0.9.2) unstable; urgency=low
+
+  [ Michael Vogt ]
+  * apt-inst/contrib/extracttar.cc:
+    - ensure that in StartGzip the InFd is set to "AutoClose" to ensure
+      that the pipe is closed when InFd is closed. This fixes a Fd leak
+      (LP: #985452)
+
+  [ David Kalnischkies ]
+   * apt-pkg/deb/deblistparser.cc:
+    - only treat the native apt as essential by default (Closes: #669377)
+  * apt-pkg/contrib/fileutl.cc:
+    - redirect stderr from compressors to /dev/null
+  * apt-pkg/aptconfiguration.cc:
+    - if the compressor is not installed, but we link against it's
+      library accept it as a CompressionType (Closes: #669328)
+  * apt-pkg/contrib/sha2_internal.cc:
+    - do not use the input data directly but memcpy it instead as
+      it could be unaligned as in the http-transport which causes
+      a sigbus error on sparc (Closes: #669061)
+  * apt-pkg/cacheset.cc:
+    - actually return to the fallback modifier if we have detected we
+      should for packagenames which look like modifiers (Closes: #669591)
+
+  [ Adam Conrad ]
+  * Set FD_CLOEXEC on history.log's FD (Closes: #610069, LP: #636010)
+
+  [ Thorsten Spindler ]
+  * apt-pkg/deb/dpkgpm.cc:
+    - do not crash if (*I).Pkg is NULL (LP: #939867)
+
+  [ Malcolm Scott ]
+  * apt-pkg/packagemanager.cc:
+    - iterate over all pre-depends or-group member instead of looping
+      endlessly over the first member in SmartUnpack (LP: #985852)
+
+ -- Michael Vogt <mvo@debian.org>  Fri, 20 Apr 2012 11:26:16 +0200
+
+apt (0.9.1) unstable; urgency=low
+
+  [ David Kalnischkies ]
+  * cmdline/apt-get.cc:
+    - if pkgCacheFile::Generate is disabled in 'update' don't
+      remove the caches (and don't try to open them)
+  * apt-pkg/packagemanager.cc:
+    - init counter in SmartConfigure so that the loop-breaker isn't
+      triggered at random… (Closes: #669060)
+
+  [ Christian Perrier ]
+  * Fix typo in apt-get(8). Closes: #664833
+  * Replace "argument" by "paramètre" in French translation.
+    Merci, les Titeps!
+  * Drop hardcoded "en.html" suffix in apt-secure manpage.
+    Thanks to David Prevot.
+  
+ -- Michael Vogt <mvo@debian.org>  Tue, 17 Apr 2012 09:49:31 +0200
+
 apt (0.9.0) unstable; urgency=low
 
   * upload to debian/unstable
@@ -507,6 +883,16 @@ apt (0.8.16~exp1) experimental; urgency=low
 
  -- Michael Vogt <mvo@debian.org>  Wed, 29 Jun 2011 12:40:31 +0200
 
+apt (0.8.15.11) UNRELEASED; urgency=low
+
+  * Fix typo in apt-get(8). Closes: #664833
+  * Replace "argument" by "paramètre" in French translation.
+    Merci, les Titeps!
+  * Drop hardcoded "en.html" suffix in apt-secure manpage.
+    Thanks to David Prevot.
+
+ -- Christian Perrier <bubulle@debian.org>  Tue, 27 Mar 2012 20:31:38 +0200
+
 apt (0.8.15.10) unstable; urgency=high
 
   [ David Kalnischkies ]

+ 5 - 2
debian/control

@@ -8,8 +8,9 @@ Uploaders: Michael Vogt <mvo@debian.org>, Otavio Salvador <otavio@debian.org>,
 Standards-Version: 3.9.3
 Build-Depends: dpkg-dev (>= 1.15.8), debhelper (>= 8.1.3~), libdb-dev,
  gettext (>= 0.12), libcurl4-gnutls-dev (>= 7.19.0),
- zlib1g-dev, libbz2-dev, debiandoc-sgml, xsltproc, docbook-xsl, docbook-xml,
- po4a (>= 0.34-2), autotools-dev, autoconf, automake, doxygen
+ zlib1g-dev, libbz2-dev, xsltproc, docbook-xsl, docbook-xml,
+ po4a (>= 0.34-2), autotools-dev, autoconf, automake
+Build-Depends-Indep: doxygen, debiandoc-sgml
 Build-Conflicts: autoconf2.13, automake1.4
 Vcs-Bzr: http://bzr.debian.org/apt/debian-sid/
 Vcs-Browser: http://bzr.debian.org/loggerhead/apt/debian-sid/
@@ -40,6 +41,7 @@ Architecture: any
 Multi-Arch: same
 Pre-Depends: ${misc:Pre-Depends}
 Depends: ${shlibs:Depends}, ${misc:Depends}
+Section: libs
 Description: package managment runtime library
  This library provides the common functionality for searching and
  managing packages as well as information about packages.
@@ -61,6 +63,7 @@ Architecture: any
 Multi-Arch: same
 Pre-Depends: ${misc:Pre-Depends}
 Depends: ${shlibs:Depends}, ${misc:Depends}
+Section: libs
 Description: deb package format runtime library
  This library provides methods to query and extract information
  from deb packages. This includes the control data and the package

+ 1 - 1
debian/libapt-inst1.5.symbols

@@ -1,4 +1,4 @@
-libapt-inst.so.1.4 libapt-inst1.4 #MINVER#
+libapt-inst.so.1.5 libapt-inst1.5 #MINVER#
 * Build-Depends-Package: libapt-pkg-dev
  (c++)"ExtractTar::Done(bool)@Base" 0.8.0
  (c++)"ExtractTar::Go(pkgDirStream&)@Base" 0.8.0

+ 0 - 1
debian/libapt-pkg4.12.symbols

@@ -1530,4 +1530,3 @@ libapt-pkg.so.4.12 libapt-pkg4.12 #MINVER#
  (c++|optional=private)"pkgCacheGenerator::MergeListVersion(pkgCacheGenerator::ListParser&, pkgCache::PkgIterator&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, pkgCache::VerIterator*&)@Base" 0.8.16~exp7
  (c++|optional=private)"pkgCacheGenerator::AddImplicitDepends(pkgCache::GrpIterator&, pkgCache::PkgIterator&, pkgCache::VerIterator&)@Base" 0.8.16~exp7
  (c++|optional=private)"pkgCacheGenerator::AddImplicitDepends(pkgCache::VerIterator&, pkgCache::PkgIterator&)@Base" 0.8.16~exp7
- (c++|optional=internal)"IsDuplicateDescription(pkgCache::DescIterator, HashSumValue<128> const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@Base" 0.8.16~exp7

+ 16 - 9
debian/rules

@@ -51,7 +51,7 @@ override BLD := ./build
 endif
 
 # APT Programs in apt-utils
-APT_UTILS=ftparchive sortpkgs extracttemplates internal-solver
+APT_UTILS=ftparchive sortpkgs extracttemplates
 
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
@@ -67,7 +67,8 @@ LIBAPT_INST=libapt-inst$(LIBAPTINST_MAJOR)
 export DPKG_GENSYMBOLS_CHECK_LEVEL=0
 
 build: build/build-stamp
-build-doc: build/build-doc-stamp
+build-debiandoc: build/build-debiandoc-stamp
+build-manpages: build/build-manpages-stamp
 
 # Note that this is unconditionally done first as part of loading environment.mak
 # The true is needed to force make to reload environment.mak after running
@@ -97,9 +98,14 @@ else
 endif
 	touch $@
 
-build/build-doc-stamp: build/configure-stamp
+build/build-debiandoc-stamp: build/configure-stamp
 	# Add here commands to compile the package.
-	$(MAKE) doc
+	$(MAKE) debiandoc
+	touch $@
+
+build/build-manpages-stamp: build/configure-stamp
+	# Add here commands to compile the package.
+	$(MAKE) manpages
 	touch $@
 
 clean:
@@ -115,7 +121,7 @@ debian/%.install: debian/%.install.in
 
 binary-indep: apt-doc libapt-pkg-doc
 # Build architecture-independent files here.
-libapt-pkg-doc: build-doc
+libapt-pkg-doc: build-debiandoc
 	dh_testdir -p$@
 	dh_testroot -p$@
 	dh_prep -p$@
@@ -141,7 +147,7 @@ libapt-pkg-doc: build-doc
 	dh_md5sums -p$@
 	dh_builddeb -p$@
 
-apt-doc: build-doc
+apt-doc: build-debiandoc
 	dh_testdir -p$@
 	dh_testroot -p$@
 	dh_prep -p$@
@@ -167,7 +173,7 @@ apt-doc: build-doc
 
 binary-arch: $(LIBAPT_PKG) $(LIBAPT_INST) apt libapt-pkg-dev apt-utils apt-transport-https
 apt_MANPAGES = apt-cache apt-cdrom apt-config apt-get apt-key apt-mark apt-secure apt apt.conf apt_preferences sources.list
-apt: build build-doc
+apt: build build-manpages
 	dh_testdir -p$@
 	dh_testroot -p$@
 	dh_prep -p$@
@@ -185,7 +191,7 @@ apt: build build-doc
 	dh_install -p$@ --sourcedir=$(BLD)
 
 	# Remove the bits that are in apt-utils
-	rm $(addprefix debian/$@/usr/bin/apt-,$(APT_UTILS) dump-solver)
+	rm $(addprefix debian/$@/usr/bin/apt-,$(APT_UTILS) dump-solver internal-solver)
 
 	# https has its own package
 	rm debian/$@/usr/lib/apt/methods/https
@@ -231,7 +237,7 @@ libapt-pkg-dev: build debian/libapt-pkg-dev.install
 	dh_builddeb -p$@
 
 apt-utils_MANPAGES = apt-sortpkgs apt-ftparchive apt-extracttemplates
-apt-utils: build
+apt-utils: build build-manpages
 	dh_testdir -p$@
 	dh_testroot -p$@
 	dh_prep -p$@
@@ -239,6 +245,7 @@ apt-utils: build
 
 	cp $(addprefix $(BLD)/bin/apt-,$(APT_UTILS)) debian/$@/usr/bin/
 	cp $(BLD)/bin/apt-dump-solver debian/$@/usr/lib/apt/solvers/dump
+	cp $(BLD)/bin/apt-internal-solver debian/$@/usr/lib/apt/solvers/apt
 
 	dh_install -p$@ --sourcedir=$(BLD)
 	dh_link -p$@

+ 33 - 36
doc/apt-cache.8.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="no"?>
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
-  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
 
 <!ENTITY % aptent SYSTEM "apt.ent">
 %aptent;
@@ -18,7 +18,7 @@
    &apt-email;
    &apt-product;
    <!-- The last update date -->
-   <date>04 February 2011</date>
+   <date>2012-06-09T00:00:00Z</date>
  </refentryinfo>
  
  <refmeta>
@@ -45,14 +45,12 @@
    commands below must be present.</para>
 
    <variablelist>
-     <varlistentry><term>gencaches</term>
-     <listitem><para><literal>gencaches</literal> performs the same operation as 
-     <command>apt-get check</command>. It builds the source and package caches from 
-     the sources in &sources-list; and from
-     <filename>/var/lib/dpkg/status</filename>.</para></listitem>
+     <varlistentry><term><option>gencaches</option></term>
+     <listitem><para><literal>gencaches</literal> creates APT's package cache. This is done
+     implicitly by all commands needing this cache if it is missing or outdated.</para></listitem>
      </varlistentry>
 
-     <varlistentry><term>showpkg <replaceable>pkg(s)</replaceable></term>
+     <varlistentry><term><option>showpkg</option> <option><replaceable>&synopsis-pkg;</replaceable>…</option></term>
      <listitem><para><literal>showpkg</literal> displays information about the packages listed on the 
      command line. Remaining arguments are package names. The available 
      versions and reverse dependencies of each package listed are listed, as 
@@ -86,7 +84,7 @@ Reverse Provides:
      is best to consult the apt source code.</para></listitem>
      </varlistentry>
 
-     <varlistentry><term>stats</term><listitem><para><literal>stats</literal> displays some statistics about the cache.
+     <varlistentry><term><option>stats</option></term><listitem><para><literal>stats</literal> displays some statistics about the cache.
      No further arguments are expected. Statistics reported are:
      <itemizedlist>
        <listitem><para><literal>Total package names</literal> is the number of package names found 
@@ -102,20 +100,20 @@ Reverse Provides:
        <listitem><para><literal>Pure virtual packages</literal> is the number of packages that exist 
        only as a virtual package name; that is, packages only "provide" the 
        virtual package name, and no package actually uses the name. For 
-       instance, "mail-transport-agent" in the Debian GNU/Linux system is a 
+       instance, "mail-transport-agent" in the Debian system is a 
        pure virtual package; several packages provide "mail-transport-agent", 
        but there is no package named "mail-transport-agent".</para>
        </listitem>
    
        <listitem><para><literal>Single virtual packages</literal> is the number of packages with only 
        one package providing a particular virtual package. For example, in the
-       Debian GNU/Linux system, "X11-text-viewer" is a virtual package, but 
+       Debian system, "X11-text-viewer" is a virtual package, but 
        only one package, xless, provides "X11-text-viewer".</para>
        </listitem>
 
        <listitem><para><literal>Mixed virtual packages</literal> is the number of packages that either 
        provide a particular virtual package or have the virtual package name 
-       as the package name. For instance, in the Debian GNU/Linux system, 
+       as the package name. For instance, in the Debian system, 
        "debconf" is both an actual package, and provided by the debconf-tiny
        package.</para>
        </listitem>
@@ -129,8 +127,8 @@ Reverse Provides:
 
        <listitem><para><literal>Total distinct</literal> versions is the number of package versions 
        found in the cache; this value is therefore at least equal to the 
-       number of total package names. If more than one distribution (both 
-       "stable" and "unstable", for instance), is being accessed, this value 
+       number of total package names. If more than one distribution is being accessed
+       (for instance, "stable" and "unstable"), this value
        can be considerably larger than the number of total package names.</para>
        </listitem>
 
@@ -141,38 +139,36 @@ Reverse Provides:
      </para></listitem>
      </varlistentry>
      
-     <varlistentry><term>showsrc <replaceable>pkg(s)</replaceable></term>
+     <varlistentry><term><option>showsrc</option> <option><replaceable>&synopsis-pkg;</replaceable>…</option></term>
      <listitem><para><literal>showsrc</literal> displays all the source package records that match
      the given package names. All versions are shown, as well as all 
-     records that declare the name to be a Binary.</para></listitem>
+     records that declare the name to be a binary package.</para></listitem>
      </varlistentry>
      
-     <varlistentry><term>dump</term>
+     <varlistentry><term><option>dump</option></term>
      <listitem><para><literal>dump</literal> shows a short listing of every package in the cache. It is 
      primarily for debugging.</para></listitem>
      </varlistentry>
 
-     <varlistentry><term>dumpavail</term>
+     <varlistentry><term><option>dumpavail</option></term>
      <listitem><para><literal>dumpavail</literal> prints out an available list to stdout. This is 
      suitable for use with &dpkg; and is used by the &dselect; method.</para></listitem>
      </varlistentry>
 
-     <varlistentry><term>unmet</term>
+     <varlistentry><term><option>unmet</option></term>
      <listitem><para><literal>unmet</literal> displays a summary of all unmet dependencies in the 
      package cache.</para></listitem>
      </varlistentry>
 
-     <varlistentry><term>show <replaceable>pkg(s)</replaceable></term>
+     <varlistentry><term><option>show</option> <option><replaceable>&synopsis-pkg;</replaceable>…</option></term>
      <listitem><para><literal>show</literal> performs a function similar to 
      <command>dpkg --print-avail</command>; it displays the package records for the 
      named packages.</para></listitem>
      </varlistentry>
 
-     <varlistentry><term>search <replaceable>regex [ regex ... ]</replaceable></term>
+     <varlistentry><term><option>search</option> <option><replaceable>&synopsis-regex;</replaceable>…</option></term>
      <listitem><para><literal>search</literal> performs a full text search on all available package
-     lists for the POSIX regex pattern given, see 
-     <citerefentry><refentrytitle><command>regex</command></refentrytitle>
-     <manvolnum>7</manvolnum></citerefentry>.
+     lists for the POSIX regex pattern given, see &regex;.
      It searches the package names and the
      descriptions for an occurrence of the regular expression and prints out
      the package name and the short description, including virtual package
@@ -186,17 +182,17 @@ Reverse Provides:
      are and'ed together.</para></listitem>
      </varlistentry>
 
-     <varlistentry><term>depends <replaceable>pkg(s)</replaceable></term>
+     <varlistentry><term><option>depends</option> <option><replaceable>&synopsis-pkg;</replaceable>…</option></term>
      <listitem><para><literal>depends</literal> shows a listing of each dependency a package has 
      and all the possible other packages that can fulfill that dependency.</para></listitem>
      </varlistentry>
 
-     <varlistentry><term>rdepends <replaceable>pkg(s)</replaceable></term>
+     <varlistentry><term><option>rdepends</option> <option><replaceable>&synopsis-pkg;</replaceable>…</option></term>
      <listitem><para><literal>rdepends</literal> shows a listing of each reverse dependency a
       package has.</para></listitem>
      </varlistentry>
 
-     <varlistentry><term>pkgnames <replaceable>[ prefix ]</replaceable></term>
+     <varlistentry><term><option>pkgnames</option> <optional><replaceable>&synopsis-prefix;</replaceable></optional></term>
      <listitem><para>This command prints the name of each package APT knows. The optional
      argument is a prefix match to filter the name list. The output is suitable
      for use in a shell tab complete function and the output is generated 
@@ -207,7 +203,7 @@ Reverse Provides:
      </para></listitem>
      </varlistentry>
      
-     <varlistentry><term>dotty <replaceable>pkg(s)</replaceable></term>
+     <varlistentry><term><option>dotty</option> <option><replaceable>&synopsis-pkg;</replaceable>…</option></term>
      <listitem><para><literal>dotty</literal> takes a list of packages on the command line and 
      generates output suitable for use by dotty from the 
      <ulink url="http://www.research.att.com/sw/tools/graphviz/">GraphViz</ulink>
@@ -218,26 +214,26 @@ Reverse Provides:
      set the <literal>APT::Cache::GivenOnly</literal> option.</para>
 
      <para>The resulting nodes will have several shapes; normal packages are boxes,
-     pure provides are triangles, mixed provides are diamonds, 
+     pure virtual packages are triangles, mixed virtual packages are diamonds,
      missing packages are hexagons. Orange boxes mean recursion was stopped 
-     [leaf packages], blue lines are pre-depends, green lines are conflicts.</para>
+     (leaf packages), blue lines are pre-depends, green lines are conflicts.</para>
 
      <para>Caution, dotty cannot graph larger sets of packages.</para></listitem>
      </varlistentry>
      
-     <varlistentry><term>xvcg <replaceable>pkg(s)</replaceable></term>
+     <varlistentry><term><option>xvcg</option> <option><replaceable>&synopsis-pkg;</replaceable>…</option></term>
 	 <listitem><para>The same as <literal>dotty</literal>, only for xvcg from the
 	 <ulink url="http://rw4.cs.uni-sb.de/users/sander/html/gsvcg1.html">VCG tool</ulink>.
 	 </para></listitem></varlistentry>
 
-     <varlistentry><term>policy <replaceable>[ pkg(s) ]</replaceable></term>
+	 <varlistentry><term><option>policy</option> <optional><replaceable>&synopsis-pkg;</replaceable>…</optional></term>
      <listitem><para><literal>policy</literal> is meant to help debug issues relating to the 
      preferences file. With no arguments it will print out the 
      priorities of each source. Otherwise it prints out detailed information
      about the priority selection of the named package.</para></listitem>
      </varlistentry>
 
-     <varlistentry><term>madison <replaceable>[ pkg(s) ]</replaceable></term>
+     <varlistentry><term><option>madison</option> <option><replaceable>&synopsis-pkg;</replaceable>…</option></term>
      <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
      archive management tool, <literal>madison</literal>.  It displays
@@ -275,7 +271,8 @@ Reverse Provides:
      </varlistentry>
 
      <varlistentry><term><option>-i</option></term><term><option>--important</option></term>
-     <listitem><para>Print only important dependencies; for use with unmet and depends. Causes only Depends and 
+     <listitem><para>Print only important dependencies; for use with <literal>unmet</literal>
+     and <literal>depends</literal>. Causes only Depends and
      Pre-Depends relations to be printed.
      Configuration Item: <literal>APT::Cache::Important</literal>.</para></listitem>
      </varlistentry>
@@ -303,7 +300,7 @@ Reverse Provides:
      <listitem><para>Print full records for all available versions. This is the
      default; to turn it off, use <option>--no-all-versions</option>.
      If <option>--no-all-versions</option> is specified, only the candidate version
-     will displayed (the one which would be selected for installation).
+     will be displayed (the one which would be selected for installation).
      This option is only applicable to  the <literal>show</literal> command.
      Configuration Item: <literal>APT::Cache::AllVersions</literal>.</para></listitem>
      </varlistentry>

+ 17 - 18
doc/apt-cdrom.8.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="no"?>
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
-  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
 
 <!ENTITY % aptent SYSTEM "apt.ent">
 %aptent;
@@ -17,7 +17,7 @@
    &apt-author.team;
    &apt-email;
    &apt-product;
-   <date>14 February 2004</date>
+   <date>2012-06-09T00:00:00Z</date>
  </refentryinfo>
 
  <refmeta>
@@ -29,13 +29,13 @@
  <!-- Man page title -->
  <refnamediv>
     <refname>apt-cdrom</refname>
-    <refpurpose>APT CDROM management utility</refpurpose>
+    <refpurpose>APT CD-ROM management utility</refpurpose>
  </refnamediv>
 
  &synopsis-command-apt-cdrom;
 
  <refsect1><title>Description</title>
-   <para><command>apt-cdrom</command> is used to add a new CDROM to APTs list
+   <para><command>apt-cdrom</command> is used to add a new CD-ROM to APT's list
     of available sources. <command>apt-cdrom</command> takes care of
    determining the structure of
    the disc as well as correcting for several possible mis-burns and 
@@ -43,39 +43,38 @@
    </para>
 
    <para>It is necessary to use <command>apt-cdrom</command> to add CDs to the
-   APT system, 
-   it cannot be done by hand. Furthermore each disk in a multi-cd set must be
+   APT system;
+   it cannot be done by hand. Furthermore each disc in a multi-CD set must be
    inserted and scanned separately to account for possible mis-burns.
    </para>
 
    <para>Unless the <option>-h</option>, or <option>--help</option> option is
-    given one of the commands below must be present.
-   
+   given, one of the commands below must be present.</para>
+
     <variablelist>
-     <varlistentry><term>add</term>
+     <varlistentry><term><option>add</option></term>
      <listitem><para><literal>add</literal> is used to add a new disc to the
      source list. It will unmount the
-     CDROM device, prompt for a disk to be inserted and then proceed to 
+     CD-ROM device, prompt for a disc to be inserted and then proceed to 
      scan it and copy the index files. If the disc does not have a proper
-     <filename>disk</filename> directory you will be prompted for a descriptive 
+     <filename>.disk</filename> directory you will be prompted for a descriptive 
      title.
      </para>
 
-     <para>APT uses a CDROM ID to track which disc is currently in the drive and
+     <para>APT uses a CD-ROM ID to track which disc is currently in the drive and
      maintains a database of these IDs in 
      <filename>&statedir;/cdroms.list</filename>
      </para>
      </listitem>
      </varlistentry>
      
-     <varlistentry><term>ident</term>
+     <varlistentry><term><option>ident</option></term>
      <listitem><para>A debugging tool to report the identity of the current
       disc as well as the stored file name
      </para>
      </listitem>
      </varlistentry>
     </variablelist>
-   </para>
  </refsect1>
 
  <refsect1><title>Options</title>
@@ -83,7 +82,7 @@
    
    <variablelist>
      <varlistentry><term><option>-d</option></term><term><option>--cdrom</option></term>
-     <listitem><para>Mount point; specify the location to mount the cdrom. This
+     <listitem><para>Mount point; specify the location to mount the CD-ROM. This
       mount point must be listed in <filename>/etc/fstab</filename> and
       properly configured.
       Configuration Item: <literal>Acquire::cdrom::mount</literal>.
@@ -92,8 +91,8 @@
      </varlistentry>
      
      <varlistentry><term><option>-r</option></term><term><option>--rename</option></term>
-     <listitem><para>Rename a disc; change the label of a disk or override the
-      disks given label. This option will cause <command>apt-cdrom</command> to
+     <listitem><para>Rename a disc; change the label of a disc or override the
+      disc's given label. This option will cause <command>apt-cdrom</command> to
       prompt for a new label.
      Configuration Item: <literal>APT::CDROM::Rename</literal>.
      </para>

+ 28 - 13
doc/apt-config.8.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="no"?>
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
-  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
 
 <!ENTITY % aptent SYSTEM "apt.ent">
 %aptent;
@@ -18,7 +18,7 @@
    &apt-email;
    &apt-product;
    <!-- The last update date -->
-   <date>29 February 2004</date>
+   <date>2012-06-09T00:00:00Z</date>
  </refentryinfo>
  
  <refmeta>
@@ -39,20 +39,20 @@
    <para><command>apt-config</command> is an internal program used by various
    portions of the APT suite to provide consistent configurability. It accesses
    the main configuration file <filename>/etc/apt/apt.conf</filename> in a
-   manner that is easy to use by scripted applications.</para>
+   manner that is easy to use for scripted applications.</para>
 
    <para>Unless the <option>-h</option>, or <option>--help</option> option is
-   given one of the commands below must be present.
+   given, one of the commands below must be present.
    </para>
    
    <variablelist>
-     <varlistentry><term>shell</term>
+     <varlistentry><term><option>shell</option></term>
      <listitem><para>
-     shell is used to access the configuration information from a shell 
-     script. It is given pairs of arguments, the first being a shell 
-     variable and the second the configuration value to query. As output 
-     it lists a series of shell assignments commands for each present value. 
-     In a shell script it should be used like:
+     shell is used to access the configuration information from a shell
+     script. It is given pairs of arguments, the first being a shell
+     variable and the second the configuration value to query. As output
+     it lists shell assignment commands for each value present.
+     In a shell script it should be used as follows:
      </para>
      
 <informalexample><programlisting>
@@ -72,7 +72,7 @@ eval $RES
      </listitem>
      </varlistentry>
 
-     <varlistentry><term>dump</term>
+     <varlistentry><term><option>dump</option></term>
      <listitem><para>
      Just show the contents of the configuration space.</para>
      </listitem>
@@ -85,7 +85,22 @@ eval $RES
    &apt-cmdblurb;
    
    <variablelist>
-   
+     <varlistentry>
+      <term><option>--empty</option></term>
+      <listitem><para>Include options which have an empty value. This is the default, so
+		      use --no-empty to remove them from the output.</para></listitem>
+     </varlistentry>
+
+     <varlistentry>
+      <term><option>--format '<replaceable>&percnt;f &#x0022;&percnt;v&#x0022;;&percnt;n</replaceable>'</option></term>
+      <listitem><para>Defines the output of each config option. &percnt;t will be replaced with its individual name,
+		      &percnt;f with its full hierarchical name and &percnt;v with its value.
+		      Use uppercase letters and special characters in the value will be encoded to ensure that
+		      it can e.g. be safely used in a quoted-string as defined by RFC822. Additionally
+		      &percnt;n will be replaced by a newline, and &percnt;N by a tab. A &percnt; can be
+		      printed by using &percnt;&percnt;.</para></listitem>
+     </varlistentry>
+
      &apt-commonoptions;
      
    </variablelist>

+ 8 - 7
doc/apt-extracttemplates.1.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="no"?>
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
-  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
 
 <!ENTITY % aptent SYSTEM "apt.ent">
 %aptent;
@@ -18,7 +18,7 @@
    &apt-email;
    &apt-product;
    <!-- The last update date -->
-   <date>29 February 2004</date>
+   <date>2012-06-09T00:00:00Z</date>
  </refentryinfo>
  
  <refmeta>
@@ -30,7 +30,7 @@
  <!-- Man page title -->
  <refnamediv>
     <refname>apt-extracttemplates</refname>
-    <refpurpose>Utility to extract DebConf config and templates from Debian packages</refpurpose>
+    <refpurpose>Utility to extract <command>debconf</command> config and templates from Debian packages</refpurpose>
  </refnamediv>
 
  &synopsis-command-apt-extracttemplates;
@@ -43,8 +43,9 @@
    in the format:</para>
    <para>package version template-file config-script</para>
    <para>template-file and config-script are written to the temporary directory
-   specified by the -t or --tempdir (<literal>APT::ExtractTemplates::TempDir</literal>) 
-   directory, with filenames of the form <filename>package.template.XXXX</filename> and 
+   specified by the <option>-t</option> or <option>--tempdir</option>
+   (<literal>APT::ExtractTemplates::TempDir</literal>) directory,
+   with filenames of the form <filename>package.template.XXXX</filename> and
    <filename>package.config.XXXX</filename></para>
  </refsect1>
  
@@ -54,7 +55,7 @@
    <variablelist>
      <varlistentry><term><option>-t</option></term><term><option>--tempdir</option></term>
      <listitem><para>
-     Temporary directory in which to write extracted debconf template files
+     Temporary directory in which to write extracted <command>debconf</command> template files
      and config scripts.
      Configuration Item: <literal>APT::ExtractTemplates::TempDir</literal></para></listitem>
      </varlistentry>

+ 79 - 79
doc/apt-ftparchive.1.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="no"?>
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
-  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
 
 <!ENTITY % aptent SYSTEM "apt.ent">
 %aptent;
@@ -18,7 +18,7 @@
    &apt-email;
    &apt-product;
    <!-- The last update date -->
-   <date>17 August 2009</date>
+   <date>2012-06-09T00:00:00Z</date>
  </refentryinfo>
  
  <refmeta>
@@ -51,11 +51,11 @@
    programs aside from &gzip;. When doing a full generate it automatically 
    performs file-change checks and builds the desired compressed output files.</para>
    
-   <para>Unless the <option>-h</option>, or <option>--help</option> option is given one of the
-   commands below must be present.</para>
+   <para>Unless the <option>-h</option>, or <option>--help</option> option is given,
+   one of the commands below must be present.</para>
    
    <variablelist>
-     <varlistentry><term>packages</term>
+     <varlistentry><term><option>packages</option></term>
      <listitem><para>
      The packages command generates a package file from a directory tree. It
      takes the given directory and recursively searches it for .deb files, 
@@ -65,7 +65,7 @@
      <para>The option <option>--db</option> can be used to specify a binary caching DB.</para></listitem>
      </varlistentry>
      
-     <varlistentry><term>sources</term>
+     <varlistentry><term><option>sources</option></term>
      <listitem><para>
      The <literal>sources</literal> command generates a source index file from a directory tree. 
      It takes the given directory and recursively searches it for .dsc files,
@@ -77,7 +77,7 @@
      used to change the source override file that will be used.</para></listitem>
      </varlistentry>
 
-     <varlistentry><term>contents</term>
+     <varlistentry><term><option>contents</option></term>
      <listitem><para>
      The <literal>contents</literal> command generates a contents file from a directory tree. It
      takes the given directory and recursively searches it for .deb files, 
@@ -89,16 +89,16 @@
      The option <option>--db</option> can be used to specify a binary caching DB.</para></listitem>
      </varlistentry>
 
-     <varlistentry><term>release</term>
+     <varlistentry><term><option>release</option></term>
      <listitem><para>
      The <literal>release</literal> command generates a Release file from a
      directory tree. It recursively searches the given directory for uncompressed
-     <filename>Packages</filename> and <filename>Sources</filename> files and the ones
+     <filename>Packages</filename> and <filename>Sources</filename> files and ones
      compressed with <command>gzip</command>, <command>bzip2</command> or <command>lzma</command>
      as well as <filename>Release</filename> and <filename>md5sum.txt</filename> files by default
      (<literal>APT::FTPArchive::Release::Default-Patterns</literal>). Additional filename patterns
      can be added by listing them in <literal>APT::FTPArchive::Release::Patterns</literal>.
-     It then writes to stdout a Release file containing a MD5, SHA1 and SHA256 digest
+     It then writes to stdout a <filename>Release</filename> file containing an MD5, SHA1 and SHA256 digest
      for each file.</para>
      <para>
      Values for the additional metadata fields in the Release file are
@@ -112,7 +112,7 @@
 
      </varlistentry>
 
-     <varlistentry><term>generate</term>
+     <varlistentry><term><option>generate</option></term>
      <listitem><para>
      The <literal>generate</literal> command is designed to be runnable from a cron script and
      builds indexes according to the given config file. The config language
@@ -121,7 +121,7 @@
      required settings.</para></listitem>
      </varlistentry>
 
-     <varlistentry><term>clean</term>
+     <varlistentry><term><option>clean</option></term>
      <listitem><para>
      The <literal>clean</literal> command tidies the databases used by the given 
      configuration file by removing any records that are no longer necessary.</para></listitem>
@@ -139,33 +139,33 @@
    tree manner. This only effects how the scope tag is handled.</para>
 
    <para>
-   The generate configuration has 4 separate sections, each described below.</para>
+   The generate configuration has four separate sections, each described below.</para>
 
-   <refsect2><title>Dir Section</title>
+     <refsect2><title><literal>Dir</literal> Section</title>
      <para>
      The <literal>Dir</literal> section defines the standard directories needed to 
      locate the files required during the generation process. These 
      directories are prepended certain relative paths defined in later 
      sections to produce a complete an absolute path.</para>
      <variablelist>     
-      <varlistentry><term>ArchiveDir</term>
+      <varlistentry><term><option>ArchiveDir</option></term>
       <listitem><para>
       Specifies the root of the FTP archive, in a standard
       Debian configuration this is the directory that contains the 
       <filename>ls-LR</filename> and dist nodes.</para></listitem>
       </varlistentry>
 
-      <varlistentry><term>OverrideDir</term>
+      <varlistentry><term><option>OverrideDir</option></term>
       <listitem><para>
       Specifies the location of the override files.</para></listitem>
       </varlistentry>
       
-      <varlistentry><term>CacheDir</term>
+      <varlistentry><term><option>CacheDir</option></term>
       <listitem><para>
-      Specifies the location of the cache files</para></listitem>
+      Specifies the location of the cache files.</para></listitem>
       </varlistentry>
       
-      <varlistentry><term>FileListDir</term>
+      <varlistentry><term><option>FileListDir</option></term>
       <listitem><para>
       Specifies the location of the file list files, 
       if the <literal>FileList</literal> setting is used below.</para></listitem>
@@ -173,87 +173,87 @@
      </variablelist>
    </refsect2>
    
-   <refsect2><title>Default Section</title>
+   <refsect2><title><literal>Default</literal> Section</title>
      <para>
      The <literal>Default</literal> section specifies default values, and settings 
      that control the operation of the generator. Other sections may override 
      these defaults with a per-section setting.</para>
      <variablelist>     
-      <varlistentry><term>Packages::Compress</term>
+      <varlistentry><term><option>Packages::Compress</option></term>
       <listitem><para>
       Sets the default compression schemes to use 
-      for the Package index files. It is a string that contains a space 
+      for the package index files. It is a string that contains a space 
       separated list of at least one of: '.' (no compression), 'gzip' and 
       'bzip2'. The default for all compression schemes is '. gzip'.</para></listitem>
       </varlistentry>
 
-      <varlistentry><term>Packages::Extensions</term>
+      <varlistentry><term><option>Packages::Extensions</option></term>
       <listitem><para>
       Sets the default list of file extensions that are package files.
       This defaults to '.deb'.</para></listitem>
       </varlistentry>
       
-      <varlistentry><term>Sources::Compress</term>
+      <varlistentry><term><option>Sources::Compress</option></term>
       <listitem><para>
       This is similar to <literal>Packages::Compress</literal> 
       except that it controls the compression for the Sources files.</para></listitem>
       </varlistentry>
       
-      <varlistentry><term>Sources::Extensions</term>
+      <varlistentry><term><option>Sources::Extensions</option></term>
       <listitem><para>
       Sets the default list of file extensions that are source files.
       This defaults to '.dsc'.</para></listitem>
       </varlistentry>
       
-      <varlistentry><term>Contents::Compress</term>
+      <varlistentry><term><option>Contents::Compress</option></term>
       <listitem><para>
       This is similar to <literal>Packages::Compress</literal> 
       except that it controls the compression for the Contents files.</para></listitem>
       </varlistentry>
 
-      <varlistentry><term>Translation::Compress</term>
+      <varlistentry><term><option>Translation::Compress</option></term>
       <listitem><para>
       This is similar to <literal>Packages::Compress</literal> 
       except that it controls the compression for the Translation-en master file.</para></listitem>
       </varlistentry>
 
-      <varlistentry><term>DeLinkLimit</term>
+      <varlistentry><term><option>DeLinkLimit</option></term>
       <listitem><para>
       Specifies the number of kilobytes to delink (and 
       replace with hard links) per run. This is used in conjunction with the 
       per-section <literal>External-Links</literal> setting.</para></listitem>
       </varlistentry>
       
-      <varlistentry><term>FileMode</term>
+      <varlistentry><term><option>FileMode</option></term>
       <listitem><para>
       Specifies the mode of all created index files. It 
       defaults to 0644. All index files are set to this mode with no regard 
       to the umask.</para></listitem>
       </varlistentry>
 
-      <varlistentry><term>LongDescription</term>
+      <varlistentry><term><option>LongDescription</option></term>
       <listitem><para>
-      Sets if long descriptions should be included in the Packages file or split
-      out into a master Translation-en file.</para></listitem>
+      Specifies whether long descriptions should be included in the <filename>Packages</filename> file or split
+      out into a master <filename>Translation-en</filename> file.</para></listitem>
       </varlistentry>
      </variablelist>
    </refsect2>
    
-   <refsect2><title>TreeDefault Section</title>
+   <refsect2><title><literal>TreeDefault</literal> Section</title>
      <para>
      Sets defaults specific to <literal>Tree</literal> sections. All of these
      variables are substitution variables and have the strings $(DIST), 
      $(SECTION) and $(ARCH) replaced with their respective values.</para>
      
      <variablelist>     
-      <varlistentry><term>MaxContentsChange</term>
+      <varlistentry><term><option>MaxContentsChange</option></term>
       <listitem><para>
       Sets  the number of kilobytes of contents 
       files that are generated each day. The contents files are round-robined
       so that over several days they will all be rebuilt.</para></listitem>
       </varlistentry>
       
-      <varlistentry><term>ContentsAge</term>
+      <varlistentry><term><option>ContentsAge</option></term>
       <listitem><para>
       Controls the number of days a contents file is allowed
       to be checked without changing. If this limit is passed the mtime of the 
@@ -264,72 +264,72 @@
       the units are in days.</para></listitem>
       </varlistentry>
       
-      <varlistentry><term>Directory</term>
+      <varlistentry><term><option>Directory</option></term>
       <listitem><para>
       Sets the top of the .deb directory tree. Defaults to
       <filename>$(DIST)/$(SECTION)/binary-$(ARCH)/</filename></para></listitem>
       </varlistentry>
       
-      <varlistentry><term>SrcDirectory</term>
+      <varlistentry><term><option>SrcDirectory</option></term>
       <listitem><para>
       Sets the top of the source package directory tree. Defaults to
       <filename>$(DIST)/$(SECTION)/source/</filename></para></listitem>
       </varlistentry>
       
-      <varlistentry><term>Packages</term>
+      <varlistentry><term><option>Packages</option></term>
       <listitem><para>
       Sets the output Packages file. Defaults to 
       <filename>$(DIST)/$(SECTION)/binary-$(ARCH)/Packages</filename></para></listitem>
       </varlistentry>
       
-      <varlistentry><term>Sources</term>
+      <varlistentry><term><option>Sources</option></term>
       <listitem><para>
       Sets the output Sources file. Defaults to 
       <filename>$(DIST)/$(SECTION)/source/Sources</filename></para></listitem>
       </varlistentry>
 
-      <varlistentry><term>Translation</term>
+      <varlistentry><term><option>Translation</option></term>
       <listitem><para>
-      Set the output Translation-en master file with the long descriptions if they
+      Sets the output Translation-en master file with the long descriptions if they
       should be not included in the Packages file. Defaults to
       <filename>$(DIST)/$(SECTION)/i18n/Translation-en</filename></para></listitem>
       </varlistentry>
 
-      <varlistentry><term>InternalPrefix</term>
+      <varlistentry><term><option>InternalPrefix</option></term>
       <listitem><para>
       Sets the path prefix that causes a symlink to be
       considered an internal link instead of an external link. Defaults to
       <filename>$(DIST)/$(SECTION)/</filename></para></listitem>
       </varlistentry>
       
-      <varlistentry><term>Contents</term>
+      <varlistentry><term><option>Contents</option></term>
       <listitem><para>
       Sets the output Contents file. Defaults to
-      <filename>$(DIST)/Contents-$(ARCH)</filename>. If this setting causes multiple 
-      Packages files to map onto a single Contents file (such as the default) 
+      <filename>$(DIST)/$(SECTION)/Contents-$(ARCH)</filename>. If this setting causes multiple 
+      Packages files to map onto a single Contents file (as is the default) 
       then <command>apt-ftparchive</command> will integrate those package files 
       together automatically.</para></listitem>
       </varlistentry>
       
-      <varlistentry><term>Contents::Header</term>
+      <varlistentry><term><option>Contents::Header</option></term>
       <listitem><para>
       Sets header file to prepend to the contents output.</para></listitem>
       </varlistentry>
 
-      <varlistentry><term>BinCacheDB</term>
+      <varlistentry><term><option>BinCacheDB</option></term>
       <listitem><para>
       Sets the binary cache database to use for this 
       section. Multiple sections can share the same database.</para></listitem>
       </varlistentry>
       
-      <varlistentry><term>FileList</term>
+      <varlistentry><term><option>FileList</option></term>
       <listitem><para>
       Specifies that instead of walking the directory tree, 
       <command>apt-ftparchive</command> should read the list of files from the given 
       file. Relative files names are prefixed with the archive directory.</para></listitem>
       </varlistentry>
       
-      <varlistentry><term>SourceFileList</term>
+      <varlistentry><term><option>SourceFileList</option></term>
       <listitem><para>
       Specifies that instead of walking the directory tree, 
       <command>apt-ftparchive</command> should read the list of files from the given 
@@ -339,7 +339,7 @@
      </variablelist>     
    </refsect2>
    
-   <refsect2><title>Tree Section</title>
+   <refsect2><title><literal>Tree</literal> Section</title>
      <para>
      The <literal>Tree</literal> section defines a standard Debian file tree which 
      consists of a base directory, then multiple sections in that base 
@@ -352,7 +352,7 @@
      Typically this is a setting such as <filename>dists/&stable-codename;</filename>.</para>
      <para>
      All of the settings defined in the <literal>TreeDefault</literal> section can be
-     use in a <literal>Tree</literal> section as well as three new variables.</para>
+     used in a <literal>Tree</literal> section as well as three new variables.</para>
      <para>
      When processing a <literal>Tree</literal> section <command>apt-ftparchive</command> 
      performs an operation similar to:
@@ -363,51 +363,51 @@ for i in Sections do
      </programlisting></para>
 
      <variablelist>     
-      <varlistentry><term>Sections</term>
+      <varlistentry><term><option>Sections</option></term>
       <listitem><para>
       This is a space separated list of sections which appear 
-      under the distribution, typically this is something like 
+      under the distribution; typically this is something like 
       <literal>main contrib non-free</literal></para></listitem>
       </varlistentry>
       
-      <varlistentry><term>Architectures</term>
+      <varlistentry><term><option>Architectures</option></term>
       <listitem><para>
       This is a space separated list of all the 
       architectures that appear under search section. The special architecture 
       'source' is used to indicate that this tree has a source archive.</para></listitem>
       </varlistentry>
 
-      <varlistentry><term>LongDescription</term>
+      <varlistentry><term><option>LongDescription</option></term>
       <listitem><para>
-      Sets if long descriptions should be included in the Packages file or split
-      out into a master Translation-en file.</para></listitem>
+      Specifies whether long descriptions should be included in the <filename>Packages</filename> file or split
+      out into a master <filename>Translation-en</filename> file.</para></listitem>
       </varlistentry>
 
-      <varlistentry><term>BinOverride</term>
+      <varlistentry><term><option>BinOverride</option></term>
       <listitem><para>
       Sets the binary override file. The override file 
       contains section, priority and maintainer address information.</para></listitem>
       </varlistentry>
 
-      <varlistentry><term>SrcOverride</term>
+      <varlistentry><term><option>SrcOverride</option></term>
       <listitem><para>
       Sets the source override file. The override file 
       contains section information.</para></listitem>
       </varlistentry>
       
-      <varlistentry><term>ExtraOverride</term>
+      <varlistentry><term><option>ExtraOverride</option></term>
       <listitem><para>
       Sets the binary extra override file.</para></listitem>
       </varlistentry>
       
-      <varlistentry><term>SrcExtraOverride</term>
+      <varlistentry><term><option>SrcExtraOverride</option></term>
       <listitem><para>
       Sets the source extra override file.</para></listitem> 
       </varlistentry>
      </variablelist>
    </refsect2>
    
-   <refsect2><title>BinDirectory Section</title>
+   <refsect2><title><literal>BinDirectory</literal> Section</title>
      <para>
      The <literal>bindirectory</literal> section defines a binary directory tree 
      with no special structure. The scope tag specifies the location of 
@@ -415,53 +415,53 @@ for i in Sections do
      section with no substitution variables or
      <literal>Section</literal><literal>Architecture</literal> settings.</para>
      <variablelist>
-      <varlistentry><term>Packages</term>
+      <varlistentry><term><option>Packages</option></term>
       <listitem><para>
       Sets the Packages file output.</para></listitem>
       </varlistentry>
       
-      <varlistentry><term>Sources</term>
+      <varlistentry><term><option>Sources</option></term>
       <listitem><para>
       Sets the Sources file output. At least one of
       <literal>Packages</literal> or <literal>Sources</literal> is required.</para></listitem>
       </varlistentry>
       
-      <varlistentry><term>Contents</term>
+      <varlistentry><term><option>Contents</option></term>
       <listitem><para>
-      Sets the Contents file output. (optional)</para></listitem>
+      Sets the Contents file output (optional).</para></listitem>
       </varlistentry>
       
-      <varlistentry><term>BinOverride</term>
+      <varlistentry><term><option>BinOverride</option></term>
       <listitem><para>
       Sets the binary override file.</para></listitem>
       </varlistentry>
       
-      <varlistentry><term>SrcOverride</term>
+      <varlistentry><term><option>SrcOverride</option></term>
       <listitem><para>
       Sets the source override file.</para></listitem>
       </varlistentry>
       
-      <varlistentry><term>ExtraOverride</term>
+      <varlistentry><term><option>ExtraOverride</option></term>
       <listitem><para>
       Sets the binary extra override file.</para></listitem>
       </varlistentry>
       
-      <varlistentry><term>SrcExtraOverride</term>
+      <varlistentry><term><option>SrcExtraOverride</option></term>
       <listitem><para>
       Sets the source extra override file.</para></listitem>
       </varlistentry>
       
-      <varlistentry><term>BinCacheDB</term>
+      <varlistentry><term><option>BinCacheDB</option></term>
       <listitem><para>
       Sets the cache DB.</para></listitem>
       </varlistentry>
       
-      <varlistentry><term>PathPrefix</term>
+      <varlistentry><term><option>PathPrefix</option></term>
       <listitem><para>
       Appends a path to all the output paths.</para></listitem>
       </varlistentry>
       
-      <varlistentry><term>FileList, SourceFileList</term>
+      <varlistentry><term><option>FileList</option></term><term><option>SourceFileList</option></term>
       <listitem><para>
       Specifies the file list file.</para></listitem>
       </varlistentry>
@@ -472,8 +472,8 @@ for i in Sections do
 
  <refsect1><title>The Binary Override File</title>
    <para>The binary override file is fully compatible with &dpkg-scanpackages;. It
-   contains 4 fields separated by spaces. The first field is the package name,
-   the second is the priority to force that package to, the third is the
+   contains four fields separated by spaces. The first field is the package name,
+   the second is the priority to force that package to, the third is
    the section to force that package to and the final field is the maintainer 
    permutation field.</para>
    <para>The general form of the maintainer field is:
@@ -490,14 +490,14 @@ for i in Sections do
  <refsect1><title>The Source Override File</title>
    <para>
    The source override file is fully compatible with &dpkg-scansources;. It
-   contains 2 fields separated by spaces. The first fields is the source 
+   contains two fields separated by spaces. The first field is the source 
    package name, the second is the section to assign it.</para>
  </refsect1>   
 
  <refsect1><title>The Extra Override File</title>
    <para>
    The extra override file allows any arbitrary tag to be added or replaced
-   in the output. It has 3 columns, the first is the package, the second is
+   in the output. It has three columns, the first is the package, the second is
    the tag and the remainder of the line is the new value.</para>
  </refsect1>   
 
@@ -505,7 +505,7 @@ for i in Sections do
    &apt-cmdblurb;
    
    <variablelist>
-     <varlistentry><term><option>--md5</option>, <option>--sha1</option>, <option>--sha256</option></term>
+     <varlistentry><term><option>--md5</option></term><term><option>--sha1</option></term><term><option>--sha256</option></term>
      <listitem><para>
      Generate the given checksum. These options default to on, when turned off the generated
      index files will not have the checksum fields where possible.

+ 73 - 84
doc/apt-get.8.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="no"?>
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
-  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
 
 <!ENTITY % aptent SYSTEM "apt.ent">
 %aptent;
@@ -18,7 +18,7 @@
    &apt-email;
    &apt-product;
    <!-- The last update date -->
-   <date>08 November 2008</date>
+   <date>2012-06-09T00:00:00Z</date>
  </refentryinfo>
  
  <refmeta>
@@ -45,7 +45,7 @@
    commands below must be present.</para>
    
    <variablelist>
-     <varlistentry><term>update</term>
+     <varlistentry><term><option>update</option></term>
      <listitem><para><literal>update</literal> is used to resynchronize the package index files from
      their sources. The indexes of available packages are fetched from the
      location(s) specified in <filename>/etc/apt/sources.list</filename>.
@@ -57,7 +57,7 @@
      of the package files cannot be known in advance.</para></listitem>
      </varlistentry>
      
-     <varlistentry><term>upgrade</term>
+     <varlistentry><term><option>upgrade</option></term>
      <listitem><para><literal>upgrade</literal> is used to install the newest versions of all packages 
      currently installed on the system from the sources enumerated in
      <filename>/etc/apt/sources.list</filename>. Packages currently installed with 
@@ -70,37 +70,37 @@
      available.</para></listitem>
      </varlistentry>
 
-     <varlistentry><term>dselect-upgrade</term>
-     <listitem><para><literal>dselect-upgrade</literal>
-     is used in conjunction with the traditional Debian packaging
-     front-end, &dselect;. <literal>dselect-upgrade</literal>
-     follows the changes made by &dselect; to the <literal>Status</literal>
-     field of available packages, and performs the actions necessary to realize
-     that state (for instance, the removal of old and the installation of new
-     packages).</para></listitem>
-     </varlistentry>
-
-     <varlistentry><term>dist-upgrade</term>
+     <varlistentry><term><option>dist-upgrade</option></term>
      <listitem><para><literal>dist-upgrade</literal> in addition to performing the function of 
      <literal>upgrade</literal>, also intelligently handles changing dependencies 
      with new versions of packages; <command>apt-get</command> has a "smart" conflict 
      resolution system, and it will attempt to upgrade the most important 
      packages at the expense of less important ones if necessary. 
-	 So, <literal>dist-upgrade</literal> command may remove some packages.
+     The <literal>dist-upgrade</literal> command may therefore remove some packages.
      The <filename>/etc/apt/sources.list</filename> file contains a list of locations 
      from which to retrieve desired package files.
      See also &apt-preferences; for a mechanism for
      overriding the general settings for individual packages.</para></listitem>
      </varlistentry>
 
-     <varlistentry><term>install</term>
+     <varlistentry><term><option>dselect-upgrade</option></term>
+     <listitem><para><literal>dselect-upgrade</literal>
+     is used in conjunction with the traditional Debian packaging
+     front-end, &dselect;. <literal>dselect-upgrade</literal>
+     follows the changes made by &dselect; to the <literal>Status</literal>
+     field of available packages, and performs the actions necessary to realize
+     that state (for instance, the removal of old and the installation of new
+     packages).</para></listitem>
+     </varlistentry>
+
+     <varlistentry><term><option>install</option></term>
      <listitem>
 	 <para><literal>install</literal> is followed by one or more 
 	 packages desired for installation or upgrading. 
 	 Each package is a package name, not a fully qualified 
-	 filename (for instance, in a Debian GNU/Linux system, 
-	 libc6 would be the argument provided, not 
-	 <literal>libc6_1.9.6-2.deb</literal>). All packages required 
+	 filename (for instance, in a Debian system, 
+	 <package>apt-utils</package> would be the argument provided, not 
+	 <filename>apt-utils_&apt-product-version;_amd64.deb</filename>). All packages required 
 	 by the package(s) specified for installation will also 
 	 be retrieved and installed. 
 	 The <filename>/etc/apt/sources.list</filename> file is 
@@ -147,20 +147,20 @@
      with a '^' or '$' character, or create a more specific regular expression.</para></listitem>
      </varlistentry>
 
-     <varlistentry><term>remove</term>
+     <varlistentry><term><option>remove</option></term>
      <listitem><para><literal>remove</literal> is identical to <literal>install</literal> except that packages are 
-	 removed instead of installed. Note the removing a package leaves its
-	 configuration files in system. If a plus sign is appended to the package 
+	 removed instead of installed. Note that removing a package leaves its
+	 configuration files on the system. If a plus sign is appended to the package 
      name (with no intervening space), the identified package will be 
      installed instead of removed.</para></listitem>
      </varlistentry>
 
-     <varlistentry><term>purge</term>
+     <varlistentry><term><option>purge</option></term>
      <listitem><para><literal>purge</literal> is identical to <literal>remove</literal> except that packages are 
      removed and purged (any configuration files are deleted too).</para></listitem>
      </varlistentry>
 
-     <varlistentry><term>source</term>
+     <varlistentry><term><option>source</option></term>
      <listitem><para><literal>source</literal> causes <command>apt-get</command> to fetch source packages. APT 
      will examine the available packages to decide which source package to 
      fetch. It will then find and download into the current directory the 
@@ -170,11 +170,10 @@
      <literal>pkg/release</literal> syntax, if possible.</para>
 
      <para>Source packages are tracked separately
-     from binary packages via <literal>deb-src</literal> type lines 
+     from binary packages via <literal>deb-src</literal> lines 
      in the &sources-list; file. This means that you will need to add such a line
-     for each repository you want to get sources from. If you don't do this
-     you will properly get another (newer, older or none) source version than
-     the one you have installed or could install.</para>
+     for each repository you want to get sources from; otherwise you will probably
+     get either the wrong (too old/too new) source versions or none at all.</para>
 
      <para>If the <option>--compile</option> option is specified
      then the package will be compiled to a binary .deb using
@@ -188,31 +187,31 @@
      used for the package files. This enables exact matching of the source 
      package name and version, implicitly enabling the 
      <literal>APT::Get::Only-Source</literal> option.</para>
-     
-     <para>Note that source packages are not tracked like binary packages, they 
-     exist only in the current directory and are similar to downloading source
-     tar balls.</para></listitem>
+
+     <para>Note that source packages are not installed and tracked in the
+     <command>dpkg</command> database like binary packages; they are simply downloaded
+     to the current directory, like source tarballs.</para></listitem>
      </varlistentry>
 
-     <varlistentry><term>build-dep</term>
+     <varlistentry><term><option>build-dep</option></term>
      <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. By default the dependencies are
      satisfied to build the package natively. If desired a host-architecture can be specified
      with the <option>--host-architecture</option> option instead.</para></listitem>
      </varlistentry>
 
-     <varlistentry><term>check</term>
+     <varlistentry><term><option>check</option></term>
      <listitem><para><literal>check</literal> is a diagnostic tool; it updates the package cache and checks 
      for broken dependencies.</para></listitem>
      </varlistentry>
 
-     <varlistentry><term>download</term>
+     <varlistentry><term><option>download</option></term>
        <listitem><para><literal>download</literal> will download the given
            binary package into the current directory.
        </para></listitem>
      </varlistentry>
 
-     <varlistentry><term>clean</term>
+     <varlistentry><term><option>clean</option></term>
      <listitem><para><literal>clean</literal> clears out the local repository of retrieved package 
      files. It removes everything but the lock file from 
      <filename>&cachedir;/archives/</filename> and 
@@ -222,7 +221,7 @@
      from time to time to free up disk space.</para></listitem>
      </varlistentry>
 
-     <varlistentry><term>autoclean</term>
+     <varlistentry><term><option>autoclean</option></term>
      <listitem><para>Like <literal>clean</literal>, <literal>autoclean</literal> clears out the local 
      repository of retrieved package files. The difference is that it only 
      removes package files that can no longer be downloaded, and are largely 
@@ -232,17 +231,17 @@
      erased if it is set to off.</para></listitem>
      </varlistentry>
 
-     <varlistentry><term>autoremove</term>
+     <varlistentry><term><option>autoremove</option></term>
      <listitem><para><literal>autoremove</literal> is used to remove packages that were automatically
      installed to satisfy dependencies for other packages and are now no longer needed.</para></listitem>
      </varlistentry>
 
-     <varlistentry><term>changelog</term>
+     <varlistentry><term><option>changelog</option></term>
        <listitem><para><literal>changelog</literal> downloads a package changelog and displays
            it through <command>sensible-pager</command>. The server name and base
            directory is defined in the <literal>APT::Changelogs::Server</literal>
-           variable (e. g. <ulink>http://packages.debian.org/changelogs</ulink> for
-           Debian or <ulink>http://changelogs.ubuntu.com/changelogs</ulink> for
+	   variable (e.g. <ulink url="http://packages.debian.org/changelogs">packages.debian.org/changelogs</ulink> for
+	   Debian or <ulink url="http://changelogs.ubuntu.com/changelogs">changelogs.ubuntu.com/changelogs</ulink> for
            Ubuntu).
            By default it displays the changelog for the version that is
            installed.  However, you can specify the same options as for
@@ -291,7 +290,7 @@
 
      <varlistentry><term><option>-m</option></term><term><option>--ignore-missing</option></term>
      <term><option>--fix-missing</option></term>
-     <listitem><para>Ignore missing packages; If packages cannot be retrieved or fail the    
+     <listitem><para>Ignore missing packages; if packages cannot be retrieved or fail the    
      integrity check after retrieval (corrupted package files), hold back    
      those packages and handle the result. Use of this option together with  
      <option>-f</option> may produce an error in some situations. If a package is 
@@ -312,9 +311,9 @@
      <listitem><para>Quiet; produces output suitable for logging, omitting progress indicators.
      More q's will produce more quiet up to a maximum of 2. You can also use
      <option>-q=#</option> to set the quiet level, overriding the configuration file. 
-     Note that quiet level 2 implies <option>-y</option>, you should never use -qq 
+     Note that quiet level 2 implies <option>-y</option>; you should never use -qq 
      without a no-action modifier such as -d, --print-uris or -s as APT may 
-     decided to do something you did not expect.
+     decide to do something you did not expect.
      Configuration Item: <literal>quiet</literal>.</para></listitem>
      </varlistentry>
 
@@ -328,17 +327,18 @@
      actually change the system. 
      Configuration Item: <literal>APT::Get::Simulate</literal>.</para>
 
-     <para>Simulation run as user will deactivate locking (<literal>Debug::NoLocking</literal>)
-     automatic. Also a notice will be displayed indicating that this is only a simulation,
-     if the option <literal>APT::Get::Show-User-Simulation-Note</literal> is set (Default: true).
-     Neither NoLocking nor the notice will be triggered if run as root (root should know what
-     he is doing without further warnings by <literal>apt-get</literal>).</para>
+     <para>Simulated runs performed as a user will automatically deactivate locking
+     (<literal>Debug::NoLocking</literal>), and if the option
+     <literal>APT::Get::Show-User-Simulation-Note</literal> is set
+     (as it is by default) a notice will also be displayed indicating that
+     this is only a simulation. Runs performed as root do not trigger either
+     NoLocking or the notice - superusers should know what they are doing
+     without further warnings from <literal>apt-get</literal>.</para>
 
-     <para>Simulate prints out
-     a series of lines each one representing a dpkg operation, Configure (Conf),
-     Remove (Remv), Unpack (Inst). Square brackets indicate broken packages
-     and empty set of square brackets meaning breaks that are of no consequence
-     (rare).</para></listitem>
+     <para>Simulated runs print out a series of lines, each representing a <command>dpkg</command>
+     operation: configure (<literal>Conf</literal>), remove (<literal>Remv</literal>)
+     or unpack (<literal>Inst</literal>). Square brackets indicate broken packages, and
+     empty square brackets indicate breaks that are of no consequence (rare).</para></listitem>
      </varlistentry>
 
      <varlistentry><term><option>-y</option></term><term><option>--yes</option></term>
@@ -356,7 +356,7 @@
      </varlistentry>
 
      <varlistentry><term><option>-u</option></term><term><option>--show-upgraded</option></term>
-     <listitem><para>Show upgraded packages; Print out a list of all packages that are to be
+     <listitem><para>Show upgraded packages; print out a list of all packages that are to be
      upgraded. 
      Configuration Item: <literal>APT::Get::Show-Upgraded</literal>.</para></listitem>
      </varlistentry>
@@ -383,28 +383,29 @@
      </varlistentry>
 
      <varlistentry><term><option>--ignore-hold</option></term>
-     <listitem><para>Ignore package Holds; This causes <command>apt-get</command> to ignore a hold 
+     <listitem><para>Ignore package holds; this causes <command>apt-get</command> to ignore a hold 
      placed on a package. This may be useful in conjunction with 
      <literal>dist-upgrade</literal> to override a large number of undesired holds. 
      Configuration Item: <literal>APT::Ignore-Hold</literal>.</para></listitem>
      </varlistentry>
 
      <varlistentry><term><option>--no-upgrade</option></term>
-     <listitem><para>Do not upgrade packages; When used in conjunction with <literal>install</literal>,
+     <listitem><para>Do not upgrade packages; when used in conjunction with <literal>install</literal>,
      <literal>no-upgrade</literal> will prevent packages on the command line
      from being upgraded if they are already installed.
      Configuration Item: <literal>APT::Get::Upgrade</literal>.</para></listitem>
      </varlistentry>
 
      <varlistentry><term><option>--only-upgrade</option></term>
-     <listitem><para>Do not install new packages; When used in conjunction with <literal>install</literal>,
-     <literal>only-upgrade</literal> will prevent packages on the command line
-     from being upgraded if they are not already installed.
+     <listitem><para>Do not install new packages; when used in conjunction
+     with <literal>install</literal>, <literal>only-upgrade</literal> will
+     install upgrades for already installed packages only and ignore requests
+     to install new packages.
      Configuration Item: <literal>APT::Get::Only-Upgrade</literal>.</para></listitem>
      </varlistentry>
 
      <varlistentry><term><option>--force-yes</option></term>
-     <listitem><para>Force yes; This is a dangerous option that will cause apt to continue 
+     <listitem><para>Force yes; this is a dangerous option that will cause apt to continue 
      without prompting if it is doing something potentially harmful. It 
      should not be used except in very special situations. Using 
      <literal>force-yes</literal> can potentially destroy your system! 
@@ -414,7 +415,7 @@
      <varlistentry><term><option>--print-uris</option></term>
      <listitem><para>Instead of fetching the files to install their URIs are printed. Each
      URI will have the path, the destination file name, the size and the expected
-     md5 hash. Note that the file name to write to will not always match
+     MD5 hash. Note that the file name to write to will not always match
      the file name on the remote site! This also works with the 
      <literal>source</literal> and <literal>update</literal> commands. When used with the
      <literal>update</literal> command the MD5 and size are not included, and it is
@@ -431,23 +432,22 @@
      </varlistentry>
 
      <varlistentry><term><option>--reinstall</option></term>
-     <listitem><para>Re-Install packages that are already installed and at the newest version.
+     <listitem><para>Re-install packages that are already installed and at the newest version.
      Configuration Item: <literal>APT::Get::ReInstall</literal>.</para></listitem>
      </varlistentry>
 
      <varlistentry><term><option>--list-cleanup</option></term>
-     <listitem><para>This option defaults to on, use <literal>--no-list-cleanup</literal> to turn it 
-     off. When on <command>apt-get</command> will automatically manage the contents of 
-     <filename>&statedir;/lists</filename> to ensure that obsolete files are erased. 
-     The only  reason to turn it off is if you frequently change your source 
-     list. 
+     <listitem><para>This option is on by default; use <literal>--no-list-cleanup</literal> to turn
+     it off. When it is on, <command>apt-get</command> will automatically manage the contents
+     of <filename>&statedir;/lists</filename> to ensure that obsolete files are erased.
+     The only reason to turn it off is if you frequently change your sources list.
      Configuration Item: <literal>APT::Get::List-Cleanup</literal>.</para></listitem>
      </varlistentry>
 
      <varlistentry><term><option>-t</option></term>
                    <term><option>--target-release</option></term>
                    <term><option>--default-release</option></term>
-     <listitem><para>This option controls the default input to the policy engine, it creates
+     <listitem><para>This option controls the default input to the policy engine; it creates
      a default pin at priority 990 using the specified release string.
      This overrides the general settings in <filename>/etc/apt/preferences</filename>.
      Specifically pinned packages are not affected by the value
@@ -463,7 +463,7 @@
      <varlistentry><term><option>--trivial-only</option></term>
      <listitem><para>
      Only perform operations that are 'trivial'. Logically this can be considered
-     related to <option>--assume-yes</option>, where <option>--assume-yes</option> will answer 
+     related to <option>--assume-yes</option>; where <option>--assume-yes</option> will answer 
      yes to any prompt, <option>--trivial-only</option> will answer no. 
      Configuration Item: <literal>APT::Get::Trivial-Only</literal>.</para></listitem>
      </varlistentry>
@@ -476,7 +476,7 @@
 
      <varlistentry><term><option>--auto-remove</option></term>
      <listitem><para>If the command is either <literal>install</literal> or <literal>remove</literal>,
-     then this option acts like running <literal>autoremove</literal> command, removing the unused
+     then this option acts like running the <literal>autoremove</literal> command, removing unused
      dependency packages. Configuration Item: <literal>APT::Get::AutomaticRemove</literal>.
      </para></listitem>
      </varlistentry>
@@ -534,16 +534,5 @@
  <refsect1><title>Diagnostics</title>
    <para><command>apt-get</command> returns zero on normal operation, decimal 100 on error.</para>
  </refsect1>
- <refsect1>
-	 <title>ORIGINAL AUTHORS</title>
-	 <para>&apt-author.jgunthorpe;</para>
- </refsect1>
- <refsect1>
-	 <title>CURRENT AUTHORS</title>
-	 <para>
-		 &apt-author.team;
-	 </para>
-		 &apt-qapage;
- </refsect1>
  &manbugs;
 </refentry>

+ 29 - 22
doc/apt-key.8.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="no"?>
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
-  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
 
 <!ENTITY % aptent SYSTEM "apt.ent">
 %aptent;
@@ -11,8 +11,15 @@
 ]>
 
 <refentry>
- &apt-docinfo;
- 
+ <refentryinfo>
+   &apt-author.jgunthorpe;
+   &apt-author.team;
+   &apt-email;
+   &apt-product;
+   <!-- The last update date -->
+   <date>2012-06-09T00:00:00Z</date>
+ </refentryinfo>
+
  <refmeta>
    <refentrytitle>apt-key</refentrytitle>
    <manvolnum>8</manvolnum>
@@ -37,19 +44,19 @@
 
 <refsect1><title>Commands</title>
    <variablelist>
-     <varlistentry><term>add &synopsis-param-filename;</term>
+     <varlistentry><term><option>add</option> <option>&synopsis-param-filename;</option></term>
      <listitem>
      <para>
-
-       Add a new key to the list of trusted keys.  The key is read
-       from &synopsis-param-filename;, or standard input if
-       &synopsis-param-filename; is <literal>-</literal>.
+       Add a new key to the list of trusted keys.
+       The key is read from the filename given with the parameter
+       &synopsis-param-filename; or if the filename is <literal>-</literal>
+       from standard input.
      </para>
 
      </listitem>
      </varlistentry>
 
-     <varlistentry><term>del &synopsis-param-keyid;</term>
+     <varlistentry><term><option>del</option> <option>&synopsis-param-keyid;</option></term>
      <listitem>
      <para>
 
@@ -60,7 +67,7 @@
      </listitem>
      </varlistentry>
 
-     <varlistentry><term>export &synopsis-param-keyid;</term>
+     <varlistentry><term><option>export</option> <option>&synopsis-param-keyid;</option></term>
      <listitem>
      <para>
 
@@ -71,7 +78,7 @@
      </listitem>
      </varlistentry>
 
-     <varlistentry><term>exportall</term>
+     <varlistentry><term><option>exportall</option></term>
      <listitem>
      <para>
 
@@ -82,7 +89,7 @@
      </listitem>
      </varlistentry>
 
-     <varlistentry><term>list</term>
+     <varlistentry><term><option>list</option></term>
      <listitem>
      <para>
 
@@ -93,7 +100,7 @@
      </listitem>
      </varlistentry>
      
-	 <varlistentry><term>finger</term>
+     <varlistentry><term><option>finger</option></term>
      <listitem>
      <para>
 
@@ -104,7 +111,7 @@
      </listitem>
      </varlistentry>
      
-	 <varlistentry><term>adv</term>
+     <varlistentry><term><option>adv</option></term>
      <listitem>
      <para>
 
@@ -116,7 +123,7 @@
      </listitem>
      </varlistentry>
 
-     <varlistentry><term>update</term>
+     <varlistentry><term><option>update</option></term>
      <listitem>
      <para>
 
@@ -130,17 +137,17 @@
      </listitem>
      </varlistentry>
      
-     <varlistentry><term>net-update</term>
+     <varlistentry><term><option>net-update</option></term>
      <listitem>
      <para>
 
-       Work similar to the <command>update</command> command above, but get the
-       archive keyring from an URI instead and validate it against a master key.
+       Perform an update working similarly to the <command>update</command> command above,
+       but get the archive keyring from a URI instead and validate it against a master key.
 
        This requires an installed &wget; and an APT build configured to have
        a server to fetch from and a master keyring to validate.
 
-       APT in Debian does not support this command and relies on
+       APT in Debian does not support this command, relying on
        <command>update</command> instead, but Ubuntu's APT does.
 
      </para>
@@ -153,8 +160,8 @@
  <refsect1><title>Options</title>
 <para>Note that options need to be defined before the commands described in the previous section.</para>
    <variablelist>
-      <varlistentry><term>--keyring &synopsis-param-filename;</term>
-      <listitem><para>With this option it is possible to specify a specific keyring
+      <varlistentry><term><option>--keyring</option> <option>&synopsis-param-filename;</option></term>
+      <listitem><para>With this option it is possible to specify a particular keyring
       file the command should operate on. The default is that a command is executed
       on the <filename>trusted.gpg</filename> file as well as on all parts in the
       <filename>trusted.gpg.d</filename> directory, though <filename>trusted.gpg</filename>

+ 18 - 19
doc/apt-mark.8.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="no"?>
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
-  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
 
 <!ENTITY % aptent SYSTEM "apt.ent">
 %aptent;
@@ -18,7 +18,7 @@
    &apt-email;
    &apt-product;
    <!-- The last update date -->
-   <date>21 April 2011</date>
+   <date>2012-06-09T00:00:00Z</date>
  </refentryinfo>
  
  <refmeta>
@@ -48,7 +48,7 @@
      <command>apt-get</command> or <command>aptitude</command>.
    </para>
      <variablelist>
-       <varlistentry><term>auto</term>
+     <varlistentry><term><option>auto</option></term>
 	 <listitem><para><literal>auto</literal> is used to mark a
      package as being automatically installed, which will cause the
      package to be removed when no more manually installed packages
@@ -56,7 +56,7 @@
        </para></listitem>
        </varlistentry>
 
-       <varlistentry><term>manual</term>
+     <varlistentry><term><option>manual</option></term>
 	 <listitem><para><literal>manual</literal> is used to mark a
      package as being manually installed, which will prevent the
      package from being automatically removed if no other packages
@@ -64,23 +64,23 @@
        </para></listitem>
        </varlistentry>
 
-       <varlistentry><term>hold</term>
+       <varlistentry><term><option>hold</option></term>
 	 <listitem><para><literal>hold</literal> is used to mark a
-       package as hold back, which will prevent the package from being
+       package as held back, which will prevent the package from being
        automatically installed, upgraded or removed.
        The command is only a wrapper around <command>dpkg --set-selections</command>
-       and the state is therefore maintained by &dpkg; and not effected
-       by the <option>--filename</option> option.
+       and the state is therefore maintained by &dpkg; and not affected
+       by the <option>--file</option> option.
        </para></listitem>
        </varlistentry>
 
-       <varlistentry><term>unhold</term>
+       <varlistentry><term><option>unhold</option></term>
 	 <listitem><para><literal>unhold</literal> is used to cancel a
        previously set hold on a package to allow all actions again.
        </para></listitem>
        </varlistentry>
 
-       <varlistentry><term>showauto</term>
+       <varlistentry><term><option>showauto</option></term>
 	 <listitem><para><literal>showauto</literal> is used to print a
      list of automatically installed packages with each package on a new line.
      All automatically installed packages will be listed if no package is given.
@@ -88,14 +88,14 @@
        </para></listitem>
        </varlistentry>
 
-       <varlistentry><term>showmanual</term>
+       <varlistentry><term><option>showmanual</option></term>
 	 <listitem><para><literal>showmanual</literal> can be used in
      the same way as <literal>showauto</literal> except that it will print
      a list of manually installed packages instead.
        </para></listitem>
        </varlistentry>
 
-       <varlistentry><term>showhold</term>
+       <varlistentry><term><option>showhold</option></term>
 	 <listitem><para><literal>showhold</literal> is used to print a list
      of packages on hold in the same way as for the other show commands.
        </para></listitem>
@@ -109,12 +109,11 @@
    
    <variablelist>
 	<varlistentry>
-		<term><option>-f=<filename><replaceable>FILENAME</replaceable></filename></option></term>
-		<term><option>--file=<filename><replaceable>FILENAME</replaceable></filename></option></term>
+	   <term><option>-f=&synopsis-param-filename;</option></term>
+	   <term><option>--file=&synopsis-param-filename;</option></term>
      <listitem><para>
-      
-     Read/Write package stats from <filename><replaceable>FILENAME</replaceable></filename>
-     instead of the default location, which
+     Read/Write package stats from the filename given with the parameter
+     &synopsis-param-filename; instead of from the default location, which
      is <filename>extended_status</filename> in the directory defined
      by the Configuration Item: <literal>Dir::State</literal>.</para></listitem>
      </varlistentry>
@@ -130,7 +129,7 @@
  </refsect1>
 
  <refsect1><title>See Also</title>
-   <para>&apt-get;,&aptitude;,&apt-conf;</para>
+    <para><phrase>&apt-get;,&aptitude;,&apt-conf;</phrase></para>
  </refsect1>
 
  <refsect1><title>Diagnostics</title>

+ 42 - 36
doc/apt-secure.8.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="no"?>
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
-  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
 
 <!ENTITY % aptent SYSTEM "apt.ent">
 %aptent;
@@ -11,8 +11,15 @@
 ]>
 
 <refentry>
- &apt-docinfo;
- 
+ <refentryinfo>
+   &apt-author.jgunthorpe;
+   &apt-author.team;
+   &apt-email;
+   &apt-product;
+   <!-- The last update date -->
+   <date>2012-06-09T00:00:00Z</date>
+ </refentryinfo>
+
  <refmeta>
    <refentrytitle>apt-secure</refentrytitle>
    <manvolnum>8</manvolnum>
@@ -50,11 +57,11 @@
    </para>
 
    <para>
-   If a package comes from a archive without a signature or with a
-   signature that apt does not have a key for that package is
-   considered untrusted and installing it will result in a big
+   If a package comes from a archive without a signature, or with a
+   signature that apt does not have a key for, that package is
+   considered untrusted, and installing it will result in a big
    warning. <command>apt-get</command> will currently only warn
-   for unsigned archives, future releases might force all sources
+   for unsigned archives; future releases might force all sources
    to be verified before downloading packages from them.
    </para>
 
@@ -68,11 +75,11 @@
 
    <para> 
    The chain of trust from an apt archive to the end user is made up of
-   different steps. <command>apt-secure</command> is the last step in
-   this chain, trusting an archive does not mean that the packages
-   that you trust it do not contain malicious code but means that you
-   trust the archive maintainer. It's the archive maintainer
-   responsibility to ensure that the archive integrity is correct.
+   several steps. <command>apt-secure</command> is the last step in
+   this chain; trusting an archive does not mean that you trust its
+   packages not to contain malicious code, but means that you
+   trust the archive maintainer. It's the archive maintainer's
+   responsibility to ensure that the archive's integrity is preserved.
    </para>
 
    <para>apt-secure does not review signatures at a
@@ -83,30 +90,29 @@
 
    <para>
    The chain of trust in Debian starts when a maintainer uploads a new
-   package or a new version of a package to the Debian archive. This
-   upload in order to become effective needs to be signed by a key of
-   a maintainer within the Debian maintainer's keyring (available in
-   the debian-keyring package). Maintainer's keys are signed by
+   package or a new version of a package to the Debian archive. In
+   order to become effective, this upload needs to be signed by a key
+   contained in the Debian Maintainers keyring (available in
+   the debian-keyring package). Maintainers' keys are signed by
    other maintainers following pre-established procedures to
    ensure the identity of the key holder.
    </para>
 
    <para>
    Once the uploaded package is verified and included in the archive,
-   the maintainer signature is stripped off, an MD5 sum of the package
-   is computed and put in the Packages file. The MD5 sum of all of the
-   packages files are then computed and put into the Release file. The
-   Release file is then signed by the archive key (which is created
-   once a year) and distributed through the FTP server. This key is
-   also on the Debian keyring.
+   the maintainer signature is stripped off, and checksums of the package
+   are computed and put in the Packages file. The checksums of all of the
+   Packages files are then computed and put into the Release file. The
+   Release file is then signed by the archive key for this Debian release,
+   and distributed alongside the packages and the Packages files on
+   Debian mirrors. The keys are in the Debian archive keyring available in
+   the <package>debian-archive-keyring</package> package.
    </para>
 
    <para>
-   Any end user can check the signature of the Release file, extract the MD5
-   sum of a package from it and compare it with the MD5 sum of the
-   package he downloaded. Prior to version 0.6 only the MD5 sum of the
-   downloaded Debian package was checked. Now both the MD5 sum and the
-   signature of the Release file are checked.
+   End users can check the signature of the Release file, extract a checksum
+   of a package from it and compare it with the checksum of the package
+   they downloaded by hand - or rely on APT doing this automatically.
    </para>
 
    <para>Notice that this is distinct from checking signatures on a
@@ -115,11 +121,11 @@
 
     <itemizedlist>
        <listitem><para><literal>Network "man in the middle"
-       attacks</literal>. Without signature checking, a malicious
-       agent can introduce himself in the package download process and
+       attacks</literal>. Without signature checking, malicious
+       agents can introduce themselves into the package download process and
        provide malicious software either by controlling a network
        element (router, switch, etc.) or by redirecting traffic to a
-       rogue server (through arp or DNS spoofing
+       rogue server (through ARP or DNS spoofing
        attacks).</para></listitem>
  
        <listitem><para><literal>Mirror network compromise</literal>.
@@ -138,8 +144,8 @@
  <refsect1><title>User configuration</title>
    <para>
    <command>apt-key</command> is the program that manages the list
-   of keys used by apt. It can be used to add or remove keys although
-   an installation of this release will automatically provide the
+   of keys used by apt. It can be used to add or remove keys, although
+   an installation of this release will automatically contain the
    default Debian archive signing keys used in the Debian package
    repositories.
    </para>
@@ -176,9 +182,9 @@
 
     </itemizedlist>
 
-    <para>Whenever the contents of the archive changes (new packages
+    <para>Whenever the contents of the archive change (new packages
     are added or removed) the archive maintainer has to follow the
-    first two steps previously outlined.</para>
+    first two steps outlined above.</para>
 
 </refsect1>
 
@@ -190,7 +196,7 @@
 
 <para>For more background information you might want to review the
 <ulink
-url="http://www.debian.org/doc/manuals/securing-debian-howto/ch7.en.html">Debian
+url="http://www.debian.org/doc/manuals/securing-debian-howto/ch7">Debian
 Security Infrastructure</ulink> chapter of the Securing Debian Manual
 (available also in the harden-doc package) and the
 <ulink url="http://www.cryptnet.net/fdp/crypto/strong_distro.html"

+ 6 - 6
doc/apt-sortpkgs.1.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="no"?>
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
-  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
 
 <!ENTITY % aptent SYSTEM "apt.ent">
 %aptent;
@@ -18,7 +18,7 @@
    &apt-email;
    &apt-product;
    <!-- The last update date -->
-   <date>29 February 2004</date>
+   <date>2012-06-09T00:00:00Z</date>
  </refentryinfo>
  
  <refmeta>
@@ -36,13 +36,13 @@
  &synopsis-command-apt-sortpkgs;
 
  <refsect1><title>Description</title>
-   <para><command>apt-sortpkgs</command> will take an index file (Source index or Package 
+   <para><command>apt-sortpkgs</command> will take an index file (source index or package 
    index) and sort the records so that they are ordered by the package name. 
    It will also sort the internal fields of each record according to the 
    internal sorting rules.</para>
 
    <para>
-   All output is sent to stdout, the input must be a seekable file.</para>
+   All output is sent to standard output; the input must be a seekable file.</para>
  </refsect1>
  
  <refsect1><title>options</title>
@@ -51,7 +51,7 @@
    <variablelist>
      <varlistentry><term><option>-s</option></term><term><option>--source</option></term>
      <listitem><para>
-     Use Source index field ordering.
+     Use source index field ordering.
      Configuration Item: <literal>APT::SortPkgs::Source</literal>.</para></listitem>
      </varlistentry>
    

+ 40 - 3
doc/apt-verbatim.ent

@@ -154,6 +154,24 @@
   </citerefentry>"
 >
 
+<!ENTITY apt-transport-debtorrent "<citerefentry>
+    <refentrytitle><package>apt-transport-debtorrent</package></refentrytitle>
+    <manvolnum>1</manvolnum>
+  </citerefentry>"
+>
+
+<!ENTITY regex "<citerefentry>
+     <refentrytitle><abbrev>regex</abbrev></refentrytitle>
+     <manvolnum>7</manvolnum>
+  </citerefentry>"
+>
+
+<!ENTITY glob "<citerefentry>
+     <refentrytitle><abbrev>glob</abbrev></refentrytitle>
+     <manvolnum>7</manvolnum>
+  </citerefentry>"
+>
+
 <!-- Boiler plate docinfo section -->
 <!ENTITY apt-email "
    <address>
@@ -177,6 +195,11 @@
    </author>
 ">
 
+<!ENTITY apt-name.dburrows "
+     <firstname>Daniel</firstname>
+     <surname>Burrows</surname>
+">
+
 <!ENTITY apt-copyright "
     <copyright>
      <holder>Jason Gunthorpe</holder>
@@ -185,14 +208,25 @@
 ">
 
 <!ENTITY apt-product "
-   <productname>Linux</productname>
+   <productname>APT</productname>
+   <releaseinfo role='version'>&apt-product-version;</releaseinfo>
 ">
 
+<!-- this will be updated by 'prepare-release' -->
+<!ENTITY apt-product-version "0.9.7.1">
+
 <!-- Codenames for debian releases -->
 <!ENTITY oldstable-codename "lenny">
 <!ENTITY stable-codename "squeeze">
 <!ENTITY testing-codename "wheezy">
+<!ENTITY stable-version "6.0">
+<!ENTITY ubuntu-codename "precise">
 
+<!-- good and bad just refers to matching and not matching a pattern…
+     It is not a remark about the specific perl version.
+     There is no way perl could be clasified "good" (or "bad") in any version… -->
+<!ENTITY good-perl "5.10">
+<!ENTITY bad-perl "5.14">
 
 <!-- Arguments -->
 <!ENTITY synopsis-arg-option "<arg><option>-o=<replaceable>&synopsis-config-string;</replaceable></option></arg>">
@@ -249,10 +283,10 @@
 		<arg choice='plain'>show &synopsis-arg-pkgver;</arg>
 		<arg choice='plain'>depends &synopsis-arg-pkgver;</arg>
 		<arg choice='plain'>rdepends &synopsis-arg-pkgver;</arg>
-		<arg choice='plain'>pkgnames <arg choice='plain'><replaceable>&synopsis-prefix;</replaceable></arg></arg>
+		<arg choice='plain'>pkgnames <arg><replaceable>&synopsis-prefix;</replaceable></arg></arg>
 		<arg choice='plain'>dotty &synopsis-arg-pkgver;</arg>
 		<arg choice='plain'>xvcg &synopsis-arg-pkgver;</arg>
-		<arg choice='plain'>policy &synopsis-arg-pkg;</arg>
+		<arg choice='plain'>policy <arg rep='repeat'><replaceable>&synopsis-pkg;</replaceable></arg></arg>
 		<arg choice='plain'>madison &synopsis-arg-pkg;</arg>
 		&synopsis-help;
 	</group>
@@ -269,8 +303,11 @@
 		&synopsis-help;
 	</group>
 </cmdsynopsis></refsynopsisdiv>">
+<!--<arg><option>- -format '<replaceable>&#37;f \"&#37;v\";&#37;n</replaceable>'</option></arg>-->
 <!ENTITY synopsis-command-apt-config "<refsynopsisdiv><cmdsynopsis>
 	<command>apt-config</command>
+	<arg><option>--empty</option></arg>
+	<arg><option>--format '<replaceable>&percnt;f &#x0022;&percnt;v&#x0022;;&percnt;n</replaceable>'</option></arg>
 	&synopsis-arg-option;
 	&synopsis-arg-config;
 	<group choice='req'>

+ 1 - 1
doc/apt.8

@@ -14,7 +14,7 @@
 .\" License along with APT; if not, write to the Free Software
 .\" Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 
 .\" 02111-1307 USA
-.TH apt 8 "16 June 1998" "Debian GNU/Linux"
+.TH apt 8 "16 June 1998" "Debian"
 .SH NAME
 apt \- Advanced Package Tool
 .SH SYNOPSIS

File diff suppressed because it is too large
+ 401 - 355
doc/apt.conf.5.xml


+ 10 - 20
doc/apt.ent

@@ -1,19 +1,3 @@
-<!-- -*- mode: sgml; mode: fold -*- -->
-
-<!-- Boiler plate docinfo section -->
-<!ENTITY apt-docinfo "
- <refentryinfo>
-   <address><email>apt@packages.debian.org</email></address>
-   <author>
-     <firstname>Jason</firstname> <surname>Gunthorpe</surname>
-     <contrib></contrib>
-   </author>
-   <copyright><year>1998-2001</year> <holder>Jason Gunthorpe</holder></copyright>
-   <date>28 October 2008</date>
-   <productname>Linux</productname>
- </refentryinfo>
-">
-
 <!ENTITY apt-author.team "
    <author>
     <othername>APT team</othername>
@@ -119,7 +103,7 @@
 
      <varlistentry><term><filename>&cachedir;/archives/partial/</filename></term>
      <listitem><para>Storage area for package files in transit.
-     Configuration Item: <literal>Dir::Cache::Archives</literal> (implicit partial). </para></listitem>
+     Configuration Item: <literal>Dir::Cache::Archives</literal> (<filename>partial</filename> will be implicitly appended)</para></listitem>
      </varlistentry>
 ">
 
@@ -160,7 +144,7 @@
 
      <varlistentry><term><filename>&statedir;/lists/partial/</filename></term>
      <listitem><para>Storage area for state information in transit.
-     Configuration Item: <literal>Dir::State::Lists</literal> (implicit partial).</para></listitem>
+     Configuration Item: <literal>Dir::State::Lists</literal> (<filename>partial</filename> will be implicitly appended)</para></listitem>
      </varlistentry>
 ">
 
@@ -242,11 +226,17 @@
 <!-- TRANSLATOR: used as in apt-extracttemplates filename -->
 <!ENTITY synopsis-filename "filename">
 
-<!-- TRANSLATOR: used as parameters for apt-ftparchive  e.g. apt-ftparchive packages path override pathprefix -->
+<!-- TRANSLATOR: used as parameter for apt-ftparchive  e.g. apt-ftparchive packages path override-file pathprefix -->
 <!ENTITY synopsis-path "path">
+
+<!-- TRANSLATOR: used as parameter for apt-ftparchive  e.g. apt-ftparchive packages path override-file pathprefix -->
+<!ENTITY synopsis-override "override-file">
+
+<!-- TRANSLATOR: used as parameter for apt-ftparchive  e.g. apt-ftparchive packages path override-file pathprefix -->
 <!ENTITY synopsis-pathprefix "pathprefix">
+
+<!-- TRANSLATOR: used as parameter for apt-ftparchive  e.g. apt-ftparchive generate section -->
 <!ENTITY synopsis-section "section">
-<!ENTITY synopsis-override "override">
 
 <!-- TRANSLATOR: used as in apt-key export keyid  e.g. apt-key export 473041FA -->
 <!ENTITY synopsis-keyid "keyid">

+ 37 - 36
doc/apt_preferences.5.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="no"?>
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
-  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
 
 <!ENTITY % aptent SYSTEM "apt.ent">
 %aptent;
@@ -17,7 +17,7 @@
    &apt-email;
    &apt-product;
    <!-- The last update date -->
-   <date>16 February 2010</date>
+   <date>2012-06-09T00:00:00Z</date>
  </refentryinfo>
 
  <refmeta>
@@ -45,7 +45,7 @@ the &sources-list; file contains references to more than one distribution
 APT assigns a priority to each version that is available.
 Subject to dependency constraints, <command>apt-get</command> selects the
 version with the highest priority for installation.
-The APT preferences file overrides the priorities that APT assigns to
+The APT preferences override the priorities that APT assigns to
 package versions by default, thus giving the user control over which
 one is selected for installation.</para>
 
@@ -53,17 +53,17 @@ one is selected for installation.</para>
 the &sources-list; file contains references to more than one source.
 In this case <command>apt-get</command> downloads the instance listed
 earliest in the &sources-list; file.
-The APT preferences file does not affect the choice of instance, only
+The APT preferences do not affect the choice of instance, only
 the choice of version.</para>
 
 <para>Preferences are a strong power in the hands of a system administrator
 but they can become also their biggest nightmare if used without care!
-APT will not questioning the preferences so wrong settings will therefore
+APT will not question the preferences, so wrong settings can
 lead to uninstallable packages or wrong decisions while upgrading packages.
-Even more problems will arise if multiply distribution releases are mixed
+Even more problems will arise if multiple distribution releases are mixed
 without a good understanding of the following paragraphs.
-Packages included in a specific release aren't tested in and
-therefore doesn't always work as expected in older or newer releases or
+Packages included in a specific release aren't tested in (and
+therefore don't always work as expected in) older or newer releases, or
 together with other packages from different releases.
 You have been warned.</para>
 
@@ -72,9 +72,9 @@ directory are parsed in alphanumeric ascending order and need to obey the
 following naming convention: The files have either no or "<literal>pref</literal>"
 as filename extension and only contain alphanumeric, hyphen (-),
 underscore (_) and period (.) characters.
-Otherwise APT will print a notice that it has ignored a file if the file
-doesn't match a pattern in the <literal>Dir::Ignore-Files-Silently</literal>
-configuration list - in this case it will be silently ignored.</para>
+Otherwise APT will print a notice that it has ignored a file, unless that
+file matches a pattern in the <literal>Dir::Ignore-Files-Silently</literal>
+configuration list - in which case it will be silently ignored.</para>
 
 <refsect2><title>APT's Default Priority Assignments</title>
 
@@ -106,14 +106,14 @@ algorithm to set the priorities of the versions of a package.  Assign:
 <term>priority 1</term>
 <listitem><simpara>to the versions coming from archives which in their <filename>Release</filename>
 files are marked as "NotAutomatic: yes" but <emphasis>not</emphasis> as "ButAutomaticUpgrades: yes"
-like the debian <literal>experimental</literal> archive.</simpara></listitem>
+like the Debian <literal>experimental</literal> archive.</simpara></listitem>
 </varlistentry>
 
 <varlistentry>
 <term>priority 100</term>
 <listitem><simpara>to the version that is already installed (if any) and to the versions coming
 from archives which in their <filename>Release</filename> files are marked as "NotAutomatic: yes" and
-"ButAutomaticUpgrades: yes" like the debian backports archive since <literal>squeeze-backports</literal>.
+"ButAutomaticUpgrades: yes" like the Debian backports archive since <literal>squeeze-backports</literal>.
 </simpara></listitem>
 </varlistentry>
 
@@ -185,14 +185,14 @@ and a general form.
 <itemizedlist>
 <listitem>
 <simpara>The specific form assigns a priority (a "Pin-Priority") to one or more
-specified packages and specified version or version range.  For example,
+specified packages with a specified version or version range.  For example,
 the following record assigns a high priority to all versions of
-the <filename>perl</filename> package whose version number begins with "<literal>5.8</literal>".
+the <filename>perl</filename> package whose version number begins with "<literal>&good-perl;</literal>".
 Multiple packages can be separated by spaces.</simpara>
 
 <programlisting>
 Package: perl
-Pin: version 5.8*
+Pin: version &good-perl;*
 Pin-Priority: 1001
 </programlisting>
 </listitem>
@@ -246,11 +246,11 @@ Pin-Priority: 900
 
 <simpara>The following record assigns a high priority to all package versions
 belonging to any release whose Archive name is "<literal>stable</literal>"
-and whose release Version number is "<literal>3.0</literal>".</simpara>
+and whose release Version number is "<literal>&stable-version;</literal>".</simpara>
 
 <programlisting>
 Package: *
-Pin: release a=stable, v=3.0
+Pin: release a=stable, v=&stable-version;
 Pin-Priority: 500
 </programlisting>
 </listitem>
@@ -259,12 +259,12 @@ Pin-Priority: 500
 
 </refsect2>
 
-<refsect2><title>Regular expressions and glob() syntax</title>
+<refsect2><title>Regular expressions and &glob; syntax</title>
 <para>
-APT also supports pinning by glob() expressions and regular
-expressions surrounded by /. For example, the following
+APT also supports pinning by &glob; expressions, and regular
+expressions surrounded by slashes. For example, the following
 example assigns the priority 500 to all packages from
-experimental where the name starts with gnome (as a glob()-like
+experimental where the name starts with gnome (as a &glob;-like
 expression) or contains the word kde (as a POSIX extended regular
 expression surrounded by slashes).
 </para>
@@ -278,24 +278,25 @@ Pin-Priority: 500
 <para>
 The rule for those expressions is that they can occur anywhere
 where a string can occur. Thus, the following pin assigns the
-priority 990 to all packages from a release starting with karmic.
+priority 990 to all packages from a release starting with &ubuntu-codename;.
 </para>
 
 <programlisting>
 Package: *
-Pin: release n=karmic*
+Pin: release n=&ubuntu-codename;*
 Pin-Priority: 990
 </programlisting>
 
+<para>
 If a regular expression occurs in a <literal>Package</literal> field,
 the behavior is the same as if this regular expression were replaced
 with a list of all package names it matches. It is undecided whether
-this will change in the future, thus you should always list wild-card
+this will change in the future; thus you should always list wild-card
 pins first, so later specific pins override it.
 
 The pattern "<literal>*</literal>" in a Package field is not considered
-a glob() expression in itself.
-
+a &glob; expression in itself.
+</para>
 </refsect2>
 
 
@@ -356,7 +357,7 @@ records presented earlier:</para>
 
 <programlisting>
 Package: perl
-Pin: version 5.8*
+Pin: version &good-perl;*
 Pin-Priority: 1001
 
 Package: *
@@ -372,8 +373,8 @@ Pin-Priority: 50
 <itemizedlist>
 <listitem><simpara>The most recent available version of the <literal>perl</literal>
 package will be installed, so long as that version's version number begins
-with "<literal>5.8</literal>".  If <emphasis>any</emphasis> 5.8* version of <literal>perl</literal> is
-available and the installed version is 5.9*, then <literal>perl</literal> will be
+with "<literal>&good-perl;</literal>".  If <emphasis>any</emphasis> &good-perl;* version of <literal>perl</literal> is
+available and the installed version is &bad-perl;*, then <literal>perl</literal> will be
 downgraded.</simpara></listitem>
 <listitem><simpara>A version of any package other than <literal>perl</literal>
 that is available from the local system has priority over other versions,
@@ -459,17 +460,17 @@ Pin: release n=&testing-codename;
 <varlistentry>
 <term>the <literal>Version:</literal> line</term>
 <listitem><simpara>names the release version.  For example, the
-packages in the tree might belong to Debian GNU/Linux release
-version 3.0.  Note that there is normally no version number for the
+packages in the tree might belong to Debian release
+version &stable-version;.  Note that there is normally no version number for the
 <literal>testing</literal> and <literal>unstable</literal> distributions because they
 have not been released yet.  Specifying this in the APT preferences
 file would require one of the following lines.
 </simpara>
 
 <programlisting>
-Pin: release v=3.0
-Pin: release a=stable, v=3.0
-Pin: release 3.0
+Pin: release v=&stable-version;
+Pin: release a=stable, v=&stable-version;
+Pin: release &stable-version;
 </programlisting>
 
 </listitem>

+ 1 - 1
doc/design.sgml

@@ -31,7 +31,7 @@
 
 	<p>
 	  You should have received a copy of the GNU General Public
-	  License with your Debian GNU/Linux system, in
+	  License with your Debian system, in
 	  <tt>/usr/share/common-licenses/GPL</tt>, or with the
 	  <prgn/debiandoc-sgml/ source package as the file
 	  <tt>COPYING</tt>.  If not, write to the Free Software

+ 2 - 2
doc/dpkg-tech.sgml

@@ -21,7 +21,7 @@ by the Free Software Foundation; either version 2 of the License, or (at your
 option) any later version.
 
 <p>
-For more details, on Debian GNU/Linux systems, see the file
+For more details, on Debian systems, see the file
 /usr/share/common-licenses/GPL for the full license.
 </copyright>
 
@@ -164,7 +164,7 @@ not copied into here; it is instead found as part of status or available.
 <item>methods - this directory is reserved for "method"-specific files - each
 "method" has a subdirectory underneath this directory (or at least, it can
 have). In addition, there is another subdirectory "mnt", where misc.
-filesystems (floppies, CDROMs, etc.) are mounted.
+filesystems (floppies, CD-ROMs, etc.) are mounted.
 <item>alternatives - directory used by the "update-alternatives" program. It
 contains one file for each "alternatives" interface, which contains information
 about all the needed symlinked files for each alternative.

+ 3 - 3
doc/examples/apt-ftparchive.conf

@@ -21,21 +21,21 @@ Default {
 BinDirectory "pool/main" {
 	Packages "dists/sid/main/binary-i386/Packages";
 	Sources "dists/sid/main/source/Sources";
-	Contents "dists/sid/Contents-i386";
+	Contents "dists/sid/main/Contents-i386";
 }
 
 // This is the same for the contrib section
 BinDirectory "pool/contrib" {
 	Packages "dists/sid/contrib/binary-i386/Packages";
 	Sources "dists/sid/contrib/source/Sources";
-	Contents "dists/sid/Contents-i386";
+	Contents "dists/sid/contrib/Contents-i386";
 }
 
 // This is the same for the non-free section
 BinDirectory "pool/non-free" {
 	Packages "dists/sid/non-free/binary-i386/Packages";
 	Sources "dists/sid/non-free/source/Sources";
-	Contents "dists/sid/Contents-i386";
+	Contents "dists/sid/non-free/Contents-i386";
 };
 
 // By default all Packages should have the extension ".deb"

+ 1 - 1
doc/examples/configure-index

@@ -90,7 +90,7 @@ APT
 
   Authentication
   {
-     TrustCDROM "false";            // consider the CDROM always trusted
+     TrustCDROM "false";            // consider the CD-ROM always trusted
   };
 
   // Some general options

+ 0 - 9
doc/examples/sources.list

@@ -1,9 +0,0 @@
-# See sources.list(5) for more information, especialy
-# Remember that you can only use http, ftp or file URIs
-# CDROMs are managed through the apt-cdrom tool.
-deb http://http.us.debian.org/debian stable main contrib non-free
-deb http://security.debian.org stable/updates main contrib non-free
-
-# Uncomment if you want the apt-get source function to work
-#deb-src http://http.us.debian.org/debian stable main contrib non-free
-#deb-src http://security.debian.org stable/updates main contrib non-free

+ 8 - 0
doc/examples/sources.list.in

@@ -0,0 +1,8 @@
+# See sources.list(5) manpage for more information
+# Remember that CD-ROMs, DVDs and such are managed through the apt-cdrom tool.
+deb http://ftp.us.debian.org/debian &stable-codename; main contrib non-free
+deb http://security.debian.org &stable-codename;/updates main contrib non-free
+
+# Uncomment if you want the apt-get source function to work
+#deb-src http://ftp.us.debian.org/debian &stable-codename; main contrib non-free
+#deb-src http://security.debian.org &stable-codename;/updates main contrib non-free

+ 2 - 2
doc/files.sgml

@@ -21,7 +21,7 @@ by the Free Software Foundation; either version 2 of the License, or (at your
 option) any later version.
 
 <p>
-For more details, on Debian GNU/Linux systems, see the file
+For more details, on Debian systems, see the file
 /usr/share/common-licenses/GPL for the full license.
 </copyright>
 
@@ -163,7 +163,7 @@ The extended_states file serves the same purpose as the normal dpkg status file
 This includes currently only the autoflag but is open to store more
 unique data that come up over time. It duplicates nothing from the normal
 dpkg status file.  Please see other APT documentation for a discussion
-of the exact internal behaviour of these fields. The Package and the
+of the exact internal behavior of these fields. The Package and the
 Architecture field are placed directly before the new fields to indicate
 which package they apply to. The new fields are as follows:
 

+ 4 - 4
doc/guide.sgml

@@ -19,7 +19,7 @@ by the Free Software Foundation; either version 2 of the License, or (at your
 option) any later version.
 
 <p>
-For more details, on Debian GNU/Linux systems, see the file
+For more details, on Debian systems, see the file
 /usr/share/common-licenses/GPL for the full license.
 </copyright>
 
@@ -174,11 +174,11 @@ select the packages to be installed or removed and APT actually installs them.
 To enable the APT method you need to select [A]ccess in <prgn>dselect</> 
 and then choose the APT method. You will be prompted for a set of 
 <em>Sources</> which are places to fetch archives from. These can be remote
-Internet sites, local Debian mirrors or CDROMs. Each source can provide
+Internet sites, local Debian mirrors or CD-ROMs. Each source can provide
 a fragment of the total Debian archive, APT will automatically combine them
-to form a complete set of packages. If you have a CDROM then it is a good idea
+to form a complete set of packages. If you have a CD-ROM then it is a good idea
 to specify it first and then specify a mirror so that you have access to
-the latest bug fixes. APT will automatically use packages on your CDROM before
+the latest bug fixes. APT will automatically use packages on your CD-ROM before
 downloading from the Internet.
 
 <p>

+ 52 - 21
doc/makefile

@@ -11,6 +11,8 @@ SOURCE = $(wildcard *.sgml)
 DEBIANDOC_HTML_OPTIONS=-l en.UTF-8
 include $(DEBIANDOC_H)
 
+doc: manpages debiandoc
+
 # Do not use XMLTO, build the manpages directly with XSLTPROC
 ifdef XSLTPROC
 # generate a list of accepted man page translations
@@ -22,37 +24,33 @@ LOCAL := manpage-$(firstword $(SOURCE))
 $(LOCAL)-LIST := $(SOURCE)
 
 # Install generation hooks
-doc: $($(LOCAL)-LIST)
-veryclean: veryclean/$(LOCAL)
+manpages: $($(LOCAL)-LIST)
 
-$($(LOCAL)-LIST) :: % : %.xml $(INCLUDES)
+$($(LOCAL)-LIST) :: % : %.xml $(STYLESHEET) $(INCLUDES)
 	echo Creating man page $@
 	$(XSLTPROC) -o $@ $(STYLESHEET) $<
 
 # Clean rule
 .PHONY: veryclean/$(LOCAL)
+veryclean: veryclean/$(LOCAL)
 veryclean/$(LOCAL):
 	-rm -rf $($(@F)-LIST)
-
 endif
 
 # Chain to the manpage rule
 SOURCE = apt.8
 include $(MANPAGE_H)
 
+examples/sources.list: examples/sources.list.in apt-verbatim.ent
+	sed -e 's#&stable-codename;#$(shell grep --max-count=1 '^<!ENTITY stable-codename "' apt-verbatim.ent | cut -d'"' -f 2)#g' examples/sources.list.in > examples/sources.list
+
 # Examples
 SOURCE = examples/apt.conf examples/sources.list examples/configure-index examples/apt-https-method-example.conf
 TO = $(DOC)
 TARGET = binary
 include $(COPY_H)
 
-.PHONY: clean clean-subdirs veryclean veryclean-subdirs all binary doc
-doc:
-	for i in $(shell ls po/*.po | sed -r 's#po/([a-z]+[A-Z_]*).po#\1#'); do \
-		test -d $$i || mkdir $$i; \
-		test -f $$i/makefile || sed "s#@@LANG@@#$$i#" lang.makefile > $$i/makefile; \
-		$(MAKE) -C $$i $@; \
-	done
+.PHONY: clean clean-subdirs veryclean veryclean-subdirs all binary doc stats
 
 clean: clean-subdirs
 veryclean: veryclean-subdirs
@@ -67,20 +65,53 @@ veryclean-subdirs:
 		rm -rf $$dir; \
 	done
 
-.PHONY: update-po po4a stats
+stats:
+	for i in po/*.po; do echo -n "$$i: "; msgfmt --output-file=/dev/null --statistics $$i; done
 
 ifdef PO4A
-doc: po4a
+DOCUMENTATIONPO = $(patsubst %.po,%,$(notdir $(wildcard po/*.po)))
+MANPAGEPOLIST = $(addprefix manpages-translation-,$(DOCUMENTATIONPO))
+DEBIANDOCPOLIST = $(addprefix debiandoc-translation-,$(DOCUMENTATIONPO))
 
-update-po:
-	po4a --previous --no-backups --force --no-translations po4a.conf
+MANPAGEDIRLIST = $(addsuffix /makefile,$(DOCUMENTATIONPO))
 
-po4a:
-	po4a --previous --no-backups po4a.conf
-endif
+.PHONY: update-po po4a $(MANPAGEPOLIST) $(MANPAGEDIRLIST)
 
-stats:
-	for i in po/*.po; do echo -n "$$i: "; msgfmt --statistics $$i; done
+manpages: $(MANPAGEPOLIST)
+debiandoc: $(DEBIANDOCPOLIST)
+po4a: $(MANPAGEPOLIST) $(DEBIANDOCPOLIST)
+
+update-po:
+	po4a --previous --no-backups --force --no-translations \
+		--package-name='$(PACKAGE)-doc' --package-version='$(PACKAGE_VERSION)' \
+		--msgid-bugs-address='$(PACKAGE_MAIL)' po4a.conf
+
+$(MANPAGEPOLIST) :: manpages-translation-% : %/makefile po4a.conf
+	po4a --previous --no-backups --translate-only $(dir $<)apt.ent \
+		$(patsubst %,--translate-only $(dir $<)%,$(patsubst %.1.xml,%.$(subst /,,$(dir $<)).1.xml,$(wildcard *.1.xml))) \
+		$(patsubst %,--translate-only $(dir $<)%,$(patsubst %.2.xml,%.$(subst /,,$(dir $<)).2.xml,$(wildcard *.2.xml))) \
+		$(patsubst %,--translate-only $(dir $<)%,$(patsubst %.3.xml,%.$(subst /,,$(dir $<)).3.xml,$(wildcard *.3.xml))) \
+		$(patsubst %,--translate-only $(dir $<)%,$(patsubst %.4.xml,%.$(subst /,,$(dir $<)).4.xml,$(wildcard *.4.xml))) \
+		$(patsubst %,--translate-only $(dir $<)%,$(patsubst %.5.xml,%.$(subst /,,$(dir $<)).5.xml,$(wildcard *.5.xml))) \
+		$(patsubst %,--translate-only $(dir $<)%,$(patsubst %.6.xml,%.$(subst /,,$(dir $<)).6.xml,$(wildcard *.6.xml))) \
+		$(patsubst %,--translate-only $(dir $<)%,$(patsubst %.7.xml,%.$(subst /,,$(dir $<)).7.xml,$(wildcard *.7.xml))) \
+		$(patsubst %,--translate-only $(dir $<)%,$(patsubst %.8.xml,%.$(subst /,,$(dir $<)).8.xml,$(wildcard *.8.xml))) \
+		--package-name='$(PACKAGE)-doc' --package-version='$(PACKAGE_VERSION)' \
+		--msgid-bugs-address='$(PACKAGE_MAIL)' po4a.conf
+	$(MAKE) -C $(dir $<) manpages
+
+$(DEBIANDOCPOLIST) :: debiandoc-translation-% : %/makefile po4a.conf
+	po4a --previous --no-backups --translate-only $(dir $<)apt.ent \
+		$(patsubst %,--translate-only $(dir $<)%,$(patsubst %.sgml,%.$(subst /,,$(dir $<)).sgml,$(wildcard *.sgml))) \
+		--package-name='$(PACKAGE)-doc' --package-version='$(PACKAGE_VERSION)' \
+		--msgid-bugs-address='$(PACKAGE_MAIL)' po4a.conf
+	$(MAKE) -C $(dir $<) debiandoc
+
+dirs: $(MANPAGEDIRLIST)
+$(MANPAGEDIRLIST) :: %/makefile : lang.makefile
+	test -d $(dir $@) || mkdir $(dir $@)
+	sed "s#@@LANG@@#$(subst /,,$(dir $@))#" $< > $@
+endif
 
 ifdef DOXYGEN
 DOXYGEN_SOURCES = $(shell find $(BASE)/apt-pkg -not -name .\\\#* -and \( -name \*.cc -or -name \*.h \) )
@@ -97,5 +128,5 @@ $(BUILD)/doc/doxygen-stamp: $(DOXYGEN_SOURCES) $(BUILD)/doc/Doxyfile
 	$(DOXYGEN) $(BUILD)/doc/Doxyfile
 	touch $(BUILD)/doc/doxygen-stamp
 
-doc: $(BUILD)/doc/doxygen-stamp
+debiandoc: $(BUILD)/doc/doxygen-stamp
 endif

+ 8 - 0
doc/manpage-style.xsl

@@ -5,7 +5,15 @@
 <xsl:import href="/usr/share/xml/docbook/stylesheet/nwalsh/manpages/docbook.xsl" />
 
 <xsl:param name="man.output.encoding" select="'UTF-8'" />
+<!-- LANGUAGE -->
 
 <xsl:template match="email">&lt;<xsl:apply-templates/>&gt;</xsl:template>
 
+<xsl:template match="date">
+	<xsl:call-template name="datetime.format">
+		<xsl:with-param name="date" select="."/>
+		<xsl:with-param name="format" select="'d B Y'"/>
+	</xsl:call-template>
+</xsl:template>
+
 </xsl:stylesheet>

+ 3 - 3
doc/method.sgml

@@ -20,7 +20,7 @@ by the Free Software Foundation; either version 2 of the License, or (at your
 option) any later version.
 
 <p>
-For more details, on Debian GNU/Linux systems, see the file
+For more details, on Debian systems, see the file
 /usr/share/common-licenses/GPL for the full license.
 </copyright>
 
@@ -220,7 +220,7 @@ the ones it wants.
 <tag>Local<item>The method only returns Filename: fields.
 <tag>Send-Config<item>Send configuration to the method.
 <tag>Needs-Cleanup<item>The process is kept around while the files it returned
-are being used. This is primarily intended for CDROM and File URIs that need
+are being used. This is primarily intended for CD-ROM and File URIs that need
 to unmount filesystems.
 <tag>Version<item>Version string for the method
 </taglist>
@@ -318,7 +318,7 @@ Fields: Media, Fail
 <p>
 The methods supplied by the stock apt are:
 <enumlist>
-<item>cdrom - For Multi-Disc CDROMs
+<item>cdrom - For Multi-Disc CD-ROMs
 <item>copy - (internal) For copying files around the filesystem
 <item>file - For local files
 <item>gzip - (internal) For decompression

+ 1 - 1
doc/offline.sgml

@@ -20,7 +20,7 @@ by the Free Software Foundation; either version 2 of the License, or (at your
 option) any later version.
 
 <p>
-For more details, on Debian GNU/Linux systems, see the file
+For more details, on Debian systems, see the file
 /usr/share/common-licenses/GPL for the full license.
 </copyright>
 

File diff suppressed because it is too large
+ 3669 - 5036
doc/po/apt-doc.pot


File diff suppressed because it is too large
+ 6632 - 7910
doc/po/de.po


File diff suppressed because it is too large
+ 6586 - 7837
doc/po/es.po


File diff suppressed because it is too large
+ 6638 - 7920
doc/po/fr.po


File diff suppressed because it is too large
+ 3728 - 5112
doc/po/it.po


File diff suppressed because it is too large
+ 6497 - 7748
doc/po/ja.po


File diff suppressed because it is too large
+ 5552 - 6902
doc/po/pl.po


+ 0 - 0
doc/po/pt.po


Some files were not shown because too many files changed in this diff