Browse Source

merged from the debian-sid branch

Michael Vogt 13 years ago
parent
commit
d2cca6ec46
100 changed files with 3089 additions and 2244 deletions
  1. 4 0
      .bzr-builddeb/default.conf
  2. 1 0
      .bzrignore
  3. 0 1
      COMPILING
  4. 8 3
      Makefile
  5. 0 35
      apt-inst/database.cc
  6. 0 60
      apt-inst/database.h
  7. 0 63
      apt-inst/deb/debfile.cc
  8. 2 6
      apt-inst/deb/debfile.h
  9. 0 494
      apt-inst/deb/dpkgdb.cc
  10. 0 55
      apt-inst/deb/dpkgdb.h
  11. 4 5
      apt-inst/makefile
  12. 13 28
      apt-pkg/acquire-method.cc
  13. 3 0
      apt-pkg/acquire-method.h
  14. 29 33
      apt-pkg/acquire-worker.cc
  15. 37 6
      apt-pkg/acquire.cc
  16. 84 27
      apt-pkg/algorithms.cc
  17. 4 1
      apt-pkg/algorithms.h
  18. 79 32
      apt-pkg/aptconfiguration.cc
  19. 8 0
      apt-pkg/aptconfiguration.h
  20. 47 2
      apt-pkg/cachefilter.cc
  21. 30 0
      apt-pkg/cachefilter.h
  22. 3 1
      apt-pkg/cacheiterators.h
  23. 57 6
      apt-pkg/cacheset.cc
  24. 3 2
      apt-pkg/cacheset.h
  25. 37 24
      apt-pkg/cdrom.cc
  26. 1 0
      apt-pkg/cdrom.h
  27. 10 6
      apt-pkg/clean.cc
  28. 5 3
      apt-pkg/contrib/cmndline.cc
  29. 111 38
      apt-pkg/contrib/configuration.cc
  30. 2 0
      apt-pkg/contrib/configuration.h
  31. 290 84
      apt-pkg/contrib/fileutl.cc
  32. 1 0
      apt-pkg/contrib/fileutl.h
  33. 33 19
      apt-pkg/contrib/mmap.cc
  34. 34 32
      apt-pkg/contrib/netrc.cc
  35. 3 5
      apt-pkg/contrib/netrc.h
  36. 6 2
      apt-pkg/contrib/sha2_internal.cc
  37. 37 20
      apt-pkg/contrib/strutl.cc
  38. 5 4
      apt-pkg/deb/debindexfile.cc
  39. 102 74
      apt-pkg/deb/deblistparser.cc
  40. 18 12
      apt-pkg/deb/dpkgpm.cc
  41. 27 29
      apt-pkg/depcache.cc
  42. 8 10
      apt-pkg/edsp.cc
  43. 2 1
      apt-pkg/edsp/edspindexfile.cc
  44. 1 1
      apt-pkg/edsp/edspsystem.cc
  45. 22 11
      apt-pkg/indexcopy.cc
  46. 1 1
      apt-pkg/init.cc
  47. 7 1
      apt-pkg/makefile
  48. 19 11
      apt-pkg/packagemanager.cc
  49. 57 3
      apt-pkg/pkgcache.cc
  50. 79 10
      apt-pkg/pkgcachegen.cc
  51. 26 23
      apt-pkg/policy.cc
  52. 1 0
      apt-pkg/srcrecords.h
  53. 12 17
      buildlib/config.h.in
  54. 33 7
      buildlib/configure.mak
  55. 1 1
      buildlib/copy.mak
  56. 4 2
      buildlib/debiandoc.mak
  57. 1 1
      buildlib/defaults.mak
  58. 4 2
      buildlib/environment.mak.in
  59. 0 50
      buildlib/inttypes.h.in
  60. 0 5
      buildlib/makefile.in
  61. 2 1
      buildlib/manpage.mak
  62. 0 14
      buildlib/mkChangeLog
  63. 9 3
      buildlib/po4a_manpage.mak
  64. 2 2
      buildlib/podomain.mak
  65. 0 25
      buildlib/sizetable
  66. 8 4
      cmdline/apt-cache.cc
  67. 1 1
      cmdline/apt-cdrom.cc
  68. 10 2
      cmdline/apt-config.cc
  69. 1 1
      cmdline/apt-dump-solver.cc
  70. 5 3
      cmdline/apt-extracttemplates.cc
  71. 135 70
      cmdline/apt-get.cc
  72. 8 9
      cmdline/apt-internal-solver.cc
  73. 2 1
      cmdline/apt-key
  74. 16 4
      cmdline/apt-mark.cc
  75. 1 1
      cmdline/apt-sortpkgs.cc
  76. 19 14
      cmdline/makefile
  77. 21 48
      configure.in
  78. 1 1
      debian/apt-utils.install
  79. 0 1
      debian/apt-utils.links
  80. 8 6
      debian/apt.cron.daily
  81. 7 0
      debian/apt.postinst
  82. 707 16
      debian/changelog
  83. 11 6
      debian/control
  84. 0 0
      debian/libapt-inst1.5.install.in
  85. 1 29
      debian/libapt-inst1.4.symbols
  86. 134 49
      debian/libapt-pkg4.12.symbols
  87. 16 23
      debian/rules
  88. 1 1
      doc/Doxyfile.in
  89. 35 64
      doc/apt-cache.8.xml
  90. 18 32
      doc/apt-cdrom.8.xml
  91. 30 27
      doc/apt-config.8.xml
  92. 10 17
      doc/apt-extracttemplates.1.xml
  93. 81 102
      doc/apt-ftparchive.1.xml
  94. 76 170
      doc/apt-get.8.xml
  95. 31 32
      doc/apt-key.8.xml
  96. 20 39
      doc/apt-mark.8.xml
  97. 42 36
      doc/apt-secure.8.xml
  98. 8 17
      doc/apt-sortpkgs.1.xml
  99. 196 4
      doc/apt-verbatim.ent
  100. 0 0
      doc/apt.8

+ 4 - 0
.bzr-builddeb/default.conf

@@ -1,2 +1,6 @@
 [BUILDDEB]
 native = true
+
+[HOOKS]
+pre-export = ./prepare-release pre-export
+post-build = ./prepare-release post-build

+ 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

+ 8 - 3
Makefile

@@ -9,8 +9,8 @@ endif
 .PHONY: default
 default: startup all
 
-.PHONY: headers library clean veryclean all binary program doc test
-all headers library clean veryclean binary program doc dirs test:
+.PHONY: headers library clean veryclean all binary program doc 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,9 +21,14 @@ all headers library clean veryclean binary program doc dirs test:
 	$(MAKE) -C po $@
 	$(MAKE) -C test $@
 
+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.

+ 0 - 35
apt-inst/database.cc

@@ -1,35 +0,0 @@
-// -*- mode: cpp; mode: fold -*-
-// Description								/*{{{*/
-// $Id: database.cc,v 1.2 2001/02/20 07:03:16 jgg Exp $
-/* ######################################################################
-
-   Data Base Abstraction
-   
-   ##################################################################### */
-									/*}}}*/
-// Include Files							/*{{{*/
-#include<config.h>
-
-#include <apt-pkg/database.h>
-#include <apt-pkg/filelist.h>
-#include <apt-pkg/pkgcachegen.h>
-									/*}}}*/
-
-// DataBase::GetMetaTmp - Get the temp dir				/*{{{*/
-// ---------------------------------------------------------------------
-/* This re-initializes the meta temporary directory if it hasn't yet 
-   been inited for this cycle. The flag is the emptyness of MetaDir */
-bool pkgDataBase::GetMetaTmp(std::string &Dir)
-{
-   if (MetaDir.empty() == true)
-      if (InitMetaTmp(MetaDir) == false)
-	 return false;
-   Dir = MetaDir;
-   return true;
-}
-									/*}}}*/
-pkgDataBase::~pkgDataBase()
-{
-   delete Cache;
-   delete FList;
-}

+ 0 - 60
apt-inst/database.h

@@ -1,60 +0,0 @@
-// -*- mode: cpp; mode: fold -*-
-// Description								/*{{{*/
-// $Id: database.h,v 1.2 2001/02/20 07:03:16 jgg Exp $
-/* ######################################################################
-
-   Data Base Abstraction
-   
-   This class provides a simple interface to an abstract notion of a 
-   database directory for storing state information about the system.
-
-   The 'Meta' information for a package is the control information and
-   setup scripts stored inside the archive. GetMetaTmp returns the name of
-   a directory that is used to store named files containing the control
-   information. 
-   
-   The File Listing is the database of installed files. It is loaded 
-   into the memory/persistent cache structure by the ReadFileList method.  
-   
-   ##################################################################### */
-									/*}}}*/
-#ifndef PKGLIB_DATABASE_H
-#define PKGLIB_DATABASE_H
-
-#include <apt-pkg/pkgcachegen.h>
-
-#include <string>
-
-#ifndef APT_8_CLEANER_HEADERS
-#include <apt-pkg/filelist.h>
-#endif
-
-class pkgFLCache;
-class OpProgress;
-
-class pkgDataBase
-{
-   protected:
-   
-   pkgCacheGenerator *Cache;
-   pkgFLCache *FList;
-   std::string MetaDir;
-   virtual bool InitMetaTmp(std::string &Dir) = 0;
-   
-   public:
-
-   // Some manipulators for the cache and generator
-   inline pkgCache &GetCache() {return Cache->GetCache();};
-   inline pkgFLCache &GetFLCache() {return *FList;};
-   inline pkgCacheGenerator &GetGenerator() {return *Cache;};
-   
-   bool GetMetaTmp(std::string &Dir);
-   virtual bool ReadyFileList(OpProgress &Progress) = 0;
-   virtual bool ReadyPkgCache(OpProgress &Progress) = 0;
-   virtual bool LoadChanges() = 0;
-
-   pkgDataBase() : Cache(0), FList(0) {};
-   virtual ~pkgDataBase();
-};
-
-#endif

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

@@ -18,7 +18,6 @@
 // Include Files							/*{{{*/
 #include<config.h>
 
-#include <apt-pkg/database.h>
 #include <apt-pkg/debfile.h>
 #include <apt-pkg/extracttar.h>
 #include <apt-pkg/error.h>
@@ -90,42 +89,6 @@ const ARArchive::Member *debDebFile::GotoMember(const char *Name)
    return Member;
 }
 									/*}}}*/
-// DebFile::ExtractControl - Extract Control information		/*{{{*/
-// ---------------------------------------------------------------------
-/* Extract the control information into the Database's temporary 
-   directory. */
-bool debDebFile::ExtractControl(pkgDataBase &DB)
-{
-   // Get the archive member and positition the file
-   const ARArchive::Member *Member = GotoMember("control.tar.gz");
-   if (Member == 0)
-      return false;
-      
-   // Prepare Tar
-   ControlExtract Extract;
-   ExtractTar Tar(File,Member->Size,"gzip");
-   if (_error->PendingError() == true)
-      return false;
-   
-   // Get into the temporary directory
-   std::string Cwd = SafeGetCWD();
-   std::string Tmp;
-   if (DB.GetMetaTmp(Tmp) == false)
-      return false;
-   if (chdir(Tmp.c_str()) != 0)
-      return _error->Errno("chdir",_("Couldn't change to %s"),Tmp.c_str());
-   
-   // Do extraction
-   if (Tar.Go(Extract) == false)
-      return false;
-   
-   // Switch out of the tmp directory.
-   if (chdir(Cwd.c_str()) != 0)
-      chdir("/");
-   
-   return true;
-}
-									/*}}}*/
 // DebFile::ExtractArchive - Extract the archive data itself		/*{{{*/
 // ---------------------------------------------------------------------
 /* Simple wrapper around tar.. */
@@ -167,32 +130,6 @@ bool debDebFile::ExtractArchive(pkgDirStream &Stream)
    return Tar.Go(Stream);
 }
 									/*}}}*/
-// DebFile::MergeControl - Merge the control information		/*{{{*/
-// ---------------------------------------------------------------------
-/* This reads the extracted control file into the cache and returns the
-   version that was parsed. All this really does is select the correct
-   parser and correct file to parse. */
-pkgCache::VerIterator debDebFile::MergeControl(pkgDataBase &DB)
-{
-   // Open the control file
-   std::string Tmp;
-   if (DB.GetMetaTmp(Tmp) == false)
-      return pkgCache::VerIterator(DB.GetCache());
-   FileFd Fd(Tmp + "control",FileFd::ReadOnly);
-   if (_error->PendingError() == true)
-      return pkgCache::VerIterator(DB.GetCache());
-   
-   // Parse it
-   debListParser Parse(&Fd);
-   pkgCache::VerIterator Ver(DB.GetCache());
-   if (DB.GetGenerator().MergeList(Parse,&Ver) == false)
-      return pkgCache::VerIterator(DB.GetCache());
-   
-   if (Ver.end() == true)
-      _error->Error(_("Failed to locate a valid control file"));
-   return Ver;
-}
-									/*}}}*/
 
 // DebFile::ControlExtract::DoItem - Control Tar Extraction		/*{{{*/
 // ---------------------------------------------------------------------

+ 2 - 6
apt-inst/deb/debfile.h

@@ -30,11 +30,10 @@
 #include <apt-pkg/pkgcache.h>
 
 #ifndef APT_8_CLEANER_HEADERS
-#include <apt-pkg/database.h>
+#include <apt-pkg/md5.h>
 #endif
 
 class FileFd;
-class pkgDataBase;
 
 class debDebFile
 {
@@ -46,13 +45,10 @@ class debDebFile
    bool CheckMember(const char *Name);
    
    public:
-
    class ControlExtract;
    class MemControlExtract;
-   
-   bool ExtractControl(pkgDataBase &DB);
+
    bool ExtractArchive(pkgDirStream &Stream);
-   pkgCache::VerIterator MergeControl(pkgDataBase &DB);
    const ARArchive::Member *GotoMember(const char *Name);
    inline FileFd &GetFile() {return File;};
    

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

@@ -1,494 +0,0 @@
-// -*- mode: cpp; mode: fold -*-
-// Description								/*{{{*/
-// $Id: dpkgdb.cc,v 1.7.2.1 2004/01/16 18:58:50 mdz Exp $
-/* ######################################################################
-
-   DPKGv1 Database Implemenation
-   
-   This class provides parsers and other implementations for the DPKGv1
-   database. It reads the diversion file, the list files and the status
-   file to build both the list of currently installed files and the 
-   currently installed package list.
-   
-   ##################################################################### */
-									/*}}}*/
-// Include Files							/*{{{*/
-#include<config.h>
-
-#include <apt-pkg/dpkgdb.h>
-#include <apt-pkg/configuration.h>
-#include <apt-pkg/error.h>
-#include <apt-pkg/progress.h>
-#include <apt-pkg/tagfile.h>
-#include <apt-pkg/strutl.h>
-#include <apt-pkg/fileutl.h>
-#include <apt-pkg/filelist.h>
-
-#include <stdio.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <ctype.h>
-#include <iostream>
-#include <apti18n.h>
-									/*}}}*/
-using namespace std;
-
-// EraseDir - Erase A Directory						/*{{{*/
-// ---------------------------------------------------------------------
-/* This is necessary to create a new empty sub directory. The caller should
-   invoke mkdir after this with the proper permissions and check for 
-   error. Maybe stick this in fileutils */
-static bool EraseDir(const char *Dir)
-{
-   // First we try a simple RM
-   if (rmdir(Dir) == 0 ||
-       errno == ENOENT)
-      return true;
-   
-   // A file? Easy enough..
-   if (errno == ENOTDIR)
-   {
-      if (unlink(Dir) != 0)
-	 return _error->Errno("unlink",_("Failed to remove %s"),Dir);
-      return true;
-   }
-   
-   // Should not happen
-   if (errno != ENOTEMPTY)
-      return _error->Errno("rmdir",_("Failed to remove %s"),Dir);
-   
-   // Purge it using rm
-   pid_t Pid = ExecFork();
-
-   // Spawn the subprocess
-   if (Pid == 0)
-   {
-      execlp(_config->Find("Dir::Bin::rm","/bin/rm").c_str(),
-	     "rm","-rf","--",Dir,(char *)NULL);
-      _exit(100);
-   }
-   return ExecWait(Pid,_config->Find("dir::bin::rm","/bin/rm").c_str());
-}
-									/*}}}*/
-// DpkgDB::debDpkgDB - Constructor					/*{{{*/
-// ---------------------------------------------------------------------
-/* */
-debDpkgDB::debDpkgDB() : CacheMap(0), FileMap(0)
-{
-   AdminDir = flNotFile(_config->Find("Dir::State::status"));   
-   DiverInode = 0;
-   DiverTime = 0;
-}
-									/*}}}*/
-// DpkgDB::~debDpkgDB - Destructor					/*{{{*/
-// ---------------------------------------------------------------------
-/* */
-debDpkgDB::~debDpkgDB()
-{
-   delete Cache;
-   Cache = 0;
-   delete CacheMap;
-   CacheMap = 0;
-   
-   delete FList;
-   FList = 0;
-   delete FileMap;
-   FileMap = 0;
-}
-									/*}}}*/
-// DpkgDB::InitMetaTmp - Get the temp dir for meta information		/*{{{*/
-// ---------------------------------------------------------------------
-/* This creats+empties the meta temporary directory /var/lib/dpkg/tmp.ci
-   Only one package at a time can be using the returned meta directory. */
-bool debDpkgDB::InitMetaTmp(string &Dir)
-{
-   string Tmp = AdminDir + "tmp.ci/";
-   if (EraseDir(Tmp.c_str()) == false)
-      return _error->Error(_("Unable to create %s"),Tmp.c_str());
-   if (mkdir(Tmp.c_str(),0755) != 0)
-      return _error->Errno("mkdir",_("Unable to create %s"),Tmp.c_str());
-   
-   // Verify it is on the same filesystem as the main info directory
-   dev_t Dev;
-   struct stat St;
-   if (stat((AdminDir + "info").c_str(),&St) != 0)
-      return _error->Errno("stat",_("Failed to stat %sinfo"),AdminDir.c_str());
-   Dev = St.st_dev;
-   if (stat(Tmp.c_str(),&St) != 0)
-      return _error->Errno("stat",_("Failed to stat %s"),Tmp.c_str());
-   if (Dev != St.st_dev)
-      return _error->Error(_("The info and temp directories need to be on the same filesystem"));
-   
-   // Done
-   Dir = Tmp;
-   return true;
-}
-									/*}}}*/
-// DpkgDB::ReadyPkgCache - Prepare the cache with the current status	/*{{{*/
-// ---------------------------------------------------------------------
-/* This reads in the status file into an empty cache. This really needs 
-   to be somehow unified with the high level APT notion of the Database
-   directory, but there is no clear way on how to do that yet. */
-bool debDpkgDB::ReadyPkgCache(OpProgress &Progress)
-{
-   if (Cache != 0)
-   {  
-      Progress.OverallProgress(1,1,1,_("Reading package lists"));      
-      return true;
-   }
-   
-   if (CacheMap != 0)
-   {
-      delete CacheMap;
-      CacheMap = 0;
-   }
-   
-   if (pkgCacheGenerator::MakeOnlyStatusCache(&Progress,&CacheMap) == false)
-      return false;
-   Cache->DropProgress();
-   
-   return true;
-}
-									/*}}}*/
-// DpkgDB::ReadFList - Read the File Listings in 			/*{{{*/
-// ---------------------------------------------------------------------
-/* This reads the file listing in from the state directory. This is a 
-   performance critical routine, as it needs to parse about 50k lines of
-   text spread over a hundred or more files. For an initial cold start
-   most of the time is spent in reading file inodes and so on, not 
-   actually parsing. */
-bool debDpkgDB::ReadFList(OpProgress &Progress)
-{
-   // Count the number of packages we need to read information for
-   unsigned long Total = 0;
-   pkgCache &Cache = this->Cache->GetCache();
-   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
-   {
-      // Only not installed packages have no files.
-      if (I->CurrentState == pkgCache::State::NotInstalled)
-	 continue;
-      Total++;
-   }
-
-   /* Switch into the admin dir, this prevents useless lookups for the 
-      path components */
-   string Cwd = SafeGetCWD();
-   if (chdir((AdminDir + "info/").c_str()) != 0)
-      return _error->Errno("chdir",_("Failed to change to the admin dir %sinfo"),AdminDir.c_str());
-   
-   // Allocate a buffer. Anything larger than this buffer will be mmaped
-   unsigned long BufSize = 32*1024;
-   char *Buffer = new char[BufSize];
-
-   // Begin Loading them
-   unsigned long Count = 0;
-   char Name[300];
-   for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
-   {
-      /* Only not installed packages have no files. ConfFile packages have
-         file lists but we don't want to read them in */
-      if (I->CurrentState == pkgCache::State::NotInstalled ||
-	  I->CurrentState == pkgCache::State::ConfigFiles)
-	 continue;
-
-      // Fetch a package handle to associate with the file
-      pkgFLCache::PkgIterator FlPkg = FList->GetPkg(I.Name(),0,true);
-      if (FlPkg.end() == true)
-      {
-	 _error->Error(_("Internal error getting a package name"));
-	 break;
-      }
-      
-      Progress.OverallProgress(Count,Total,1,_("Reading file listing"));
-     
-      // Open the list file
-      snprintf(Name,sizeof(Name),"%s.list",I.Name());
-      int Fd = open(Name,O_RDONLY);
-      
-      /* Okay this is very strange and bad.. Best thing is to bail and
-         instruct the user to look into it. */
-      struct stat Stat;
-      if (Fd == -1 || fstat(Fd,&Stat) != 0)
-      {
-	 _error->Errno("open",_("Failed to open the list file '%sinfo/%s'. If you "
-		       "cannot restore this file then make it empty "
-		       "and immediately re-install the same version of the package!"),
-		       AdminDir.c_str(),Name);
-	 break;
-      }
-      
-      // Set File to be a memory buffer containing the whole file
-      char *File;
-      if ((unsigned)Stat.st_size < BufSize)
-      {
-	 if (read(Fd,Buffer,Stat.st_size) != Stat.st_size)
-	 {
-	    _error->Errno("read",_("Failed reading the list file %sinfo/%s"),
-			  AdminDir.c_str(),Name);
-	    close(Fd);
-	    break;
-	 }
-	 File = Buffer;
-      }
-      else
-      {
-	 // Use mmap
-	 File = (char *)mmap(0,Stat.st_size,PROT_READ,MAP_PRIVATE,Fd,0);
-	 if (File == (char *)(-1))
-	 {
-	    _error->Errno("mmap",_("Failed reading the list file %sinfo/%s"),
-			  AdminDir.c_str(),Name);
-	    close(Fd);
-	    break;
-	 }	    
-      }
-      
-      // Parse it
-      const char *Start = File;
-      const char *End = File;
-      const char *Finish = File + Stat.st_size;
-      for (; End < Finish; End++)
-      {
-	 // Not an end of line
-	 if (*End != '\n' && End + 1 < Finish)
-	    continue;
-
-	 // Skip blank lines
-	 if (End - Start > 1)
-	 {
-	    pkgFLCache::NodeIterator Node = FList->GetNode(Start,End,
- 					      FlPkg.Offset(),true,false);
-	    if (Node.end() == true)
-	    {
-	       _error->Error(_("Internal error getting a node"));
-	       break;
-	    }
-	 }
-	 
-	 // Skip past the end of line
-	 for (; *End == '\n' && End < Finish; End++);
-	 Start = End;
-      }      
-      
-      close(Fd);
-      if ((unsigned)Stat.st_size >= BufSize)
-	 munmap((caddr_t)File,Stat.st_size);
-      
-      // Failed
-      if (End < Finish)
-	 break;
-      
-      Count++;
-   }
-
-   delete [] Buffer;
-   if (chdir(Cwd.c_str()) != 0)
-      chdir("/");
-   
-   return !_error->PendingError();
-}
-									/*}}}*/
-// DpkgDB::ReadDiversions - Load the diversions file			/*{{{*/
-// ---------------------------------------------------------------------
-/* Read the diversion file in from disk. This is usually invoked by 
-   LoadChanges before performing an operation that uses the FLCache. */
-bool debDpkgDB::ReadDiversions()
-{
-   struct stat Stat;
-   if (stat((AdminDir + "diversions").c_str(),&Stat) != 0)
-      return true;
-   
-   if (_error->PendingError() == true)
-      return false;
-   
-   FILE *Fd = fopen((AdminDir + "diversions").c_str(),"r");
-   if (Fd == 0)
-      return _error->Errno("fopen",_("Failed to open the diversions file %sdiversions"),AdminDir.c_str());
-	
-   FList->BeginDiverLoad();
-   while (1)
-   {
-      char From[300];
-      char To[300];
-      char Package[100];
-   
-      // Read the three lines in
-      if (fgets(From,sizeof(From),Fd) == 0)
-	 break;
-      if (fgets(To,sizeof(To),Fd) == 0 ||
-	  fgets(Package,sizeof(Package),Fd) == 0)
-      {
-	 _error->Error(_("The diversion file is corrupted"));
-	 break;
-      }
-      
-      // Strip the \ns
-      unsigned long Len = strlen(From);
-      if (Len < 2 || From[Len-1] != '\n')
-	 _error->Error(_("Invalid line in the diversion file: %s"),From);
-      else
-	 From[Len-1] = 0;
-      Len = strlen(To);
-      if (Len < 2 || To[Len-1] != '\n')
-	 _error->Error(_("Invalid line in the diversion file: %s"),To);
-      else
-	 To[Len-1] = 0;     
-      Len = strlen(Package);
-      if (Len < 2 || Package[Len-1] != '\n')
-	 _error->Error(_("Invalid line in the diversion file: %s"),Package);
-      else
-	 Package[Len-1] = 0;
-      
-      // Make sure the lines were parsed OK
-      if (_error->PendingError() == true)
-	 break;
-      
-      // Fetch a package
-      if (strcmp(Package,":") == 0)
-	 Package[0] = 0;
-      pkgFLCache::PkgIterator FlPkg = FList->GetPkg(Package,0,true);
-      if (FlPkg.end() == true)
-      {
-	 _error->Error(_("Internal error getting a package name"));
-	 break;
-      }
-      
-      // Install the diversion
-      if (FList->AddDiversion(FlPkg,From,To) == false)
-      {
-	 _error->Error(_("Internal error adding a diversion"));
-	 break;
-      }
-   }
-   if (_error->PendingError() == false)
-      FList->FinishDiverLoad();
-   
-   DiverInode = Stat.st_ino;
-   DiverTime = Stat.st_mtime;
-   
-   fclose(Fd);
-   return !_error->PendingError();
-}
-									/*}}}*/
-// DpkgDB::ReadFileList - Read the file listing				/*{{{*/
-// ---------------------------------------------------------------------
-/* Read in the file listing. The file listing is created from three
-   sources, *.list, Conffile sections and the Diversion table. */
-bool debDpkgDB::ReadyFileList(OpProgress &Progress)
-{
-   if (Cache == 0)
-      return _error->Error(_("The pkg cache must be initialized first"));
-   if (FList != 0)
-   {
-      Progress.OverallProgress(1,1,1,_("Reading file listing"));
-      return true;
-   }
-   
-   // Create the cache and read in the file listing
-   FileMap = new DynamicMMap(MMap::Public);
-   FList = new pkgFLCache(*FileMap);
-   if (_error->PendingError() == true || 
-       ReadFList(Progress) == false ||
-       ReadConfFiles() == false || 
-       ReadDiversions() == false)
-   {
-      delete FList;
-      delete FileMap;
-      FileMap = 0;
-      FList = 0;
-      return false;
-   }
-      
-   cout << "Node: " << FList->HeaderP->NodeCount << ',' << FList->HeaderP->UniqNodes << endl;
-   cout << "Dir: " << FList->HeaderP->DirCount << endl;
-   cout << "Package: " << FList->HeaderP->PackageCount << endl;
-   cout << "HashSize: " << FList->HeaderP->HashSize << endl;
-   cout << "Size: " << FileMap->Size() << endl;
-   cout << endl;
-
-   return true;
-}
-									/*}}}*/
-// DpkgDB::ReadConfFiles - Read the conf file sections from the s-file	/*{{{*/
-// ---------------------------------------------------------------------
-/* Reading the conf files is done by reparsing the status file. This is
-   actually rather fast so it is no big deal. */
-bool debDpkgDB::ReadConfFiles()
-{
-   FileFd File(_config->FindFile("Dir::State::status"),FileFd::ReadOnly);
-   pkgTagFile Tags(&File);
-   if (_error->PendingError() == true)
-      return false;
-   
-   pkgTagSection Section;   
-   while (1)
-   {
-      // Skip to the next section
-      unsigned long Offset = Tags.Offset();
-      if (Tags.Step(Section) == false)
-	 break;
-	 
-      // Parse the line
-      const char *Start;
-      const char *Stop;
-      if (Section.Find("Conffiles",Start,Stop) == false)
-	 continue;
-
-      const char *PkgStart;
-      const char *PkgEnd;
-      if (Section.Find("Package",PkgStart,PkgEnd) == false)
-	 return _error->Error(_("Failed to find a Package: header, offset %lu"),Offset);
-
-      // Snag a package record for it
-      pkgFLCache::PkgIterator FlPkg = FList->GetPkg(PkgStart,PkgEnd,true);
-      if (FlPkg.end() == true)
-	 return _error->Error(_("Internal error getting a package name"));
-
-      // Parse the conf file lines
-      while (1)
-      {
-	 for (; isspace(*Start) != 0 && Start < Stop; Start++);
-	 if (Start == Stop)
-	    break;
-
-	 // Split it into words
-	 const char *End = Start;
-	 for (; isspace(*End) == 0 && End < Stop; End++);
-	 const char *StartMd5 = End;
-	 for (; isspace(*StartMd5) != 0 && StartMd5 < Stop; StartMd5++);
-	 const char *EndMd5 = StartMd5;
-	 for (; isspace(*EndMd5) == 0 && EndMd5 < Stop; EndMd5++);
-	 if (StartMd5 == EndMd5 || Start == End)
-	    return _error->Error(_("Bad ConfFile section in the status file. Offset %lu"),Offset);
-	 	 
-	 // Insert a new entry
-	 unsigned char MD5[16];
-	 if (Hex2Num(string(StartMd5,EndMd5-StartMd5),MD5,16) == false)
-	    return _error->Error(_("Error parsing MD5. Offset %lu"),Offset);
-
-	 if (FList->AddConfFile(Start,End,FlPkg,MD5) == false)
-	    return false;
-	 Start = EndMd5;
-      }      
-   }   
-   
-   return true;
-}
-									/*}}}*/
-// DpkgDB::LoadChanges - Read in any changed state files		/*{{{*/
-// ---------------------------------------------------------------------
-/* The only file in the dpkg system that can change while packages are
-   unpacking is the diversions file. */
-bool debDpkgDB::LoadChanges()
-{
-   struct stat Stat;
-   if (stat((AdminDir + "diversions").c_str(),&Stat) != 0)
-      return true;
-   if (DiverInode == Stat.st_ino && DiverTime == Stat.st_mtime)
-      return true;
-   return ReadDiversions();
-}
-									/*}}}*/

+ 0 - 55
apt-inst/deb/dpkgdb.h

@@ -1,55 +0,0 @@
-// -*- mode: cpp; mode: fold -*-
-// Description								/*{{{*/
-// $Id: dpkgdb.h,v 1.2 2001/02/20 07:03:17 jgg Exp $
-/* ######################################################################
-
-   DPKGv1 Data Base Implemenation
-   
-   The DPKGv1 database is typically stored in /var/lib/dpkg/. For 
-   DPKGv1 the 'meta' information is the contents of the .deb control.tar.gz
-   member prepended by the package name. The meta information is unpacked
-   in its temporary directory and then migrated into the main list dir
-   at a checkpoint.
-   
-   Journaling is providing by syncronized file writes to the updates sub
-   directory.
-
-   ##################################################################### */
-									/*}}}*/
-#ifndef PKGLIB_DPKGDB_H
-#define PKGLIB_DPKGDB_H
-
-
-#include <apt-pkg/database.h>
-
-#include <string>
-
-class DynamicMMap;
-class OpProgress;
-
-class debDpkgDB : public pkgDataBase
-{
-   protected:
-
-   std::string AdminDir;
-   DynamicMMap *CacheMap;
-   DynamicMMap *FileMap;
-   unsigned long DiverInode;
-   signed long DiverTime;
-
-   virtual bool InitMetaTmp(std::string &Dir);
-   bool ReadFList(OpProgress &Progress);
-   bool ReadDiversions();
-   bool ReadConfFiles();
-      
-   public:
-
-   virtual bool ReadyFileList(OpProgress &Progress);
-   virtual bool ReadyPkgCache(OpProgress &Progress);
-   virtual bool LoadChanges();
-   
-   debDpkgDB();
-   virtual ~debDpkgDB();
-};
-
-#endif

+ 4 - 5
apt-inst/makefile

@@ -14,7 +14,7 @@ include ../buildlib/libversion.mak
 
 # The library name
 LIBRARY=apt-inst
-MAJOR=1.4
+MAJOR=1.5
 MINOR=0
 SLIBS=$(PTHREADLIB) -lapt-pkg
 APT_DOMAIN:=libapt-inst$(MAJOR)
@@ -23,12 +23,11 @@ APT_DOMAIN:=libapt-inst$(MAJOR)
 SOURCE = contrib/extracttar.cc contrib/arfile.cc
 
 # Source code for the main library
-SOURCE+= filelist.cc database.cc dirstream.cc extract.cc \
-         deb/dpkgdb.cc deb/debfile.cc
+SOURCE+= filelist.cc dirstream.cc extract.cc deb/debfile.cc
 
 # Public header files
-HEADERS = extracttar.h arfile.h filelist.h database.h extract.h \
-          dpkgdb.h dirstream.h debfile.h
+HEADERS = extracttar.h arfile.h filelist.h extract.h \
+          dirstream.h debfile.h
 
 HEADERS := $(addprefix apt-pkg/,$(HEADERS))
 include $(LIBRARY_H)

+ 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();
 };
 
 /** @} */

+ 29 - 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;
          }
    
@@ -431,7 +446,9 @@ bool pkgAcquire::Worker::MediaChange(string Message)
 	     << Drive  << ":"     // drive
 	     << msg.str()         // l10n message
 	     << endl;
-      write(status_fd, status.str().c_str(), status.str().size());
+
+      std::string const dlstatus = status.str();
+      FileFd::Write(status_fd, dlstatus.c_str(), dlstatus.size());
    }
 
    if (Log == 0 || Log->MediaChange(LookupTag(Message,"Media"),
@@ -465,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;
 }
 									/*}}}*/
@@ -536,10 +532,10 @@ bool pkgAcquire::Worker::OutFdReady()
       Res = write(OutFd,OutQueue.c_str(),OutQueue.length());
    }
    while (Res < 0 && errno == EINTR);
-   
+
    if (Res <= 0)
       return MethodFailure();
-   
+
    OutQueue.erase(0,Res);
    if (OutQueue.empty() == true)
       OutReady = false;

+ 37 - 6
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;
 
-   return U.Access + ':' + U.Host;
+   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 FullQueueName;
 }
 									/*}}}*/
 // Acquire::GetConfig - Fetch the configuration information		/*{{{*/
@@ -872,7 +901,9 @@ bool pkgAcquireStatus::Pulse(pkgAcquire *Owner)
 	     << ":"  << (CurrentBytes/float(TotalBytes)*100.0) 
 	     << ":" << msg 
 	     << endl;
-      write(fd, status.str().c_str(), status.str().size());
+
+      std::string const dlstatus = status.str();
+      FileFd::Write(fd, dlstatus.c_str(), dlstatus.size());
    }
 
    return true;

+ 84 - 27
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,
@@ -188,6 +194,11 @@ bool pkgSimulate::Remove(PkgIterator iPkg,bool Purge)
 {
    // Adapt the iterator
    PkgIterator Pkg = Sim.FindPkg(iPkg.Name(), iPkg.Arch());
+   if (Pkg.end() == true)
+   {
+      std::cerr << (Purge ? "Purg" : "Remv") << " invalid package " << iPkg.FullName() << std::endl;
+      return false;
+   }
 
    Flags[Pkg->ID] = 3;
    Sim.MarkDelete(Pkg);
@@ -276,13 +287,13 @@ bool pkgApplyStatus(pkgDepCache &Cache)
 		 Cache[I].CandidateVerIter(Cache).Downloadable() == true)
 	       Cache.MarkInstall(I, true, 0, false);
 	    else
-	       Cache.MarkDelete(I);
+	       Cache.MarkDelete(I, false, 0, false);
 	 }
 	 break;
 
 	 // This means removal failed
 	 case pkgCache::State::HalfInstalled:
-	 Cache.MarkDelete(I);
+	 Cache.MarkDelete(I, false, 0, false);
 	 break;
 	 
 	 default:
@@ -356,11 +367,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. */
@@ -738,7 +774,7 @@ bool pkgProblemResolver::DoUpgrade(pkgCache::PkgIterator Pkg)
       if (WasKept == true)
 	 Cache.MarkKeep(Pkg, false, false);
       else
-	 Cache.MarkDelete(Pkg);
+	 Cache.MarkDelete(Pkg, false, 0, false);
       return false;
    }	 
    
@@ -867,7 +903,7 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
 		OldBreaks < Cache.BrokenCount())
 	    {
 	       if (OldVer == 0)
-		  Cache.MarkDelete(I);
+		  Cache.MarkDelete(I, false, 0, false);
 	       else
 		  Cache.MarkKeep(I, false, false);
 	    }	    
@@ -906,7 +942,7 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
 		     {
 			if (Debug == true)
 			   clog << "  Or group remove for " << I.FullName(false) << endl;
-			Cache.MarkDelete(I);
+			Cache.MarkDelete(I, false, 0, false);
 			Change = true;
 		     }
 		  }
@@ -1041,7 +1077,7 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
 			{
 			   if (Debug == true)
 			      clog << "  Removing " << I.FullName(false) << " rather than change " << Start.TargetPkg().FullName(false) << endl;
-			   Cache.MarkDelete(I);
+			   Cache.MarkDelete(I, false, 0, false);
 			   if (Counter > 1 && Scores[Pkg->ID] > Scores[I->ID])
 			      Scores[I->ID] = Scores[Pkg->ID];
 			}
@@ -1130,7 +1166,7 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
 		  if (Debug == true)
 		     clog << "  Removing " << I.FullName(false) << " because I can't find " << Start.TargetPkg().FullName(false) << endl;
 		  if (InOr == false)
-		     Cache.MarkDelete(I);
+		     Cache.MarkDelete(I, false, 0, false);
 	       }
 
 	       Change = true;
@@ -1157,7 +1193,7 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
 		  {
 		     if (Debug == true)
 			clog << "  Fixing " << I.FullName(false) << " via remove of " << J->Pkg.FullName(false) << endl;
-		     Cache.MarkDelete(J->Pkg);
+		     Cache.MarkDelete(J->Pkg, false, 0, false);
 		  }
 	       }
 	       else
@@ -1383,12 +1419,18 @@ bool pkgProblemResolver::ResolveByKeepInternal()
 	 continue;
       
       // Restart again.
-      if (K == LastStop)
-	 return _error->Error("Internal Error, pkgProblemResolver::ResolveByKeep is looping on package %s.",I.FullName(false).c_str());
+      if (K == LastStop) {
+          // I is an iterator based off our temporary package list,
+          // so copy the name we need before deleting the temporary list
+          std::string const LoopingPackage = I.FullName(false);
+          delete[] PList;
+          return _error->Error("Internal Error, pkgProblemResolver::ResolveByKeep is looping on package %s.", LoopingPackage.c_str());
+      }
       LastStop = K;
       K = PList - 1;
-   }   
+   }
 
+   delete[] PList;
    return true;
 }
 									/*}}}*/
@@ -1453,7 +1495,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 +1504,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 +1512,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 +1566,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 +1583,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

+ 79 - 32
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
@@ -312,6 +319,17 @@ std::vector<std::string> const Configuration::getLanguages(bool const &All,
 		return codes;
 }
 									/*}}}*/
+// checkLanguage - are we interested in the given Language?		/*{{{*/
+bool const Configuration::checkLanguage(std::string Lang, bool const All) {
+	// the empty Language is always interesting as it is the original
+	if (Lang.empty() == true)
+		return true;
+	// filenames are encoded, so undo this
+	Lang = SubstVar(Lang, "%5f", "_");
+	std::vector<std::string> const langs = getLanguages(All, true);
+	return (std::find(langs.begin(), langs.end(), Lang) != langs.end());
+}
+									/*}}}*/
 // getArchitectures - Return Vector of prefered Architectures		/*{{{*/
 std::vector<std::string> const Configuration::getArchitectures(bool const &Cached) {
 	using std::string;
@@ -432,9 +450,30 @@ bool const Configuration::checkArchitecture(std::string const &Arch) {
 // setDefaultConfigurationForCompressors				/*{{{*/
 void Configuration::setDefaultConfigurationForCompressors() {
 	// Set default application paths to check for optional compression types
-	_config->CndSet("Dir::Bin::lzma", "/usr/bin/lzma");
-	_config->CndSet("Dir::Bin::xz", "/usr/bin/xz");
 	_config->CndSet("Dir::Bin::bzip2", "/bin/bzip2");
+	_config->CndSet("Dir::Bin::xz", "/usr/bin/xz");
+	if (FileExists(_config->FindFile("Dir::Bin::xz")) == true) {
+		_config->Clear("Dir::Bin::lzma");
+		_config->Set("APT::Compressor::lzma::Binary", "xz");
+		if (_config->Exists("APT::Compressor::lzma::CompressArg") == false) {
+			_config->Set("APT::Compressor::lzma::CompressArg::", "--format=lzma");
+			_config->Set("APT::Compressor::lzma::CompressArg::", "-9");
+		}
+		if (_config->Exists("APT::Compressor::lzma::UncompressArg") == false) {
+			_config->Set("APT::Compressor::lzma::UncompressArg::", "--format=lzma");
+			_config->Set("APT::Compressor::lzma::UncompressArg::", "-d");
+		}
+	} else {
+		_config->CndSet("Dir::Bin::lzma", "/usr/bin/lzma");
+		if (_config->Exists("APT::Compressor::lzma::CompressArg") == false) {
+			_config->Set("APT::Compressor::lzma::CompressArg::", "--suffix=");
+			_config->Set("APT::Compressor::lzma::CompressArg::", "-9");
+		}
+		if (_config->Exists("APT::Compressor::lzma::UncompressArg") == false) {
+			_config->Set("APT::Compressor::lzma::UncompressArg::", "--suffix=");
+			_config->Set("APT::Compressor::lzma::UncompressArg::", "-d");
+		}
+	}
 }
 									/*}}}*/
 // getCompressors - Return Vector of usbale compressors			/*{{{*/
@@ -453,15 +492,23 @@ 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", 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));
-	if (_config->Exists("Dir::Bin::lzma") == false || FileExists(_config->FindFile("Dir::Bin::lzma")) == true)
-		compressors.push_back(Compressor("lzma",".lzma","lzma","-9","-d",4));
+#ifdef HAVE_BZ2
+	else
+		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",5));
+		compressors.push_back(Compressor("xz",".xz","xz","-6","-d",4));
+	if (_config->Exists("Dir::Bin::lzma") == false || FileExists(_config->FindFile("Dir::Bin::lzma")) == true)
+		compressors.push_back(Compressor("lzma",".lzma","lzma","-9","-d",5));
 
 	std::vector<std::string> const comp = _config->FindVector("APT::Compressor");
 	for (std::vector<std::string>::const_iterator c = comp.begin();
@@ -494,7 +541,7 @@ Configuration::Compressor::Compressor(char const *name, char const *extension,
 				      char const *binary,
 				      char const *compressArg, char const *uncompressArg,
 				      unsigned short const cost) {
-	std::string const config = std::string("APT:Compressor::").append(name).append("::");
+	std::string const config = std::string("APT::Compressor::").append(name).append("::");
 	Name = _config->Find(std::string(config).append("Name"), name);
 	Extension = _config->Find(std::string(config).append("Extension"), extension);
 	Binary = _config->Find(std::string(config).append("Binary"), binary);

+ 8 - 0
apt-pkg/aptconfiguration.h

@@ -67,6 +67,14 @@ public:									/*{{{*/
 	std::vector<std::string> static const getLanguages(bool const &All = false,
 			bool const &Cached = true, char const ** const Locale = 0);
 
+	/** \brief Are we interested in the given Language?
+	 *
+	 *  \param Lang is the language we want to check
+	 *  \param All defines if we check against all codes or only against used codes
+	 *  \return true if we are interested, false otherwise
+	 */
+	bool static const checkLanguage(std::string Lang, bool const All = false);
+
 	/** \brief Returns a vector of Architectures we support
 	 *
 	 *  \param Cached saves the result so we need to calculated it only once

+ 47 - 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,48 @@ 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 == "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)

+ 57 - 6
apt-pkg/cacheset.cc

@@ -182,15 +182,63 @@ 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);
+		if (arch == "all" || arch == "native")
+			arch = _config->Find("APT::Architecture");
+	}
+
+	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 +265,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 +292,7 @@ bool PackageContainerInterface::FromModifierCommandLine(unsigned short &modID, P
 		helper.showErrors(errors);
 		if (Pkg.end() == false) {
 			pci->insert(Pkg);
+			modID = fallback;
 			return true;
 		}
 	}
@@ -281,13 +331,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; };

+ 37 - 24
apt-pkg/cdrom.cc

@@ -269,6 +269,29 @@ bool pkgCdrom::DropBinaryArch(vector<string> &List)
       --I; // the next entry is at the same index after the erase
    }
    
+   return true;
+}
+									/*}}}*/
+// DropTranslation - Dump unwanted Translation-<lang> files		/*{{{*/
+// ---------------------------------------------------------------------
+/* Here we drop everything that is not configured in Acquire::Languages */
+bool pkgCdrom::DropTranslation(vector<string> &List)
+{
+   for (unsigned int I = 0; I < List.size(); I++)
+   {
+      const char *Start;
+      if ((Start = strstr(List[I].c_str(), "/Translation-")) == NULL)
+	 continue;
+      Start += strlen("/Translation-");
+
+      if (APT::Configuration::checkLanguage(Start, true) == true)
+	 continue;
+
+      // not accepted -> Erase it
+      List.erase(List.begin() + I);
+      --I; // the next entry is at the same index after the erase
+   }
+
    return true;
 }
 									/*}}}*/
@@ -363,6 +386,7 @@ void pkgCdrom::ReduceSourcelist(string CD,vector<string> &List)
 
       string Word1 = string(*I,Space,SSpace-Space);
       string Prefix = string(*I,0,Space);
+      string Component = string(*I,SSpace);
       for (vector<string>::iterator J = List.begin(); J != I; ++J)
       {
 	 // Find a space..
@@ -377,9 +401,11 @@ void pkgCdrom::ReduceSourcelist(string CD,vector<string> &List)
 	    continue;
 	 if (string(*J,Space2,SSpace2-Space2) != Word1)
 	    continue;
-	 
-	 *J += string(*I,SSpace);
-	 *I = string();
+
+	 string Component2 = string(*J, SSpace2) + " ";
+	 if (Component2.find(Component + " ") == std::string::npos)
+	    *J += Component;
+	 I->clear();
       }
    }   
 
@@ -409,28 +435,12 @@ 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();
-   
-   link(DFile.c_str(),string(DFile + '~').c_str());
+
+   if (FileExists(DFile) == true)
+      rename(DFile.c_str(), string(DFile + '~').c_str());
    if (rename(NewFile.c_str(),DFile.c_str()) != 0)
       return _error->Errno("rename","Failed to rename %s.new to %s",
 			   DFile.c_str(),DFile.c_str());
@@ -697,7 +707,8 @@ bool pkgCdrom::Add(pkgCdromStatus *log)					/*{{{*/
       return false;
    }
 
-   chdir(StartDir.c_str());
+   if (chdir(StartDir.c_str()) != 0)
+      return _error->Errno("chdir","Unable to change to %s", StartDir.c_str());
 
    if (_config->FindB("Debug::aptcdrom",false) == true)
    {
@@ -726,6 +737,8 @@ bool pkgCdrom::Add(pkgCdromStatus *log)					/*{{{*/
    DropRepeats(SigList,"InRelease");
    _error->RevertToStack();
    DropRepeats(TransList,"");
+   if (_config->FindB("APT::CDROM::DropTranslation", true) == true)
+      DropTranslation(TransList);
    if(log != NULL) {
       msg.str("");
       ioprintf(msg, _("Found %zu package indexes, %zu source indexes, "

+ 1 - 0
apt-pkg/cdrom.h

@@ -60,6 +60,7 @@ class pkgCdrom								/*{{{*/
 		     unsigned int Depth = 0);
    bool DropBinaryArch(std::vector<std::string> &List);
    bool DropRepeats(std::vector<std::string> &List,const char *Name);
+   bool DropTranslation(std::vector<std::string> &List);
    void ReduceSourcelist(std::string CD,std::vector<std::string> &List);
    bool WriteDatabase(Configuration &Cnf);
    bool WriteSourceList(std::string Name,std::vector<std::string> &List,bool Source);

+ 10 - 6
apt-pkg/clean.cc

@@ -54,9 +54,11 @@ bool pkgArchiveCleaner::Go(std::string Dir,pkgCache &Cache)
       struct stat St;
       if (stat(Dir->d_name,&St) != 0)
       {
-	 chdir(StartDir.c_str());
+	 _error->Errno("stat",_("Unable to stat %s."),Dir->d_name);
 	 closedir(D);
-	 return _error->Errno("stat",_("Unable to stat %s."),Dir->d_name);
+	 if (chdir(StartDir.c_str()) != 0)
+	    return _error->Errno("chdir", _("Unable to change to %s"), StartDir.c_str());
+	 return false;
       }
       
       // Grab the package name
@@ -79,12 +81,13 @@ bool pkgArchiveCleaner::Go(std::string Dir,pkgCache &Cache)
       if (*I != '.')
 	 continue;
       std::string const Arch = DeQuoteString(std::string(Start,I-Start));
-      
+
+      // ignore packages of unconfigured architectures
       if (APT::Configuration::checkArchitecture(Arch) == false)
 	 continue;
       
       // Lookup the package
-      pkgCache::PkgIterator P = Cache.FindPkg(Pkg);
+      pkgCache::PkgIterator P = Cache.FindPkg(Pkg, Arch);
       if (P.end() != true)
       {
 	 pkgCache::VerIterator V = P.VersionList();
@@ -115,8 +118,9 @@ bool pkgArchiveCleaner::Go(std::string Dir,pkgCache &Cache)
       Erase(Dir->d_name,Pkg,Ver,St);
    };
    
-   chdir(StartDir.c_str());
    closedir(D);
-   return true;   
+   if (chdir(StartDir.c_str()) != 0)
+      return _error->Errno("chdir", _("Unable to change to %s"), StartDir.c_str());
+   return true;
 }
 									/*}}}*/

+ 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();

+ 290 - 84
apt-pkg/contrib/fileutl.cc

@@ -44,14 +44,11 @@
 #include <set>
 #include <algorithm>
 
-// FIXME: Compressor Fds have some speed disadvantages and are a bit buggy currently,
-// so while the current implementation satisfies the testcases it is not a real option
-// to disable it for now
-#define APT_USE_ZLIB 1
-#if APT_USE_ZLIB
-#include <zlib.h>
-#else
-#pragma message "Usage of zlib is DISABLED!"
+#ifdef HAVE_ZLIB
+	#include <zlib.h>
+#endif
+#ifdef HAVE_BZ2
+	#include <bzlib.h>
 #endif
 
 #ifdef WORDS_BIGENDIAN
@@ -65,10 +62,15 @@ using namespace std;
 
 class FileFdPrivate {
 	public:
-#if APT_USE_ZLIB
+#ifdef HAVE_ZLIB
 	gzFile gz;
 #else
 	void* gz;
+#endif
+#ifdef HAVE_BZ2
+	BZFILE* bz2;
+#else
+	void* bz2;
 #endif
 	int compressed_fd;
 	pid_t compressor_pid;
@@ -76,8 +78,34 @@ class FileFdPrivate {
 	APT::Configuration::Compressor compressor;
 	unsigned int openmode;
 	unsigned long long seekpos;
-	FileFdPrivate() : gz(NULL), compressed_fd(-1), compressor_pid(-1), pipe(false),
+	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	/*{{{*/
@@ -835,7 +863,6 @@ bool FileFd::Open(string FileName,unsigned int const Mode,CompressMode Compress,
    if (Compress == Auto && (Mode & WriteOnly) == WriteOnly)
       return _error->Error("Autodetection on %s only works in ReadOnly openmode!", FileName.c_str());
 
-   // FIXME: Denote inbuilt compressors somehow - as we don't need to have the binaries for them
    std::vector<APT::Configuration::Compressor> const compressors = APT::Configuration::getCompressors();
    std::vector<APT::Configuration::Compressor>::const_iterator compressor = compressors.begin();
    if (Compress == Auto)
@@ -903,8 +930,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)
@@ -998,10 +1023,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)
    {
@@ -1013,32 +1049,71 @@ 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 APT_USE_ZLIB
-   else if (compressor.Name == "gzip")
+
+   if (d == NULL)
    {
+      d = new FileFdPrivate();
+      d->openmode = Mode;
+      d->compressor = compressor;
+   }
+
+#ifdef HAVE_ZLIB
+   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)
 	 d->gz = gzdopen(iFd, "w");
       else
-	 d->gz = gzdopen (iFd, "r");
+	 d->gz = gzdopen(iFd, "r");
       if (d->gz == NULL)
 	 return false;
       Flags |= Compressed;
       return true;
    }
 #endif
+#ifdef HAVE_BZ2
+   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)
+	 d->bz2 = BZ2_bzdopen(iFd, "w");
+      else
+	 d->bz2 = BZ2_bzdopen(iFd, "r");
+      if (d->bz2 == NULL)
+	 return false;
+      Flags |= Compressed;
+      return true;
+   }
+#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)
@@ -1047,13 +1122,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);
 
@@ -1080,6 +1161,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);
@@ -1109,8 +1196,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;
 }
@@ -1122,6 +1207,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				/*{{{*/
@@ -1137,9 +1228,14 @@ bool FileFd::Read(void *To,unsigned long long Size,unsigned long long *Actual)
    *((char *)To) = '\0';
    do
    {
-#if APT_USE_ZLIB
-      if (d->gz != NULL)
-         Res = gzread(d->gz,To,Size);
+#ifdef HAVE_ZLIB
+      if (d != NULL && d->gz != NULL)
+	 Res = gzread(d->gz,To,Size);
+      else
+#endif
+#ifdef HAVE_BZ2
+      if (d != NULL && d->bz2 != NULL)
+	 Res = BZ2_bzread(d->bz2,To,Size);
       else
 #endif
          Res = read(iFd,To,Size);
@@ -1149,21 +1245,31 @@ bool FileFd::Read(void *To,unsigned long long Size,unsigned long long *Actual)
 	 if (errno == EINTR)
 	    continue;
 	 Flags |= Fail;
-#if APT_USE_ZLIB
-	 if (d->gz != NULL)
+#ifdef HAVE_ZLIB
+	 if (d != NULL && d->gz != NULL)
 	 {
 	    int err;
 	    char const * const errmsg = gzerror(d->gz, &err);
 	    if (err != Z_ERRNO)
 	       return _error->Error("gzread: %s (%d: %s)", _("Read error"), err, errmsg);
 	 }
+#endif
+#ifdef HAVE_BZ2
+	 if (d != NULL && d->bz2 != NULL)
+	 {
+	    int err;
+	    char const * const errmsg = BZ2_bzerror(d->bz2, &err);
+	    if (err != BZ_IO_ERROR)
+	       return _error->Error("BZ2_bzread: %s (%d: %s)", _("Read error"), err, errmsg);
+	 }
 #endif
 	 return _error->Errno("read",_("Read error"));
       }
       
       To = (char *)To + Res;
       Size -= Res;
-      d->seekpos += Res;
+      if (d != NULL)
+	 d->seekpos += Res;
       if (Actual != 0)
 	 *Actual += Res;
    }
@@ -1190,8 +1296,8 @@ bool FileFd::Read(void *To,unsigned long long Size,unsigned long long *Actual)
 char* FileFd::ReadLine(char *To, unsigned long long const Size)
 {
    *To = '\0';
-#if APT_USE_ZLIB
-   if (d->gz != NULL)
+#ifdef HAVE_ZLIB
+   if (d != NULL && d->gz != NULL)
       return gzgets(d->gz, To, Size);
 #endif
 
@@ -1221,10 +1327,15 @@ bool FileFd::Write(const void *From,unsigned long long Size)
    errno = 0;
    do
    {
-#if APT_USE_ZLIB
-      if (d->gz != NULL)
+#ifdef HAVE_ZLIB
+      if (d != NULL && d->gz != NULL)
          Res = gzwrite(d->gz,From,Size);
       else
+#endif
+#ifdef HAVE_BZ2
+      if (d != NULL && d->bz2 != NULL)
+         Res = BZ2_bzwrite(d->bz2,(void*)From,Size);
+      else
 #endif
          Res = write(iFd,From,Size);
       if (Res < 0 && errno == EINTR)
@@ -1232,12 +1343,31 @@ bool FileFd::Write(const void *From,unsigned long long Size)
       if (Res < 0)
       {
 	 Flags |= Fail;
+#ifdef HAVE_ZLIB
+	 if (d != NULL && d->gz != NULL)
+	 {
+	    int err;
+	    char const * const errmsg = gzerror(d->gz, &err);
+	    if (err != Z_ERRNO)
+	       return _error->Error("gzwrite: %s (%d: %s)", _("Write error"), err, errmsg);
+	 }
+#endif
+#ifdef HAVE_BZ2
+	 if (d != NULL && d->bz2 != NULL)
+	 {
+	    int err;
+	    char const * const errmsg = BZ2_bzerror(d->bz2, &err);
+	    if (err != BZ_IO_ERROR)
+	       return _error->Error("BZ2_bzwrite: %s (%d: %s)", _("Write error"), err, errmsg);
+	 }
+#endif
 	 return _error->Errno("write",_("Write error"));
       }
       
       From = (char *)From + Res;
       Size -= Res;
-      d->seekpos += Res;
+      if (d != NULL)
+	 d->seekpos += Res;
    }
    while (Res > 0 && Size > 0);
    
@@ -1246,6 +1376,28 @@ bool FileFd::Write(const void *From,unsigned long long Size)
    
    Flags |= Fail;
    return _error->Error(_("write, still have %llu to write but couldn't"), Size);
+}
+bool FileFd::Write(int Fd, const void *From, unsigned long long Size)
+{
+   int Res;
+   errno = 0;
+   do
+   {
+      Res = write(Fd,From,Size);
+      if (Res < 0 && errno == EINTR)
+	 continue;
+      if (Res < 0)
+	 return _error->Errno("write",_("Write error"));
+
+      From = (char *)From + Res;
+      Size -= Res;
+   }
+   while (Res > 0 && Size > 0);
+
+   if (Size == 0)
+      return true;
+
+   return _error->Error(_("write, still have %llu to write but couldn't"), Size);
 }
 									/*}}}*/
 // FileFd::Seek - Seek in the file					/*{{{*/
@@ -1253,7 +1405,11 @@ bool FileFd::Write(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
+#endif
+	))
    {
       // Our poor man seeking in pipes is costly, so try to avoid it
       unsigned long long seekpos = Tell();
@@ -1263,9 +1419,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!");
-      close(iFd);
-      iFd = 0;
+      }
+#ifdef HAVE_BZ2
+      if (d->bz2 != NULL)
+	 BZ2_bzclose(d->bz2);
+#endif
+      if (iFd != -1)
+	 close(iFd);
+      iFd = -1;
       if (TemporaryFileName.empty() == false)
 	 iFd = open(TemporaryFileName.c_str(), O_RDONLY);
       else if (FileName.empty() == false)
@@ -1275,12 +1439,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);
@@ -1289,8 +1459,8 @@ bool FileFd::Seek(unsigned long long To)
       return true;
    }
    int res;
-#if APT_USE_ZLIB
-   if (d->gz)
+#ifdef HAVE_ZLIB
+   if (d != NULL && d->gz)
       res = gzseek(d->gz,To,SEEK_SET);
    else
 #endif
@@ -1301,7 +1471,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;
 }
 									/*}}}*/
@@ -1310,7 +1481,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
+#endif
+	))
    {
       d->seekpos += Over;
       char buffer[1024];
@@ -1318,15 +1493,18 @@ 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;
    }
 
    int res;
-#if APT_USE_ZLIB
-   if (d->gz != NULL)
+#ifdef HAVE_ZLIB
+   if (d != NULL && d->gz != NULL)
       res = gzseek(d->gz,Over,SEEK_CUR);
    else
 #endif
@@ -1336,7 +1514,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;
 }
@@ -1346,11 +1525,13 @@ bool FileFd::Skip(unsigned long long Over)
 /* */
 bool FileFd::Truncate(unsigned long long To)
 {
-   if (d->gz != NULL)
+#if defined HAVE_ZLIB || defined HAVE_BZ2
+   if (d != NULL && (d->gz != NULL || d->bz2 != NULL))
    {
       Flags |= Fail;
-      return _error->Error("Truncating gzipped files is not implemented (%s)", FileName.c_str());
+      return _error->Error("Truncating compressed files is not implemented (%s)", FileName.c_str());
    }
+#endif
    if (ftruncate(iFd,To) != 0)
    {
       Flags |= Fail;
@@ -1369,19 +1550,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
+#endif
+	))
       return d->seekpos;
 
    off_t Res;
-#if APT_USE_ZLIB
-   if (d->gz != NULL)
+#ifdef HAVE_ZLIB
+   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;
 }
 									/*}}}*/
@@ -1391,17 +1580,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;
@@ -1416,7 +1612,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)
+#endif
+	))
    {
       unsigned long long const oldSeek = Tell();
       char ignore[1000];
@@ -1427,11 +1627,11 @@ unsigned long long FileFd::Size()
       size = Tell();
       Seek(oldSeek);
    }
-#if APT_USE_ZLIB
+#ifdef HAVE_ZLIB
    // 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
@@ -1439,10 +1639,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;
@@ -1452,7 +1658,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;
    }
@@ -1467,20 +1676,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;
       }
@@ -1500,19 +1712,18 @@ bool FileFd::Close()
    bool Res = true;
    if ((Flags & AutoClose) == AutoClose)
    {
-#if APT_USE_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
-	 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());
 
@@ -1527,14 +1738,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;
 }
 									/*}}}*/
@@ -1543,10 +1748,11 @@ bool FileFd::Close()
 /* */
 bool FileFd::Sync()
 {
-#ifdef _POSIX_SYNCHRONIZED_IO
    if (fsync(iFd) != 0)
+   {
+      Flags |= Fail;
       return _error->Errno("sync",_("Problem syncing the file"));
-#endif
+   }
    return true;
 }
 									/*}}}*/

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

@@ -78,6 +78,7 @@ class FileFd
    bool Read(void *To,unsigned long long Size,unsigned long long *Actual = 0);
    char* ReadLine(char *To, unsigned long long const Size);
    bool Write(const void *From,unsigned long long Size);
+   bool static Write(int Fd, const void *From, unsigned long long Size);
    bool Seek(unsigned long long To);
    bool Skip(unsigned long long To);
    bool Truncate(unsigned long long To);

+ 33 - 19
apt-pkg/contrib/mmap.cc

@@ -83,24 +83,26 @@ 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);
+	    SyncToFd = new FileFd();
 	    return Fd.Read(Base, iSize);
 	 }
 	 // FIXME: Writing to compressed fd's ?
@@ -108,7 +110,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 +136,7 @@ bool MMap::Close(bool DoSync)
 
    if (SyncToFd != NULL)
    {
-      delete[] (char *)Base;
+      free(Base);
       delete SyncToFd;
       SyncToFd = NULL;
    }
@@ -154,11 +156,10 @@ bool MMap::Close(bool DoSync)
 /* This is done in syncronous mode - the docs indicate that this will 
    not return till all IO is complete */
 bool MMap::Sync()
-{   
+{
    if ((Flags & UnMapped) == UnMapped)
       return true;
-   
-#ifdef _POSIX_SYNCHRONIZED_IO   
+
    if ((Flags & ReadOnly) != ReadOnly)
    {
       if (SyncToFd != NULL)
@@ -168,11 +169,12 @@ bool MMap::Sync()
       }
       else
       {
+#ifdef _POSIX_SYNCHRONIZED_IO
 	 if (msync((char *)Base, iSize, MS_SYNC) < 0)
 	    return _error->Errno("msync", _("Unable to synchronize mmap"));
+#endif
       }
    }
-#endif   
    return true;
 }
 									/*}}}*/
@@ -183,9 +185,7 @@ bool MMap::Sync(unsigned long Start,unsigned long Stop)
 {
    if ((Flags & UnMapped) == UnMapped)
       return true;
-   
-#ifdef _POSIX_SYNCHRONIZED_IO
-   unsigned long long PSize = sysconf(_SC_PAGESIZE);
+
    if ((Flags & ReadOnly) != ReadOnly)
    {
       if (SyncToFd != 0)
@@ -196,11 +196,13 @@ bool MMap::Sync(unsigned long Start,unsigned long Stop)
       }
       else
       {
+#ifdef _POSIX_SYNCHRONIZED_IO
+	 unsigned long long const PSize = sysconf(_SC_PAGESIZE);
 	 if (msync((char *)Base+(unsigned long long)(Start/PSize)*PSize,Stop - Start,MS_SYNC) < 0)
 	    return _error->Errno("msync", _("Unable to synchronize mmap"));
+#endif
       }
    }
-#endif   
    return true;
 }
 									/*}}}*/
@@ -215,7 +217,17 @@ DynamicMMap::DynamicMMap(FileFd &F,unsigned long Flags,unsigned long const &Work
 {
    if (_error->PendingError() == true)
       return;
-   
+
+   // disable Moveable if we don't grow
+   if (Grow == 0)
+      this->Flags &= ~Moveable;
+
+#ifndef __linux__
+   // kfreebsd doesn't have mremap, so we use the fallback
+   if ((this->Flags & Moveable) == Moveable)
+      this->Flags |= Fallback;
+#endif
+
    unsigned long long EndOfFile = Fd->Size();
    if (EndOfFile > WorkSpace)
       WorkSpace = EndOfFile;
@@ -282,8 +294,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 +310,7 @@ DynamicMMap::~DynamicMMap()
 #ifdef _POSIX_MAPPED_FILES
       munmap(Base, WorkSpace);
 #else
-      delete [] (unsigned char *)Base;
+      free(Base);
 #endif
       return;
    }
@@ -328,7 +339,7 @@ unsigned long DynamicMMap::RawAllocate(unsigned long long Size,unsigned long Aln
       if(!Grow())
       {
 	 _error->Fatal(_("Dynamic MMap ran out of room. Please increase the size "
-			 "of APT::Cache-Limit. Current value: %lu. (man 5 apt.conf)"), WorkSpace);
+			 "of APT::Cache-Start. Current value: %lu. (man 5 apt.conf)"), WorkSpace);
 	 return 0;
       }
    }
@@ -463,6 +474,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;

+ 34 - 32
apt-pkg/contrib/netrc.cc

@@ -45,11 +45,11 @@ enum {
 #define NETRC DOT_CHAR "netrc"
 
 /* returns -1 on failure, 0 if the host is found, 1 is the host isn't found */
-int parsenetrc (char *host, char *login, char *password, char *netrcfile = NULL)
+static int parsenetrc_string (char *host, std::string &login, std::string &password, char *netrcfile = NULL)
 {
   FILE *file;
   int retcode = 1;
-  int specific_login = (login[0] != 0);
+  int specific_login = (login.empty() == false);
   char *home = NULL;
   bool netrc_alloc = false;
 
@@ -69,8 +69,7 @@ int parsenetrc (char *host, char *login, char *password, char *netrcfile = NULL)
     if (!home)
       return -1;
 
-    asprintf (&netrcfile, "%s%s%s", home, DIR_CHAR, NETRC);
-    if(!netrcfile)
+    if (asprintf (&netrcfile, "%s%s%s", home, DIR_CHAR, NETRC) == -1 || netrcfile == NULL)
       return -1;
     else
       netrc_alloc = true;
@@ -81,16 +80,17 @@ int parsenetrc (char *host, char *login, char *password, char *netrcfile = NULL)
     char *tok;
     char *tok_buf;
     bool done = false;
-    char netrcbuffer[256];
+    char *netrcbuffer = NULL;
+    size_t netrcbuffer_size = 0;
 
     int state = NOTHING;
     char state_login = 0;        /* Found a login keyword */
     char state_password = 0;     /* Found a password keyword */
 
-    while (!done && fgets(netrcbuffer, sizeof (netrcbuffer), file)) {
+    while (!done && getline(&netrcbuffer, &netrcbuffer_size, file) != -1) {
       tok = strtok_r (netrcbuffer, " \t\n", &tok_buf);
       while (!done && tok) {
-        if(login[0] && password[0]) {
+        if(login.empty() == false && password.empty() == false) {
           done = true;
           break;
         }
@@ -122,23 +122,13 @@ int parsenetrc (char *host, char *login, char *password, char *netrcfile = NULL)
           /* we are now parsing sub-keywords concerning "our" host */
           if (state_login) {
             if (specific_login)
-              state_our_login = !strcasecmp (login, tok);
+              state_our_login = !strcasecmp (login.c_str(), tok);
             else
-            {
-              if (strlen(tok) > LOGINSIZE)
-                 _error->Error("login token too long %i (max: %i)", 
-                               strlen(tok), LOGINSIZE);
-              strncpy (login, tok, LOGINSIZE - 1);
-            }
+              login = tok;
             state_login = 0;
           } else if (state_password) {
-             if (state_our_login || !specific_login) 
-             {
-              if (strlen(tok) > PASSWORDSIZE)
-                 _error->Error("password token too long %i (max %i)", 
-                               strlen(tok), PASSWORDSIZE);
-              strncpy (password, tok, PASSWORDSIZE - 1);
-             }
+            if (state_our_login || !specific_login)
+              password = tok;
             state_password = 0;
           } else if (!strcasecmp ("login", tok))
             state_login = 1;
@@ -154,8 +144,9 @@ int parsenetrc (char *host, char *login, char *password, char *netrcfile = NULL)
 
         tok = strtok_r (NULL, " \t\n", &tok_buf);
       } /* while(tok) */
-    } /* while fgets() */
+    } /* while getline() */
 
+    free(netrcbuffer);
     fclose(file);
   }
 
@@ -164,6 +155,18 @@ int parsenetrc (char *host, char *login, char *password, char *netrcfile = NULL)
 
   return retcode;
 }
+// for some unknown reason this method is exported so keep a compatible interface for now …
+int parsenetrc (char *host, char *login, char *password, char *netrcfile = NULL)
+{
+   std::string login_string, password_string;
+   int const ret = parsenetrc_string(host, login_string, password_string, netrcfile);
+   if (ret < 0)
+      return ret;
+   strncpy(login, login_string.c_str(), LOGINSIZE - 1);
+   strncpy(password, password_string.c_str(), PASSWORDSIZE - 1);
+   return ret;
+}
+
 
 void maybe_add_auth (URI &Uri, string NetRCFile)
 {
@@ -174,21 +177,20 @@ void maybe_add_auth (URI &Uri, string NetRCFile)
   {
     if (NetRCFile.empty () == false)
     {
-      char login[LOGINSIZE] = "";
-      char password[PASSWORDSIZE] = "";
+       std::string login, password;
       char *netrcfile = strdup(NetRCFile.c_str());
 
       // first check for a generic host based netrc entry
       char *host = strdup(Uri.Host.c_str());
-      if (host && parsenetrc (host, login, password, netrcfile) == 0)
+      if (host && parsenetrc_string(host, login, password, netrcfile) == 0)
       {
 	 if (_config->FindB("Debug::Acquire::netrc", false) == true)
 	    std::clog << "host: " << host 
 		      << " user: " << login
-		      << " pass-size: " << strlen(password)
+		      << " pass-size: " << password.size()
 		      << std::endl;
-        Uri.User = string (login);
-        Uri.Password = string (password);
+        Uri.User = login;
+        Uri.Password = password;
 	free(netrcfile);
 	free(host);
 	return;
@@ -199,15 +201,15 @@ void maybe_add_auth (URI &Uri, string NetRCFile)
       // a lookup uri.startswith(host) in the netrc file parser (because
       // of the "/"
       char *hostpath = strdup(string(Uri.Host+Uri.Path).c_str());
-      if (hostpath && parsenetrc (hostpath, login, password, netrcfile) == 0)
+      if (hostpath && parsenetrc_string(hostpath, login, password, netrcfile) == 0)
       {
 	 if (_config->FindB("Debug::Acquire::netrc", false) == true)
 	    std::clog << "hostpath: " << hostpath
 		      << " user: " << login
-		      << " pass-size: " << strlen(password)
+		      << " pass-size: " << password.size()
 		      << std::endl;
-	 Uri.User = string (login);
-	 Uri.Password = string (password);
+	 Uri.User = login;
+	 Uri.Password = password;
       }
       free(netrcfile);
       free(hostpath);

+ 3 - 5
apt-pkg/contrib/netrc.h

@@ -25,11 +25,9 @@
 
 class URI;
 
-// Assume: password[0]=0, host[0] != 0.
-// If login[0] = 0, search for login and password within a machine section
-// in the netrc.
-// If login[0] != 0, search for password within machine and login.
-int parsenetrc (char *host, char *login, char *password, char *filename);
+// kill this export on the next ABI break - strongly doubt its in use anyway
+// outside of the apt itself, its really a internal interface
+__deprecated int parsenetrc (char *host, char *login, char *password, char *filename);
 
 void maybe_add_auth (URI &Uri, std::string NetRCFile);
 #endif

+ 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;

+ 37 - 20
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>
@@ -1168,34 +1169,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());   

+ 102 - 74
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,18 +622,21 @@ 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 &&
+      // If negative is unspecific it needs to apply on all architectures
+      if (MultiArchEnabled == true && found == string::npos &&
 	  (Type == pkgCache::Dep::Conflicts ||
 	   Type == pkgCache::Dep::DpkgBreaks ||
 	   Type == pkgCache::Dep::Replaces))
@@ -645,9 +645,33 @@ bool debListParser::ParseDepends(pkgCache::VerIterator &Ver,
 	      a != Architectures.end(); ++a)
 	    if (NewDepends(Ver,Package,*a,Version,Op,Type) == false)
 	       return false;
+	 if (NewDepends(Ver,Package,"none",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 ((Type == pkgCache::Dep::Conflicts ||
+	      Type == pkgCache::Dep::DpkgBreaks ||
+	      Type == pkgCache::Dep::Replaces) &&
+	     NewDepends(Ver, Package,
+			(pkgArch != "none") ? "none" : _config->Find("APT::Architecture"),
+			Version,Op,Type) == false)
+	    return false;
       }
-      else if (NewDepends(Ver,Package,pkgArch,Version,Op,Type) == false)
-	 return false;
       if (Start == Stop)
 	 break;
    }
@@ -741,13 +765,15 @@ bool debListParser::Step()
          drop the whole section. A missing arch tag only happens (in theory)
          inside the Status file, so that is a positive return */
       string const Architecture = Section.FindS("Architecture");
-      if (Architecture.empty() == true)
-	 return true;
 
       if (Arch.empty() == true || Arch == "any" || MultiArchEnabled == false)
       {
 	 if (APT::Configuration::checkArchitecture(Architecture) == true)
 	    return true;
+	 /* parse version stanzas without an architecture only in the status file
+	    (and as misfortune bycatch flat-archives) */
+	 if ((Arch.empty() == true || Arch == "any") && Architecture.empty() == true)
+	    return true;
       }
       else
       {
@@ -771,7 +797,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 +885,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;
 	 }
       }

+ 18 - 12
apt-pkg/deb/dpkgpm.cc

@@ -187,7 +187,7 @@ pkgDPkgPM::~pkgDPkgPM()
 bool pkgDPkgPM::Install(PkgIterator Pkg,string File)
 {
    if (File.empty() == true || Pkg.end() == true)
-      return _error->Error("Internal Error, No file name for %s",Pkg.Name());
+      return _error->Error("Internal Error, No file name for %s",Pkg.FullName().c_str());
 
    // If the filename string begins with DPkg::Chroot-Directory, return the
    // substr that is within the chroot so dpkg can access it.
@@ -425,7 +425,7 @@ void pkgDPkgPM::DoStdin(int master)
    unsigned char input_buf[256] = {0,}; 
    ssize_t len = read(0, input_buf, sizeof(input_buf));
    if (len)
-      write(master, input_buf, len);
+      FileFd::Write(master, input_buf, len);
    else
       d->stdin_is_dev_null = true;
 }
@@ -451,7 +451,7 @@ void pkgDPkgPM::DoTerminalPty(int master)
    }  
    if(len <= 0) 
       return;
-   write(1, term_buf, len);
+   FileFd::Write(1, term_buf, len);
    if(d->term_out)
       fwrite(term_buf, len, sizeof(char), d->term_out);
 }
@@ -526,7 +526,7 @@ void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line)
 	     << ":" << s
 	     << endl;
       if(OutStatusFd > 0)
-	 write(OutStatusFd, status.str().c_str(), status.str().size());
+	 FileFd::Write(OutStatusFd, status.str().c_str(), status.str().size());
       if (Debug == true)
 	 std::clog << "send: '" << status.str() << "'" << endl;
 
@@ -550,7 +550,7 @@ void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line)
 	     << ":" << list[3]
 	     << endl;
       if(OutStatusFd > 0)
-	 write(OutStatusFd, status.str().c_str(), status.str().size());
+	 FileFd::Write(OutStatusFd, status.str().c_str(), status.str().size());
       if (Debug == true)
 	 std::clog << "send: '" << status.str() << "'" << endl;
       pkgFailures++;
@@ -564,7 +564,7 @@ void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line)
 	     << ":" << list[3]
 	     << endl;
       if(OutStatusFd > 0)
-	 write(OutStatusFd, status.str().c_str(), status.str().size());
+	 FileFd::Write(OutStatusFd, status.str().c_str(), status.str().size());
       if (Debug == true)
 	 std::clog << "send: '" << status.str() << "'" << endl;
       return;
@@ -592,7 +592,7 @@ void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line)
 	     << ":" << s
 	     << endl;
       if(OutStatusFd > 0)
-	 write(OutStatusFd, status.str().c_str(), status.str().size());
+	 FileFd::Write(OutStatusFd, status.str().c_str(), status.str().size());
       if (Debug == true)
 	 std::clog << "send: '" << status.str() << "'" << endl;
    }
@@ -726,7 +726,7 @@ bool pkgDPkgPM::OpenLog()
       gr = getgrnam("adm");
       if (pw != NULL && gr != NULL)
 	  chown(logfile_name.c_str(), pw->pw_uid, gr->gr_gid);
-      chmod(logfile_name.c_str(), 0644);
+      chmod(logfile_name.c_str(), 0640);
       fprintf(d->term_out, "\nLog started: %s\n", timestr);
    }
 
@@ -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;
@@ -1055,7 +1056,8 @@ bool pkgDPkgPM::Go(int OutStatusFd)
       }
 
       int fd[2];
-      pipe(fd);
+      if (pipe(fd) != 0)
+	 return _error->Errno("pipe","Failed to create IPC pipe to dpkg");
 
 #define ADDARG(X) Args.push_back(X); Size += strlen(X)
 #define ADDARGC(X) Args.push_back(X); Size += sizeof(X) - 1
@@ -1129,7 +1131,9 @@ bool pkgDPkgPM::Go(int OutStatusFd)
 	    if (I->Op == Item::Configure && disappearedPkgs.find(I->Pkg.Name()) != disappearedPkgs.end())
 	       continue;
 	    // We keep this here to allow "smooth" transitions from e.g. multiarch dpkg/ubuntu to dpkg/debian
-	    if (dpkgMultiArch == false && (I->Pkg.Arch() == nativeArch || !strcmp(I->Pkg.Arch(), "all")))
+	    if (dpkgMultiArch == false && (I->Pkg.Arch() == nativeArch ||
+					   strcmp(I->Pkg.Arch(), "all") == 0 ||
+					   strcmp(I->Pkg.Arch(), "none") == 0))
 	    {
 	       char const * const name = I->Pkg.Name();
 	       ADDARG(name);
@@ -1146,7 +1150,9 @@ bool pkgDPkgPM::Go(int OutStatusFd)
                }
 	       else
 		  PkgVer = Cache[I->Pkg].InstVerIter(Cache);
-               if (PkgVer.end() == false)
+	       if (strcmp(I->Pkg.Arch(), "none") == 0)
+		  ; // never arch-qualify a package without an arch
+	       else if (PkgVer.end() == false)
                   name.append(":").append(PkgVer.Arch());
                else
                   _error->Warning("Can not find PkgVer for '%s'", name.c_str());
@@ -1236,7 +1242,7 @@ bool pkgDPkgPM::Go(int OutStatusFd)
 		<< (PackagesDone/float(PackagesTotal)*100.0) 
 		<< ":" << _("Running dpkg")
 		<< endl;
-	 write(OutStatusFd, status.str().c_str(), status.str().size());
+	 FileFd::Write(OutStatusFd, status.str().c_str(), status.str().size());
       }
       Child = ExecFork();
             

+ 27 - 29
apt-pkg/depcache.cc

@@ -346,7 +346,7 @@ bool pkgDepCache::CheckDep(DepIterator Dep,int Type,PkgIterator &Res)
    /* Check simple depends. A depends -should- never self match but 
       we allow it anyhow because dpkg does. Technically it is a packaging
       bug. Conflicts may never self match */
-   if (Dep.TargetPkg() != Dep.ParentPkg() || Dep.IsNegative() == false)
+   if (Dep.IsIgnorable(Res) == false)
    {
       PkgIterator Pkg = Dep.TargetPkg();
       // Check the base package
@@ -913,11 +913,15 @@ bool pkgDepCache::IsModeChangeOk(ModeList const mode, PkgIterator const &Pkg,
       return true;
 
    StateCache &P = PkgState[Pkg->ID];
+   // not changing the mode is obviously also fine as we might want to call
+   // e.g. MarkInstall multiple times with different arguments for the same package
+   if (P.Mode == mode)
+      return true;
 
    // if previous state was set by user only user can reset it
    if ((P.iFlags & Protected) == Protected)
    {
-      if (unlikely(DebugMarker == true) && P.Mode != mode)
+      if (unlikely(DebugMarker == true))
 	 std::clog << OutputInDepth(Depth) << "Ignore Mark" << PrintMode(mode)
 		   << " of " << Pkg << " as its mode (" << PrintMode(P.Mode)
 		   << ") is protected" << std::endl;
@@ -927,7 +931,7 @@ bool pkgDepCache::IsModeChangeOk(ModeList const mode, PkgIterator const &Pkg,
    else if (mode != ModeKeep && Pkg->SelectedState == pkgCache::State::Hold &&
 	    _config->FindB("APT::Ignore-Hold",false) == false)
    {
-      if (unlikely(DebugMarker == true) && P.Mode != mode)
+      if (unlikely(DebugMarker == true))
 	 std::clog << OutputInDepth(Depth) << "Hold prevents Mark" << PrintMode(mode)
 		   << " of " << Pkg << std::endl;
       return false;
@@ -1152,9 +1156,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 +1168,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);
 	 }
@@ -1179,32 +1182,25 @@ bool pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
 	       std::clog << OutputInDepth(Depth) << "Installing " << InstPkg.Name()
 			 << " as " << Start.DepType() << " of " << Pkg.Name()
 			 << std::endl;
- 	    // now check if we should consider it a automatic dependency or not
- 	    if(Pkg.Section() && ConfigValueInSubTree("APT::Never-MarkAuto-Sections", Pkg.Section()))
- 	    {
+	    MarkInstall(InstPkg, true, Depth + 1, false, ForceImportantDeps);
+	    // now check if we should consider it a automatic dependency or not
+	    if(InstPkg->CurrentVer == 0 && Pkg->Section != 0 && ConfigValueInSubTree("APT::Never-MarkAuto-Sections", Pkg.Section()))
+	    {
 	       if(DebugAutoInstall == true)
 		  std::clog << OutputInDepth(Depth) << "Setting NOT as auto-installed (direct "
                             << Start.DepType() << " of pkg in APT::Never-MarkAuto-Sections)" << std::endl;
- 	       MarkInstall(InstPkg,true,Depth + 1, true);
- 	    }
- 	    else 
- 	    {
- 	       // mark automatic dependency
- 	       MarkInstall(InstPkg,true,Depth + 1, false, ForceImportantDeps);
- 	       // Set the autoflag, after MarkInstall because MarkInstall unsets it
- 	       if (InstPkg->CurrentVer == 0)
- 		  PkgState[InstPkg->ID].Flags |= Flag::Auto;
- 	    }
+	       MarkAuto(InstPkg, false);
+	    }
 	 }
 	 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 +1211,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;

+ 8 - 10
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;
@@ -218,9 +214,11 @@ bool EDSP::WriteRequest(pkgDepCache &Cache, FILE* output, bool const Upgrade,
       if (Progress != NULL && p % 100 == 0)
          Progress->Progress(p);
       string* req;
-      if (Cache[Pkg].Delete() == true)
+      pkgDepCache::StateCache &P = Cache[Pkg];
+      if (P.Delete() == true)
 	 req = &del;
-      else if (Cache[Pkg].NewInstall() == true || Cache[Pkg].Upgrade() == true)
+      else if (P.NewInstall() == true || P.Upgrade() == true || P.ReInstall() == true ||
+	       (P.Mode == pkgDepCache::ModeKeep && (P.iFlags & pkgDepCache::Protected) == pkgDepCache::Protected))
 	 req = &inst;
       else
 	 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;
 }

+ 22 - 11
apt-pkg/indexcopy.cc

@@ -350,9 +350,6 @@ bool IndexCopy::ReconstructChop(unsigned long &Chop,string Dir,string File)
  */
 void IndexCopy::ConvertToSourceList(string CD,string &Path)
 {
-   char S[300];
-   snprintf(S,sizeof(S),"binary-%s",_config->Find("Apt::Architecture").c_str());
-   
    // Strip the cdrom base path
    Path = string(Path,CD.length());
    if (Path.empty() == true)
@@ -388,7 +385,13 @@ void IndexCopy::ConvertToSourceList(string CD,string &Path)
 	 return;
       string Binary = string(Path,Slash+1,BinSlash - Slash-1);
       
-      if (Binary != S && Binary != "source")
+      if (strncmp(Binary.c_str(), "binary-", strlen("binary-")) == 0)
+      {
+	 Binary.erase(0, strlen("binary-"));
+	 if (APT::Configuration::checkArchitecture(Binary) == false)
+	    continue;
+      }
+      else if (Binary != "source")
 	 continue;
 
       Path = Dist + ' ' + Comp;
@@ -494,17 +497,20 @@ bool SourceCopy::RewriteEntry(FILE *Target,string File)
 bool SigVerify::Verify(string prefix, string file, indexRecords *MetaIndex)
 {
    const indexRecords::checkSum *Record = MetaIndex->Lookup(file);
+   bool const Debug = _config->FindB("Debug::aptcdrom",false);
 
-   // we skip non-existing files in the verifcation to support a cdrom
-   // with no Packages file (just a Package.gz), see LP: #255545
-   // (non-existing files are not considered a error)
+   // we skip non-existing files in the verifcation of the Release file
+   // as non-existing files do not harm, but a warning scares people and
+   // makes it hard to strip unneeded files from an ISO like uncompressed
+   // indexes as it is done on the mirrors (see also LP: #255545 )
    if(!RealFileExists(prefix+file))
    {
-      _error->Warning(_("Skipping nonexistent file %s"), string(prefix+file).c_str());
+      if (Debug == true)
+	 cout << "Skipping nonexistent in " << prefix << " file " << file << std::endl;
       return true;
    }
 
-   if (!Record) 
+   if (!Record)
    {
       _error->Warning(_("Can't find authentication record for: %s"), file.c_str());
       return false;
@@ -516,7 +522,7 @@ bool SigVerify::Verify(string prefix, string file, indexRecords *MetaIndex)
       return false;
    }
 
-   if(_config->FindB("Debug::aptcdrom",false)) 
+   if(Debug == true)
    {
       cout << "File: " << prefix+file << endl;
       cout << "Expected Hash " << Record->Hash.toStr() << endl;
@@ -810,9 +816,14 @@ bool TranslationsCopy::CopyTranslations(string CDROM,string Name,	/*{{{*/
 	       (*I).c_str() + CDROM.length());
       string TargetF = _config->FindDir("Dir::State::lists") + "partial/";
       TargetF += URItoFileName(S);
+      FileFd Target;
       if (_config->FindB("APT::CDROM::NoAct",false) == true)
+      {
 	 TargetF = "/dev/null";
-      FileFd Target(TargetF,FileFd::WriteAtomic);
+	 Target.Open(TargetF,FileFd::WriteExists);
+      } else {
+	 Target.Open(TargetF,FileFd::WriteAtomic);
+      }
       FILE *TargetFl = fdopen(dup(Target.Fd()),"w");
       if (_error->PendingError() == true)
 	 return false;

+ 1 - 1
apt-pkg/init.cc

@@ -24,7 +24,7 @@
 
 #define Stringfy_(x) # x
 #define Stringfy(x)  Stringfy_(x)
-const char *pkgVersion = VERSION;
+const char *pkgVersion = PACKAGE_VERSION;
 const char *pkgLibVersion = Stringfy(APT_PKG_MAJOR) "."
                             Stringfy(APT_PKG_MINOR) "." 
                             Stringfy(APT_PKG_RELEASE);

+ 7 - 1
apt-pkg/makefile

@@ -14,7 +14,13 @@ include ../buildlib/libversion.mak
 LIBRARY=apt-pkg
 MAJOR=$(LIBAPTPKG_MAJOR)
 MINOR=$(LIBAPTPKG_RELEASE)
-SLIBS=$(PTHREADLIB) $(INTLLIBS) -lutil -ldl -lz
+SLIBS=$(PTHREADLIB) $(INTLLIBS) -lutil -ldl
+ifeq ($(HAVE_ZLIB),yes)
+SLIBS+= -lz
+endif
+ifeq ($(HAVE_BZ2),yes)
+SLIBS+= -lbz2
+endif
 APT_DOMAIN:=libapt-pkg$(LIBAPTPKG_MAJOR)
 
 # Source code for the contributed non-core things

+ 19 - 11
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;
 
@@ -337,7 +338,7 @@ bool pkgPackageManager::SmartConfigure(PkgIterator Pkg, int const Depth)
       however if there is a loop (A depends on B, B depends on A) this will not 
       be the case, so check for dependencies before configuring. */
    bool Bad = false, Changed = false;
-   const unsigned int max_loops = _config->FindI("APT::pkgPackageManager::MaxLoopCount", 100);
+   const unsigned int max_loops = _config->FindI("APT::pkgPackageManager::MaxLoopCount", 500);
    unsigned int i=0;
    do
    {
@@ -491,6 +492,7 @@ bool pkgPackageManager::SmartConfigure(PkgIterator Pkg, int const Depth)
 	   P.end() == false; P = Pkg.Group().NextPkg(P))
       {
 	 if (Pkg == P || List->IsFlag(P,pkgOrderList::Configured) == true ||
+	     List->IsFlag(P,pkgOrderList::UnPacked) == false ||
 	     Cache[P].InstallVer == 0 || (P.CurrentVer() == Cache[P].InstallVer &&
 	      (Cache[Pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall))
 	    continue;
@@ -601,8 +603,8 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c
       This will be either dealt with if the package is configured as a dependency of Pkg (if and when Pkg is configured),
       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", 100);
-   unsigned int i;
+   const unsigned int max_loops = _config->FindI("APT::pkgPackageManager::MaxLoopCount", 500);
+   unsigned int i = 0;
    do 
    {
       Changed = false;
@@ -621,7 +623,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);
@@ -642,9 +644,9 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c
 	    }
 
 	    // Look for something that could be configured.
-	    for (DepIterator Cur = Start; Bad == true; ++Cur)
+	    for (DepIterator Cur = Start; Bad == true && Cur.end() == false; ++Cur)
 	    {
-	       SPtrArray<Version *> VList = Start.AllTargets();
+	       SPtrArray<Version *> VList = Cur.AllTargets();
 	       for (Version **I = VList; *I != 0; ++I)
 	       {
 		  VerIterator Ver(Cache,*I);
@@ -784,7 +786,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;
@@ -830,7 +832,7 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c
 	 }
       }
       if (i++ > max_loops)
-         return _error->Error("Internal error: MaxLoopCount reached in SmartConfigure for %s, aborting", Pkg.FullName().c_str());
+         return _error->Error("Internal error: APT::pkgPackageManager::MaxLoopCount reached in SmartConfigure for %s, aborting", Pkg.FullName().c_str());
    } while (Changed == true);
    
    // Check for reverse conflicts.
@@ -855,7 +857,10 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c
 	 This way we avoid that M-A: enabled packages are installed before
 	 their older non-M-A enabled packages are replaced by newer versions */
       bool const installed = Pkg->CurrentVer != 0;
-      if (installed == true && Install(Pkg,FileNames[Pkg->ID]) == false)
+      if (installed == true &&
+	  (instVer != Pkg.CurrentVer() ||
+	   ((Cache[Pkg].iFlags & pkgDepCache::ReInstall) == pkgDepCache::ReInstall)) &&
+	  Install(Pkg,FileNames[Pkg->ID]) == false)
 	 return false;
       for (PkgIterator P = Pkg.Group().PackageList();
 	   P.end() == false; P = Pkg.Group().NextPkg(P))
@@ -873,6 +878,7 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c
 	   P.end() == false; P = Pkg.Group().NextPkg(P))
       {
 	 if (P->CurrentVer != 0 || P == Pkg || List->IsFlag(P,pkgOrderList::UnPacked) == true ||
+	     List->IsFlag(P,pkgOrderList::Configured) == true ||
 	     Cache[P].InstallVer == 0 || (P.CurrentVer() == Cache[P].InstallVer &&
 	      (Cache[Pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall))
 	    continue;
@@ -881,7 +887,9 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c
       }
    }
    // packages which are already unpacked don't need to be unpacked again
-   else if (Pkg.State() != pkgCache::PkgIterator::NeedsConfigure && Install(Pkg,FileNames[Pkg->ID]) == false)
+   else if ((instVer != Pkg.CurrentVer() ||
+	     ((Cache[Pkg].iFlags & pkgDepCache::ReInstall) == pkgDepCache::ReInstall)) &&
+	    Install(Pkg,FileNames[Pkg->ID]) == false)
       return false;
 
    if (Immediate == true) {

+ 57 - 3
apt-pkg/pkgcache.cc

@@ -238,7 +238,7 @@ pkgCache::PkgIterator pkgCache::FindPkg(const string &Name) {
 // ---------------------------------------------------------------------
 /* Returns 0 on error, pointer to the package otherwise */
 pkgCache::PkgIterator pkgCache::FindPkg(const string &Name, string const &Arch) {
-	if (MultiArchCache() == false) {
+	if (MultiArchCache() == false && Arch != "none") {
 		if (Arch == "native" || Arch == "all" || Arch == "any" ||
 		    Arch == NativeArch())
 			return SingleArchFindPkg(Name);
@@ -376,6 +376,10 @@ pkgCache::PkgIterator pkgCache::GrpIterator::FindPreferredPkg(bool const &Prefer
 		if (Pkg.end() == false && (PreferNonVirtual == false || Pkg->VersionList != 0))
 			return Pkg;
 	}
+	// packages without an architecture
+	Pkg = FindPkg("none");
+	if (Pkg.end() == false && (PreferNonVirtual == false || Pkg->VersionList != 0))
+		return Pkg;
 
 	if (PreferNonVirtual == true)
 		return FindPreferredPkg(false);
@@ -686,8 +690,29 @@ void pkgCache::DepIterator::GlobOr(DepIterator &Start,DepIterator &End)
    on virtual packages. */
 bool pkgCache::DepIterator::IsIgnorable(PkgIterator const &Pkg) const
 {
-   if (ParentPkg() == TargetPkg())
-      return IsNegative();
+   if (IsNegative() == false)
+      return false;
+
+   pkgCache::PkgIterator PP = ParentPkg();
+   pkgCache::PkgIterator PT = TargetPkg();
+   if (PP->Group != PT->Group)
+      return false;
+   // self-conflict
+   if (PP == PT)
+      return true;
+   pkgCache::VerIterator PV = ParentVer();
+   // ignore group-conflict on a M-A:same package - but not our implicit dependencies
+   // so that we can have M-A:same packages conflicting with their own real name
+   if ((PV->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same)
+   {
+      // Replaces: ${self}:other ( << ${binary:Version})
+      if (S->Type == pkgCache::Dep::Replaces && S->CompareOp == pkgCache::Dep::Less && strcmp(PV.VerStr(), TargetVer()) == 0)
+	 return false;
+      // Breaks: ${self}:other (!= ${binary:Version})
+      if (S->Type == pkgCache::Dep::DpkgBreaks && S->CompareOp == pkgCache::Dep::NotEquals && strcmp(PV.VerStr(), TargetVer()) == 0)
+	 return false;
+      return true;
+   }
 
    return false;
 }
@@ -708,6 +733,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 +986,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;
+}
+									/*}}}*/

+ 79 - 10
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;
@@ -69,7 +69,9 @@ pkgCacheGenerator::pkgCacheGenerator(DynamicMMap *pMap,OpProgress *Prog) :
       *Cache.HeaderP = pkgCache::Header();
       map_ptrloc const idxVerSysName = WriteStringInMap(_system->VS->Label);
       Cache.HeaderP->VerSysName = idxVerSysName;
-      map_ptrloc const idxArchitecture = WriteStringInMap(_config->Find("APT::Architecture"));
+      // this pointer is set in ReMap, but we need it now for WriteUniqString
+      Cache.StringItemP = (pkgCache::StringItem *)Map.Data();
+      map_ptrloc const idxArchitecture = WriteUniqString(_config->Find("APT::Architecture"));
       Cache.HeaderP->Architecture = idxArchitecture;
       if (unlikely(idxVerSysName == 0 || idxArchitecture == 0))
 	 return;
@@ -195,12 +197,27 @@ bool pkgCacheGenerator::MergeList(ListParser &List,
       string const Version = List.Version();
       if (Version.empty() == true && Arch.empty() == true)
       {
+	 // package descriptions
 	 if (MergeListGroup(List, PackageName) == false)
 	    return false;
+	 continue;
       }
 
       if (Arch.empty() == true)
-	 Arch = _config->Find("APT::Architecture");
+      {
+	 // use the pseudo arch 'none' for arch-less packages
+	 Arch = "none";
+	 /* We might built a SingleArchCache here, which we don't want to blow up
+	    just for these :none packages to a proper MultiArchCache, so just ensure
+	    that we have always a native package structure first for SingleArch */
+	 pkgCache::PkgIterator NP;
+	 Dynamic<pkgCache::PkgIterator> DynPkg(NP);
+	 if (NewPackage(NP, PackageName, _config->Find("APT::Architecture")) == false)
+	 // TRANSLATOR: The first placeholder is a package name,
+	 // the other two should be copied verbatim as they include debug info
+	 return _error->Error(_("Error occurred while processing %s (%s%d)"),
+			      PackageName.c_str(), "NewPackage", 0);
+      }
 
       // Get a pointer to the package structure
       pkgCache::PkgIterator Pkg;
@@ -286,7 +303,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 +321,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;
@@ -415,6 +435,43 @@ bool pkgCacheGenerator::MergeListVersion(ListParser &List, pkgCache::PkgIterator
 	       return _error->Error(_("Error occurred while processing %s (%s%d)"),
 				    Pkg.Name(), "AddImplicitDepends", 1);
       }
+      /* :none packages are packages without an architecture. They are forbidden by
+	 debian-policy, so usually they will only be in (old) dpkg status files -
+	 and dpkg will complain about them - and are pretty rare. We therefore do
+	 usually not create conflicts while the parent is created, but only if a :none
+	 package (= the target) appears. This creates incorrect dependencies on :none
+	 for architecture-specific dependencies on the package we copy from, but we
+	 will ignore this bug as architecture-specific dependencies are only allowed
+	 in jessie and until then the :none packages should be extinct (hopefully).
+	 In other words: This should work long enough to allow graceful removal of
+	 these packages, it is not supposed to allow users to keep using them … */
+      if (strcmp(Pkg.Arch(), "none") == 0)
+      {
+	 pkgCache::PkgIterator M = Grp.FindPreferredPkg();
+	 if (M.end() == false && Pkg != M)
+	 {
+	    pkgCache::DepIterator D = M.RevDependsList();
+	    Dynamic<pkgCache::DepIterator> DynD(D);
+	    for (; D.end() == false; ++D)
+	    {
+	       if ((D->Type != pkgCache::Dep::Conflicts &&
+		    D->Type != pkgCache::Dep::DpkgBreaks &&
+		    D->Type != pkgCache::Dep::Replaces) ||
+		   D.ParentPkg().Group() == Grp)
+		  continue;
+
+	       map_ptrloc *OldDepLast = NULL;
+	       pkgCache::VerIterator ConVersion = D.ParentVer();
+	       Dynamic<pkgCache::VerIterator> DynV(ConVersion);
+	       // duplicate the Conflicts/Breaks/Replaces for :none arch
+	       if (D->Version == 0)
+		  NewDepends(Pkg, ConVersion, "", 0, D->Type, OldDepLast);
+	       else
+		  NewDepends(Pkg, ConVersion, D.TargetVer(),
+			     D->CompareOp, D->Type, OldDepLast);
+	    }
+	 }
+      }
    }
    if (unlikely(AddImplicitDepends(Grp, Pkg, Ver) == false))
       return _error->Error(_("Error occurred while processing %s (%s%d)"),
@@ -456,6 +513,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;
@@ -716,6 +776,7 @@ unsigned long pkgCacheGenerator::NewVersion(pkgCache::VerIterator &Ver,
    
    // Fill it in
    Ver = pkgCache::VerIterator(Cache,Cache.VerP + Version);
+   //Dynamic<pkgCache::VerIterator> DynV(Ver); // caller MergeListVersion already takes care of it
    Ver->NextVer = Next;
    Ver->ID = Cache.HeaderP->VersionCount++;
    map_ptrloc const idxVerStr = WriteStringInMap(VerStr);
@@ -865,6 +926,9 @@ bool pkgCacheGenerator::ListParser::NewDepends(pkgCache::VerIterator &Ver,
 
    // Locate the target package
    pkgCache::PkgIterator Pkg = Grp.FindPkg(Arch);
+   // we don't create 'none' packages and their dependencies if we can avoid it …
+   if (Pkg.end() == true && Arch == "none" && strcmp(Ver.ParentPkg().Arch(), "none") != 0)
+      return true;
    Dynamic<pkgCache::PkgIterator> DynPkg(Pkg);
    if (Pkg.end() == true) {
       if (unlikely(Owner->NewPackage(Pkg, PackageName, Arch) == false))
@@ -911,8 +975,12 @@ bool pkgCacheGenerator::ListParser::NewProvides(pkgCache::VerIterator &Ver,
    Prv->Version = Ver.Index();
    Prv->NextPkgProv = Ver->ProvidesList;
    Ver->ProvidesList = Prv.Index();
-   if (Version.empty() == false && unlikely((Prv->ProvideVersion = WriteString(Version)) == 0))
-      return false;
+   if (Version.empty() == false) {
+      map_ptrloc const idxProvideVersion = WriteString(Version);
+      Prv->ProvideVersion = idxProvideVersion;
+      if (unlikely(idxProvideVersion == 0))
+	 return false;
+   }
    
    // Locate the target package
    pkgCache::PkgIterator Pkg;
@@ -1310,10 +1378,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 +1518,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)

+ 26 - 23
apt-pkg/policy.cc

@@ -27,6 +27,7 @@
 
 #include <apt-pkg/policy.h>
 #include <apt-pkg/configuration.h>
+#include <apt-pkg/cachefilter.h>
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/fileutl.h>
@@ -259,17 +260,33 @@ void pkgPolicy::CreatePin(pkgVersionMatch::MatchType Type,string Name,
    }
 
    // find the package (group) this pin applies to
-   pkgCache::GrpIterator Grp;
-   pkgCache::PkgIterator Pkg;
-   if (Arch.empty() == false)
-      Pkg = Cache->FindPkg(Name, Arch);
-   else {
-      Grp = Cache->FindGrp(Name);
-      if (Grp.end() == false)
-	 Pkg = Grp.PackageList();
+   pkgCache::GrpIterator Grp = Cache->FindGrp(Name);
+   bool matched = false;
+   if (Grp.end() == false)
+   {
+      std::string MatchingArch;
+      if (Arch.empty() == true)
+	 MatchingArch = Cache->NativeArch();
+      else
+	 MatchingArch = Arch;
+      APT::CacheFilter::PackageArchitectureMatchesSpecification pams(MatchingArch);
+      for (pkgCache::PkgIterator Pkg = Grp.PackageList(); Pkg.end() != true; Pkg = Grp.NextPkg(Pkg))
+      {
+	 if (pams(Pkg.Arch()) == false)
+	    continue;
+	 Pin *P = Pins + Pkg->ID;
+	 // the first specific stanza for a package is the ruler,
+	 // all others need to be ignored
+	 if (P->Type != pkgVersionMatch::None)
+	    P = &*Unmatched.insert(Unmatched.end(),PkgPin(Pkg.FullName()));
+	 P->Type = Type;
+	 P->Priority = Priority;
+	 P->Data = Data;
+	 matched = true;
+      }
    }
 
-   if (Pkg.end() == true)
+   if (matched == false)
    {
       PkgPin *P = &*Unmatched.insert(Unmatched.end(),PkgPin(Name));
       if (Arch.empty() == false)
@@ -279,20 +296,6 @@ void pkgPolicy::CreatePin(pkgVersionMatch::MatchType Type,string Name,
       P->Data = Data;
       return;
    }
-
-   for (; Pkg.end() != true; Pkg = Grp.NextPkg(Pkg))
-   {
-      Pin *P = Pins + Pkg->ID;
-      // the first specific stanza for a package is the ruler,
-      // all others need to be ignored
-      if (P->Type != pkgVersionMatch::None)
-	 P = &*Unmatched.insert(Unmatched.end(),PkgPin(Pkg.FullName()));
-      P->Type = Type;
-      P->Priority = Priority;
-      P->Data = Data;
-      if (Grp.end() == true)
-	 break;
-   }
 }
 									/*}}}*/
 // Policy::GetMatch - Get the matching version for a package pin	/*{{{*/

+ 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);
 

+ 12 - 17
buildlib/config.h.in

@@ -2,23 +2,15 @@
    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
 
+/* Define if we have the zlib library for gzip */
+#undef HAVE_ZLIB
+
+/* Define if we have the bz2 library for bzip2 */
+#undef HAVE_BZ2
+
 /* These two are used by the statvfs shim for glibc2.0 and bsd */
 /* Define if we have sys/vfs.h */
 #undef HAVE_VFS_H
@@ -39,10 +31,13 @@
 /* Define the arch name string */
 #undef COMMON_ARCH
 
-/* The version number string */
-#undef VERSION
-
 /* The package name string */
 #undef PACKAGE
 
+/* 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
-headers library clean veryclean program test:
+startup headers library clean veryclean program test update-po manpages debiandoc:
 
 veryclean:
 	echo Very Clean done for $(SUBDIR)

+ 4 - 2
buildlib/environment.mak.in

@@ -2,6 +2,8 @@
 # if you want you can edit it, just don't re-run configure.
 
 PACKAGE = @PACKAGE@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PACKAGE_MAIL = @PACKAGE_MAIL@
 
 # C++ compiler options
 CC = @CC@
@@ -52,9 +54,9 @@ BDBLIB = @BDBLIB@
 INTLLIBS = @INTLLIBS@
 
 # Shim Headerfile control
-HAVE_C9X = @HAVE_C9X@
 HAVE_STATVFS = @HAVE_STATVFS@
-HAVE_TIMEGM = @HAVE_TIMEGM@
+HAVE_ZLIB = @HAVE_ZLIB@
+HAVE_BZ2 = @HAVE_BZ2@
 NEED_SOCKLEN_T_DEFINE = @NEED_SOCKLEN_T_DEFINE@
 
 # Shared library things

+ 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) > $@
-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

+ 8 - 4
cmdline/apt-cache.cc

@@ -597,6 +597,7 @@ bool ShowDepends(CommandLine &CmdL, bool const RevDepends)
    bool const Installed = _config->FindB("APT::Cache::Installed", false);
    bool const Important = _config->FindB("APT::Cache::Important", false);
    bool const ShowDepType = _config->FindB("APT::Cache::ShowDependencyType", RevDepends == false);
+   bool const ShowVersion = _config->FindB("APT::Cache::ShowVersion", false);
    bool const ShowPreDepends = _config->FindB("APT::Cache::ShowPre-Depends", true);
    bool const ShowDepends = _config->FindB("APT::Cache::ShowDepends", true);
    bool const ShowRecommends = _config->FindB("APT::Cache::ShowRecommends", Important == false);
@@ -646,10 +647,13 @@ bool ShowDepends(CommandLine &CmdL, bool const RevDepends)
 		if (ShowDepType == true)
 		  cout << D.DepType() << ": ";
 		if (Trg->VersionList == 0)
-		  cout << "<" << Trg.FullName(true) << ">" << endl;
+		  cout << "<" << Trg.FullName(true) << ">";
 		else
-		  cout << Trg.FullName(true) << endl;
-	    
+		  cout << Trg.FullName(true);
+		if (ShowVersion == true && D->Version != 0)
+		   cout << " (" << pkgCache::CompTypeDeb(D->CompareOp) << ' ' << D.TargetVer() << ')';
+		cout << std::endl;
+
 		if (Recurse == true && Shown[Trg->ID] == false)
 		{
 		  Shown[Trg->ID] = true;
@@ -1676,7 +1680,7 @@ bool GenCaches(CommandLine &Cmd)
 /* */
 bool ShowHelp(CommandLine &Cmd)
 {
-   ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,VERSION,
+   ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION,
 	    COMMON_ARCH,__DATE__,__TIME__);
    
    if (_config->FindB("version") == true)

+ 1 - 1
cmdline/apt-cdrom.cc

@@ -195,7 +195,7 @@ bool DoIdent(CommandLine &)
 /* */
 int ShowHelp()
 {
-   ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,VERSION,
+   ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION,
 	    COMMON_ARCH,__DATE__,__TIME__);
    if (_config->FindB("version") == true)
       return 0;

+ 10 - 2
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;
 }
 									/*}}}*/
@@ -72,7 +78,7 @@ bool DoDump(CommandLine &CmdL)
 /* */
 int ShowHelp()
 {
-   ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,VERSION,
+   ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION,
 	    COMMON_ARCH,__DATE__,__TIME__);
    if (_config->FindB("version") == true)
       return 0;
@@ -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},

+ 1 - 1
cmdline/apt-dump-solver.cc

@@ -21,7 +21,7 @@
 bool ShowHelp() {
 
 	std::cout <<
-		PACKAGE " " VERSION " for " COMMON_ARCH " compiled on " __DATE__ " " __TIME__ << std::endl <<
+		PACKAGE " " PACKAGE_VERSION " for " COMMON_ARCH " compiled on " __DATE__ " " __TIME__ << std::endl <<
 		"Usage: apt-dump-resolver\n"
 		"\n"
 		"apt-dump-resolver is a dummy solver who just dumps its input to the\n"

+ 5 - 3
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;
@@ -224,7 +226,7 @@ bool DebFile::ParseInfo()
 /* */
 int ShowHelp(void)
 {
-   	ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,VERSION,
+   	ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION,
 	    COMMON_ARCH,__DATE__,__TIME__);
 
 	if (_config->FindB("version") == true) 

+ 135 - 70
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++)
    {
@@ -1252,7 +1255,9 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,
    {
       if (_config->FindB("APT::Get::Trivial-Only",false) == true)
 	 return _error->Error(_("Trivial Only specified but this is not a trivial operation."));
-      
+
+      // TRANSLATOR: This string needs to be typed by the user as a confirmation, so be
+      //             careful with hard to type or special characters (like non-breaking spaces)
       const char *Prompt = _("Yes, do as I say!");
       ioprintf(c2out,
 	       _("You are about to do something potentially harmful.\n"
@@ -1415,7 +1420,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,
 	"all files have been overwritten by other packages:",
 	"The following packages disappeared from your system as\n"
 	"all files have been overwritten by other packages:", disappearedPkgs.size()), disappear, "");
-   c0out << _("Note: This is done automatic and on purpose by dpkg.") << std::endl;
+   c0out << _("Note: This is done automatically and on purpose by dpkg.") << std::endl;
 
    return true;
 }
@@ -1431,7 +1436,7 @@ bool TryToInstallBuildDep(pkgCache::PkgIterator Pkg,pkgCacheFile &Cache,
    if (Cache[Pkg].CandidateVer == 0 && Pkg->ProvidesList != 0)
    {
       CacheSetHelperAPTGet helper(c1out);
-      helper.showErrors(AllowFail == false);
+      helper.showErrors(false);
       pkgCache::VerIterator Ver = helper.canNotFindNewestVer(Cache, Pkg);
       if (Ver.end() == false)
 	 Pkg = Ver.ParentPkg();
@@ -1679,10 +1684,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;
 }
 									/*}}}*/
@@ -1711,12 +1719,13 @@ bool DoAutomaticRemove(CacheFile &Cache)
    bool smallList = (hideAutoRemove == false &&
 		strcasecmp(_config->Find("APT::Get::HideAutoRemove","").c_str(),"small") == 0);
 
-   string autoremovelist, autoremoveversions;
    unsigned long autoRemoveCount = 0;
    APT::PackageSet tooMuch;
+   APT::PackageList autoRemoveList;
    // look over the cache to see what can be removed
-   for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); ! Pkg.end(); ++Pkg)
+   for (unsigned J = 0; J < Cache->Head().PackageCount; ++J)
    {
+      pkgCache::PkgIterator Pkg(Cache,Cache.List[J]);
       if (Cache[Pkg].Garbage)
       {
 	 if(Pkg.CurrentVer() != 0 || Cache[Pkg].Install())
@@ -1727,31 +1736,25 @@ bool DoAutomaticRemove(CacheFile &Cache)
 	 {
 	    if(Pkg.CurrentVer() != 0 && 
 	       Pkg->CurrentState != pkgCache::State::ConfigFiles)
-	       Cache->MarkDelete(Pkg, purgePkgs);
+	       Cache->MarkDelete(Pkg, purgePkgs, 0, false);
 	    else
 	       Cache->MarkKeep(Pkg, false, false);
 	 }
 	 else
 	 {
+	    if (hideAutoRemove == false && Cache[Pkg].Delete() == false)
+	       autoRemoveList.insert(Pkg);
 	    // if the package is a new install and already garbage we don't need to
 	    // install it in the first place, so nuke it instead of show it
 	    if (Cache[Pkg].Install() == true && Pkg.CurrentVer() == 0)
 	    {
 	       if (Pkg.CandVersion() != 0)
 	          tooMuch.insert(Pkg);
-	       Cache->MarkDelete(Pkg, false);
+	       Cache->MarkDelete(Pkg, false, 0, false);
 	    }
 	    // only show stuff in the list that is not yet marked for removal
-	    else if(hideAutoRemove == false && Cache[Pkg].Delete() == false) 
-	    {
+	    else if(hideAutoRemove == false && Cache[Pkg].Delete() == false)
 	       ++autoRemoveCount;
-	       // we don't need to fill the strings if we don't need them
-	       if (smallList == false)
-	       {
-		 autoremovelist += Pkg.FullName(true) + " ";
-		 autoremoveversions += string(Cache[Pkg].CandVersion) + "\n";
-	       }
-	    }
 	 }
       }
    }
@@ -1784,16 +1787,9 @@ bool DoAutomaticRemove(CacheFile &Cache)
 		    continue;
 		 if (Debug == true)
 		    std::clog << "Save " << Pkg << " as another installed garbage package depends on it" << std::endl;
-		 Cache->MarkInstall(Pkg, false);
+		 Cache->MarkInstall(Pkg, false, 0, false);
 		 if (hideAutoRemove == false)
-		 {
 		    ++autoRemoveCount;
-		    if (smallList == false)
-		    {
-		       autoremovelist += Pkg.FullName(true) + " ";
-		       autoremoveversions += string(Cache[Pkg].CandVersion) + "\n";
-		    }
-		 }
 		 tooMuch.erase(Pkg);
 		 Changed = true;
 		 break;
@@ -1803,6 +1799,18 @@ bool DoAutomaticRemove(CacheFile &Cache)
       } while (Changed == true);
    }
 
+   std::string autoremovelist, autoremoveversions;
+   if (smallList == false && autoRemoveCount != 0)
+   {
+      for (APT::PackageList::const_iterator Pkg = autoRemoveList.begin(); Pkg != autoRemoveList.end(); ++Pkg)
+      {
+	 if (Cache[Pkg].Garbage == false)
+	    continue;
+	 autoremovelist += Pkg.FullName(true) + " ";
+	 autoremoveversions += string(Cache[Pkg].CandVersion) + "\n";
+      }
+   }
+
    // Now see if we had destroyed anything (if we had done anything)
    if (Cache->BrokenCount() != 0)
    {
@@ -1826,7 +1834,7 @@ bool DoAutomaticRemove(CacheFile &Cache)
       else
 	 ioprintf(c1out, P_("%lu package was automatically installed and is no longer required.\n",
 	          "%lu packages were automatically installed and are no longer required.\n", autoRemoveCount), autoRemoveCount);
-      c1out << _("Use 'apt-get autoremove' to remove them.") << std::endl;
+      c1out << P_("Use 'apt-get autoremove' to remove it.", "Use 'apt-get autoremove' to remove them.", autoRemoveCount) << std::endl;
    }
    return true;
 }
@@ -2356,6 +2364,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 +2376,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 +2404,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 +2513,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 +2806,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");
@@ -2864,48 +2894,63 @@ bool DoBuildDep(CommandLine &CmdL)
 	    pkgCache::PkgIterator Pkg;
 
 	    // Cross-Building?
-	    if (StripMultiArch == false)
+	    if (StripMultiArch == false && D->Type != pkgSrcRecords::Parser::BuildDependIndep)
 	    {
 	       size_t const colon = D->Package.find(":");
-	       if (colon != string::npos &&
-		   (strcmp(D->Package.c_str() + colon, ":any") == 0 || strcmp(D->Package.c_str() + colon, ":native") == 0))
-		  Pkg = Cache->FindPkg(D->Package.substr(0,colon));
+	       if (colon != string::npos)
+	       {
+		  if (strcmp(D->Package.c_str() + colon, ":any") == 0 || strcmp(D->Package.c_str() + colon, ":native") == 0)
+		     Pkg = Cache->FindPkg(D->Package.substr(0,colon));
+		  else
+		     Pkg = Cache->FindPkg(D->Package);
+	       }
 	       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;
+		  Pkg = Cache->FindPkg(D->Package, hostArch);
 
 	       // 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)
+		  pkgCache::PkgIterator BuildPkg = Cache->FindPkg(D->Package, "native");
+		  if (BuildPkg.end() == false && Pkg != BuildPkg)
 		  {
-		     Ver = (*Cache)[HostPkg].InstVerIter(*Cache);
-		     if (BADVER(Ver))
-		        Ver = (*Cache)[HostPkg].CandidateVerIter(*Cache);
+		     pkgCache::VerIterator Ver = (*Cache)[BuildPkg].InstVerIter(*Cache);
+		     if (BADVER(Ver) == false)
+			verlist.insert(Ver);
+		     Ver = (*Cache)[BuildPkg].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 (strcmp(D->Package.c_str() + colon, ":native") == 0)
+			Pkg = Ver.ParentPkg().Group().FindPkg("native");
 		  }
 		  else if (Ver->MultiArch == pkgCache::Version::Same)
 		  {
@@ -2913,11 +2958,15 @@ bool DoBuildDep(CommandLine &CmdL)
 			Pkg = Ver.ParentPkg().Group().FindPkg(hostArch);
 		     else if (strcmp(D->Package.c_str() + colon, ":any") == 0)
 			forbidden = "Multi-Arch: same";
-		     // :native gets the buildArch
+		     else if (strcmp(D->Package.c_str() + colon, ":native") == 0)
+			Pkg = Ver.ParentPkg().Group().FindPkg("native");
 		  }
 		  else if ((Ver->MultiArch & pkgCache::Version::Foreign) == pkgCache::Version::Foreign)
 		  {
-		     if (colon != string::npos)
+		     if (colon == string::npos)
+			Pkg = Ver.ParentPkg().Group().FindPkg("native");
+		     else if (strcmp(D->Package.c_str() + colon, ":any") == 0 ||
+			      strcmp(D->Package.c_str() + colon, ":native") == 0)
 			forbidden = "Multi-Arch: foreign";
 		  }
 		  else if ((Ver->MultiArch & pkgCache::Version::Allowed) == pkgCache::Version::Allowed)
@@ -2935,28 +2984,40 @@ bool DoBuildDep(CommandLine &CmdL)
 			if (Pkg.end() == true)
 			   Pkg = Grp.FindPreferredPkg(true);
 		     }
-		     // native gets buildArch
+		     else if (strcmp(D->Package.c_str() + colon, ":native") == 0)
+			Pkg = Ver.ParentPkg().Group().FindPkg("native");
 		  }
+
 		  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);
 
-	    if (Pkg.end() == true)
+	    if (Pkg.end() == true || (Pkg->VersionList == 0 && Pkg->ProvidesList == 0))
             {
                if (_config->FindB("Debug::BuildDeps",false) == true)
                     cout << " (not found)" << (*D).Package << endl;
@@ -3039,7 +3100,7 @@ bool DoBuildDep(CommandLine &CmdL)
 	       }
 	    }
 
-            if (TryToInstallBuildDep(Pkg,Cache,Fix,false,false) == true)
+            if (TryToInstallBuildDep(Pkg,Cache,Fix,false,false,false) == true)
             {
                // We successfully installed something; skip remaining alternatives
                skipAlternatives = hasAlternatives;
@@ -3228,9 +3289,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);
@@ -3295,7 +3360,7 @@ bool DoMoo(CommandLine &CmdL)
 /* */
 bool ShowHelp(CommandLine &CmdL)
 {
-   ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,VERSION,
+   ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION,
 	    COMMON_ARCH,__DATE__,__TIME__);
 	    
    if (_config->FindB("version") == true)

+ 8 - 9
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,33 +20,30 @@
 #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					/*{{{*/
 // ---------------------------------------------------------------------
 /* */
 bool ShowHelp(CommandLine &CmdL) {
-	ioprintf(std::cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,VERSION,
+	ioprintf(std::cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION,
 		 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"

+ 16 - 4
cmdline/apt-mark.cc

@@ -291,14 +291,26 @@ bool DoHold(CommandLine &CmdL)
    FILE* dpkg = fdopen(external[1], "w");
    for (APT::PackageList::iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
    {
+      if (dpkgMultiArch == false)
+	 fprintf(dpkg, "%s", Pkg.FullName(true).c_str());
+      else
+      {
+	 if (Pkg->CurrentVer != 0)
+	    fprintf(dpkg, "%s:%s", Pkg.Name(), Pkg.CurrentVer().Arch());
+	 else if (Pkg.VersionList().end() == false)
+	    fprintf(dpkg, "%s:%s", Pkg.Name(), Pkg.VersionList().Arch());
+	 else
+	    fprintf(dpkg, "%s", Pkg.FullName(false).c_str());
+      }
+
       if (MarkHold == true)
       {
-	 fprintf(dpkg, "%s hold\n", Pkg.FullName(!dpkgMultiArch).c_str());
+	 fprintf(dpkg, " hold\n");
 	 ioprintf(c1out,_("%s set on hold.\n"), Pkg.FullName(true).c_str());
       }
       else
       {
-	 fprintf(dpkg, "%s install\n", Pkg.FullName(!dpkgMultiArch).c_str());
+	 fprintf(dpkg, " install\n");
 	 ioprintf(c1out,_("Canceled hold on %s.\n"), Pkg.FullName(true).c_str());
       }
    }
@@ -360,14 +372,14 @@ bool ShowHold(CommandLine &CmdL)
 /* */
 bool ShowHelp(CommandLine &CmdL)
 {
-   ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,VERSION,
+   ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION,
 	    COMMON_ARCH,__DATE__,__TIME__);
 
    cout <<
     _("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"

+ 1 - 1
cmdline/apt-sortpkgs.cc

@@ -144,7 +144,7 @@ bool DoIt(string InFile)
 /* */
 int ShowHelp()
 {
-   ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,VERSION,
+   ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION,
 	    COMMON_ARCH,__DATE__,__TIME__);
    if (_config->FindB("version") == true)
       return 0;

+ 19 - 14
cmdline/makefile

@@ -33,20 +33,6 @@ LIB_MAKES = apt-pkg/makefile
 SOURCE = apt-cdrom.cc 
 include $(PROGRAM_H)
 
-# The apt-sortpkgs program
-PROGRAM=apt-sortpkgs
-SLIBS = -lapt-pkg $(INTLLIBS)
-LIB_MAKES = apt-pkg/makefile
-SOURCE = apt-sortpkgs.cc
-include $(PROGRAM_H)
-
-# The apt-extracttemplates program
-PROGRAM=apt-extracttemplates
-SLIBS = -lapt-pkg -lapt-inst $(INTLLIBS)
-LIB_MAKES = apt-pkg/makefile
-SOURCE = apt-extracttemplates.cc 
-include $(PROGRAM_H)
-
 # The apt-key program
 SOURCE=apt-key
 TO=$(BIN)
@@ -66,6 +52,25 @@ include $(PROGRAM_H)
 #TARGET=program
 #include $(COPY_H)
 
+#
+# the following programs are shipped in apt-utils
+#
+APT_DOMAIN:=apt-utils
+
+# The apt-sortpkgs program
+PROGRAM=apt-sortpkgs
+SLIBS = -lapt-pkg $(INTLLIBS)
+LIB_MAKES = apt-pkg/makefile
+SOURCE = apt-sortpkgs.cc
+include $(PROGRAM_H)
+
+# The apt-extracttemplates program
+PROGRAM=apt-extracttemplates
+SLIBS = -lapt-pkg -lapt-inst $(INTLLIBS)
+LIB_MAKES = apt-pkg/makefile
+SOURCE = apt-extracttemplates.cc 
+include $(PROGRAM_H)
+
 # The internal solver acting as an external
 PROGRAM=apt-internal-solver
 SLIBS = -lapt-pkg $(INTLLIBS)

+ 21 - 48
configure.in

@@ -17,11 +17,15 @@ AC_INIT(configure.in)
 AC_CONFIG_AUX_DIR(buildlib)
 AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in)
 
-dnl -- SET THIS TO THE RELEASE VERSION --
-AC_DEFINE_UNQUOTED(VERSION,"0.8.16~exp9")
 PACKAGE="apt"
+PACKAGE_VERSION="0.9.7.7"
+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
@@ -87,9 +91,21 @@ AC_CHECK_LIB(curl, curl_easy_init,
 
 AC_SUBST(BDBLIB)
 
+HAVE_ZLIB=no
 AC_CHECK_LIB(z, gzopen,
-	[AC_CHECK_HEADER(zlib.h, [], AC_MSG_ERROR([failed: zlib.h not found]))],
+	[AC_CHECK_HEADER(zlib.h, [HAVE_ZLIB=yes], AC_MSG_ERROR([failed: zlib.h not found]))],
 	AC_MSG_ERROR([failed: Need libz]))
+AC_SUBST(HAVE_ZLIB)
+if test "x$HAVE_ZLIB" = "xyes"; then
+	AC_DEFINE(HAVE_ZLIB)
+fi
+
+HAVE_BZ2=no
+AC_CHECK_LIB(bz2, BZ2_bzopen,[AC_CHECK_HEADER(bzlib.h, [HAVE_BZ2=yes], [])], [])
+AC_SUBST(HAVE_BZ2)
+if test "x$HAVE_BZ2" = "xyes"; then
+	AC_DEFINE(HAVE_BZ2)
+fi
 
 dnl Converts the ARCH to be something singular for this general CPU family
 dnl This is often the dpkg architecture string.
@@ -103,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)
@@ -128,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)],[
@@ -218,4 +191,4 @@ fi
 AC_SUBST(USE_NLS)
 AC_PATH_PROG(BASH, bash)
 
-AC_OUTPUT(environment.mak:buildlib/environment.mak.in makefile:buildlib/makefile.in doc/Doxyfile,make -s dirs)
+AC_OUTPUT(environment.mak:buildlib/environment.mak.in makefile:buildlib/makefile.in doc/Doxyfile:doc/Doxyfile.in,make -s dirs)

+ 1 - 1
debian/apt-utils.install

@@ -1 +1 @@
-
+usr/share/locale/*/*/apt-utils.mo

+ 0 - 1
debian/apt-utils.links

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

+ 8 - 6
debian/apt.cron.daily

@@ -327,12 +327,14 @@ check_power(){
 
 # ------------------------ main ----------------------------
 
-# Backup the 7 last versions of APT's extended_states file
-# shameless copy from dpkg cron
-if cd /var/backups ; then
-    if ! cmp -s apt.extended_states.0 /var/lib/apt/extended_states; then
-	cp -p /var/lib/apt/extended_states apt.extended_states
-	savelog -c 7 apt.extended_states >/dev/null
+if test -r /var/lib/apt/extended_states; then
+    # Backup the 7 last versions of APT's extended_states file
+    # shameless copy from dpkg cron
+    if cd /var/backups ; then
+	if ! cmp -s apt.extended_states.0 /var/lib/apt/extended_states; then
+	    cp -p /var/lib/apt/extended_states apt.extended_states
+	    savelog -c 7 apt.extended_states >/dev/null
+	fi
     fi
 fi
 

+ 7 - 0
debian/apt.postinst

@@ -21,6 +21,13 @@ case "$1" in
 		rm -f $SECRING
 	fi
 	apt-key update
+
+        # ensure tighter permissons on the logs, see LP: #975199
+        if dpkg --compare-versions "$2" lt-nl 0.9.7.7; then
+            # ensure permissions are right
+            chmod -f 0640 /var/log/apt/term.log* || true
+        fi
+
     ;;
 
     abort-upgrade|abort-remove|abort-deconfigure)

+ 707 - 16
debian/changelog

@@ -1,13 +1,601 @@
-apt (0.8.16~exp15) unstable; urgency=low
+apt (0.9.7.8) UNRELEASED; urgency=low
 
+  [ Manpages translation updates ]
+  * Italian (Beatrice Torracca). Closes: #696601
+
+ -- Christian Perrier <bubulle@debian.org>  Mon, 24 Dec 2012 07:01:20 +0100
+
+apt (0.9.7.7) unstable; urgency=low
+
+  [ Program translation updates ]
+  * Catalan (Jordi Mallach)
+  * Drop a confusing non-breaking space. Closes: #691024
+  * Thai (Theppitak Karoonboonyanan). Closes: #691613
+  * Vietnamese (Trần Ngọc Quân). Closes: #693773
+  * Fix Plural forms in German, French, Japanese and Portuguese
+    translations. Thanks to Jakub Wilk for reporting these errors.
+
+  [ David Kalnischkies ]
+  * apt-pkg/packagemanager.cc:
+    - do not do lock-step configuration for a M-A:same package if it isn't
+      unpacked yet in SmartConfigure and do not unpack a M-A:same package
+      again in SmartUnPack if we have already configured it (LP: #1062503)
+  * apt-pkg/depcache.cc:
+    - don't call MarkInstall with the FromUser flag set for packages
+      which are dependencies of APT::Never-MarkAuto-Sections matchers
+    - no mode changes should obviously be ok for pkgDepCache::IsModeChangeOk
+  * cmdline/apt-get.cc:
+    - do not call Mark{Install,Delete} from the autoremove code with
+      the FromUser bit set to avoid modifying the auto-installed bit
+  * apt-pkg/algorithms.cc:
+    - ensure pkgProblemResolver calls MarkDelete without FromUser set
+      so that it can't overrule holds and the protection flag
+  
+  [ Michael Vogt ]
+  * change permissions of /var/log/apt/term.log to 0640 (LP: #975199)
+
+  [ Jonathan Thomas ]
+  * apt-pkg/algorithms.cc:
+    - fix package-pointer array memory leak in ResolveByKeepInternal()
+
+ -- Michael Vogt <mvo@debian.org>  Thu, 13 Dec 2012 09:52:19 +0100
+
+apt (0.9.7.6) unstable; urgency=low
+
+  [ Program translation updates ]
+  * Ukrainian (A. Bondarenko)
+
+  [ David Kalnischkies ]
+  * apt-pkg/pkgcachegen.cc:
+    - ensure that dependencies for packages:none are always generated
+    - add 2 missing remap registrations causing a segfault in case
+      we use the not remapped iterators after a move of the mmap again
+    - write the native architecture as unique string into the cache header
+      as it is used for arch:all packages as a map to arch:native.
+      Otherwise arch comparisons later will see differences (Closes: #689323)
+  * apt-pkg/pkgcache.cc:
+    - ignore negative dependencies applying in the same group for M-A:same
+      packages on the real package name as self-conflicts (Closes: #688863)
+  * cmdline/apt-cache.cc:
+    - print versioned dependency relations in (r)depends if the option
+      APT::Cache::ShowVersion is true (default: false) as discussed in
+      #218995 to help debian-cd fixing #687949. Thanks to Sam Lidder
+      for initial patch and Steve McIntyre for nagging and testing!
+  * apt-pkg/edsp.cc:
+    - include reinstall requests and already installed (= protected) packages
+      in the install-request for external resolvers (Closes: #689331)
+  * apt-pkg/policy.cc:
+    - match pins with(out) an architecture as we do on the commandline
+      (partly fixing #687255, b= support has to wait for jessie)
+  * apt-pkg/contrib/netrc.cc:
+    - remove the 64 char limit for login/password in internal usage
+    - remove 256 char line limit by using getline() (POSIX.1-2008)
+  
+  [ Colin Watson ]
+  * apt-pkg/pkgcachegen.cc:
+    - Fix crash if the cache is remapped while writing a Provides version
+      (LP: #1066445).
+
+ -- Michael Vogt <mvo@debian.org>  Tue, 16 Oct 2012 18:08:53 +0200
+
+apt (0.9.7.5) unstable; urgency=low
+
+  [ Manpages translation updates ]
+  * Japanese (KURASAWA Nozomu) (Closes: #684435)
+  * Portuguese (Américo Monteiro) (Closes: #686975)
+
+  [ David Kalnischkies ]
+  * handle packages without a mandatory architecture (debian-policy §5.3)
+    by introducing a pseudo-architecture 'none' so that the small group of
+    users with these packages can get right of them without introducing too
+    much hassle for other users (Closes: #686346)
+  * apt-pkg/cdrom.cc:
+    - copy only configured translation files from a CD-ROM and not all
+      available translation files preventing new installs with d-i from
+      being initialized with all translations (Closes: #678227)
+    - handle Components in the reduction for the source.list as multi-arch CDs
+      otherwise create duplicated source entries (e.g. "wheezy main main")
+  * apt-pkg/packagemanager.cc:
+    - unpack versions only in case a different version from the package
+      is currently in unpack state to recover from broken system states
+      (like different file in M-A:same package and other dpkg errors)
+      and avoid re-unpack otherwise (Closes: #670900)
+  * debian/control:
+    - let libapt-pkg break apt < 0.9.4 to ensure that the installed http-
+      method supports the new redirection-style, thanks to Raphael Geissert
+      for reporting & testing (Closes: #685192)
+  * doc/apt_preferences.5.xml:
+    - use the correct interval (x <= P < y) for pin value documentation as
+      these are the intervals used by the code (Closes: #685989)
+  * apt-pkg/indexcopy.cc:
+    - do not create duplicated flat-archive CD-ROM sources for foreign
+      architectures on multi-arch CD-ROMs
+    - do not warn about files which have a record in the Release file, but
+      are not present on the CD to mirror the behavior of the other methods
+      and to allow uncompressed indexes to be dropped without scaring users
+  * apt-pkg/pkgcachegen.cc:
+    - do not create 'native' (or now 'none') package structures as a side
+      effect of description translation parsing as it pollutes the cache
+
+ -- Michael Vogt <mvo@debian.org>  Tue, 11 Sep 2012 15:56:44 +0200
+
+apt (0.9.7.4) unstable; urgency=low
+
+  [ Manpages translation updates ]
+  * Polish (Robert Luberda) (Closes: #683109)
+
+  [ Program translation updates ]
+  * Polish (Michał Kułach)
+
+  [ Pino Toscano ]
+  * apt-pkg/contrib/mmap.cc:
+    - guard only the msync call with _POSIX_SYNCHRONIZED_IO rather
+      than also the fallback code as it breaks APT on hurd since 0.9.7.3
+      as the fallback is now always used on non-linux (Closes: #683354)
+
+  [ David Kalnischkies ]
+  * apt-pkg/contrib/fileutl.cc:
+    - remove _POSIX_SYNCHRONIZED_IO guard in FileFd::Sync() around fsync
+      as this guard is only needed for fdatasync and not defined on hurd
+  * cmdline/apt-get.cc:
+    - error out on (unsatisfiable) build-deps on purly virtual packages
+      instead of ignoring these dependencies; thanks to Johannes Schauer
+      for the detailed report! (Closes: #683786)
+    - ensure that the right architecture is used for cross-dependencies in
+      cases we have to choose a provider by defaulting on host-arch
+      instead of build-arch
+  * doc/apt-verbatim.ent:
+    - denote 'wheezy' as stable codename and 'jessie' as testing codename
+      in the documentation in preparation for release
+  * apt-pkg/indexcopy.cc:
+    - do not use atomic writing if the target is /dev/null as we don't want
+      to replace it, not even automically. (Closes: #683410)
+  * apt-pkg/cdrom.cc:
+    - do not link() but rename() the cdroms.list to cdroms.list~ as a backup
+      to ensure that apt-cdrom can be run multiple times (Closes: #676302)
+
+ -- Michael Vogt <mvo@debian.org>  Mon, 06 Aug 2012 15:55:04 +0200
+
+apt (0.9.7.3) unstable; urgency=low
+
+  [ Manpages translation updates ]
+  * Spanish; (Omar Campagne). Closes: #681566
+
+  [ Program translation updates ]
+  * Czech (Miroslav Kure). Closes: #680758
+
+  [ David Kalnischkies ]
+  * apt-pkg/cacheset.cc:
+    - handle :all and :native correctly as architectures again
+      in the commandline parsing (regression in 0.9.7)
+  * apt-pkg/packagemanager.cc:
+    - do not segfault if nothing can be configured to statisfy
+      a pre-depends (e.g. in a pre-depends loop) (Closes: #681958)
+  * apt-pkg/contrib/mmap.cc:
+    - trigger the usage of the fallback code for kfreebsd also in the
+      second (filebased) constructor of DynamicMMap (Closes: #677704)
+    - refer to APT::Cache-Start in case the growing failed as if -Limit is
+      really the offender it will be noted in a previous error message.
+    - for filesystems not supporting mmap'ing a file we need to use a
+      SyncToFd dummy just as we did for compressed files in 0.9.5
+
+ -- Michael Vogt <mvo@debian.org>  Fri, 27 Jul 2012 17:53:41 +0200
+
+apt (0.9.7.2) unstable; urgency=low
+
+  [ Manpages translation updates ]
+  * French (Christian Perrier)
+  * German (Chris Leick)
+
+  [ Program translation updates ]
+  * Greek (Θανάσης Νάτσης)
+  * Japanese (Kenshi Muto) (Closes: #679662)
+  * Russian (Yuri Kozlov) (Closes: #679599)
+  * Danish (Joe Dalton) (Closes: #680119)
+  * Portuguese (Miguel Figueiredo) (Closes: #680616)
+
+  [ David Kalnischkies ]
+  * debian/apt.cron.daily:
+    - do not try to backup extended_states file if it doesn't
+      exist (Closes: #680287)
+  * ftparchive/writer.cc:
+    - handle the APT::FTPArchive::Packages::SHA512 option correctly instead
+      of overriding SHA256, thanks Christian Marillat! (Closes: #680252)
+  * cmdline/apt-mark.cc:
+    - arch:all packages are treated as arch:native packages, but dpkg
+      expects pkg:all for selections, so use the arch of the installed
+      version instead of the package structure if possible.
+      Thanks to Stepan Golosunov for the report! (Closes: #680041)
+  * apt-pkg/clean.cc:
+    - run autoclean against pkg:arch and not always against pkg:native as
+      this removes valid cache entries (Closes: #679371)
+  * apt-pkg/deb/deblistparser.cc:
+    - negative dependencies need to apply to all architectures,
+      but those with a specific architecture only apply to this one
+  * apt-pkg/cachefilter.cc:
+    - remove architecture-specific arch to tuple expansion-rules as they lead
+      to the same tuples for different architectures (e.g. linux-arm for arm,
+      armel and armhf) while the dpkg-architecture code uses triples which
+      are different (in the first part, which we omit in our tuples), so e.g.
+      build-dep restrictions for armel ended up effecting armhf as well
+
+ -- Michael Vogt <mvo@debian.org>  Fri, 13 Jul 2012 21:33:56 +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)
 
- -- Michael Vogt <michael.vogt@ubuntu.com>  Thu, 19 Apr 2012 10:53:30 +0200
+  [ 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)
 
-apt (0.8.16~exp14) UNRELEASED; urgency=low
+  [ 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
+
+ -- Michael Vogt <mvo@debian.org>  Mon, 16 Apr 2012 15:53:17 +0200
+
+apt (0.9.0~exp1) experimental; urgency=low
 
   [ Michael Vogt ]
   * apt-pkg/packagemanager.cc:
@@ -15,19 +603,99 @@ apt (0.8.16~exp14) UNRELEASED; urgency=low
     - add APT::pkgPackageManager::MaxLoopCount to ensure that the
       ordering code does not get into a endless loop when it flip-flops
       between two states
-  
+  * update libapt-inst1.4 to libapt-inst1.5 because of the cleanup 
+    performed
+  * prepare debian/unstable upload, if there are no issues with this
+    upload it will directly go into unstable as 0.9.0  
+
   [ David Kalnischkies ]
+  * do not update po and pot files in the process of the build as this
+    causes timestamp changes for the mo files which therefore can't
+    be refcounted by dpkg for your M-A: same packages
+    (Closes: #659333, LP: #924628)
+  * apt-inst/database.{cc,h}, apt-inst/deb/dpkgdb.{cc,h}:
+    - drop instead of fix as it is only needed if you want to reimplement dpkg
+      and comes straight from the beginning of last decade (Closes: #663372)
+  * apt-inst/deb/debfile.cc:
+    - {Extract,Merge}Control() is another instance of "lets reimplement dpkg"
+      so shot of this code before someone ends up using this…
+  * debian/libapt-pkg4.12:
+    - update symbols file
+  * debian/apt-utils.install:
+    - ship the ftparchive, apt-extractemplates and apt-sortpkgs locales
+      in the apt-utils package instead of the apt package
   * apt-pkg/packagemanager.cc:
     - recheck all dependencies if we changed a package in SmartConfigure
       as this could break an earlier dependency (LP: #940396)
     - recheck dependencies in SmartUnpack after a change, too
-  
-  [ Thorsten Spindler ]
+  * apt-pkg/acquire-worker.cc:
+    - check return of write() as gcc recommends
+  * apt-pkg/acquire.cc:
+    - check return of write() as gcc recommends
+  * apt-pkg/cdrom.cc:
+    - check return of chdir() and link() as gcc recommends
+  * apt-pkg/clean.cc:
+    - check return of chdir() as gcc recommends
+  * apt-pkg/contrib/netrc.cc:
+    - check return of asprintf() as gcc recommends
+  * methods/rred.cc:
+    - check return of writev() as gcc recommends
+  * methods/mirror.cc:
+    - check return of chdir() as gcc recommends
   * apt-pkg/deb/dpkgpm.cc:
-    - do not crash if (*I).Pkg is NULL (LP: #939867)
-  
-  
- -- David Kalnischkies <kalnischkies@gmail.com>  Tue, 13 Mar 2012 12:38:35 +0100
+    - check return of write() a gcc recommends
+  * apt-inst/deb/debfile.cc:
+    - check return of chdir() as gcc recommends
+  * apt-inst/deb/dpkgdb.cc:
+    - check return of chdir() as gcc recommends
+  * methods/makefile:
+    - do not link rred against libz anymore as FileFd handles all
+      this transparently now
+  * debian/control:
+    - bump Standards-Version to 3.9.3 (no changes needed)
+    - add libbz2-dev as new build-dependency
+    - remove the libz-dev alternative from zlib1g-dev build-dependency
+    - suggest xz-utils instead of bzip2 and lzma
+  * doc/apt-get.8.xml:
+    - typofix: respect → respecting, thanks Mike Erickson! (Closes: #664833)
+  * debian/rules:
+    - do not sed in configure.in to set the version-number
+  * prepare-release:
+    - add as a small script to lazy check and prepare releases
+  * doc/*:
+    - move the command synopsis out of each manpage into apt-verbatim.ent
+      as they are a hell to translate and just single out the parameters
+      which can be translated to apt.ent
+  * apt-pkg/aptconfiguration.cc:
+    - if present, prefer xz binary over lzma
+    - if we have zlib builtin insert add a dummy gzip compressor for FileFD
+    - do the same for bz2 builtin if available
+  * methods/bzip2.cc:
+    - remove it as the functionality for all compressors can be
+      provided by gzip.cc now with the usage of FileFD
+  * apt-pkg/contrib/fileutl.cc:
+    - use libz2 library for (de)compression instead of the bzip2 binary as
+      the first is a dependency of dpkg and the later just priority:optional
+      so we gain 'easier' access to bz2-compressed Translation files this way
+  * cmdline/apt-get.cc:
+    - print list of autoremoves in alphabetical order (Closes: #639008)
+
+  [ Bogdan Purcareata ]
+  * doc/apt-get.8.xml:
+    - add 'download' to the usage line (Closes: #649340)
+  * cmdline/apt-get.cc:
+    - distinguish information about 'apt-get autoremove' based on the
+      number of auto-removed packages both before and after the list
+      of packages (Closes: #665833)
+
+  [ Steve Langasek ]
+  * don't treat build-depends-indep as cross-build-dependencies; we should
+    always install the host arch versions.  LP: #968828.
+
+  [ Paolo Rotolo ]
+  * Fix string from automatic to automatically (LP: #967393).
+
+ -- Michael Vogt <mvo@debian.org>  Thu, 12 Apr 2012 12:40:39 +0200
 
 apt (0.8.16~exp13) experimental; urgency=low
 
@@ -178,6 +846,10 @@ apt (0.8.16~exp10) experimental; urgency=low
   * apt-pkg/contrib/fileutl.h:
     - store the offset in the internal fd before calculate size of
       the zlib-handled file to jump back to this place again
+  * apt-pkg/aptconfiguration.cc:
+    - parse dpkg --print-foreign-architectures correctly in
+      case archs are separated by newline instead of space, too.
+      (Closes: #655590)
 
   [ Michael Vogt ]
   * apt-pkg/contrib/fileutl.h:
@@ -426,19 +1098,30 @@ 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.10) UNRELEASEDunstable; urgency=low
+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 ]
   * algorithms.cc:
     - show a debug why a package was kept by ResolveByKeep()
   * doc/manpage-style.xml:
     - put <brackets> around email addresses
-  * apt-pkg/aptconfiguration.cc:
-    - parse dpkg --print-foreign-architectures correctly in
-      case archs are separated by newline instead of space, too.
-      (Closes: #655590)
   * doc/po/de.po:
     - apply typo-fix from Michael Basse, thanks! (LP: #900770)
+  * apt-pkg/acquire-item.cc:
+    - remove 'old' InRelease file if we can't get a new one before
+      proceeding with Release.gpg to avoid the false impression of a still
+      trusted repository by a (still present) old InRelease file.
+      Thanks to Simon Ruderich for reporting this issue! (CVE-2012-0214)
 
   [ Chris Leick ]
   * German manpage translation update
@@ -450,8 +1133,16 @@ apt (0.8.15.10) UNRELEASEDunstable; urgency=low
   * Slovak (Ivan Masar). Closes: #652985
   * Russian (Yuri Kozlov). Closes: #654844
   * Hungarian (Gabor Kelemen). Closes: #655238
+  * Polish (Michał Kułach). Closes: #656908
+  * Danish (Joe Hansen). Closes: #658643
+  * French: replace "étiquetage" by "épinglage" for "pinning"
+
+  [ Michael Vogt ]
+  * merged patch from lp:~uusijani/apt/uusi-branch:
+     Correct fi translation for hash sum mismatches (lp:420403)
+     Thanks to Jani Uusitalo
 
- -- David Kalnischkies <kalnischkies@gmail.com>  Fri, 13 Jan 2012 17:30:36 +0100
+ -- Michael Vogt <mvo@debian.org>  Tue, 06 Mar 2012 14:14:26 +0100
 
 apt (0.8.15.9) unstable; urgency=low
 

+ 11 - 6
debian/control

@@ -5,11 +5,12 @@ Maintainer: APT Development Team <deity@lists.debian.org>
 Uploaders: Michael Vogt <mvo@debian.org>, Otavio Salvador <otavio@debian.org>,
  Christian Perrier <bubulle@debian.org>, Daniel Burrows <dburrows@debian.org>,
  Julian Andres Klode <jak@debian.org>
-Standards-Version: 3.9.2
+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 | libz-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/
@@ -19,7 +20,7 @@ Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}, debian-archive-keyring, gnupg
 Replaces: manpages-pl (<< 20060617-3~)
 Conflicts: python-apt (<< 0.7.93.2~)
-Suggests: aptitude | synaptic | wajig, dpkg-dev, apt-doc, bzip2, lzma, python-apt
+Suggests: aptitude | synaptic | wajig, dpkg-dev, apt-doc, xz-utils, python-apt
 Description: commandline package manager
  This package provides commandline tools for searching and
  managing as well as querying information about packages
@@ -40,6 +41,8 @@ Architecture: any
 Multi-Arch: same
 Pre-Depends: ${misc:Pre-Depends}
 Depends: ${shlibs:Depends}, ${misc:Depends}
+Breaks: apt (<< 0.9.4~)
+Section: libs
 Description: package managment runtime library
  This library provides the common functionality for searching and
  managing packages as well as information about packages.
@@ -56,11 +59,12 @@ Description: package managment runtime library
     http, rsh as well as an interface to add more transports like
     https (apt-transport-https) and debtorrent (apt-transport-debtorrent).
 
-Package: libapt-inst1.4
+Package: libapt-inst1.5
 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
@@ -80,7 +84,7 @@ Architecture: any
 Multi-Arch: same
 Priority: optional
 Pre-Depends: ${misc:Pre-Depends}
-Depends: ${libapt-pkg-name} (= ${binary:Version}), ${libapt-inst-name} (= ${binary:Version}), ${misc:Depends}, zlib1g-dev | zlib-dev
+Depends: ${libapt-pkg-name} (= ${binary:Version}), ${libapt-inst-name} (= ${binary:Version}), ${misc:Depends}, zlib1g-dev
 Section: libdevel
 Description: development files for APT's libapt-pkg and libapt-inst
  This package contains the header files and libraries for
@@ -102,6 +106,7 @@ Description: documentation for APT development
 Package: apt-utils
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}
+Suggests: xz-utils
 Description: package managment related utility programs
  This package contains some less used commandline utilities related
  to package managment with APT.

debian/libapt-inst1.4.install.in → debian/libapt-inst1.5.install.in


+ 1 - 29
debian/libapt-inst1.4.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
@@ -7,11 +7,9 @@ libapt-inst.so.1.4 libapt-inst1.4 #MINVER#
  (c++)"ExtractTar::~ExtractTar()@Base" 0.8.0
  (c++)"debDebFile::GotoMember(char const*)@Base" 0.8.0
  (c++)"debDebFile::CheckMember(char const*)@Base" 0.8.0
- (c++)"debDebFile::MergeControl(pkgDataBase&)@Base" 0.8.0
  (c++)"debDebFile::ControlExtract::DoItem(pkgDirStream::Item&, int&)@Base" 0.8.0
  (c++)"debDebFile::ControlExtract::~ControlExtract()@Base" 0.8.0
  (c++)"debDebFile::ExtractArchive(pkgDirStream&)@Base" 0.8.0
- (c++)"debDebFile::ExtractControl(pkgDataBase&)@Base" 0.8.0
  (c++)"debDebFile::MemControlExtract::TakeControl(void const*, unsigned long)@Base" 0.8.0
  (c++)"debDebFile::MemControlExtract::Read(debDebFile&)@Base" 0.8.0
  (c++)"debDebFile::MemControlExtract::DoItem(pkgDirStream::Item&, int&)@Base" 0.8.0
@@ -39,16 +37,11 @@ libapt-inst.so.1.4 libapt-inst1.4 #MINVER#
  (c++)"pkgFLCache::HashNode(pkgFLCache::NodeIterator const&)@Base" 0.8.0
  (c++)"pkgFLCache::PrintTree(unsigned int, unsigned long)@Base" 0.8.0
  (c++)"pkgFLCache::pkgFLCache(DynamicMMap&)@Base" 0.8.0
- (c++)"pkgDataBase::GetMetaTmp(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)@Base" 0.8.0
- (c++)"pkgDataBase::~pkgDataBase()@Base" 0.8.0
  (c++)"pkgDirStream::FinishedFile(pkgDirStream::Item&, int)@Base" 0.8.0
  (c++)"pkgDirStream::Fail(pkgDirStream::Item&, int)@Base" 0.8.0
  (c++)"pkgDirStream::DoItem(pkgDirStream::Item&, int&)@Base" 0.8.0
  (c++)"pkgDirStream::Process(pkgDirStream::Item&, unsigned char const*, unsigned long, unsigned long)@Base" 0.8.0
  (c++)"pkgDirStream::~pkgDirStream()@Base" 0.8.0
- (c++|optional)"debListParser::~debListParser()@Base" 0.8.0
- (c++|optional)"pkgCacheGenerator::ListParser::CollectFileProvides(pkgCache&, pkgCache::VerIterator&)@Base" 0.8.0
- (c++|optional)"pkgCacheGenerator::ListParser::~ListParser()@Base" 0.8.0
  (c++|optional)"pkgCache::DepIterator::operator++(int)@Base" 0.8.0
  (c++|optional)"pkgCache::DepIterator::operator++()@Base" 0.8.0
  (c++|optional)"pkgCache::VerIterator::operator++(int)@Base" 0.8.0
@@ -56,15 +49,6 @@ libapt-inst.so.1.4 libapt-inst1.4 #MINVER#
  (c++)"ARArchive::LoadHeaders()@Base" 0.8.0
  (c++)"ARArchive::ARArchive(FileFd&)@Base" 0.8.0
  (c++)"ARArchive::~ARArchive()@Base" 0.8.0
- (c++)"debDpkgDB::InitMetaTmp(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)@Base" 0.8.0
- (c++)"debDpkgDB::LoadChanges()@Base" 0.8.0
- (c++)"debDpkgDB::ReadConfFiles()@Base" 0.8.0
- (c++)"debDpkgDB::ReadyFileList(OpProgress&)@Base" 0.8.0
- (c++)"debDpkgDB::ReadyPkgCache(OpProgress&)@Base" 0.8.0
- (c++)"debDpkgDB::ReadDiversions()@Base" 0.8.0
- (c++)"debDpkgDB::ReadFList(OpProgress&)@Base" 0.8.0
- (c++)"debDpkgDB::debDpkgDB()@Base" 0.8.0
- (c++)"debDpkgDB::~debDpkgDB()@Base" 0.8.0
  (c++)"pkgFLCache::NodeIterator::RealPackage() const@Base" 0.8.0
  (c++)"pkgFLCache::Header::CheckSizes(pkgFLCache::Header&) const@Base" 0.8.0
  (c++|optional)"pkgCache::DepIterator::OwnerPointer() const@Base" 0.8.0
@@ -72,42 +56,30 @@ libapt-inst.so.1.4 libapt-inst1.4 #MINVER#
  (c++)"ARArchive::FindMember(char const*) const@Base" 0.8.0
  (c++)"typeinfo for ExtractTar@Base" 0.8.0
  (c++)"typeinfo for pkgExtract@Base" 0.8.0
- (c++)"typeinfo for pkgDataBase@Base" 0.8.0
  (c++)"typeinfo for pkgDirStream@Base" 0.8.0
- (c++)"typeinfo for debDpkgDB@Base" 0.8.0
  (c++)"typeinfo for debDebFile::ControlExtract@Base" 0.8.0
  (c++)"typeinfo for debDebFile::MemControlExtract@Base" 0.8.0
- (c++|optional)"typeinfo for pkgCacheGenerator::ListParser@Base" 0.8.0
  (c++|optional)"typeinfo for pkgCache::DepIterator@Base" 0.8.0
  (c++|optional)"typeinfo for pkgCache::VerIterator@Base" 0.8.0
  (c++|optional)"typeinfo for pkgCache::Iterator<pkgCache::Dependency, pkgCache::DepIterator>@Base" 0.8.0
- (c++|optional)"typeinfo for pkgCache::Iterator<pkgCache::Package, pkgCache::PkgIterator>@Base" 0.8.0
  (c++|optional)"typeinfo for pkgCache::Iterator<pkgCache::Version, pkgCache::VerIterator>@Base" 0.8.0
  (c++)"typeinfo name for ExtractTar@Base" 0.8.0
  (c++)"typeinfo name for pkgExtract@Base" 0.8.0
- (c++)"typeinfo name for pkgDataBase@Base" 0.8.0
  (c++)"typeinfo name for pkgDirStream@Base" 0.8.0
- (c++)"typeinfo name for debDpkgDB@Base" 0.8.0
  (c++)"typeinfo name for debDebFile::ControlExtract@Base" 0.8.0
  (c++)"typeinfo name for debDebFile::MemControlExtract@Base" 0.8.0
- (c++|optional)"typeinfo name for pkgCacheGenerator::ListParser@Base" 0.8.0
  (c++|optional)"typeinfo name for pkgCache::DepIterator@Base" 0.8.0
  (c++|optional)"typeinfo name for pkgCache::VerIterator@Base" 0.8.0
  (c++|optional)"typeinfo name for pkgCache::Iterator<pkgCache::Dependency, pkgCache::DepIterator>@Base" 0.8.0
- (c++|optional)"typeinfo name for pkgCache::Iterator<pkgCache::Package, pkgCache::PkgIterator>@Base" 0.8.0
  (c++|optional)"typeinfo name for pkgCache::Iterator<pkgCache::Version, pkgCache::VerIterator>@Base" 0.8.0
  (c++)"vtable for ExtractTar@Base" 0.8.0
  (c++)"vtable for pkgExtract@Base" 0.8.0
- (c++)"vtable for pkgDataBase@Base" 0.8.0
  (c++)"vtable for pkgDirStream@Base" 0.8.0
- (c++)"vtable for debDpkgDB@Base" 0.8.0
  (c++)"vtable for debDebFile::ControlExtract@Base" 0.8.0
  (c++)"vtable for debDebFile::MemControlExtract@Base" 0.8.0
- (c++|optional)"vtable for pkgCacheGenerator::ListParser@Base" 0.8.0
  (c++|optional)"vtable for pkgCache::DepIterator@Base" 0.8.0
  (c++|optional)"vtable for pkgCache::VerIterator@Base" 0.8.0
  (c++|optional)"vtable for pkgCache::Iterator<pkgCache::Dependency, pkgCache::DepIterator>@Base" 0.8.0
- (c++|optional)"vtable for pkgCache::Iterator<pkgCache::Package, pkgCache::PkgIterator>@Base" 0.8.0
  (c++|optional)"vtable for pkgCache::Iterator<pkgCache::Version, pkgCache::VerIterator>@Base" 0.8.0
 ### gcc-4.4 specific
 # (c++|regex|optional=std)"^char\* std::[^ ]+<.+ >::_.+@Base$" 0.8.0

File diff suppressed because it is too large
+ 134 - 49
debian/libapt-pkg4.12.symbols


+ 16 - 23
debian/rules

@@ -34,9 +34,6 @@ build:
 
 PKG=apt
 DEB_BUILD_PROG:=debuild --preserve-envvar PATH --preserve-envvar CCACHE_DIR -us -uc $(DEB_BUILD_PROG_OPTS)
-APT_DEBVER=$(shell dpkg-parsechangelog |sed -n -e '/^Version:/s/^Version: //p' | sed -e 's/\+.*$$//')
-APT_CONFVER=$(shell sed -n -e 's/^AC_DEFINE_UNQUOTED(VERSION,"\(.*\)")/\1/p' configure.in)
-APT_CVSTAG=$(shell echo "$(APT_DEBVER)" | sed -e 's/^/v/' -e 's/\./_/g')
 
 # Determine the build directory to use
 BASE=.
@@ -53,19 +50,8 @@ ifeq ($(words $(BLD)),0)
 override BLD := ./build
 endif
 
-# Rebuild configure.in to have the correct version from the change log
-ifneq ($(APT_DEBVER),$(APT_CONFVER))
-ifneq ($(APT_DEBVER),)
-.PHONY: configure.in
-configure.in:
-	sed -e 's/$(APT_CONFVER)/$(APT_DEBVER)/' $@ > $@.$$$$ && mv $@.$$$$ $@
-endif
-else
-configure.in:
-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
@@ -81,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
@@ -111,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) debiandoc
+	touch $@
+
+build/build-manpages-stamp: build/configure-stamp
 	# Add here commands to compile the package.
-	$(MAKE) doc
+	$(MAKE) manpages
 	touch $@
 
 clean:
@@ -129,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$@
@@ -155,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$@
@@ -181,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$@
@@ -199,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
@@ -245,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$@
@@ -253,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$@

+ 1 - 1
doc/Doxyfile.in

@@ -31,7 +31,7 @@ PROJECT_NAME           = @PACKAGE@
 # This could be handy for archiving the generated documentation or
 # if some version control system is used.
 
-PROJECT_NUMBER         = @VERSION@
+PROJECT_NUMBER         = @PACKAGE_VERSION@
 
 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
 # base path where the generated documentation will be put.

+ 35 - 64
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>
@@ -33,34 +33,8 @@
     <refpurpose>query the APT cache</refpurpose>
  </refnamediv>
 
- <!-- Arguments -->
- <refsynopsisdiv>
-   <cmdsynopsis>
-      <command>apt-cache</command>
-      <arg><option>-hvsn</option></arg>
-      <arg><option>-o=<replaceable>config string</replaceable></option></arg>
-      <arg><option>-c=<replaceable>file</replaceable></option></arg>
-      <group choice="req">
-         <arg>gencaches</arg>
-         <arg>showpkg <arg choice="plain" rep="repeat"><replaceable>pkg</replaceable></arg></arg>
-         <arg>showsrc <arg choice="plain" rep="repeat"><replaceable>pkg</replaceable></arg></arg>
-         <arg>stats</arg>
-         <arg>dump</arg>
-         <arg>dumpavail</arg>
-         <arg>unmet</arg>
-         <arg>search <arg choice="plain"><replaceable>regex</replaceable></arg></arg>
-         <arg>show <arg choice="plain" rep="repeat"><replaceable>pkg</replaceable></arg></arg>
-         <arg>depends <arg choice="plain" rep="repeat"><replaceable>pkg</replaceable></arg></arg>
-         <arg>rdepends <arg choice="plain" rep="repeat"><replaceable>pkg</replaceable></arg></arg>
-         <arg>pkgnames <arg choice="plain"><replaceable>prefix</replaceable></arg></arg>
-         <arg>dotty <arg choice="plain" rep="repeat"><replaceable>pkg</replaceable></arg></arg>
-         <arg>xvcg <arg choice="plain" rep="repeat"><replaceable>pkg</replaceable></arg></arg>
-         <arg>policy <arg choice="plain" rep="repeat"><replaceable>pkgs</replaceable></arg></arg>
-         <arg>madison <arg choice="plain" rep="repeat"><replaceable>pkgs</replaceable></arg></arg>
-      </group>   
-   </cmdsynopsis>
- </refsynopsisdiv>
- 
+ &synopsis-command-apt-cache;
+
  <refsect1><title>Description</title>
    <para><command>apt-cache</command> performs a variety of operations on APT's package 
    cache. <command>apt-cache</command> does not manipulate the state of the system 
@@ -71,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 
@@ -112,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 
@@ -128,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>
@@ -155,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>
 
@@ -167,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
@@ -212,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 
@@ -233,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>
@@ -244,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
@@ -301,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>
@@ -329,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>

+ 18 - 32
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,26 +29,13 @@
  <!-- Man page title -->
  <refnamediv>
     <refname>apt-cdrom</refname>
-    <refpurpose>APT CDROM management utility</refpurpose>
+    <refpurpose>APT CD-ROM management utility</refpurpose>
  </refnamediv>
 
- <!-- Arguments -->
- <refsynopsisdiv>
-   <cmdsynopsis>
-      <command>apt-cdrom</command>
-      <arg><option>-hvrmfan</option></arg>
-      <arg><option>-d=<replaceable>cdrom mount point</replaceable></option></arg>
-      <arg><option>-o=<replaceable>config string</replaceable></option></arg>
-      <arg><option>-c=<replaceable>file</replaceable></option></arg>
-      <group>
-         <arg>add</arg>
-         <arg>ident</arg>
-      </group>   
-   </cmdsynopsis>
- </refsynopsisdiv>
+ &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 
@@ -56,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>
@@ -96,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>.
@@ -105,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>

+ 30 - 27
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>
@@ -33,38 +33,26 @@
     <refpurpose>APT Configuration Query program</refpurpose>
  </refnamediv>
 
- <!-- Arguments -->
- <refsynopsisdiv>
-   <cmdsynopsis>
-      <command>apt-config</command>
-      <arg><option>-hv</option></arg>
-      <arg><option>-o=<replaceable>config string</replaceable></option></arg>
-      <arg><option>-c=<replaceable>file</replaceable></option></arg>
-      <group choice="req">
-         <arg>shell</arg>
-         <arg>dump</arg>
-      </group>   
-   </cmdsynopsis>
- </refsynopsisdiv>
- 
+ &synopsis-command-apt-config;
+
  <refsect1><title>Description</title>
    <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>
@@ -84,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>
@@ -97,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>

+ 10 - 17
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,19 +30,11 @@
  <!-- 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>
 
- <!-- Arguments -->
- <refsynopsisdiv>
-   <cmdsynopsis>
-      <command>apt-extracttemplates</command>
-      <arg><option>-hv</option></arg>
-      <arg><option>-t=<replaceable>temporary directory</replaceable></option></arg>
-      <arg choice="plain" rep="repeat"><replaceable>file</replaceable></arg>
-   </cmdsynopsis>
- </refsynopsisdiv>
- 
+ &synopsis-command-apt-extracttemplates;
+
  <refsect1><title>Description</title>
    <para><command>apt-extracttemplates</command> will take one or more Debian package files
    as input and write out (to a temporary directory) all associated config
@@ -51,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>
  
@@ -62,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>

+ 81 - 102
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>
@@ -33,29 +33,8 @@
     <refpurpose>Utility to generate index files</refpurpose>
  </refnamediv>
 
- <!-- Arguments -->
- <refsynopsisdiv>
-   <cmdsynopsis>
-      <command>apt-ftparchive</command>
-      <arg><option>-hvdsq</option></arg>
-      <arg><option>--md5</option></arg>
-      <arg><option>--delink</option></arg>
-      <arg><option>--readonly</option></arg>
-      <arg><option>--contents</option></arg>
-      <arg><option>--arch <replaceable>architecture</replaceable></option></arg>
-      <arg><option>-o <replaceable>config</replaceable>=<replaceable>string</replaceable></option></arg>
-      <arg><option>-c=<replaceable>file</replaceable></option></arg>      
-      <group choice="req">
-         <arg>packages<arg choice="plain" rep="repeat"><replaceable>path</replaceable></arg><arg><replaceable>override</replaceable><arg><replaceable>pathprefix</replaceable></arg></arg></arg>
-         <arg>sources<arg choice="plain" rep="repeat"><replaceable>path</replaceable></arg><arg><replaceable>override</replaceable><arg><replaceable>pathprefix</replaceable></arg></arg></arg>
-         <arg>contents <arg choice="plain"><replaceable>path</replaceable></arg></arg>
-         <arg>release <arg choice="plain"><replaceable>path</replaceable></arg></arg>
-         <arg>generate <arg choice="plain"><replaceable>config-file</replaceable></arg> <arg choice="plain" rep="repeat"><replaceable>section</replaceable></arg></arg>
-         <arg>clean <arg choice="plain"><replaceable>config-file</replaceable></arg></arg>
-      </group>
-   </cmdsynopsis>
- </refsynopsisdiv>
- 
+ &synopsis-command-apt-ftparchive;
+
  <refsect1><title>Description</title>
    <para><command>apt-ftparchive</command> is the command line tool that generates the index 
    files that APT uses to access a distribution source. The index files should 
@@ -72,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, 
@@ -86,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,
@@ -98,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, 
@@ -110,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
@@ -133,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
@@ -142,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>
@@ -160,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>
@@ -194,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 
@@ -285,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 
@@ -360,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 
@@ -373,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:
@@ -384,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 
@@ -436,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>
@@ -493,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:
@@ -511,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>   
 
@@ -526,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.

+ 76 - 170
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>
@@ -33,91 +33,8 @@
     <refpurpose>APT package handling utility -- command-line interface</refpurpose>
  </refnamediv>
 
- <!-- Arguments -->
- <refsynopsisdiv>
-   <cmdsynopsis>
-      <command>apt-get</command>
-      <arg><option>-sqdyfmubV</option></arg>
-      <arg>
-	      <option>-o=
-			  <replaceable>config_string</replaceable>
-	      </option>
-      </arg>
-      <arg>
-	      <option>-c=
-		      <replaceable>config_file</replaceable>
-	      </option>
-      </arg>
-      <arg>
-		<option>-t=</option>
-		<arg choice='plain'>
-			<replaceable>target_release</replaceable>
-		</arg>
-      </arg>
-      <arg>
-		<option>-a=</option>
-		<arg choice='plain'>
-			<replaceable>default_architecture</replaceable>
-		</arg>
-      </arg>
-
-
-      <group choice="req">
-         <arg choice='plain'>update</arg>
-         <arg choice='plain'>upgrade</arg>
-         <arg choice='plain'>dselect-upgrade</arg>
-         <arg choice='plain'>dist-upgrade</arg>
-         <arg choice='plain'>install 
-			 <arg choice="plain" rep="repeat"><replaceable>pkg</replaceable>
-				<arg>
-					<group choice='req'>
-						<arg choice='plain'>
-							=<replaceable>pkg_version_number</replaceable>
-						</arg>
-						<arg choice='plain'>
-							/<replaceable>target_release</replaceable>
-						</arg>
-					</group>
-				</arg>
-			 </arg>
-	     </arg>
-         <arg choice='plain'>remove <arg choice="plain" rep="repeat"><replaceable>pkg</replaceable></arg></arg>
-         <arg choice='plain'>purge <arg choice="plain" rep="repeat"><replaceable>pkg</replaceable></arg></arg>
-         <arg choice='plain'>source 
-			 <arg choice="plain" rep="repeat"><replaceable>pkg</replaceable>
-				<arg>
-					<group choice='req'>
-						<arg choice='plain'>
-							=<replaceable>pkg_version_number</replaceable>
-						</arg>
-						<arg choice='plain'>
-							/<replaceable>target_release</replaceable>
-						</arg>
-					</group>
-				</arg>
-			 </arg>
-	     </arg>
-         <arg choice='plain'>build-dep <arg choice="plain" rep="repeat"><replaceable>pkg</replaceable></arg></arg>
-         <arg choice='plain'>check</arg>
-         <arg choice='plain'>clean</arg>
-         <arg choice='plain'>autoclean</arg>
-         <arg choice='plain'>autoremove</arg>
-		 <arg choice='plain'>
-			 <group choice='req'>
-				<arg choice='plain'>-v</arg>
-				<arg choice='plain'>--version</arg>
-			 </group>
-		 </arg>
-		 <arg choice='plain'>
-			 <group choice='req'>
-				<arg choice='plain'>-h</arg>
-				<arg choice='plain'>--help</arg>
-			 </group>
-		 </arg>
-      </group>   
-   </cmdsynopsis>
- </refsynopsisdiv>
- 
+ &synopsis-command-apt-get;
+
  <refsect1><title>Description</title>
    <para><command>apt-get</command> is the command-line tool for handling packages, and may be 
    considered the user's "back-end" to other tools using the APT
@@ -128,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>.
@@ -140,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 
@@ -153,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 
@@ -230,34 +147,33 @@
      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 
-     newest available version of that source package while respect the
+     newest available version of that source package while respecting the
      default release, set with the option <literal>APT::Default-Release</literal>,
      the <option>-t</option> option or per package with the
      <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
@@ -271,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 
@@ -305,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 
@@ -315,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
@@ -374,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 
@@ -395,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>
 
@@ -411,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>
@@ -439,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>
@@ -466,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! 
@@ -497,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
@@ -514,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
@@ -546,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>
@@ -559,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>
@@ -617,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>

+ 31 - 32
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>
@@ -25,15 +32,7 @@
     <refpurpose>APT key management utility</refpurpose>
  </refnamediv>
 
- <!-- Arguments -->
- <refsynopsisdiv>
-   <cmdsynopsis>
-      <command>apt-key</command>
-      <arg><option>--keyring <replaceable>filename</replaceable></option></arg>
-      <arg><replaceable>command</replaceable></arg>
-      <arg rep="repeat"><option><replaceable>arguments</replaceable></option></arg>
-   </cmdsynopsis>
- </refsynopsisdiv>
+ &synopsis-command-apt-key;
 
  <refsect1><title>Description</title>
    <para>
@@ -45,19 +44,19 @@
 
 <refsect1><title>Commands</title>
    <variablelist>
-     <varlistentry><term>add <replaceable>filename</replaceable></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 <replaceable>filename</replaceable>, or standard input if
-       <replaceable>filename</replaceable> 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 <replaceable>keyid</replaceable></term>
+     <varlistentry><term><option>del</option> <option>&synopsis-param-keyid;</option></term>
      <listitem>
      <para>
 
@@ -68,18 +67,18 @@
      </listitem>
      </varlistentry>
 
-     <varlistentry><term>export <replaceable>keyid</replaceable></term>
+     <varlistentry><term><option>export</option> <option>&synopsis-param-keyid;</option></term>
      <listitem>
      <para>
 
-        Output the key <replaceable>keyid</replaceable> to standard output.
+        Output the key &synopsis-param-keyid; to standard output.
 
      </para>
 
      </listitem>
      </varlistentry>
 
-     <varlistentry><term>exportall</term>
+     <varlistentry><term><option>exportall</option></term>
      <listitem>
      <para>
 
@@ -90,7 +89,7 @@
      </listitem>
      </varlistentry>
 
-     <varlistentry><term>list</term>
+     <varlistentry><term><option>list</option></term>
      <listitem>
      <para>
 
@@ -101,7 +100,7 @@
      </listitem>
      </varlistentry>
      
-	 <varlistentry><term>finger</term>
+     <varlistentry><term><option>finger</option></term>
      <listitem>
      <para>
 
@@ -112,7 +111,7 @@
      </listitem>
      </varlistentry>
      
-	 <varlistentry><term>adv</term>
+     <varlistentry><term><option>adv</option></term>
      <listitem>
      <para>
 
@@ -124,7 +123,7 @@
      </listitem>
      </varlistentry>
 
-     <varlistentry><term>update</term>
+     <varlistentry><term><option>update</option></term>
      <listitem>
      <para>
 
@@ -138,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>
@@ -161,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 <replaceable>filename</replaceable></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>

+ 20 - 39
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>
@@ -33,26 +33,8 @@
     <refpurpose>mark/unmark a package as being automatically-installed</refpurpose>
  </refnamediv>
 
- <!-- Arguments -->
- <refsynopsisdiv>
-   <cmdsynopsis>
-	<command>apt-mark</command>
-	<arg><option>-hv</option></arg>
-	<arg><option>-f=<replaceable>FILENAME</replaceable></option></arg>
-	<group choice="plain">
-		<arg choice="plain">
-			<group choice="req">
-				<arg choice="plain">auto</arg>
-				<arg choice="plain">manual</arg>
-				<arg choice="plain">showauto</arg>
-				<arg choice="plain">showmanual</arg>
-			</group>
-			<arg choice="plain" rep="repeat"><replaceable>package</replaceable></arg>
-		</arg>
-	</group>
-   </cmdsynopsis>
- </refsynopsisdiv>
- 
+ &synopsis-command-apt-mark;
+
  <refsect1><title>Description</title>
    <para><command>apt-mark</command> will change whether a package has
    been marked as being automatically installed.
@@ -66,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
@@ -74,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
@@ -82,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.
@@ -106,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>
@@ -127,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>
@@ -148,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"

+ 8 - 17
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>
@@ -33,25 +33,16 @@
     <refpurpose>Utility to sort package index files</refpurpose>
  </refnamediv>
 
- <!-- Arguments -->
- <refsynopsisdiv>
-   <cmdsynopsis>
-      <command>apt-sortpkgs</command>
-      <arg><option>-hvs</option></arg>
-      <arg><option>-o=<replaceable>config string</replaceable></option></arg>
-      <arg><option>-c=<replaceable>file</replaceable></option></arg>
-      <arg choice="plain" rep="repeat"><replaceable>file</replaceable></arg>
-   </cmdsynopsis>
- </refsynopsisdiv>
- 
+ &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>
@@ -60,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>
    

+ 196 - 4
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,10 +208,179 @@
 ">
 
 <!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.7">
+
 <!-- Codenames for debian releases -->
-<!ENTITY oldstable-codename "lenny">
-<!ENTITY stable-codename "squeeze">
-<!ENTITY testing-codename "wheezy">
+<!ENTITY oldstable-codename "squeeze">
+<!ENTITY stable-codename "wheezy">
+<!ENTITY testing-codename "jessie">
+<!ENTITY stable-version "7.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>">
+<!ENTITY synopsis-arg-config "<arg><option>-c=<filename><replaceable>&synopsis-config-file;</replaceable></filename></option></arg>">
+<!ENTITY synopsis-arg-target-release "<arg><option>-t=<replaceable>&synopsis-target-release;</replaceable></option></arg>">
+<!ENTITY synopsis-arg-architecture "<arg><option>-a=<replaceable>&synopsis-architecture;</replaceable></option></arg>">
+<!ENTITY synopsis-arg-pkgver "<arg choice='plain' rep='repeat'><replaceable>&synopsis-pkg;</replaceable><arg><group choice='req'>
+	<arg choice='plain'>=<replaceable>&synopsis-pkg-ver-number;</replaceable></arg>
+	<arg choice='plain'>/<replaceable>&synopsis-target-release;</replaceable></arg>
+</group></arg></arg>">
+<!ENTITY synopsis-arg-pkg "<arg choice='plain' rep='repeat'><replaceable>&synopsis-pkg;</replaceable></arg>">
+<!ENTITY synopsis-param-filename "<filename><replaceable>&synopsis-filename;</replaceable></filename>">
+<!ENTITY synopsis-help "<arg choice='plain'><group choice='req'><arg choice='plain'>-v</arg><arg choice='plain'>--version</arg></group></arg>
+	<arg choice='plain'><group choice='req'><arg choice='plain'>-h</arg><arg choice='plain'>--help</arg></group></arg>">
+<!ENTITY synopsis-command-apt-get "<refsynopsisdiv><cmdsynopsis>
+	<command>apt-get</command>
+	<arg><option>-asqdyfmubV</option></arg>
+	&synopsis-arg-option;
+	&synopsis-arg-config;
+	&synopsis-arg-target-release;
+	&synopsis-arg-architecture;
+	<group choice='req'>
+		<arg choice='plain'>update</arg>
+		<arg choice='plain'>upgrade</arg>
+		<arg choice='plain'>dselect-upgrade</arg>
+		<arg choice='plain'>dist-upgrade</arg>
+		<arg choice='plain'>install &synopsis-arg-pkgver;</arg>
+		<arg choice='plain'>remove &synopsis-arg-pkg;</arg>
+		<arg choice='plain'>purge &synopsis-arg-pkg;</arg>
+		<arg choice='plain'>source &synopsis-arg-pkgver;</arg>
+		<arg choice='plain'>build-dep &synopsis-arg-pkgver;</arg>
+		<arg choice='plain'>download &synopsis-arg-pkgver;</arg>
+		<arg choice='plain'>check</arg>
+		<arg choice='plain'>clean</arg>
+		<arg choice='plain'>autoclean</arg>
+		<arg choice='plain'>autoremove</arg>
+		&synopsis-help;
+	</group>
+</cmdsynopsis></refsynopsisdiv>">
+<!ENTITY synopsis-command-apt-cache "<refsynopsisdiv><cmdsynopsis>
+	<command>apt-cache</command>
+	<arg><option>-agipns</option></arg>
+	&synopsis-arg-option;
+	&synopsis-arg-config;
+	<group choice='req'>
+		<arg choice='plain'>gencaches</arg>
+		<arg choice='plain'>showpkg &synopsis-arg-pkg;</arg>
+		<arg choice='plain'>showsrc &synopsis-arg-pkg;</arg>
+		<arg choice='plain'>stats</arg>
+		<arg choice='plain'>dump</arg>
+		<arg choice='plain'>dumpavail</arg>
+		<arg choice='plain'>unmet</arg>
+		<arg choice='plain'>search <arg choice='plain' rep='repeat'><replaceable>&synopsis-regex;</replaceable></arg></arg>
+		<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><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 <arg rep='repeat'><replaceable>&synopsis-pkg;</replaceable></arg></arg>
+		<arg choice='plain'>madison &synopsis-arg-pkg;</arg>
+		&synopsis-help;
+	</group>
+</cmdsynopsis></refsynopsisdiv>">
+<!ENTITY synopsis-command-apt-cdrom "<refsynopsisdiv><cmdsynopsis>
+	<command>apt-cdrom</command>
+	<arg><option>-rmfan</option></arg>
+	<arg><option>-d=<replaceable>&synopsis-cdrom-mount;</replaceable></option></arg>
+	&synopsis-arg-option;
+	&synopsis-arg-config;
+	<group choice='req'>
+		<arg choice='plain'>add</arg>
+		<arg choice='plain'>ident</arg>
+		&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'>
+		<arg choice='plain'>shell</arg>
+		<arg choice='plain'>dump</arg>
+		&synopsis-help;
+	</group>
+</cmdsynopsis></refsynopsisdiv>">
+<!ENTITY synopsis-command-apt-extracttemplates "<refsynopsisdiv><cmdsynopsis>
+	<command>apt-extracttemplates</command>
+	<arg><option>-t=<replaceable>&synopsis-tmp-directory;</replaceable></option></arg>
+	<arg choice='plain' rep='repeat'>&synopsis-param-filename;</arg>
+	&synopsis-help;
+</cmdsynopsis></refsynopsisdiv>">
+<!ENTITY synopsis-arg-ftparchive "<arg choice='plain' rep='repeat'><replaceable>&synopsis-path;</replaceable></arg><arg><filename><replaceable>&synopsis-override;</replaceable></filename><arg><replaceable>&synopsis-pathprefix;</replaceable></arg></arg>">
+<!ENTITY synopsis-command-apt-ftparchive "<refsynopsisdiv><cmdsynopsis>
+	<command>apt-ftparchive</command>
+	<arg><option>-dsq</option></arg>
+	<arg><option>--md5</option></arg>
+	<arg><option>--delink</option></arg>
+	<arg><option>--readonly</option></arg>
+	<arg><option>--contents</option></arg>
+	<arg><option>--arch <replaceable>architecture</replaceable></option></arg>
+	&synopsis-arg-option;
+	&synopsis-arg-config;
+	<group choice='req'>
+		<arg choice='plain'>packages &synopsis-arg-ftparchive;</arg>
+		<arg choice='plain'>sources &synopsis-arg-ftparchive;</arg>
+		<arg choice='plain'>contents <arg choice='plain'><replaceable>&synopsis-path;</replaceable></arg></arg>
+		<arg choice='plain'>release <arg choice='plain'><replaceable>&synopsis-path;</replaceable></arg></arg>
+		<arg choice='plain'>generate <arg choice='plain'><replaceable>&synopsis-config-file;</replaceable></arg> <arg choice='plain' rep='repeat'><replaceable>&synopsis-section;</replaceable></arg></arg>
+		<arg choice='plain'>clean <arg choice='plain'><replaceable>&synopsis-config-file;</replaceable></arg></arg>
+		&synopsis-help;
+	</group>
+</cmdsynopsis></refsynopsisdiv>">
+<!ENTITY synopsis-param-keyid "<replaceable>&synopsis-keyid;</replaceable>">
+<!ENTITY synopsis-command-apt-key "<refsynopsisdiv><cmdsynopsis>
+	<command>apt-key</command>
+	<arg><option>--keyring &synopsis-param-filename;</option></arg>
+	<group choice='req'>
+		<arg choice='plain'>add &synopsis-param-filename;</arg>
+		<arg choice='plain'>del &synopsis-param-keyid;</arg>
+		<arg choice='plain'>export &synopsis-param-keyid;</arg>
+		<arg choice='plain'>exportall</arg>
+		<arg choice='plain'>list</arg>
+		<arg choice='plain'>finger</arg>
+		<arg choice='plain'>adv</arg>
+		<arg choice='plain'>update</arg>
+		<arg choice='plain'>net-update</arg>
+		&synopsis-help;
+	</group>
+</cmdsynopsis></refsynopsisdiv>">
+<!ENTITY synopsis-command-apt-mark "<refsynopsisdiv><cmdsynopsis>
+	<command>apt-mark</command>
+	<arg><option>-f=&synopsis-param-filename;</option></arg>
+	<group choice='plain'>
+		<arg choice='plain'>
+			<group choice='req'>
+				<arg choice='plain'>auto</arg>
+				<arg choice='plain'>manual</arg>
+				<arg choice='plain'>showauto</arg>
+				<arg choice='plain'>showmanual</arg>
+			</group>
+			&synopsis-arg-pkg;
+		</arg>
+		&synopsis-help;
+	</group>
+</cmdsynopsis></refsynopsisdiv>">
+<!ENTITY synopsis-command-apt-sortpkgs "<refsynopsisdiv><cmdsynopsis>
+	<command>apt-sortpkgs</command>
+	<arg><option>-s</option></arg>
+	&synopsis-arg-option;
+	&synopsis-arg-config;
+	<arg choice='plain' rep='repeat'>&synopsis-param-filename;</arg>
+	&synopsis-help;
+</cmdsynopsis></refsynopsisdiv>">

+ 0 - 0
doc/apt.8


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