Просмотр исходного кода

merged from donkults experimental branch

Michael Vogt лет назад: 14
Родитель
Сommit
c3753d1de2
91 измененных файлов с 1792 добавлено и 2316 удалено
  1. 4 0
      .bzr-builddeb/default.conf
  2. 4 2
      Makefile
  3. 0 35
      apt-inst/database.cc
  4. 0 60
      apt-inst/database.h
  5. 0 63
      apt-inst/deb/debfile.cc
  6. 1 9
      apt-inst/deb/debfile.h
  7. 0 494
      apt-inst/deb/dpkgdb.cc
  8. 0 55
      apt-inst/deb/dpkgdb.h
  9. 3 4
      apt-inst/makefile
  10. 5 10
      apt-pkg/acquire-worker.cc
  11. 3 1
      apt-pkg/acquire.cc
  12. 35 6
      apt-pkg/aptconfiguration.cc
  13. 4 2
      apt-pkg/cdrom.cc
  14. 7 4
      apt-pkg/clean.cc
  15. 133 29
      apt-pkg/contrib/fileutl.cc
  16. 1 0
      apt-pkg/contrib/fileutl.h
  17. 1 2
      apt-pkg/contrib/netrc.cc
  18. 9 8
      apt-pkg/deb/dpkgpm.cc
  19. 1 1
      apt-pkg/init.cc
  20. 7 1
      apt-pkg/makefile
  21. 9 3
      buildlib/config.h.in
  22. 1 1
      buildlib/defaults.mak
  23. 3 1
      buildlib/environment.mak.in
  24. 1 1
      buildlib/podomain.mak
  25. 1 1
      cmdline/apt-cache.cc
  26. 1 1
      cmdline/apt-cdrom.cc
  27. 1 1
      cmdline/apt-config.cc
  28. 1 1
      cmdline/apt-dump-solver.cc
  29. 1 1
      cmdline/apt-extracttemplates.cc
  30. 20 20
      cmdline/apt-get.cc
  31. 1 1
      cmdline/apt-internal-solver.cc
  32. 1 1
      cmdline/apt-mark.cc
  33. 1 1
      cmdline/apt-sortpkgs.cc
  34. 19 14
      cmdline/makefile
  35. 17 4
      configure.in
  36. 1 1
      debian/apt-utils.install
  37. 95 10
      debian/changelog
  38. 5 4
      debian/control
  39. 0 28
      debian/libapt-inst1.4.symbols
  40. 135 49
      debian/libapt-pkg4.12.symbols
  41. 0 14
      debian/rules
  42. 1 1
      doc/Doxyfile.in
  43. 2 28
      doc/apt-cache.8.xml
  44. 1 14
      doc/apt-cdrom.8.xml
  45. 2 14
      doc/apt-config.8.xml
  46. 2 10
      doc/apt-extracttemplates.1.xml
  47. 2 23
      doc/apt-ftparchive.1.xml
  48. 3 86
      doc/apt-get.8.xml
  49. 8 16
      doc/apt-key.8.xml
  50. 2 20
      doc/apt-mark.8.xml
  51. 2 11
      doc/apt-sortpkgs.1.xml
  52. 155 0
      doc/apt-verbatim.ent
  53. 43 0
      doc/apt.ent
  54. 4 12
      doc/makefile
  55. 1 1
      doc/po/apt-doc.pot
  56. 1 1
      doc/po/de.po
  57. 1 1
      doc/po/es.po
  58. 3 3
      doc/po/fr.po
  59. 1 1
      doc/po/it.po
  60. 1 1
      doc/po/ja.po
  61. 1 1
      doc/po/pl.po
  62. 1 1
      doc/po/pt.po
  63. 1 1
      doc/po/pt_BR.po
  64. 1 1
      ftparchive/apt-ftparchive.cc
  65. 2 1
      ftparchive/makefile
  66. 0 175
      methods/bzip2.cc
  67. 16 2
      methods/gzip.cc
  68. 1 1
      methods/http.cc
  69. 1 1
      methods/https.cc
  70. 17 23
      methods/makefile
  71. 3 2
      methods/mirror.cc
  72. 20 5
      methods/rred.cc
  73. 312 296
      po/da.po
  74. 2 2
      po/fi.po
  75. 5 5
      po/fr.po
  76. 15 9
      po/makefile
  77. 562 473
      po/pl.po
  78. 37 0
      prepare-release
  79. 2 2
      test/Makefile
  80. 4 2
      test/integration/framework
  81. 8 4
      test/integration/test-bug-595691-empty-and-broken-archive-files
  82. 2 2
      test/integration/test-bug-604222-new-and-autoremove
  83. 1 1
      test/integration/test-bug-613420-new-garbage-dependency
  84. 1 1
      test/integration/test-conflicts-loop
  85. 1 1
      test/integration/test-hashsum-verification
  86. 1 1
      test/integration/test-pdiff-usage
  87. 1 1
      test/integration/test-releasefile-verification
  88. 1 2
      test/interactive-helper/extract-control.cc
  89. 4 8
      test/interactive-helper/makefile
  90. 0 103
      test/interactive-helper/testextract.cc
  91. 2 2
      test/libapt/run-tests

+ 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

+ 4 - 2
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
+startup all headers library clean veryclean binary program doc dirs test update-po:
 	$(MAKE) -C apt-pkg $@
 	$(MAKE) -C apt-inst $@
 	$(MAKE) -C methods $@
@@ -21,6 +21,8 @@ all headers library clean veryclean binary program doc dirs test:
 	$(MAKE) -C po $@
 	$(MAKE) -C test $@
 
+update-po: startup
+
 # Some very common aliases
 .PHONY: maintainer-clean dist-clean distclean pristine sanity 
 maintainer-clean dist-clean distclean pristine sanity: veryclean

+ 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		/*{{{*/
 // ---------------------------------------------------------------------

+ 1 - 9
apt-inst/deb/debfile.h

@@ -29,12 +29,7 @@
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/pkgcache.h>
 
-#ifndef APT_8_CLEANER_HEADERS
-#include <apt-pkg/database.h>
-#endif
-
 class FileFd;
-class pkgDataBase;
 
 class debDebFile
 {
@@ -46,13 +41,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

+ 3 - 4
apt-inst/makefile

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

+ 5 - 10
apt-pkg/acquire-worker.cc

@@ -431,7 +431,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"),
@@ -530,17 +532,10 @@ bool pkgAcquire::Worker::QueueItem(pkgAcquire::Queue::QItem *Item)
 /* */
 bool pkgAcquire::Worker::OutFdReady()
 {
-   int Res;
-   do
-   {
-      Res = write(OutFd,OutQueue.c_str(),OutQueue.length());
-   }
-   while (Res < 0 && errno == EINTR);
-   
-   if (Res <= 0)
+   if (FileFd::Write(OutFd,OutQueue.c_str(),OutQueue.length()) == false)
       return MethodFailure();
    
-   OutQueue.erase(0,Res);
+   OutQueue.clear();
    if (OutQueue.empty() == true)
       OutReady = false;
    

+ 3 - 1
apt-pkg/acquire.cc

@@ -872,7 +872,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;

+ 35 - 6
apt-pkg/aptconfiguration.cc

@@ -432,9 +432,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			/*{{{*/
@@ -456,12 +477,20 @@ const Configuration::getCompressors(bool const Cached) {
 	compressors.push_back(Compressor(".", "", "", "", "", 1));
 	if (_config->Exists("Dir::Bin::gzip") == false || FileExists(_config->FindFile("Dir::Bin::gzip")) == true)
 		compressors.push_back(Compressor("gzip",".gz","gzip","-9n","-d",2));
+#ifdef HAVE_ZLIB
+	else
+		compressors.push_back(Compressor("gzip",".gz","false", "", "", 2));
+#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", "", "", 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 +523,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);

+ 4 - 2
apt-pkg/cdrom.cc

@@ -430,7 +430,8 @@ bool pkgCdrom::WriteDatabase(Configuration &Cnf)
 
    Out.close();
    
-   link(DFile.c_str(),string(DFile + '~').c_str());
+   if (FileExists(DFile) == true && link(DFile.c_str(),string(DFile + '~').c_str()) != 0)
+      return _error->Errno("link", "Failed to link %s to %s~", DFile.c_str(), DFile.c_str());
    if (rename(NewFile.c_str(),DFile.c_str()) != 0)
       return _error->Errno("rename","Failed to rename %s.new to %s",
 			   DFile.c_str(),DFile.c_str());
@@ -697,7 +698,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)
    {

+ 7 - 4
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
@@ -115,8 +117,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;
 }
 									/*}}}*/

+ 133 - 29
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,7 +78,8 @@ 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) {};
 };
 
@@ -835,7 +838,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)
@@ -1016,7 +1018,7 @@ bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::C
    d->compressor = compressor;
    if (compressor.Name == "." || compressor.Binary.empty() == true)
       return true;
-#if APT_USE_ZLIB
+#ifdef HAVE_ZLIB
    else if (compressor.Name == "gzip")
    {
       if ((Mode & ReadWrite) == ReadWrite)
@@ -1024,13 +1026,29 @@ bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::C
       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
+   else if (compressor.Name == "bzip2")
+   {
+      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
+
 
    if ((Mode & ReadWrite) == ReadWrite)
       return _error->Error("ReadWrite mode is not supported for file %s", FileName.c_str());
@@ -1137,9 +1155,14 @@ bool FileFd::Read(void *To,unsigned long long Size,unsigned long long *Actual)
    *((char *)To) = '\0';
    do
    {
-#if APT_USE_ZLIB
+#ifdef HAVE_ZLIB
       if (d->gz != NULL)
-         Res = gzread(d->gz,To,Size);
+	 Res = gzread(d->gz,To,Size);
+      else
+#endif
+#ifdef HAVE_BZ2
+      if (d->bz2 != NULL)
+	 Res = BZ2_bzread(d->bz2,To,Size);
       else
 #endif
          Res = read(iFd,To,Size);
@@ -1149,7 +1172,7 @@ bool FileFd::Read(void *To,unsigned long long Size,unsigned long long *Actual)
 	 if (errno == EINTR)
 	    continue;
 	 Flags |= Fail;
-#if APT_USE_ZLIB
+#ifdef HAVE_ZLIB
 	 if (d->gz != NULL)
 	 {
 	    int err;
@@ -1157,6 +1180,15 @@ bool FileFd::Read(void *To,unsigned long long Size,unsigned long long *Actual)
 	    if (err != Z_ERRNO)
 	       return _error->Error("gzread: %s (%d: %s)", _("Read error"), err, errmsg);
 	 }
+#endif
+#ifdef HAVE_BZ2
+	 if (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"));
       }
@@ -1190,7 +1222,7 @@ 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
+#ifdef HAVE_ZLIB
    if (d->gz != NULL)
       return gzgets(d->gz, To, Size);
 #endif
@@ -1221,10 +1253,15 @@ bool FileFd::Write(const void *From,unsigned long long Size)
    errno = 0;
    do
    {
-#if APT_USE_ZLIB
+#ifdef HAVE_ZLIB
       if (d->gz != NULL)
          Res = gzwrite(d->gz,From,Size);
       else
+#endif
+#ifdef HAVE_BZ2
+      if (d->bz2 != NULL)
+         Res = BZ2_bzwrite(d->bz2,(void*)From,Size);
+      else
 #endif
          Res = write(iFd,From,Size);
       if (Res < 0 && errno == EINTR)
@@ -1232,6 +1269,24 @@ bool FileFd::Write(const void *From,unsigned long long Size)
       if (Res < 0)
       {
 	 Flags |= Fail;
+#ifdef HAVE_ZLIB
+	 if (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->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"));
       }
       
@@ -1246,6 +1301,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 +1330,11 @@ bool FileFd::Write(const void *From,unsigned long long Size)
 /* */
 bool FileFd::Seek(unsigned long long To)
 {
-   if (d->pipe == true)
+   if (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();
@@ -1264,6 +1345,10 @@ bool FileFd::Seek(unsigned long long To)
 
       if ((d->openmode & ReadOnly) != ReadOnly)
 	 return _error->Error("Reopen is only implemented for read-only files!");
+#ifdef HAVE_BZ2
+      if (d->bz2 != NULL)
+	 BZ2_bzclose(d->bz2);
+#endif
       close(iFd);
       iFd = 0;
       if (TemporaryFileName.empty() == false)
@@ -1289,7 +1374,7 @@ bool FileFd::Seek(unsigned long long To)
       return true;
    }
    int res;
-#if APT_USE_ZLIB
+#ifdef HAVE_ZLIB
    if (d->gz)
       res = gzseek(d->gz,To,SEEK_SET);
    else
@@ -1310,7 +1395,11 @@ bool FileFd::Seek(unsigned long long To)
 /* */
 bool FileFd::Skip(unsigned long long Over)
 {
-   if (d->pipe == true)
+   if (d->pipe == true
+#ifdef HAVE_BZ2
+	|| d->bz2 != NULL
+#endif
+	)
    {
       d->seekpos += Over;
       char buffer[1024];
@@ -1325,7 +1414,7 @@ bool FileFd::Skip(unsigned long long Over)
    }
 
    int res;
-#if APT_USE_ZLIB
+#ifdef HAVE_ZLIB
    if (d->gz != NULL)
       res = gzseek(d->gz,Over,SEEK_CUR);
    else
@@ -1346,11 +1435,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->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,11 +1460,15 @@ 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->pipe == true
+#ifdef HAVE_BZ2
+	|| d->bz2 != NULL
+#endif
+	)
       return d->seekpos;
 
    off_t Res;
-#if APT_USE_ZLIB
+#ifdef HAVE_ZLIB
    if (d->gz != NULL)
      Res = gztell(d->gz);
    else
@@ -1416,7 +1511,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->pipe == true
+#ifdef HAVE_BZ2
+	|| (d->bz2 && size > 0)
+#endif
+	)
    {
       unsigned long long const oldSeek = Tell();
       char ignore[1000];
@@ -1427,7 +1526,7 @@ 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
@@ -1500,13 +1599,18 @@ bool FileFd::Close()
    bool Res = true;
    if ((Flags & AutoClose) == AutoClose)
    {
-#if APT_USE_ZLIB
+#ifdef HAVE_ZLIB
       if (d != NULL && d->gz != NULL) {
 	 int const e = gzclose(d->gz);
 	 // gzdclose() on empty files always fails with "buffer error" here, ignore that
 	 if (e != 0 && e != Z_BUF_ERROR)
 	    Res &= _error->Errno("close",_("Problem closing the gzip file %s"), FileName.c_str());
       } else
+#endif
+#ifdef HAVE_BZ2
+      if (d != NULL && d->bz2 != NULL)
+	 BZ2_bzclose(d->bz2);
+      else
 #endif
 	 if (iFd > 0 && close(iFd) != 0)
 	    Res &= _error->Errno("close",_("Problem closing the file %s"), FileName.c_str());

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

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

@@ -68,8 +68,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;

+ 9 - 8
apt-pkg/deb/dpkgpm.cc

@@ -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;
    }
@@ -1055,7 +1055,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
@@ -1236,7 +1237,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();
             

+ 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

+ 9 - 3
buildlib/config.h.in

@@ -19,6 +19,12 @@
 /* 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 +45,10 @@
 /* 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
+
 #define APT_8_CLEANER_HEADERS

+ 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:
 
 veryclean:
 	echo Very Clean done for $(SUBDIR)

+ 3 - 1
buildlib/environment.mak.in

@@ -2,6 +2,7 @@
 # if you want you can edit it, just don't re-run configure.
 
 PACKAGE = @PACKAGE@
+PACKAGE_VERSION = @PACKAGE_VERSION@
 
 # C++ compiler options
 CC = @CC@
@@ -54,7 +55,8 @@ 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

+ 1 - 1
buildlib/podomain.mak

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

+ 1 - 1
cmdline/apt-cache.cc

@@ -1676,7 +1676,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;

+ 1 - 1
cmdline/apt-config.cc

@@ -72,7 +72,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;

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

+ 1 - 1
cmdline/apt-extracttemplates.cc

@@ -224,7 +224,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) 

+ 20 - 20
cmdline/apt-get.cc

@@ -1711,12 +1711,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())
@@ -1733,6 +1734,8 @@ bool DoAutomaticRemove(CacheFile &Cache)
 	 }
 	 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)
@@ -1742,16 +1745,8 @@ bool DoAutomaticRemove(CacheFile &Cache)
 	       Cache->MarkDelete(Pkg, 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";
-	       }
-	    }
 	 }
       }
    }
@@ -1786,14 +1781,7 @@ bool DoAutomaticRemove(CacheFile &Cache)
 		    std::clog << "Save " << Pkg << " as another installed garbage package depends on it" << std::endl;
 		 Cache->MarkInstall(Pkg, 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 +1791,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 +1826,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;
 }
@@ -3295,7 +3295,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)

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

@@ -29,7 +29,7 @@
 // ---------------------------------------------------------------------
 /* */
 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 <<

+ 1 - 1
cmdline/apt-mark.cc

@@ -360,7 +360,7 @@ 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 <<

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

+ 17 - 4
configure.in

@@ -17,11 +17,12 @@ 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.8.16~exp14"
 AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE")
+AC_DEFINE_UNQUOTED(PACKAGE_VERSION,"$PACKAGE_VERSION")
 AC_SUBST(PACKAGE)
+AC_SUBST(PACKAGE_VERSION)
 
 dnl Check the archs, we want the target type.
 AC_CANONICAL_SYSTEM
@@ -87,9 +88,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.
@@ -218,4 +231,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

+ 95 - 10
debian/changelog

@@ -6,16 +6,88 @@ 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
-  * debian/control:
-    - suggest xz-lzma instead of lzma
-  
+
   [ 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
+  * 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:
+    - 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)
 
- -- David Kalnischkies <kalnischkies@gmail.com>  Tue, 13 Mar 2012 12:38:35 +0100
+  [ 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)
+
+ -- David Kalnischkies <kalnischkies@gmail.com>  Wed, 11 Apr 2012 12:09:33 +0200
 
 apt (0.8.16~exp13) experimental; urgency=low
 
@@ -166,6 +238,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:
@@ -414,19 +490,20 @@ 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.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
@@ -438,8 +515,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
 

+ 5 - 4
debian/control

@@ -5,10 +5,10 @@ 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,
+ zlib1g-dev, libbz2-dev, debiandoc-sgml, xsltproc, docbook-xsl, docbook-xml,
  po4a (>= 0.34-2), autotools-dev, autoconf, automake, doxygen
 Build-Conflicts: autoconf2.13, automake1.4
 Vcs-Bzr: http://bzr.debian.org/apt/debian-sid/
@@ -19,7 +19,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, xz-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
@@ -80,7 +80,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 +102,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.

+ 0 - 28
debian/libapt-inst1.4.symbols

@@ -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

Разница между файлами не показана из-за своего большого размера
+ 135 - 49
debian/libapt-pkg4.12.symbols


+ 0 - 14
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,17 +50,6 @@ 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
 

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

+ 2 - 28
doc/apt-cache.8.xml

@@ -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 

+ 1 - 14
doc/apt-cdrom.8.xml

@@ -32,20 +32,7 @@
     <refpurpose>APT CDROM 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

+ 2 - 14
doc/apt-config.8.xml

@@ -33,20 +33,8 @@
     <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

+ 2 - 10
doc/apt-extracttemplates.1.xml

@@ -33,16 +33,8 @@
     <refpurpose>Utility to extract DebConf 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

+ 2 - 23
doc/apt-ftparchive.1.xml

@@ -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 

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

@@ -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
@@ -247,7 +164,7 @@
      <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>

+ 8 - 16
doc/apt-key.8.xml

@@ -25,15 +25,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 +37,19 @@
 
 <refsect1><title>Commands</title>
    <variablelist>
-     <varlistentry><term>add <replaceable>filename</replaceable></term>
+     <varlistentry><term>add &synopsis-param-filename;</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>.
+       from &synopsis-param-filename;, or standard input if
+       &synopsis-param-filename; is <literal>-</literal>.
      </para>
 
      </listitem>
      </varlistentry>
 
-     <varlistentry><term>del <replaceable>keyid</replaceable></term>
+     <varlistentry><term>del &synopsis-param-keyid;</term>
      <listitem>
      <para>
 
@@ -68,11 +60,11 @@
      </listitem>
      </varlistentry>
 
-     <varlistentry><term>export <replaceable>keyid</replaceable></term>
+     <varlistentry><term>export &synopsis-param-keyid;</term>
      <listitem>
      <para>
 
-        Output the key <replaceable>keyid</replaceable> to standard output.
+        Output the key &synopsis-param-keyid; to standard output.
 
      </para>
 
@@ -161,7 +153,7 @@
  <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>
+      <varlistentry><term>--keyring &synopsis-param-filename;</term>
       <listitem><para>With this option it is possible to specify a specific 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

+ 2 - 20
doc/apt-mark.8.xml

@@ -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.

+ 2 - 11
doc/apt-sortpkgs.1.xml

@@ -33,17 +33,8 @@
     <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 
    index) and sort the records so that they are ordered by the package name. 

+ 155 - 0
doc/apt-verbatim.ent

@@ -192,3 +192,158 @@
 <!ENTITY oldstable-codename "lenny">
 <!ENTITY stable-codename "squeeze">
 <!ENTITY testing-codename "wheezy">
+
+
+<!-- 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 choice='plain'><replaceable>&synopsis-prefix;</replaceable></arg></arg>
+		<arg choice='plain'>dotty &synopsis-arg-pkgver;</arg>
+		<arg choice='plain'>xvcg &synopsis-arg-pkgver;</arg>
+		<arg choice='plain'>policy &synopsis-arg-pkg;</arg>
+		<arg choice='plain'>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>">
+<!ENTITY synopsis-command-apt-config "<refsynopsisdiv><cmdsynopsis>
+	<command>apt-config</command>
+	&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>">

+ 43 - 0
doc/apt.ent

@@ -208,3 +208,46 @@
      This is done on purpose, to avoid losing content when the
      translation is lagging behind the original content.
 ">
+
+<!-- TRANSLATOR: used as in -o=config_string  e.g. -o=Debug::pkgProblemResolver=1 -->
+<!ENTITY synopsis-config-string "config_string">
+
+<!-- TRANSLATOR: used as in -c=config_file  e.g. -c=./apt.conf -->
+<!ENTITY synopsis-config-file "config_file">
+
+<!-- TRANSLATOR: used as in -t=target_release or pkg/target_release  e.g. -t=squeeze apt/experimental -->
+<!ENTITY synopsis-target-release "target_release">
+
+<!-- TRANSLATOR: used as in -a=architecture  e.g. -a=armel -->
+<!ENTITY synopsis-architecture "architecture">
+
+<!-- TRANSLATOR: used as in apt-get install pkg  e.g. apt-get install awesome -->
+<!ENTITY synopsis-pkg "pkg">
+
+<!-- TRANSLATOR: used as in pkg=pkg_version_number  e.g. apt=0.8.15 -->
+<!ENTITY synopsis-pkg-ver-number "pkg_version_number">
+
+<!-- TRANSLATOR: used as in apt-cache pkgnames prefix  e.g. apt-cache pkgnames apt -->
+<!ENTITY synopsis-prefix "prefix">
+
+<!-- TRANSLATOR: used as in apt-cache search regex  e.g. apt-cache search awesome -->
+<!ENTITY synopsis-regex "regex">
+
+<!-- TRANSLATOR: used as in apt-cdrom -d=cdrom_mount_point  e.g. apt-cdrom -d=/media/cdrom -->
+<!ENTITY synopsis-cdrom-mount "cdrom_mount_point">
+
+<!-- TRANSLATOR: used as in apt-extracttemplates -t=temporary_directory  e.g. apt-extracttemplates -t=/tmp -->
+<!ENTITY synopsis-tmp-directory "temporary_directory">
+
+<!-- TRANSLATOR: used as in apt-extracttemplates filename -->
+<!ENTITY synopsis-filename "filename">
+
+<!-- TRANSLATOR: used as parameters for apt-ftparchive  e.g. apt-ftparchive packages path override pathprefix -->
+<!ENTITY synopsis-path "path">
+<!ENTITY synopsis-pathprefix "pathprefix">
+<!ENTITY synopsis-section "section">
+<!ENTITY synopsis-override "override">
+
+<!-- TRANSLATOR: used as in apt-key export keyid  e.g. apt-key export 473041FA -->
+<!ENTITY synopsis-keyid "keyid">
+

+ 4 - 12
doc/makefile

@@ -15,7 +15,7 @@ include $(DEBIANDOC_H)
 ifdef XSLTPROC
 # generate a list of accepted man page translations
 SOURCE = $(patsubst %.xml,%,$(wildcard *.?.xml))
-INCLUDES = apt.ent
+INCLUDES = apt.ent apt-verbatim.ent
 STYLESHEET=manpage-style.xsl
 
 LOCAL := manpage-$(firstword $(SOURCE))
@@ -67,26 +67,21 @@ veryclean-subdirs:
 		rm -rf $$dir; \
 	done
 
+.PHONY: update-po po4a stats
+
 ifdef PO4A
 doc: po4a
 
-clean: po4a-clean
-
-.PHONY: update-po po4a stats
 update-po:
 	po4a --previous --no-backups --force --no-translations po4a.conf
 
-po4a-clean:
-	po4a --previous --rm-backups --rm-translations po4a.conf
-
 po4a:
 	po4a --previous --no-backups po4a.conf
+endif
 
 stats:
 	for i in po/*.po; do echo -n "$$i: "; msgfmt --statistics $$i; done
 
-endif
-
 ifdef DOXYGEN
 DOXYGEN_SOURCES = $(shell find $(BASE)/apt-pkg -not -name .\\\#* -and \( -name \*.cc -or -name \*.h \) )
 
@@ -96,9 +91,6 @@ doxygen-clean:
 	rm -fr $(BUILD)/doc/doxygen
 	rm -f $(BUILD)/doc/doxygen-stamp
 
-$(BUILD)/doc/Doxyfile: Doxyfile.in
-	(cd $(BUILD) && ./config.status doc/Doxyfile)
-
 $(BUILD)/doc/doxygen-stamp: $(DOXYGEN_SOURCES) $(BUILD)/doc/Doxyfile
 	rm -fr $(BUILD)/doc/doxygen
 	mkdir $(BUILD)/doc/doxygen  # some versions seem to not create this directory #628799

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

@@ -2845,7 +2845,7 @@ msgid ""
 "<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 "
+"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."

+ 1 - 1
doc/po/de.po

@@ -3768,7 +3768,7 @@ msgid ""
 "<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 "
+"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."

+ 1 - 1
doc/po/es.po

@@ -3820,7 +3820,7 @@ msgid ""
 "<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 "
+"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."

+ 3 - 3
doc/po/fr.po

@@ -465,7 +465,7 @@ msgstr ""
 "<!ENTITY file-preferences \"\n"
 "     <varlistentry><term><filename>/etc/apt/preferences</filename></term>\n"
 "     <listitem><para>Fichier des préférences.\n"
-"     C'est dans ce fichier qu'on peut faire de l'étiquetage (pinning) c'est-à-dire, choisir d'obtenir des paquets d'une source distincte ou d'une distribution différente.\n"
+"     C'est dans ce fichier qu'on peut faire de l'épinglage (pinning) c'est-à-dire, choisir d'obtenir des paquets d'une source distincte ou d'une distribution différente.\n"
 "     Élément de configuration : <literal>Dir::Etc::Preferences</literal>.</para></listitem>\n"
 "     </varlistentry>\n"
 
@@ -3752,7 +3752,7 @@ msgid ""
 "<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 "
+"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."
@@ -4444,7 +4444,7 @@ msgid ""
 "also the &apt-preferences; manual page."
 msgstr ""
 "Cette option contrôle l'entrée par défaut pour les questions de "
-"distribution ; une étiquette (pin) par défaut dont la priorité vaut 990 est "
+"distribution ; un épinglage (pin) par défaut dont la priorité vaut 990 est "
 "créée en utilisant la chaîne spécifiée. Le fichier des préférences peut "
 "annuler cette décision. En clair, cette option permet de contrôler "
 "simplement dans quelle distribution seront récupérés les paquets. Par "

+ 1 - 1
doc/po/it.po

@@ -2821,7 +2821,7 @@ msgid ""
 "<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 "
+"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."

+ 1 - 1
doc/po/ja.po

@@ -3907,7 +3907,7 @@ msgid ""
 "<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 "
+"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."

+ 1 - 1
doc/po/pl.po

@@ -3722,7 +3722,7 @@ msgid ""
 "<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 "
+"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."

+ 1 - 1
doc/po/pt.po

@@ -3755,7 +3755,7 @@ msgid ""
 "<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 "
+"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."

+ 1 - 1
doc/po/pt_BR.po

@@ -2878,7 +2878,7 @@ msgid ""
 "<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 "
+"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."

+ 1 - 1
ftparchive/apt-ftparchive.cc

@@ -587,7 +587,7 @@ void LoadBinDir(vector<PackageMap> &PkgList,Configuration &Setup)
 /* */
 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)
       return true;

+ 2 - 1
ftparchive/makefile

@@ -7,6 +7,7 @@ include ../buildlib/defaults.mak
 
 # The apt-ftparchive program
 ifdef BDBLIB
+APT_DOMAIN:=apt-utils
 PROGRAM=apt-ftparchive
 SLIBS = -lapt-pkg -lapt-inst $(BDBLIB) $(INTLLIBS)
 LIB_MAKES = apt-pkg/makefile apt-inst/makefile
@@ -15,6 +16,6 @@ SOURCE = apt-ftparchive.cc cachedb.cc writer.cc contents.cc override.cc \
 include $(PROGRAM_H)
 else
 PROGRAM=apt-ftparchive
-MESSAGE="Must have db2 to build apt-ftparchive"
+MESSAGE="Must have libdb to build apt-ftparchive"
 include $(FAIL_H)
 endif # ifdef BDBLIB

+ 0 - 175
methods/bzip2.cc

@@ -1,175 +0,0 @@
-// -*- mode: cpp; mode: fold -*-
-// Description								/*{{{*/
-/* ######################################################################
-
-   Bzip2 method - Take a file URI in and decompress it into the target 
-   file.
-
-   While the method is named "bzip2" it handles also other compression
-   types as it calls binaries based on the name of the method,
-   so it can also be used to handle gzip, lzma and others if named
-   correctly.
-
-   ##################################################################### */
-									/*}}}*/
-// Include Files							/*{{{*/
-#include <config.h>
-
-#include <apt-pkg/fileutl.h>
-#include <apt-pkg/error.h>
-#include <apt-pkg/acquire-method.h>
-#include <apt-pkg/strutl.h>
-#include <apt-pkg/hashes.h>
-#include <apt-pkg/configuration.h>
-
-#include <sys/stat.h>
-#include <unistd.h>
-#include <utime.h>
-#include <stdio.h>
-#include <errno.h>
-#include <apti18n.h>
-									/*}}}*/
-
-const char *Prog;
-
-class Bzip2Method : public pkgAcqMethod
-{
-   virtual bool Fetch(FetchItem *Itm);
-   
-   public:
-   
-   Bzip2Method() : pkgAcqMethod("1.1",SingleInstance | SendConfig) {};
-};
-
-
-// Bzip2Method::Fetch - Decompress the passed URI			/*{{{*/
-// ---------------------------------------------------------------------
-/* */
-bool Bzip2Method::Fetch(FetchItem *Itm)
-{
-   URI Get = Itm->Uri;
-   std::string Path = Get.Host + Get.Path; // To account for relative paths
-   
-   std::string GzPathOption = "Dir::bin::" + std::string(Prog);
-
-   FetchResult Res;
-   Res.Filename = Itm->DestFile;
-   URIStart(Res);
-   
-   // Open the source and destination files
-   FileFd From(Path,FileFd::ReadOnly);
-
-   if(From.FileSize() == 0)
-      return _error->Error(_("Empty files can't be valid archives"));
-
-   int GzOut[2];   
-   if (pipe(GzOut) < 0)
-      return _error->Errno("pipe",_("Couldn't open pipe for %s"),Prog);
-
-   // Fork bzip2
-   pid_t Process = ExecFork();
-   if (Process == 0)
-   {
-      close(GzOut[0]);
-      dup2(From.Fd(),STDIN_FILENO);
-      dup2(GzOut[1],STDOUT_FILENO);
-      From.Close();
-      close(GzOut[1]);
-      SetCloseExec(STDIN_FILENO,false);
-      SetCloseExec(STDOUT_FILENO,false);
-      
-      const char *Args[3];
-      std::string Tmp = _config->Find(GzPathOption,Prog);
-      Args[0] = Tmp.c_str();
-      Args[1] = "-d";
-      Args[2] = 0;
-      execvp(Args[0],(char **)Args);
-      _exit(100);
-   }
-   From.Close();
-   close(GzOut[1]);
-   
-   FileFd FromGz(GzOut[0]);  // For autoclose   
-   FileFd To(Itm->DestFile,FileFd::WriteAtomic);   
-   To.EraseOnFailure();
-   if (_error->PendingError() == true)
-      return false;
-   
-   // Read data from bzip2, generate checksums and write
-   Hashes Hash;
-   bool Failed = false;
-   while (1) 
-   {
-      unsigned char Buffer[4*1024];
-      
-      ssize_t Count = read(GzOut[0],Buffer,sizeof(Buffer));
-      if (Count < 0 && errno == EINTR)
-	 continue;
-      
-      if (Count < 0)
-      {
-	 _error->Errno("read", _("Read error from %s process"),Prog);
-	 Failed = true;
-	 break;
-      }
-      
-      if (Count == 0)
-	 break;
-      
-      Hash.Add(Buffer,Count);
-      if (To.Write(Buffer,Count) == false)
-      {
-	 Failed = true;
-	 FromGz.Close();
-	 break;
-      }      
-   }
-   
-   // Wait for bzip2 to finish
-   if (ExecWait(Process,_config->Find(GzPathOption,Prog).c_str(),false) == false)
-   {
-      To.OpFail();
-      return false;
-   }  
-       
-   To.Close();
-   
-   if (Failed == true)
-      return false;
-   
-   // Transfer the modification times
-   struct stat Buf;
-   if (stat(Path.c_str(),&Buf) != 0)
-      return _error->Errno("stat",_("Failed to stat"));
-
-   struct utimbuf TimeBuf;
-   TimeBuf.actime = Buf.st_atime;
-   TimeBuf.modtime = Buf.st_mtime;
-   if (utime(Itm->DestFile.c_str(),&TimeBuf) != 0)
-      return _error->Errno("utime",_("Failed to set modification time"));
-
-   if (stat(Itm->DestFile.c_str(),&Buf) != 0)
-      return _error->Errno("stat",_("Failed to stat"));
-   
-   // Return a Done response
-   Res.LastModified = Buf.st_mtime;
-   Res.Size = Buf.st_size;
-   Res.TakeHashes(Hash);
-
-   URIDone(Res);
-   
-   return true;
-}
-									/*}}}*/
-
-int main(int argc, char *argv[])
-{
-   setlocale(LC_ALL, "");
-
-   Bzip2Method Mth;
-
-   Prog = strrchr(argv[0],'/');
-   Prog++;
-   
-   return Mth.Run();
-}

+ 16 - 2
methods/gzip.cc

@@ -25,6 +25,8 @@
 #include <apti18n.h>
 									/*}}}*/
 
+const char *Prog;
+
 class GzipMethod : public pkgAcqMethod
 {
    virtual bool Fetch(FetchItem *Itm);
@@ -46,9 +48,18 @@ bool GzipMethod::Fetch(FetchItem *Itm)
    FetchResult Res;
    Res.Filename = Itm->DestFile;
    URIStart(Res);
-   
+
+   std::vector<APT::Configuration::Compressor> const compressors = APT::Configuration::getCompressors();
+   std::vector<APT::Configuration::Compressor>::const_iterator compressor = compressors.begin();
+   for (; compressor != compressors.end(); ++compressor)
+      if (compressor->Name == Prog)
+	 break;
+   if (compressor == compressors.end())
+      return _error->Error("Extraction of file %s requires unknown compressor %s", Path.c_str(), Prog);
+
    // Open the source and destination files
-   FileFd From(Path,FileFd::ReadOnly, FileFd::Gzip);
+   FileFd From;
+   From.Open(Path, FileFd::ReadOnly, *compressor);
 
    if(From.FileSize() == 0)
       return _error->Error(_("Empty files can't be valid archives"));
@@ -117,6 +128,9 @@ int main(int argc, char *argv[])
 {
    setlocale(LC_ALL, "");
 
+   Prog = strrchr(argv[0],'/');
+   ++Prog;
+
    GzipMethod Mth;
    return Mth.Run();
 }

+ 1 - 1
methods/http.cc

@@ -758,7 +758,7 @@ void HttpMethod::SendReq(FetchItem *Itm,CircleBuf &Out)
           Base64Encode(Uri.User + ":" + Uri.Password) + "\r\n";
    }
    Req += "User-Agent: " + _config->Find("Acquire::http::User-Agent",
-		"Debian APT-HTTP/1.3 ("VERSION")") + "\r\n\r\n";
+		"Debian APT-HTTP/1.3 ("PACKAGE_VERSION")") + "\r\n\r\n";
    
    if (Debug == true)
       cerr << Req << endl;

+ 1 - 1
methods/https.cc

@@ -219,7 +219,7 @@ bool HttpsMethod::Fetch(FetchItem *Itm)
    curl_easy_setopt(curl, CURLOPT_USERAGENT,
 	_config->Find("Acquire::https::User-Agent",
 		_config->Find("Acquire::http::User-Agent",
-			"Debian APT-CURL/1.0 ("VERSION")").c_str()).c_str());
+			"Debian APT-CURL/1.0 ("PACKAGE_VERSION")").c_str()).c_str());
 
    // set timeout
    int const timeout = _config->FindI("Acquire::https::Timeout",

+ 17 - 23
methods/makefile

@@ -7,7 +7,7 @@ include ../buildlib/defaults.mak
 BIN := $(BIN)/methods
 
 include ../buildlib/libversion.mak
-APT_DOMAIN := libapt-pkg$(LIBAPTPKG_MAJOR)
+APT_DOMAIN := apt
 
 # The file method
 PROGRAM=file
@@ -67,7 +67,7 @@ include $(PROGRAM_H)
 
 # The rred method
 PROGRAM=rred
-SLIBS = -lapt-pkg -lz $(SOCKETLIBS) $(INTLLIBS)
+SLIBS = -lapt-pkg $(SOCKETLIBS) $(INTLLIBS)
 LIB_MAKES = apt-pkg/makefile
 SOURCE = rred.cc
 include $(PROGRAM_H)
@@ -86,16 +86,9 @@ LIB_MAKES = apt-pkg/makefile
 SOURCE = mirror.cc http.cc rfc2553emu.cc connect.cc
 include $(PROGRAM_H)
 
-# The gzip method
-PROGRAM=bzip2
-SLIBS = -lapt-pkg $(INTLLIBS)
-LIB_MAKES = apt-pkg/makefile
-SOURCE = bzip2.cc
-include $(PROGRAM_H)
-
-# SSH and lzma method symlink
-binary: $(BIN)/ssh $(BIN)/lzma $(BIN)/xz
-veryclean: clean-$(BIN)/ssh clean-$(BIN)/lzma clean-$(BIN)/xz
+# SSH method symlink
+binary: $(BIN)/ssh
+veryclean: clean-$(BIN)/ssh
 
 $(BIN)/ssh:
 	echo "Installing ssh method link"
@@ -103,14 +96,15 @@ $(BIN)/ssh:
 clean-$(BIN)/ssh:
 	-rm $(BIN)/ssh
 
-$(BIN)/lzma:
-	echo "Installing lzma method link"
-	ln -fs bzip2 $(BIN)/lzma
-clean-$(BIN)/lzma:
-	-rm $(BIN)/lzma
-
-$(BIN)/xz:
-	echo "Installing xz method link"
-	ln -fs bzip2 $(BIN)/xz
-clean-$(BIN)/xz:
-	-rm $(BIN)/xz
+# create links for all other compressors
+COMPRESSORS=bzip2 lzma xz
+
+binary: $(addprefix $(BIN)/,$(COMPRESSORS))
+veryclean: $(addprefix clean-$(BIN)/,$(COMPRESSORS))
+
+$(addprefix $(BIN)/,$(COMPRESSORS)): $(BIN)/gzip
+	echo "Installing $(notdir $@) method link"
+	ln -fs gzip $@
+
+$(addprefix clean-$(BIN)/,$(COMPRESSORS)):
+	-rm $(BIN)/$(notdir $@)

+ 3 - 2
methods/mirror.cc

@@ -124,9 +124,10 @@ bool MirrorMethod::Clean(string Dir)
       if (I == list.end())
 	 unlink(Dir->d_name);
    };
-   
-   chdir(StartDir.c_str());
+
    closedir(D);
+   if (chdir(StartDir.c_str()) != 0)
+      return _error->Errno("chdir",_("Unable to change to %s"),StartDir.c_str());
    return true;   
 }
 

+ 20 - 5
methods/rred.cc

@@ -227,6 +227,21 @@ struct EdCommand {
   char type;
 };
 #define IOV_COUNT 1024 /* Don't really want IOV_MAX since it can be arbitrarily large */
+static ssize_t retry_writev(int fd, const struct iovec *iov, int iovcnt) {
+	ssize_t Res;
+	errno = 0;
+	ssize_t i = 0;
+	do {
+		Res = writev(fd, iov + i, iovcnt);
+		if (Res < 0 && errno == EINTR)
+			continue;
+		if (Res < 0)
+			return _error->Errno("writev",_("Write error"));
+		iovcnt -= Res;
+		i += Res;
+	} while (Res > 0 && iovcnt > 0);
+	return i;
+}
 #endif
 										/*}}}*/
 RredMethod::State RredMethod::patchMMap(FileFd &Patch, FileFd &From,		/*{{{*/
@@ -377,7 +392,7 @@ RredMethod::State RredMethod::patchMMap(FileFd &Patch, FileFd &From,		/*{{{*/
 			hash->Add((const unsigned char*) begin, input - begin);
 
 			if(++iov_size == IOV_COUNT) {
-				writev(out_file.Fd(), iov, IOV_COUNT);
+				retry_writev(out_file.Fd(), iov, IOV_COUNT);
 				iov_size = 0;
 			}
 		}
@@ -402,7 +417,7 @@ RredMethod::State RredMethod::patchMMap(FileFd &Patch, FileFd &From,		/*{{{*/
 				iov[iov_size].iov_len);
 
 				if(++iov_size == IOV_COUNT) {
-					writev(out_file.Fd(), iov, IOV_COUNT);
+					retry_writev(out_file.Fd(), iov, IOV_COUNT);
 					iov_size = 0;
 				}
 			}
@@ -417,15 +432,15 @@ RredMethod::State RredMethod::patchMMap(FileFd &Patch, FileFd &From,		/*{{{*/
 	}
 
 	if(iov_size) {
-		writev(out_file.Fd(), iov, iov_size);
+		retry_writev(out_file.Fd(), iov, iov_size);
 		iov_size = 0;
 	}
 
 	for(i = 0; i < iov_size; i += IOV_COUNT) {
 		if(iov_size - i < IOV_COUNT)
-			writev(out_file.Fd(), iov + i, iov_size - i);
+			retry_writev(out_file.Fd(), iov + i, iov_size - i);
 		else
-			writev(out_file.Fd(), iov + i, IOV_COUNT);
+			retry_writev(out_file.Fd(), iov + i, IOV_COUNT);
 	}
 
 	delete [] iov;

Разница между файлами не показана из-за своего большого размера
+ 312 - 296
po/da.po


+ 2 - 2
po/fi.po

@@ -3018,7 +3018,7 @@ msgstr "MD5Sum ei täsmää"
 #: apt-pkg/acquire-item.cc:900 apt-pkg/acquire-item.cc:1848
 #: apt-pkg/acquire-item.cc:1991
 msgid "Hash Sum mismatch"
-msgstr "Hash Sum täsmää"
+msgstr "Tarkistussumma ei täsmää"
 
 #: apt-pkg/acquire-item.cc:1388
 #, c-format
@@ -3244,7 +3244,7 @@ msgstr ""
 #: apt-pkg/indexcopy.cc:549
 #, fuzzy, c-format
 msgid "Hash mismatch for: %s"
-msgstr "Hash Sum täsmää"
+msgstr "Kohteen %s tarkistussumma ei täsmää"
 
 #: apt-pkg/indexcopy.cc:677
 #, c-format

+ 5 - 5
po/fr.po

@@ -127,7 +127,7 @@ msgstr "Le cache est désynchronisé, impossible de référencer un fichier"
 #. Show any packages have explicit pins
 #: cmdline/apt-cache.cc:1499
 msgid "Pinned packages:"
-msgstr "Paquets étiquetés :"
+msgstr "Paquets épinglés :"
 
 #: cmdline/apt-cache.cc:1511 cmdline/apt-cache.cc:1556
 msgid "(not found)"
@@ -147,7 +147,7 @@ msgstr "(aucun)"
 
 #: cmdline/apt-cache.cc:1553
 msgid "  Package pin: "
-msgstr "  Étiquette de paquet : "
+msgstr "  Épinglage de paquet : "
 
 #. Show the priority tables
 #: cmdline/apt-cache.cc:1562
@@ -220,7 +220,7 @@ msgstr ""
 "   pkgnames - Liste le nom de tous les paquets du système\n"
 "   dotty - Génère un graphe des paquets pour GraphViz\n"
 "   xvcg - Génère un graphe des paquets pour xvcg\n"
-"   policy - Affiche l'étiquetage (Pin) en vigueur\n"
+"   policy - Affiche l'épinglage (Pin) en vigueur\n"
 "\n"
 "Options :\n"
 "  -h    Ce texte d'aide\n"
@@ -3020,11 +3020,11 @@ msgstr ""
 #: apt-pkg/policy.cc:411
 #, c-format
 msgid "Did not understand pin type %s"
-msgstr "Étiquette %s inconnue"
+msgstr "Type d'épinglage %s inconnu"
 
 #: apt-pkg/policy.cc:419
 msgid "No priority (or zero) specified for pin"
-msgstr "Aucune priorité (ou zéro) n'a été spécifiée pour l'étiquette"
+msgstr "Aucune priorité (ou zéro) n'a été spécifiée pour l'épinglage"
 
 #: apt-pkg/pkgcachegen.cc:80
 msgid "Cache has an incompatible versioning system"

+ 15 - 9
po/makefile

@@ -29,7 +29,7 @@ GETDOMAIN = $(word 1,$(subst /, ,$(1)))
 # Generate the list of files from the bits the other make files dropped 
 # and produce the .pot file.
 $(POTFILES) : $(PO)/%.pot :
-	printf "%s " "Generating POT file $@"
+	echo "Generating POT file $@"
 	echo $@ : $(wildcard $(PO)/domains/$*/*.*list) $(addprefix $(BASE)/,$(shell cat $(wildcard $(PO)/domains/$*/*.srclist))) > $@.d
 # From sh source
 	cat $(PO)/domains/$*/*.shlist 2> /dev/null | (cd $(BASE) && xargs -n1 bash --dump-po-strings) > $(PO)/domains/$*/sh.pot
@@ -40,22 +40,19 @@ $(POTFILES) : $(PO)/%.pot :
 	  --keyword=P_:1,2 \
 	  --files-from=$(PO)/POTFILES_$*.in -o $(PO)/domains/$*/c.pot
 	rm -f $(PO)/POTFILES_$*.in
-	$(MSGCOMM) --more-than=0 $(PO)/domains/$*/c.pot $(PO)/domains/$*/sh.pot --output=$@
+	$(MSGCOMM) --omit-header --more-than=0 $(PO)/domains/$*/c.pot $(PO)/domains/$*/sh.pot --output=$@
 	# copy into the domain dirs to make rosetta happy
 	rm -f $(PO)/domains/$*/*.pot
 	cp $@ $(PO)/domains/$*
 
-$(PACKAGE)-all.pot: $(POTFILES)
-	$(MSGCOMM) --more-than=0 $(POTFILES) --output=$@
-
 # Filter the complete translation with the domain specific file to produce
 # only the subtext needed for this domain
 # We cannot express the dependencies required for this directly with a pattern
 # rule, so we use the .d hack.
-$(LANG_POFILES) : $(PO_DOMAINS)/%.po : $(PACKAGE)-all.pot
+$(LANG_POFILES) : $(PO_DOMAINS)/%.po : $(POTFILES)
 	printf "%s " "Generating $@"
 	echo $@ : $(notdir $@) $(PO)/$(call GETDOMAIN,$*).pot > $(PO)/$(call GETDOMAIN,$*)_$(notdir $@).d
-	$(MSGMERGE) $(notdir $@) $(PO)/$(call GETDOMAIN,$*).pot -o $@
+	$(MSGMERGE) --no-location $(notdir $@) $(PO)/$(call GETDOMAIN,$*).pot -o $@
 
 $(MOFILES) : $(PO_DOMAINS)/%.mo : $(PO_DOMAINS)/%.po
 	printf "%s: " "Generating $(LOCALE)/$(notdir $*)/LC_MESSAGES/$(call GETDOMAIN,$*).mo"
@@ -66,7 +63,16 @@ $(MOFILES) : $(PO_DOMAINS)/%.mo : $(PO_DOMAINS)/%.po
 stats:
 	for i in *.pot *.po; do echo -n "$$i: "; msgfmt --statistics $$i; done
 
-binary: $(POTFILES) $(PACKAGE)-all.pot $(MOFILES)
+binary: $(POTFILES) $(MOFILES)
+
+$(PACKAGE)-all.pot: $(POTFILES)
+	# we create our partial pot files without a header to avoid changing dates in *.mo files,
+	# but we want a header for our master-pot file, so we use a dummy pot with nothing but the header
+	$(XGETTEXT) --default-domain=$(PO)/$(PACKAGE)-dummy.pot --foreign --language=c \
+		-o $(PO)/$(PACKAGE)-dummy.pot --force-po --package-name=$(PACKAGE) \
+		--package-version=$(PACKAGE_VERSION) --msgid-bugs-address=deity@lists.debian.org /dev/null
+	$(MSGCOMM) --more-than=0 $(PO)/$(PACKAGE)-dummy.pot $(POTFILES) --output=$(PACKAGE)-all.pot
+	rm -f $(PO)/$(PACKAGE)-dummy.pot
 
 .PHONY: update-po
 update-po: $(PACKAGE)-all.pot
@@ -78,7 +84,7 @@ update-po: $(PACKAGE)-all.pot
 	done
 
 clean: clean/local
-clean/local: update-po
+clean/local:
 	rm -f $(MOFILES) $(LANG_POFILES) $(PO)/*.d
 
 # Include the dependencies that are available

Разница между файлами не показана из-за своего большого размера
+ 562 - 473
po/pl.po


+ 37 - 0
prepare-release

@@ -0,0 +1,37 @@
+#!/bin/sh
+
+VERSION=$(dpkg-parsechangelog | sed -n -e '/^Version:/s/^Version: //p')
+DISTRIBUTION=$(dpkg-parsechangelog | sed -n -e '/^Distribution:/s/^Distribution: //p')
+
+if [ "$1" = 'pre-export' ]; then
+	if [ "$DISTRIBUTION" = 'sid' ]; then
+		echo >&2 '»sid« is not a valid distribution. Replace it with »unstable« for you'
+		sed -i -e 's/) sid; urgency=/) unstable; urgency=/' debian/changelog
+		DISTRIBUTION='unstable'
+	elif [ "$DISTRIBUTION" = 'UNRELEASED' ]; then
+		echo >&2 'WARNING: Remember to change to a valid distribution for release'
+		VERSION="$VERSION~$(date +%Y%m%d)"
+	fi
+
+	if [ "$(date +%Y-%m-%d)" != "$(grep --max-count=1 '^"POT-Creation-Date: .*\n"$' po/apt-all.pot | cut -d' ' -f 2)" -o \
+	     "$(date +%Y-%m-%d)" != "$(grep --max-count=1 '^"POT-Creation-Date: .*\n"$' doc/po/apt-doc.pot | cut -d' ' -f 2)" ]; then
+		echo >&2 'POT files are not up-to-date. Execute »make update-po« for you…'
+		make update-po
+	fi
+
+	sed -i -e "s/^PACKAGE_VERSION=\".*\"$/PACKAGE_VERSION=\"${VERSION}\"/" configure.in
+elif [ "$1" = 'post-build' ]; then
+	if [ "$DISTRIBUTION" != "UNRELEASED" ]; then
+		echo >&2 "REMEMBER: Tag this release with »bzr tag ${VERSION}« if you are satisfied"
+	else
+		echo >&2 'REMEMBER: Change to a valid distribution before release'
+	fi
+else
+	echo >&1 "Usage:\t$0 pre-export
+\t$0 post-build
+
+If you use »bzr builddeb« you can leave this script alone as it will
+be run at the right places auto-magically. Otherwise you should use
+»pre-export« to update po and pot files as well as version numbering.
+»post-build« can be used to run some more or less useful checks later on."
+fi

+ 2 - 2
test/Makefile

@@ -6,8 +6,8 @@ ifndef NOISY
 .SILENT:
 endif
 
-.PHONY: headers library clean veryclean all binary program doc test
-all clean veryclean binary program dirs test:
+.PHONY: startup headers library clean veryclean all binary program doc test update-po
+startup all clean veryclean binary program dirs test update-po:
 	$(MAKE) -C libapt $@
 	$(MAKE) -C interactive-helper $@
 

+ 4 - 2
test/integration/framework

@@ -207,7 +207,9 @@ configdpkg() {
 				if [ "${ARCH}" != "${DPKGARCH}" ]; then dpkg --add-architecture ${ARCH}; fi
 			done
 			if [ "0" = "$(dpkg -l dpkg 2> /dev/null | grep '^i' | wc -l)" ]; then
-				insertinstalledpackage 'dpkg' "all" '1.16.2~wipmultiarch~fake'
+				# dpkg doesn't really check the version as long as it is fully installed,
+				# but just to be sure we choose one above the required version
+				insertinstalledpackage 'dpkg' "all" '1.16.2+fake'
 			fi
 		fi
 	fi
@@ -556,7 +558,7 @@ buildaptarchivefromfiles() {
 		msgninfo "\t${line} file… "
 		cat ${line} | gzip > ${line}.gz
 		cat ${line} | bzip2 > ${line}.bz2
-		cat ${line} | lzma > ${line}.lzma
+		cat ${line} | xz --format=lzma > ${line}.lzma
 		cat ${line} | xz > ${line}.xz
 		msgdone "info"
 	done

+ 8 - 4
test/integration/test-bug-595691-empty-and-broken-archive-files

@@ -28,10 +28,10 @@ testaptgetupdate() {
 createemptyarchive() {
 	find aptarchive/ \( -name "Packages*" -o -name "en*" \) -type f -delete
 	if [ "en" = "$1" ]; then
-		echo -n "" | $COMPRESSOR > aptarchive/Packages.$COMPRESS
+		echo -n "" | $COMPRESSOR_CMD > aptarchive/Packages.$COMPRESS
 	fi
 	touch aptarchive/Packages
-	echo -n "" | $COMPRESSOR > aptarchive/${1}.$COMPRESS
+	echo -n "" | $COMPRESSOR_CMD > aptarchive/${1}.$COMPRESS
 	generatereleasefiles
 	signreleasefiles
 	rm -f aptarchive/Packages
@@ -40,7 +40,7 @@ createemptyarchive() {
 createemptyfile() {
 	find aptarchive/ \( -name "Packages*" -o -name "en*" \) -type f -delete
 	if [ "en" = "$1" ]; then
-		echo -n "" | $COMPRESSOR > aptarchive/Packages.$COMPRESS
+		echo -n "" | $COMPRESSOR_CMD > aptarchive/Packages.$COMPRESS
 	fi
 	touch aptarchive/Packages aptarchive/${1}.$COMPRESS
 	generatereleasefiles
@@ -50,6 +50,7 @@ createemptyfile() {
 
 setupcompressor() {
 	COMPRESSOR="$1"
+	COMPRESSOR_CMD="$1"
 	case $COMPRESSOR in
 	gzip) COMPRESS="gz";;
 	bzip2) COMPRESS="bz2";;
@@ -66,10 +67,13 @@ Dir::Bin::xz \"/does/not/exist\";" > rootdir/etc/apt/apt.conf.d/00compressor
 		echo "Dir::Bin::${COMPRESSOR} \"/bin/${COMPRESSOR}\";" >> rootdir/etc/apt/apt.conf.d/00compressor
 	elif [ -e "/usr/bin/${COMPRESSOR}" ]; then
 		echo "Dir::Bin::${COMPRESSOR} \"/usr/bin/${COMPRESSOR}\";" >> rootdir/etc/apt/apt.conf.d/00compressor
+	elif [ "${COMPRESSOR}" = 'lzma' ]; then
+		echo "Dir::Bin::xz \"/usr/bin/xz\";" >> rootdir/etc/apt/apt.conf.d/00compressor
+		COMPRESSOR_CMD='xz --format=lzma'
 	else
 		msgtest "Test for availability of compressor" "${COMPRESSOR}"
 		msgfail
-		exit 1
+		#exit 1
 	fi
 }
 

+ 2 - 2
test/integration/test-bug-604222-new-and-autoremove

@@ -16,7 +16,7 @@ Building dependency tree...
 Reading state information...
 The following package was automatically installed and is no longer required:
   libvtk5.4
-Use 'apt-get autoremove' to remove them.
+Use 'apt-get autoremove' to remove it.
 The following NEW packages will be installed:
   libavcodec52
 0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
@@ -28,7 +28,7 @@ Building dependency tree...
 Reading state information...
 The following package was automatically installed and is no longer required:
   libvtk5.4
-Use 'apt-get autoremove' to remove them.
+Use 'apt-get autoremove' to remove it.
 The following extra packages will be installed:
   libavcodec52 libopenal-dev libvtk5.4
 The following NEW packages will be installed:

+ 1 - 1
test/integration/test-bug-613420-new-garbage-dependency

@@ -22,7 +22,7 @@ testequal "Reading package lists...
 Building dependency tree...
 Reading state information...
 The following packages were automatically installed and are no longer required:
-  openoffice.org-officebean libreoffice-officebean
+  libreoffice-officebean openoffice.org-officebean
 Use 'apt-get autoremove' to remove them.
 The following extra packages will be installed:
   libreoffice-core libreoffice-officebean openoffice.org-officebean

+ 1 - 1
test/integration/test-conflicts-loop

@@ -19,10 +19,10 @@ testequal 'Reading package lists...
 Building dependency tree...
 The following packages will be upgraded:
   openjdk-6-jre openjdk-6-jre-headless openjdk-6-jre-lib
-3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
   openjdk-6-jre-lib:i386 conflicts with openjdk-6-jre:i386
     openjdk-6-jre:i386 conflicts with openjdk-6-jre-headless:i386
       openjdk-6-jre-headless:i386 conflicts with openjdk-6-jre:i386
+3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
 Remv openjdk-6-jre [6b16-1.8-0ubuntu1]
       openjdk-6-jre-headless:i386 conflicts with openjdk-6-jre-lib:i386
 Remv openjdk-6-jre-lib [6b16-1.8-0ubuntu1]

+ 1 - 1
test/integration/test-hashsum-verification

@@ -23,7 +23,7 @@ prepare() {
 	find aptarchive -name 'Release' -delete
 	cat aptarchive/Packages | gzip > aptarchive/Packages.gz
 	cat aptarchive/Packages | bzip2 > aptarchive/Packages.bz2
-	cat aptarchive/Packages | lzma > aptarchive/Packages.lzma
+	cat aptarchive/Packages | xz --format=lzma > aptarchive/Packages.lzma
         # create Release file with incorret checksums
 	cat > aptarchive/Release <<EOF
 Date: Fri, 05 Aug 2011 09:22:08 UTC

+ 1 - 1
test/integration/test-pdiff-usage

@@ -21,7 +21,7 @@ testequal "$(cat ${PKGFILE})
 cp ${PKGFILE}-new aptarchive/Packages
 cat aptarchive/Packages | gzip > aptarchive/Packages.gz
 cat aptarchive/Packages | bzip2 > aptarchive/Packages.bz2
-cat aptarchive/Packages | lzma > aptarchive/Packages.lzma
+cat aptarchive/Packages | xz --format=lzma > aptarchive/Packages.lzma
 rm -rf aptarchive/Packages.diff
 mkdir -p aptarchive/Packages.diff
 PATCHFILE="aptarchive/Packages.diff/$(date +%Y-%m-%d-%H%M.%S)"

+ 1 - 1
test/integration/test-releasefile-verification

@@ -24,7 +24,7 @@ prepare() {
 	find aptarchive -name 'Release' -delete
 	cat aptarchive/Packages | gzip > aptarchive/Packages.gz
 	cat aptarchive/Packages | bzip2 > aptarchive/Packages.bz2
-	cat aptarchive/Packages | lzma > aptarchive/Packages.lzma
+	cat aptarchive/Packages | xz --format=lzma > aptarchive/Packages.lzma
 	generatereleasefiles "$DATE"
 }
 

+ 1 - 2
test/interactive-helper/extract-control.cc

@@ -21,8 +21,7 @@ bool ExtractMember(const char *File,const char *Member)
    if (Extract.Control == 0)
       return true;
    
-   write(STDOUT_FILENO,Extract.Control,Extract.Length);
-   return true;
+   return write(STDOUT_FILENO,Extract.Control,Extract.Length) != -1;
 }
 
 int main(int argc, const char *argv[])

+ 4 - 8
test/interactive-helper/makefile

@@ -11,28 +11,24 @@ SLIBS =
 SOURCE = mthdcat.cc
 include $(PROGRAM_H)
 
-# Version compare tester
-PROGRAM=testextract
-SLIBS = -lapt-pkg -lapt-inst
-LIB_MAKES = apt-pkg/makefile apt-inst/makefile
-SOURCE = testextract.cc
-include $(PROGRAM_H)
-
 # Program for testing the tar/deb extractor
 PROGRAM=testdeb
 SLIBS = -lapt-pkg -lapt-inst
+LIB_MAKES = apt-pkg/makefile apt-inst/makefile
 SOURCE = testdeb.cc
 include $(PROGRAM_H)
 
 # Program for testing tar extraction
 PROGRAM=extract-control
 SLIBS = -lapt-pkg -lapt-inst
+LIB_MAKES = apt-pkg/makefile apt-inst/makefile
 SOURCE = extract-control.cc
 include $(PROGRAM_H)
 
 # Program for testing udevcdrom
 PROGRAM=test_udevcdrom
-SLIBS = -lapt-pkg 
+SLIBS = -lapt-pkg
+LIB_MAKES = apt-pkg/makefile
 SOURCE = test_udevcdrom.cc
 include $(PROGRAM_H)
 

+ 0 - 103
test/interactive-helper/testextract.cc

@@ -1,103 +0,0 @@
-#include <apt-pkg/dpkgdb.h>
-#include <apt-pkg/debfile.h>
-#include <apt-pkg/error.h>
-#include <apt-pkg/configuration.h>
-#include <apt-pkg/progress.h>
-#include <apt-pkg/extract.h>
-#include <apt-pkg/init.h>
-#include <apt-pkg/strutl.h>
-#include <apt-pkg/fileutl.h>
-#include <apt-pkg/pkgsystem.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-
-using namespace std;
-
-bool Go(int argc,char *argv[])
-{
-   // Init the database
-   debDpkgDB Db;   
-   {
-      OpTextProgress Prog;
-
-      if (Db.ReadyPkgCache(Prog) == false)
-	 return false;
-      Prog.Done();
-      
-      if (Db.ReadyFileList(Prog) == false)
-	 return false;
-   }
-
-   for (int I = 1; I < argc; I++)
-   {
-      const char *Fake = 0;
-      for (unsigned J = 0; argv[I][J] != 0; J++)
-      {
-	 if (argv[I][J] != ',')
-	    continue;
-	 Fake = argv[I] + J + 1;
-	 argv[I][J] = 0;
-      }
-      
-      FileFd F(argv[I],FileFd::ReadOnly);
-      debDebFile Deb(F);
-
-      if (_error->PendingError() == true)
-	 return false;
-      
-      if (Deb.ExtractControl(Db) == false)
-	 return false;
-      cout << argv[I] << endl;
-      
-      pkgCache::VerIterator Ver = Deb.MergeControl(Db);
-      if (Ver.end() == true)
-	 return false;
-      
-      cout << Ver.ParentPkg().Name() << ' ' << Ver.VerStr() << endl;
-      
-      pkgExtract Extract(Db.GetFLCache(),Ver);
-      
-      if (Fake != 0)
-      {
-	 pkgExtract::Item Itm;
-	 memset(&Itm,0,sizeof(Itm));
-	 FILE *F = fopen(Fake,"r");
-	 while (feof(F) == 0)
-	 {
-	    char Line[300];
-	    fgets(Line,sizeof(Line),F);
-	    Itm.Name = _strstrip(Line);
-	    Itm.Type = pkgDirStream::Item::File;
-	    if (Line[strlen(Line)-1] == '/')
-	       Itm.Type = pkgDirStream::Item::Directory;
-
-	    int Fd;
-	    if (Extract.DoItem(Itm,Fd) == false) {
-	       fclose(F);
-	       return false;
-	    }
-	 }
-	 fclose(F);
-      }
-      else
-	 if (Deb.ExtractArchive(Extract) == false)
-	    return false;
-   }
-   return true;
-}
-
-int main(int argc,char *argv[])
-{
-   pkgInitConfig(*_config);
-   pkgInitSystem(*_config,_system);
-   _config->Set("Dir::State::status","/tmp/testing/status");
-
-   Go(argc,argv);
-   
-   if (_error->PendingError() == true)
-   {
-      _error->DumpErrors();
-      return 0;
-   }
-}

+ 2 - 2
test/libapt/run-tests

@@ -68,8 +68,8 @@ do
 			"${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-ast_DE"
 	elif [ $name = "HashSums${EXT}" ]; then
 		TMP="$(readlink -f "./${0}")"
-		echo -n "Testing with \033[1;35m${name}\033[0m ... "
-		LD_LIBRARY_PATH=${LDPATH} ${testapp} $TMP $(md5sum $TMP | cut -d' ' -f 1) $(sha1sum $TMP | cut -d' ' -f 1) $(sha256sum $TMP | cut -d' ' -f 1) $(sha512sum $TMP | cut -d' ' -f 1) && echo "\033[1;32mOKAY\033[0m" || echo "\033[1;31mFAILED\033[0m"
+		echo -n "Testing with ${NAME} "
+		LD_LIBRARY_PATH=${LDPATH} ${testapp} $TMP $(md5sum $TMP | cut -d' ' -f 1) $(sha1sum $TMP | cut -d' ' -f 1) $(sha256sum $TMP | cut -d' ' -f 1) $(sha512sum $TMP | cut -d' ' -f 1) && echo "$TESTOKAY" || echo "$TESTFAIL"
 		continue
 	elif [ $name = "CompareVersion${EXT}" ]; then
 		tmppath="${DIR}/versions.lst"