Przeglądaj źródła

merged from debian-experimental2

Michael Vogt 14 lat temu
rodzic
commit
e70c1d0673
100 zmienionych plików z 2841 dodań i 1304 usunięć
  1. 2 0
      .bzrignore
  2. 3 0
      apt-inst/contrib/arfile.h
  3. 6 0
      apt-inst/contrib/extracttar.h
  4. 4 0
      apt-inst/database.h
  5. 4 0
      apt-inst/deb/debfile.h
  6. 2 2
      apt-pkg/acquire-item.cc
  7. 8 0
      apt-pkg/acquire-item.h
  8. 5 0
      apt-pkg/acquire-method.h
  9. 5 0
      apt-pkg/acquire.h
  10. 5 0
      apt-pkg/algorithms.h
  11. 6 0
      apt-pkg/cachefile.h
  12. 2 0
      apt-pkg/cacheiterators.h
  13. 203 178
      apt-pkg/cacheset.cc
  14. 440 180
      apt-pkg/cacheset.h
  15. 77 33
      apt-pkg/cdrom.cc
  16. 5 0
      apt-pkg/cdrom.h
  17. 4 0
      apt-pkg/contrib/cdromutl.h
  18. 4 0
      apt-pkg/contrib/cmndline.h
  19. 4 0
      apt-pkg/contrib/configuration.h
  20. 475 78
      apt-pkg/contrib/fileutl.cc
  21. 59 12
      apt-pkg/contrib/fileutl.h
  22. 35 5
      apt-pkg/contrib/hashes.cc
  23. 11 0
      apt-pkg/contrib/hashes.h
  24. 22 0
      apt-pkg/contrib/hashsum.cc
  25. 8 0
      apt-pkg/contrib/hashsum_template.h
  26. 5 0
      apt-pkg/contrib/md5.h
  27. 20 2
      apt-pkg/contrib/mmap.cc
  28. 5 0
      apt-pkg/contrib/mmap.h
  29. 4 0
      apt-pkg/contrib/netrc.h
  30. 4 0
      apt-pkg/contrib/progress.h
  31. 5 0
      apt-pkg/contrib/sha1.h
  32. 6 0
      apt-pkg/contrib/strutl.h
  33. 14 21
      apt-pkg/deb/debindexfile.cc
  34. 1 0
      apt-pkg/deb/deblistparser.cc
  35. 4 0
      apt-pkg/deb/deblistparser.h
  36. 4 0
      apt-pkg/deb/debmetaindex.h
  37. 1 1
      apt-pkg/deb/debrecords.cc
  38. 4 0
      apt-pkg/deb/debrecords.h
  39. 1 1
      apt-pkg/deb/debsrcrecords.h
  40. 52 21
      apt-pkg/deb/dpkgpm.cc
  41. 5 0
      apt-pkg/deb/dpkgpm.h
  42. 65 33
      apt-pkg/depcache.cc
  43. 5 0
      apt-pkg/depcache.h
  44. 6 3
      apt-pkg/edsp.h
  45. 4 7
      apt-pkg/edsp/edspindexfile.cc
  46. 4 0
      apt-pkg/edsp/edspindexfile.h
  47. 6 0
      apt-pkg/edsp/edsplistparser.h
  48. 59 116
      apt-pkg/indexcopy.cc
  49. 5 0
      apt-pkg/indexcopy.h
  50. 4 0
      apt-pkg/indexfile.h
  51. 4 0
      apt-pkg/indexrecords.h
  52. 5 0
      apt-pkg/init.h
  53. 7 0
      apt-pkg/metaindex.h
  54. 1 1
      apt-pkg/packagemanager.cc
  55. 5 0
      apt-pkg/packagemanager.h
  56. 35 9
      apt-pkg/pkgcache.cc
  57. 5 2
      apt-pkg/pkgcache.h
  58. 9 7
      apt-pkg/pkgcachegen.cc
  59. 4 0
      apt-pkg/pkgsystem.h
  60. 4 0
      apt-pkg/policy.h
  61. 15 13
      apt-pkg/sourcelist.h
  62. 4 4
      apt-pkg/srcrecords.cc
  63. 5 0
      apt-pkg/srcrecords.h
  64. 4 0
      apt-pkg/tagfile.h
  65. 4 0
      apt-pkg/vendor.h
  66. 7 0
      apt-pkg/vendorlist.h
  67. 4 0
      apt-pkg/version.h
  68. 4 0
      apt-pkg/versionmatch.h
  69. 2 0
      buildlib/config.h.in
  70. 19 19
      cmdline/apt-cache.cc
  71. 16 0
      cmdline/apt-config.cc
  72. 6 4
      cmdline/apt-extracttemplates.h
  73. 29 18
      cmdline/apt-get.cc
  74. 8 8
      cmdline/apt-mark.cc
  75. 1 1
      configure.in
  76. 71 5
      debian/changelog
  77. 7 1
      debian/control
  78. 0 2
      debian/libapt-inst1.4.install
  79. 2 0
      debian/libapt-inst1.4.install.in
  80. 0 2
      debian/libapt-pkg-dev.dirs
  81. 0 3
      debian/libapt-pkg-dev.install
  82. 3 0
      debian/libapt-pkg-dev.install.in
  83. 0 2
      debian/libapt-pkg4.12.install
  84. 2 0
      debian/libapt-pkg4.12.install.in
  85. 9 3
      debian/rules
  86. 3 3
      doc/apt-get.8.xml
  87. 1 1
      doc/apt-key.8.xml
  88. 1 1
      doc/apt.conf.5.xml
  89. 2 0
      doc/manpage-style.xsl
  90. 255 360
      doc/po/de.po
  91. 127 1
      doc/po/es.po
  92. 167 1
      doc/po/fr.po
  93. 77 1
      doc/po/ja.po
  94. 71 1
      doc/po/pl.po
  95. 125 1
      doc/po/pt.po
  96. 1 1
      doc/sources.list.5.xml
  97. 4 4
      ftparchive/cachedb.cc
  98. 13 127
      ftparchive/multicompress.cc
  99. 1 5
      ftparchive/multicompress.h
  100. 0 0
      ftparchive/writer.cc

+ 2 - 0
.bzrignore

@@ -10,6 +10,8 @@ build/
 configure
 configure
 buildlib/config.sub
 buildlib/config.sub
 buildlib/config.guess
 buildlib/config.guess
+debian/libapt-pkg[0-9]*.install
+debian/libapt-inst[0-9]*.install
 
 
 # abichecker related files/dir
 # abichecker related files/dir
 abicheck/apt_build.xml
 abicheck/apt_build.xml

+ 3 - 0
apt-inst/contrib/arfile.h

@@ -17,6 +17,9 @@
 
 
 
 
 #include <string>
 #include <string>
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/fileutl.h>
+#endif
 
 
 class FileFd;
 class FileFd;
 
 

+ 6 - 0
apt-inst/contrib/extracttar.h

@@ -18,6 +18,12 @@
 
 
 #include <string>
 #include <string>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/dirstream.h>
+#include <algorithm>
+using std::min;
+#endif
+
 class pkgDirStream;
 class pkgDirStream;
 
 
 class ExtractTar
 class ExtractTar

+ 4 - 0
apt-inst/database.h

@@ -25,6 +25,10 @@
 
 
 #include <string>
 #include <string>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/filelist.h>
+#endif
+
 class pkgFLCache;
 class pkgFLCache;
 class OpProgress;
 class OpProgress;
 
 

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

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

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

@@ -438,7 +438,7 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string IndexDiffFile)		/*{{{*/
 
 
       FileFd fd(CurrentPackagesFile, FileFd::ReadOnly);
       FileFd fd(CurrentPackagesFile, FileFd::ReadOnly);
       SHA1Summation SHA1;
       SHA1Summation SHA1;
-      SHA1.AddFD(fd.Fd(), fd.Size());
+      SHA1.AddFD(fd);
       string const local_sha1 = SHA1.Result();
       string const local_sha1 = SHA1.Result();
 
 
       if(local_sha1 == ServerSha1) 
       if(local_sha1 == ServerSha1) 
@@ -669,7 +669,7 @@ bool pkgAcqIndexDiffs::QueueNextDiff()					/*{{{*/
 
 
    FileFd fd(FinalFile, FileFd::ReadOnly);
    FileFd fd(FinalFile, FileFd::ReadOnly);
    SHA1Summation SHA1;
    SHA1Summation SHA1;
-   SHA1.AddFD(fd.Fd(), fd.Size());
+   SHA1.AddFD(fd);
    string local_sha1 = string(SHA1.Result());
    string local_sha1 = string(SHA1.Result());
    if(Debug)
    if(Debug)
       std::clog << "QueueNextDiff: " 
       std::clog << "QueueNextDiff: " 

+ 8 - 0
apt-pkg/acquire-item.h

@@ -25,6 +25,14 @@
 #include <apt-pkg/weakptr.h>
 #include <apt-pkg/weakptr.h>
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/pkgcache.h>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/indexfile.h>
+#include <apt-pkg/vendor.h>
+#include <apt-pkg/sourcelist.h>
+#include <apt-pkg/pkgrecords.h>
+#include <apt-pkg/indexrecords.h>
+#endif
+
 /** \addtogroup acquire
 /** \addtogroup acquire
  *  @{
  *  @{
  *
  *

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

@@ -25,6 +25,11 @@
 #include <string>
 #include <string>
 #include <vector>
 #include <vector>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/strutl.h>
+#endif
+
 class Hashes;
 class Hashes;
 class pkgAcqMethod
 class pkgAcqMethod
 {
 {

+ 5 - 0
apt-pkg/acquire.h

@@ -75,6 +75,11 @@
 #include <sys/time.h>
 #include <sys/time.h>
 #include <unistd.h>
 #include <unistd.h>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::vector;
+using std::string;
+#endif
+
 class pkgAcquireStatus;
 class pkgAcquireStatus;
 
 
 /** \brief The core download scheduler.					{{{
 /** \brief The core download scheduler.					{{{

+ 5 - 0
apt-pkg/algorithms.h

@@ -36,6 +36,11 @@
 
 
 #include <iostream>
 #include <iostream>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/acquire.h>
+using std::ostream;
+#endif
+
 class pkgAcquireStatus;
 class pkgAcquireStatus;
 
 
 class pkgSimulate : public pkgPackageManager				/*{{{*/
 class pkgSimulate : public pkgPackageManager				/*{{{*/

+ 6 - 0
apt-pkg/cachefile.h

@@ -20,6 +20,12 @@
 #include <apt-pkg/depcache.h>
 #include <apt-pkg/depcache.h>
 #include <apt-pkg/macros.h>
 #include <apt-pkg/macros.h>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/acquire.h>
+#include <apt-pkg/policy.h>
+#include <apt-pkg/sourcelist.h>
+#endif
+
 class pkgPolicy;
 class pkgPolicy;
 class pkgSourceList;
 class pkgSourceList;
 class OpProgress;
 class OpProgress;

+ 2 - 0
apt-pkg/cacheiterators.h

@@ -283,6 +283,8 @@ class pkgCache::DepIterator : public Iterator<Dependency, DepIterator> {
 	inline bool Reverse() const {return Type == DepRev;};
 	inline bool Reverse() const {return Type == DepRev;};
 	bool IsCritical() const;
 	bool IsCritical() const;
 	bool IsNegative() const;
 	bool IsNegative() const;
+	bool IsIgnorable(PrvIterator const &Prv) const;
+	bool IsIgnorable(PkgIterator const &Pkg) const;
 	void GlobOr(DepIterator &Start,DepIterator &End);
 	void GlobOr(DepIterator &Start,DepIterator &End);
 	Version **AllTargets() const;
 	Version **AllTargets() const;
 	bool SmartTargetPkg(PkgIterator &Result) const;
 	bool SmartTargetPkg(PkgIterator &Result) const;

+ 203 - 178
apt-pkg/cacheset.cc

@@ -29,7 +29,7 @@
 									/*}}}*/
 									/*}}}*/
 namespace APT {
 namespace APT {
 // FromTask - Return all packages in the cache from a specific task	/*{{{*/
 // FromTask - Return all packages in the cache from a specific task	/*{{{*/
-PackageSet PackageSet::FromTask(pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
+bool PackageContainerInterface::FromTask(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
 	size_t const archfound = pattern.find_last_of(':');
 	size_t const archfound = pattern.find_last_of(':');
 	std::string arch = "native";
 	std::string arch = "native";
 	if (archfound != std::string::npos) {
 	if (archfound != std::string::npos) {
@@ -38,13 +38,16 @@ PackageSet PackageSet::FromTask(pkgCacheFile &Cache, std::string pattern, CacheS
 	}
 	}
 
 
 	if (pattern[pattern.length() -1] != '^')
 	if (pattern[pattern.length() -1] != '^')
-		return APT::PackageSet(TASK);
+		return false;
 	pattern.erase(pattern.length()-1);
 	pattern.erase(pattern.length()-1);
 
 
 	if (unlikely(Cache.GetPkgCache() == 0 || Cache.GetDepCache() == 0))
 	if (unlikely(Cache.GetPkgCache() == 0 || Cache.GetDepCache() == 0))
-		return APT::PackageSet(TASK);
+		return false;
+
+	bool const wasEmpty = pci->empty();
+	if (wasEmpty == true)
+		pci->setConstructor(TASK);
 
 
-	PackageSet pkgset(TASK);
 	// get the records
 	// get the records
 	pkgRecords Recs(Cache);
 	pkgRecords Recs(Cache);
 
 
@@ -54,9 +57,10 @@ PackageSet PackageSet::FromTask(pkgCacheFile &Cache, std::string pattern, CacheS
 	snprintf(S, sizeof(S), "^Task:.*[, ]%s([, ]|$)", pattern.c_str());
 	snprintf(S, sizeof(S), "^Task:.*[, ]%s([, ]|$)", pattern.c_str());
 	if(regcomp(&Pattern,S, REG_EXTENDED | REG_NOSUB | REG_NEWLINE) != 0) {
 	if(regcomp(&Pattern,S, REG_EXTENDED | REG_NOSUB | REG_NEWLINE) != 0) {
 		_error->Error("Failed to compile task regexp");
 		_error->Error("Failed to compile task regexp");
-		return pkgset;
+		return false;
 	}
 	}
 
 
+	bool found = false;
 	for (pkgCache::GrpIterator Grp = Cache->GrpBegin(); Grp.end() == false; ++Grp) {
 	for (pkgCache::GrpIterator Grp = Cache->GrpBegin(); Grp.end() == false; ++Grp) {
 		pkgCache::PkgIterator Pkg = Grp.FindPkg(arch);
 		pkgCache::PkgIterator Pkg = Grp.FindPkg(arch);
 		if (Pkg.end() == true)
 		if (Pkg.end() == true)
@@ -75,22 +79,33 @@ PackageSet PackageSet::FromTask(pkgCacheFile &Cache, std::string pattern, CacheS
 		if (regexec(&Pattern, buf, 0, 0, 0) != 0)
 		if (regexec(&Pattern, buf, 0, 0, 0) != 0)
 			continue;
 			continue;
 
 
-		pkgset.insert(Pkg);
+		pci->insert(Pkg);
+		helper.showTaskSelection(Pkg, pattern);
+		found = true;
 	}
 	}
 	regfree(&Pattern);
 	regfree(&Pattern);
 
 
-	if (pkgset.empty() == true)
-		return helper.canNotFindTask(Cache, pattern);
+	if (found == false) {
+		helper.canNotFindTask(pci, Cache, pattern);
+		pci->setConstructor(UNKNOWN);
+		return false;
+	}
+
+	if (wasEmpty == false && pci->getConstructor() != UNKNOWN)
+		pci->setConstructor(UNKNOWN);
 
 
-	helper.showTaskSelection(pkgset, pattern);
-	return pkgset;
+	return true;
 }
 }
 									/*}}}*/
 									/*}}}*/
 // FromRegEx - Return all packages in the cache matching a pattern	/*{{{*/
 // FromRegEx - Return all packages in the cache matching a pattern	/*{{{*/
-PackageSet PackageSet::FromRegEx(pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
+bool PackageContainerInterface::FromRegEx(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
 	static const char * const isregex = ".?+*|[^$";
 	static const char * const isregex = ".?+*|[^$";
 	if (pattern.find_first_of(isregex) == std::string::npos)
 	if (pattern.find_first_of(isregex) == std::string::npos)
-		return PackageSet(REGEX);
+		return false;
+
+	bool const wasEmpty = pci->empty();
+	if (wasEmpty == true)
+		pci->setConstructor(REGEX);
 
 
 	size_t archfound = pattern.find_last_of(':');
 	size_t archfound = pattern.find_last_of(':');
 	std::string arch = "native";
 	std::string arch = "native";
@@ -103,11 +118,11 @@ PackageSet PackageSet::FromRegEx(pkgCacheFile &Cache, std::string pattern, Cache
 	}
 	}
 
 
 	if (unlikely(Cache.GetPkgCache() == 0))
 	if (unlikely(Cache.GetPkgCache() == 0))
-		return PackageSet(REGEX);
+		return false;
 
 
 	APT::CacheFilter::PackageNameMatchesRegEx regexfilter(pattern);
 	APT::CacheFilter::PackageNameMatchesRegEx regexfilter(pattern);
 
 
-	PackageSet pkgset(REGEX);
+	bool found = false;
 	for (pkgCache::GrpIterator Grp = Cache.GetPkgCache()->GrpBegin(); Grp.end() == false; ++Grp) {
 	for (pkgCache::GrpIterator Grp = Cache.GetPkgCache()->GrpBegin(); Grp.end() == false; ++Grp) {
 		if (regexfilter(Grp) == false)
 		if (regexfilter(Grp) == false)
 			continue;
 			continue;
@@ -123,18 +138,25 @@ PackageSet PackageSet::FromRegEx(pkgCacheFile &Cache, std::string pattern, Cache
 				continue;
 				continue;
 		}
 		}
 
 
-		pkgset.insert(Pkg);
+		pci->insert(Pkg);
+		helper.showRegExSelection(Pkg, pattern);
+		found = true;
 	}
 	}
 
 
-	if (pkgset.empty() == true)
-		return helper.canNotFindRegEx(Cache, pattern);
+	if (found == false) {
+		helper.canNotFindRegEx(pci, Cache, pattern);
+		pci->setConstructor(UNKNOWN);
+		return false;
+	}
+
+	if (wasEmpty == false && pci->getConstructor() != UNKNOWN)
+		pci->setConstructor(UNKNOWN);
 
 
-	helper.showRegExSelection(pkgset, pattern);
-	return pkgset;
+	return true;
 }
 }
 									/*}}}*/
 									/*}}}*/
 // FromName - Returns the package defined  by this string		/*{{{*/
 // FromName - Returns the package defined  by this string		/*{{{*/
-pkgCache::PkgIterator PackageSet::FromName(pkgCacheFile &Cache,
+pkgCache::PkgIterator PackageContainerInterface::FromName(pkgCacheFile &Cache,
 			std::string const &str, CacheSetHelper &helper) {
 			std::string const &str, CacheSetHelper &helper) {
 	std::string pkg = str;
 	std::string pkg = str;
 	size_t archfound = pkg.find_last_of(':');
 	size_t archfound = pkg.find_last_of(':');
@@ -160,144 +182,131 @@ pkgCache::PkgIterator PackageSet::FromName(pkgCacheFile &Cache,
 	return Pkg;
 	return Pkg;
 }
 }
 									/*}}}*/
 									/*}}}*/
-// GroupedFromCommandLine - Return all versions specified on commandline/*{{{*/
-std::map<unsigned short, PackageSet> PackageSet::GroupedFromCommandLine(
-		pkgCacheFile &Cache, const char **cmdline,
-		std::list<PackageSet::Modifier> const &mods,
-		unsigned short const &fallback, CacheSetHelper &helper) {
-	std::map<unsigned short, PackageSet> pkgsets;
-	for (const char **I = cmdline; *I != 0; ++I) {
-		unsigned short modID = fallback;
-		std::string str = *I;
-		bool modifierPresent = false;
-		for (std::list<PackageSet::Modifier>::const_iterator mod = mods.begin();
-		     mod != mods.end(); ++mod) {
-			size_t const alength = strlen(mod->Alias);
-			switch(mod->Pos) {
-			case PackageSet::Modifier::POSTFIX:
-				if (str.compare(str.length() - alength, alength,
-						mod->Alias, 0, alength) != 0)
-					continue;
-				str.erase(str.length() - alength);
-				modID = mod->ID;
-				break;
-			case PackageSet::Modifier::PREFIX:
-				continue;
-			case PackageSet::Modifier::NONE:
-				continue;
-			}
-			modifierPresent = true;
-			break;
-		}
-		if (modifierPresent == true) {
-			bool const errors = helper.showErrors(false);
-			pkgCache::PkgIterator Pkg = FromName(Cache, *I, helper);
-			helper.showErrors(errors);
-			if (Pkg.end() == false) {
-				pkgsets[fallback].insert(Pkg);
-				continue;
-			}
-		}
-		pkgsets[modID].insert(PackageSet::FromString(Cache, str, helper));
-	}
-	return pkgsets;
-}
-									/*}}}*/
-// FromCommandLine - Return all packages specified on commandline	/*{{{*/
-PackageSet PackageSet::FromCommandLine(pkgCacheFile &Cache, const char **cmdline, CacheSetHelper &helper) {
-	PackageSet pkgset;
-	for (const char **I = cmdline; *I != 0; ++I) {
-		PackageSet pset = FromString(Cache, *I, helper);
-		pkgset.insert(pset.begin(), pset.end());
-	}
-	return pkgset;
-}
-									/*}}}*/
 // FromString - Return all packages matching a specific string		/*{{{*/
 // FromString - Return all packages matching a specific string		/*{{{*/
-PackageSet PackageSet::FromString(pkgCacheFile &Cache, std::string const &str, CacheSetHelper &helper) {
+bool PackageContainerInterface::FromString(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &str, CacheSetHelper &helper) {
+	bool found = true;
 	_error->PushToStack();
 	_error->PushToStack();
 
 
-	PackageSet pkgset;
 	pkgCache::PkgIterator Pkg = FromName(Cache, str, helper);
 	pkgCache::PkgIterator Pkg = FromName(Cache, str, helper);
 	if (Pkg.end() == false)
 	if (Pkg.end() == false)
-		pkgset.insert(Pkg);
-	else {
-		pkgset = FromTask(Cache, str, helper);
-		if (pkgset.empty() == true) {
-			pkgset = FromRegEx(Cache, str, helper);
-			if (pkgset.empty() == true)
-				pkgset = helper.canNotFindPackage(Cache, str);
-		}
+		pci->insert(Pkg);
+	else if (FromTask(pci, Cache, str, helper) == false &&
+		 FromRegEx(pci, Cache, str, helper) == false)
+	{
+		helper.canNotFindPackage(pci, Cache, str);
+		found = false;
 	}
 	}
 
 
-	if (pkgset.empty() == false)
+	if (found == true)
 		_error->RevertToStack();
 		_error->RevertToStack();
 	else
 	else
 		_error->MergeWithStack();
 		_error->MergeWithStack();
-	return pkgset;
+	return found;
 }
 }
 									/*}}}*/
 									/*}}}*/
-// GroupedFromCommandLine - Return all versions specified on commandline/*{{{*/
-std::map<unsigned short, VersionSet> VersionSet::GroupedFromCommandLine(
-		pkgCacheFile &Cache, const char **cmdline,
-		std::list<VersionSet::Modifier> const &mods,
-		unsigned short const &fallback, CacheSetHelper &helper) {
-	std::map<unsigned short, VersionSet> versets;
-	for (const char **I = cmdline; *I != 0; ++I) {
-		unsigned short modID = fallback;
-		VersionSet::Version select = VersionSet::NEWEST;
-		std::string str = *I;
-		bool modifierPresent = false;
-		for (std::list<VersionSet::Modifier>::const_iterator mod = mods.begin();
-		     mod != mods.end(); ++mod) {
-			if (modID == fallback && mod->ID == fallback)
-				select = mod->SelectVersion;
-			size_t const alength = strlen(mod->Alias);
-			switch(mod->Pos) {
-			case VersionSet::Modifier::POSTFIX:
-				if (str.compare(str.length() - alength, alength,
-						mod->Alias, 0, alength) != 0)
-					continue;
-				str.erase(str.length() - alength);
-				modID = mod->ID;
-				select = mod->SelectVersion;
-				break;
-			case VersionSet::Modifier::PREFIX:
-				continue;
-			case VersionSet::Modifier::NONE:
+// FromCommandLine - Return all packages specified on commandline	/*{{{*/
+bool PackageContainerInterface::FromCommandLine(PackageContainerInterface * const pci, pkgCacheFile &Cache, const char **cmdline, CacheSetHelper &helper) {
+	bool found = false;
+	for (const char **I = cmdline; *I != 0; ++I)
+		found |= PackageContainerInterface::FromString(pci, Cache, *I, helper);
+	return found;
+}
+									/*}}}*/
+// FromModifierCommandLine - helper doing the work for PKG:GroupedFromCommandLine	/*{{{*/
+bool PackageContainerInterface::FromModifierCommandLine(unsigned short &modID, PackageContainerInterface * const pci,
+							pkgCacheFile &Cache, const char * cmdline,
+							std::list<Modifier> const &mods, CacheSetHelper &helper) {
+	std::string str = cmdline;
+	bool modifierPresent = false;
+	for (std::list<Modifier>::const_iterator mod = mods.begin();
+	     mod != mods.end(); ++mod) {
+		size_t const alength = strlen(mod->Alias);
+		switch(mod->Pos) {
+		case Modifier::POSTFIX:
+			if (str.compare(str.length() - alength, alength,
+					mod->Alias, 0, alength) != 0)
 				continue;
 				continue;
-			}
-			modifierPresent = true;
+			str.erase(str.length() - alength);
+			modID = mod->ID;
 			break;
 			break;
+		case Modifier::PREFIX:
+			continue;
+		case Modifier::NONE:
+			continue;
 		}
 		}
-
-		if (modifierPresent == true) {
-			bool const errors = helper.showErrors(false);
-			VersionSet const vset = VersionSet::FromString(Cache, std::string(*I), select, helper, true);
-			helper.showErrors(errors);
-			if (vset.empty() == false) {
-				versets[fallback].insert(vset);
+		modifierPresent = true;
+		break;
+	}
+	if (modifierPresent == true) {
+		bool const errors = helper.showErrors(false);
+		pkgCache::PkgIterator Pkg = FromName(Cache, cmdline, helper);
+		helper.showErrors(errors);
+		if (Pkg.end() == false) {
+			pci->insert(Pkg);
+			return true;
+		}
+	}
+	return FromString(pci, Cache, str, helper);
+}
+									/*}}}*/
+// FromModifierCommandLine - helper doing the work for VER:GroupedFromCommandLine	/*{{{*/
+bool VersionContainerInterface::FromModifierCommandLine(unsigned short &modID,
+							VersionContainerInterface * const vci,
+							pkgCacheFile &Cache, const char * cmdline,
+							std::list<Modifier> const &mods,
+							CacheSetHelper &helper) {
+	Version select = NEWEST;
+	std::string str = cmdline;
+	bool modifierPresent = false;
+	unsigned short fallback = modID;
+	for (std::list<Modifier>::const_iterator mod = mods.begin();
+	     mod != mods.end(); ++mod) {
+		if (modID == fallback && mod->ID == fallback)
+			select = mod->SelectVersion;
+		size_t const alength = strlen(mod->Alias);
+		switch(mod->Pos) {
+		case Modifier::POSTFIX:
+			if (str.compare(str.length() - alength, alength,
+					mod->Alias, 0, alength) != 0)
 				continue;
 				continue;
-			}
+			str.erase(str.length() - alength);
+			modID = mod->ID;
+			select = mod->SelectVersion;
+			break;
+		case Modifier::PREFIX:
+			continue;
+		case Modifier::NONE:
+			continue;
 		}
 		}
-		versets[modID].insert(VersionSet::FromString(Cache, str, select , helper));
+		modifierPresent = true;
+		break;
 	}
 	}
-	return versets;
+
+	if (modifierPresent == true) {
+		bool const errors = helper.showErrors(false);
+		bool const found = VersionContainerInterface::FromString(vci, Cache, cmdline, select, helper, true);
+		helper.showErrors(errors);
+		if (found == true)
+			return true;
+	}
+	return FromString(vci, Cache, str, select, helper);
 }
 }
 									/*}}}*/
 									/*}}}*/
 // FromCommandLine - Return all versions specified on commandline	/*{{{*/
 // FromCommandLine - Return all versions specified on commandline	/*{{{*/
-APT::VersionSet VersionSet::FromCommandLine(pkgCacheFile &Cache, const char **cmdline,
-		APT::VersionSet::Version const &fallback, CacheSetHelper &helper) {
-	VersionSet verset;
+bool VersionContainerInterface::FromCommandLine(VersionContainerInterface * const vci,
+						pkgCacheFile &Cache, const char **cmdline,
+						Version const &fallback, CacheSetHelper &helper) {
+	bool found = false;
 	for (const char **I = cmdline; *I != 0; ++I)
 	for (const char **I = cmdline; *I != 0; ++I)
-		verset.insert(VersionSet::FromString(Cache, *I, fallback, helper));
-	return verset;
+		found |= VersionContainerInterface::FromString(vci, Cache, *I, fallback, helper);
+	return found;
 }
 }
 									/*}}}*/
 									/*}}}*/
 // FromString - Returns all versions spedcified by a string		/*{{{*/
 // FromString - Returns all versions spedcified by a string		/*{{{*/
-APT::VersionSet VersionSet::FromString(pkgCacheFile &Cache, std::string pkg,
-		APT::VersionSet::Version const &fallback, CacheSetHelper &helper,
-		bool const &onlyFromName) {
+bool VersionContainerInterface::FromString(VersionContainerInterface * const vci,
+					   pkgCacheFile &Cache, std::string pkg,
+					   Version const &fallback, CacheSetHelper &helper,
+					   bool const onlyFromName) {
 	std::string ver;
 	std::string ver;
 	bool verIsRel = false;
 	bool verIsRel = false;
 	size_t const vertag = pkg.find_last_of("/=");
 	size_t const vertag = pkg.find_last_of("/=");
@@ -308,19 +317,20 @@ APT::VersionSet VersionSet::FromString(pkgCacheFile &Cache, std::string pkg,
 	}
 	}
 	PackageSet pkgset;
 	PackageSet pkgset;
 	if (onlyFromName == false)
 	if (onlyFromName == false)
-		pkgset = PackageSet::FromString(Cache, pkg, helper);
+		PackageContainerInterface::FromString(&pkgset, Cache, pkg, helper);
 	else {
 	else {
-		pkgset.insert(PackageSet::FromName(Cache, pkg, helper));
+		pkgset.insert(PackageContainerInterface::FromName(Cache, pkg, helper));
 	}
 	}
 
 
-	VersionSet verset;
 	bool errors = true;
 	bool errors = true;
 	if (pkgset.getConstructor() != PackageSet::UNKNOWN)
 	if (pkgset.getConstructor() != PackageSet::UNKNOWN)
 		errors = helper.showErrors(false);
 		errors = helper.showErrors(false);
+
+	bool found = false;
 	for (PackageSet::const_iterator P = pkgset.begin();
 	for (PackageSet::const_iterator P = pkgset.begin();
 	     P != pkgset.end(); ++P) {
 	     P != pkgset.end(); ++P) {
 		if (vertag == std::string::npos) {
 		if (vertag == std::string::npos) {
-			verset.insert(VersionSet::FromPackage(Cache, P, fallback, helper));
+			found |= VersionContainerInterface::FromPackage(vci, Cache, P, fallback, helper);
 			continue;
 			continue;
 		}
 		}
 		pkgCache::VerIterator V;
 		pkgCache::VerIterator V;
@@ -350,75 +360,78 @@ APT::VersionSet VersionSet::FromString(pkgCacheFile &Cache, std::string pkg,
 		if (V.end() == true)
 		if (V.end() == true)
 			continue;
 			continue;
 		helper.showSelectedVersion(P, V, ver, verIsRel);
 		helper.showSelectedVersion(P, V, ver, verIsRel);
-		verset.insert(V);
+		vci->insert(V);
+		found = true;
 	}
 	}
 	if (pkgset.getConstructor() != PackageSet::UNKNOWN)
 	if (pkgset.getConstructor() != PackageSet::UNKNOWN)
 		helper.showErrors(errors);
 		helper.showErrors(errors);
-	return verset;
+	return found;
 }
 }
 									/*}}}*/
 									/*}}}*/
 // FromPackage - versions from package based on fallback		/*{{{*/
 // FromPackage - versions from package based on fallback		/*{{{*/
-VersionSet VersionSet::FromPackage(pkgCacheFile &Cache, pkgCache::PkgIterator const &P,
-		VersionSet::Version const &fallback, CacheSetHelper &helper) {
-	VersionSet verset;
+bool VersionContainerInterface::FromPackage(VersionContainerInterface * const vci,
+					    pkgCacheFile &Cache,
+					    pkgCache::PkgIterator const &P,
+					    Version const &fallback,
+					    CacheSetHelper &helper) {
 	pkgCache::VerIterator V;
 	pkgCache::VerIterator V;
 	bool showErrors;
 	bool showErrors;
+	bool found = false;
 	switch(fallback) {
 	switch(fallback) {
-	case VersionSet::ALL:
+	case ALL:
 		if (P->VersionList != 0)
 		if (P->VersionList != 0)
 			for (V = P.VersionList(); V.end() != true; ++V)
 			for (V = P.VersionList(); V.end() != true; ++V)
-				verset.insert(V);
+				found |= vci->insert(V);
 		else
 		else
-			verset.insert(helper.canNotFindAllVer(Cache, P));
+			helper.canNotFindAllVer(vci, Cache, P);
 		break;
 		break;
-	case VersionSet::CANDANDINST:
-		verset.insert(getInstalledVer(Cache, P, helper));
-		verset.insert(getCandidateVer(Cache, P, helper));
+	case CANDANDINST:
+		found |= vci->insert(getInstalledVer(Cache, P, helper));
+		found |= vci->insert(getCandidateVer(Cache, P, helper));
 		break;
 		break;
-	case VersionSet::CANDIDATE:
-		verset.insert(getCandidateVer(Cache, P, helper));
+	case CANDIDATE:
+		found |= vci->insert(getCandidateVer(Cache, P, helper));
 		break;
 		break;
-	case VersionSet::INSTALLED:
-		verset.insert(getInstalledVer(Cache, P, helper));
+	case INSTALLED:
+		found |= vci->insert(getInstalledVer(Cache, P, helper));
 		break;
 		break;
-	case VersionSet::CANDINST:
+	case CANDINST:
 		showErrors = helper.showErrors(false);
 		showErrors = helper.showErrors(false);
 		V = getCandidateVer(Cache, P, helper);
 		V = getCandidateVer(Cache, P, helper);
 		if (V.end() == true)
 		if (V.end() == true)
 			V = getInstalledVer(Cache, P, helper);
 			V = getInstalledVer(Cache, P, helper);
 		helper.showErrors(showErrors);
 		helper.showErrors(showErrors);
 		if (V.end() == false)
 		if (V.end() == false)
-			verset.insert(V);
+			found |= vci->insert(V);
 		else
 		else
-			verset.insert(helper.canNotFindInstCandVer(Cache, P));
+			helper.canNotFindInstCandVer(vci, Cache, P);
 		break;
 		break;
-	case VersionSet::INSTCAND:
+	case INSTCAND:
 		showErrors = helper.showErrors(false);
 		showErrors = helper.showErrors(false);
 		V = getInstalledVer(Cache, P, helper);
 		V = getInstalledVer(Cache, P, helper);
 		if (V.end() == true)
 		if (V.end() == true)
 			V = getCandidateVer(Cache, P, helper);
 			V = getCandidateVer(Cache, P, helper);
 		helper.showErrors(showErrors);
 		helper.showErrors(showErrors);
 		if (V.end() == false)
 		if (V.end() == false)
-			verset.insert(V);
+			found |= vci->insert(V);
 		else
 		else
-			verset.insert(helper.canNotFindInstCandVer(Cache, P));
+			helper.canNotFindInstCandVer(vci, Cache, P);
 		break;
 		break;
-	case VersionSet::NEWEST:
+	case NEWEST:
 		if (P->VersionList != 0)
 		if (P->VersionList != 0)
-			verset.insert(P.VersionList());
+			found |= vci->insert(P.VersionList());
 		else
 		else
-			verset.insert(helper.canNotFindNewestVer(Cache, P));
+			helper.canNotFindNewestVer(Cache, P);
 		break;
 		break;
 	}
 	}
-	return verset;
+	return found;
 }
 }
 									/*}}}*/
 									/*}}}*/
 // getCandidateVer - Returns the candidate version of the given package	/*{{{*/
 // getCandidateVer - Returns the candidate version of the given package	/*{{{*/
-pkgCache::VerIterator VersionSet::getCandidateVer(pkgCacheFile &Cache,
+pkgCache::VerIterator VersionContainerInterface::getCandidateVer(pkgCacheFile &Cache,
 		pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper) {
 		pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper) {
 	pkgCache::VerIterator Cand;
 	pkgCache::VerIterator Cand;
-	if (Cache.IsPolicyBuilt() == true || Cache.IsDepCacheBuilt() == false)
-	{
+	if (Cache.IsPolicyBuilt() == true || Cache.IsDepCacheBuilt() == false) {
 		if (unlikely(Cache.GetPolicy() == 0))
 		if (unlikely(Cache.GetPolicy() == 0))
 			return pkgCache::VerIterator(Cache);
 			return pkgCache::VerIterator(Cache);
 		Cand = Cache.GetPolicy()->GetCandidateVer(Pkg);
 		Cand = Cache.GetPolicy()->GetCandidateVer(Pkg);
@@ -431,13 +444,14 @@ pkgCache::VerIterator VersionSet::getCandidateVer(pkgCacheFile &Cache,
 }
 }
 									/*}}}*/
 									/*}}}*/
 // getInstalledVer - Returns the installed version of the given package	/*{{{*/
 // getInstalledVer - Returns the installed version of the given package	/*{{{*/
-pkgCache::VerIterator VersionSet::getInstalledVer(pkgCacheFile &Cache,
+pkgCache::VerIterator VersionContainerInterface::getInstalledVer(pkgCacheFile &Cache,
 		pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper) {
 		pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper) {
 	if (Pkg->CurrentVer == 0)
 	if (Pkg->CurrentVer == 0)
 		return helper.canNotFindInstalledVer(Cache, Pkg);
 		return helper.canNotFindInstalledVer(Cache, Pkg);
 	return Pkg.CurrentVer();
 	return Pkg.CurrentVer();
 }
 }
 									/*}}}*/
 									/*}}}*/
+
 // canNotFindPkgName - handle the case no package has this name		/*{{{*/
 // canNotFindPkgName - handle the case no package has this name		/*{{{*/
 pkgCache::PkgIterator CacheSetHelper::canNotFindPkgName(pkgCacheFile &Cache,
 pkgCache::PkgIterator CacheSetHelper::canNotFindPkgName(pkgCacheFile &Cache,
 			std::string const &str) {
 			std::string const &str) {
@@ -447,46 +461,40 @@ pkgCache::PkgIterator CacheSetHelper::canNotFindPkgName(pkgCacheFile &Cache,
 }
 }
 									/*}}}*/
 									/*}}}*/
 // canNotFindTask - handle the case no package is found for a task	/*{{{*/
 // canNotFindTask - handle the case no package is found for a task	/*{{{*/
-PackageSet CacheSetHelper::canNotFindTask(pkgCacheFile &Cache, std::string pattern) {
+void CacheSetHelper::canNotFindTask(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern) {
 	if (ShowError == true)
 	if (ShowError == true)
 		_error->Insert(ErrorType, _("Couldn't find task '%s'"), pattern.c_str());
 		_error->Insert(ErrorType, _("Couldn't find task '%s'"), pattern.c_str());
-	return PackageSet();
 }
 }
 									/*}}}*/
 									/*}}}*/
 // canNotFindRegEx - handle the case no package is found by a regex	/*{{{*/
 // canNotFindRegEx - handle the case no package is found by a regex	/*{{{*/
-PackageSet CacheSetHelper::canNotFindRegEx(pkgCacheFile &Cache, std::string pattern) {
+void CacheSetHelper::canNotFindRegEx(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern) {
 	if (ShowError == true)
 	if (ShowError == true)
 		_error->Insert(ErrorType, _("Couldn't find any package by regex '%s'"), pattern.c_str());
 		_error->Insert(ErrorType, _("Couldn't find any package by regex '%s'"), pattern.c_str());
-	return PackageSet();
 }
 }
 									/*}}}*/
 									/*}}}*/
 // canNotFindPackage - handle the case no package is found from a string/*{{{*/
 // canNotFindPackage - handle the case no package is found from a string/*{{{*/
-PackageSet CacheSetHelper::canNotFindPackage(pkgCacheFile &Cache, std::string const &str) {
-	return PackageSet();
+void CacheSetHelper::canNotFindPackage(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &str) {
 }
 }
 									/*}}}*/
 									/*}}}*/
 // canNotFindAllVer							/*{{{*/
 // canNotFindAllVer							/*{{{*/
-VersionSet CacheSetHelper::canNotFindAllVer(pkgCacheFile &Cache,
+void CacheSetHelper::canNotFindAllVer(VersionContainerInterface * const vci, pkgCacheFile &Cache,
 		pkgCache::PkgIterator const &Pkg) {
 		pkgCache::PkgIterator const &Pkg) {
 	if (ShowError == true)
 	if (ShowError == true)
 		_error->Insert(ErrorType, _("Can't select versions from package '%s' as it is purely virtual"), Pkg.FullName(true).c_str());
 		_error->Insert(ErrorType, _("Can't select versions from package '%s' as it is purely virtual"), Pkg.FullName(true).c_str());
-	return VersionSet();
 }
 }
 									/*}}}*/
 									/*}}}*/
 // canNotFindInstCandVer						/*{{{*/
 // canNotFindInstCandVer						/*{{{*/
-VersionSet CacheSetHelper::canNotFindInstCandVer(pkgCacheFile &Cache,
+void CacheSetHelper::canNotFindInstCandVer(VersionContainerInterface * const vci, pkgCacheFile &Cache,
 		pkgCache::PkgIterator const &Pkg) {
 		pkgCache::PkgIterator const &Pkg) {
 	if (ShowError == true)
 	if (ShowError == true)
 		_error->Insert(ErrorType, _("Can't select installed nor candidate version from package '%s' as it has neither of them"), Pkg.FullName(true).c_str());
 		_error->Insert(ErrorType, _("Can't select installed nor candidate version from package '%s' as it has neither of them"), Pkg.FullName(true).c_str());
-	return VersionSet();
 }
 }
 									/*}}}*/
 									/*}}}*/
 // canNotFindInstCandVer						/*{{{*/
 // canNotFindInstCandVer						/*{{{*/
-VersionSet CacheSetHelper::canNotFindCandInstVer(pkgCacheFile &Cache,
+void CacheSetHelper::canNotFindCandInstVer(VersionContainerInterface * const vci, pkgCacheFile &Cache,
 		pkgCache::PkgIterator const &Pkg) {
 		pkgCache::PkgIterator const &Pkg) {
 	if (ShowError == true)
 	if (ShowError == true)
 		_error->Insert(ErrorType, _("Can't select installed nor candidate version from package '%s' as it has neither of them"), Pkg.FullName(true).c_str());
 		_error->Insert(ErrorType, _("Can't select installed nor candidate version from package '%s' as it has neither of them"), Pkg.FullName(true).c_str());
-	return VersionSet();
 }
 }
 									/*}}}*/
 									/*}}}*/
 // canNotFindNewestVer							/*{{{*/
 // canNotFindNewestVer							/*{{{*/
@@ -513,4 +521,21 @@ pkgCache::VerIterator CacheSetHelper::canNotFindInstalledVer(pkgCacheFile &Cache
 	return pkgCache::VerIterator(Cache, 0);
 	return pkgCache::VerIterator(Cache, 0);
 }
 }
 									/*}}}*/
 									/*}}}*/
+// showTaskSelection							/*{{{*/
+void CacheSetHelper::showTaskSelection(pkgCache::PkgIterator const &pkg,
+				       std::string const &pattern) {
+}
+									/*}}}*/
+// showRegExSelection							/*{{{*/
+void CacheSetHelper::showRegExSelection(pkgCache::PkgIterator const &pkg,
+					std::string const &pattern) {
+}
+									/*}}}*/
+// showSelectedVersion							/*{{{*/
+void CacheSetHelper::showSelectedVersion(pkgCache::PkgIterator const &Pkg,
+					 pkgCache::VerIterator const Ver,
+					 std::string const &ver,
+					 bool const verIsRel) {
+}
+									/*}}}*/
 }
 }

+ 440 - 180
apt-pkg/cacheset.h

@@ -14,17 +14,24 @@
 #include <list>
 #include <list>
 #include <map>
 #include <map>
 #include <set>
 #include <set>
+#include <list>
 #include <string>
 #include <string>
+#include <iterator>
 
 
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/pkgcache.h>
+
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/cachefile.h>
+#endif
 									/*}}}*/
 									/*}}}*/
 
 
 class pkgCacheFile;
 class pkgCacheFile;
 
 
 namespace APT {
 namespace APT {
-class PackageSet;
-class VersionSet;
+class PackageContainerInterface;
+class VersionContainerInterface;
+
 class CacheSetHelper {							/*{{{*/
 class CacheSetHelper {							/*{{{*/
 /** \class APT::CacheSetHelper
 /** \class APT::CacheSetHelper
     Simple base class with a lot of virtual methods which can be overridden
     Simple base class with a lot of virtual methods which can be overridden
@@ -35,25 +42,28 @@ class CacheSetHelper {							/*{{{*/
     printed out.
     printed out.
 */
 */
 public:									/*{{{*/
 public:									/*{{{*/
-	CacheSetHelper(bool const &ShowError = true,
+	CacheSetHelper(bool const ShowError = true,
 		GlobalError::MsgType ErrorType = GlobalError::ERROR) :
 		GlobalError::MsgType ErrorType = GlobalError::ERROR) :
 			ShowError(ShowError), ErrorType(ErrorType) {};
 			ShowError(ShowError), ErrorType(ErrorType) {};
 	virtual ~CacheSetHelper() {};
 	virtual ~CacheSetHelper() {};
 
 
-	virtual void showTaskSelection(PackageSet const &pkgset, std::string const &pattern) {};
-	virtual void showRegExSelection(PackageSet const &pkgset, std::string const &pattern) {};
+	virtual void showTaskSelection(pkgCache::PkgIterator const &pkg, std::string const &pattern);
+	virtual void showRegExSelection(pkgCache::PkgIterator const &pkg, std::string const &pattern);
 	virtual void showSelectedVersion(pkgCache::PkgIterator const &Pkg, pkgCache::VerIterator const Ver,
 	virtual void showSelectedVersion(pkgCache::PkgIterator const &Pkg, pkgCache::VerIterator const Ver,
-				 std::string const &ver, bool const &verIsRel) {};
+				 std::string const &ver, bool const verIsRel);
 
 
-	virtual pkgCache::PkgIterator canNotFindPkgName(pkgCacheFile &Cache, std::string const &str);
-	virtual PackageSet canNotFindTask(pkgCacheFile &Cache, std::string pattern);
-	virtual PackageSet canNotFindRegEx(pkgCacheFile &Cache, std::string pattern);
-	virtual PackageSet canNotFindPackage(pkgCacheFile &Cache, std::string const &str);
-	virtual VersionSet canNotFindAllVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg);
-	virtual VersionSet canNotFindInstCandVer(pkgCacheFile &Cache,
+	virtual void canNotFindTask(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern);
+	virtual void canNotFindRegEx(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern);
+	virtual void canNotFindPackage(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &str);
+
+	virtual void canNotFindAllVer(VersionContainerInterface * const vci, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg);
+	virtual void canNotFindInstCandVer(VersionContainerInterface * const vci, pkgCacheFile &Cache,
 				pkgCache::PkgIterator const &Pkg);
 				pkgCache::PkgIterator const &Pkg);
-	virtual VersionSet canNotFindCandInstVer(pkgCacheFile &Cache,
+	virtual void canNotFindCandInstVer(VersionContainerInterface * const vci,
+				pkgCacheFile &Cache,
 				pkgCache::PkgIterator const &Pkg);
 				pkgCache::PkgIterator const &Pkg);
+
+	virtual pkgCache::PkgIterator canNotFindPkgName(pkgCacheFile &Cache, std::string const &str);
 	virtual pkgCache::VerIterator canNotFindNewestVer(pkgCacheFile &Cache,
 	virtual pkgCache::VerIterator canNotFindNewestVer(pkgCacheFile &Cache,
 				pkgCache::PkgIterator const &Pkg);
 				pkgCache::PkgIterator const &Pkg);
 	virtual pkgCache::VerIterator canNotFindCandidateVer(pkgCacheFile &Cache,
 	virtual pkgCache::VerIterator canNotFindCandidateVer(pkgCacheFile &Cache,
@@ -62,7 +72,7 @@ public:									/*{{{*/
 				pkgCache::PkgIterator const &Pkg);
 				pkgCache::PkgIterator const &Pkg);
 
 
 	bool showErrors() const { return ShowError; };
 	bool showErrors() const { return ShowError; };
-	bool showErrors(bool const &newValue) { if (ShowError == newValue) return ShowError; else return ((ShowError = newValue) == false); };
+	bool showErrors(bool const newValue) { if (ShowError == newValue) return ShowError; else return ((ShowError = newValue) == false); };
 	GlobalError::MsgType errorType() const { return ErrorType; };
 	GlobalError::MsgType errorType() const { return ErrorType; };
 	GlobalError::MsgType errorType(GlobalError::MsgType const &newValue)
 	GlobalError::MsgType errorType(GlobalError::MsgType const &newValue)
 	{
 	{
@@ -79,53 +89,134 @@ protected:
 	bool ShowError;
 	bool ShowError;
 	GlobalError::MsgType ErrorType;
 	GlobalError::MsgType ErrorType;
 };									/*}}}*/
 };									/*}}}*/
-class PackageSet : public std::set<pkgCache::PkgIterator> {		/*{{{*/
-/** \class APT::PackageSet
-
-    Simple wrapper around a std::set to provide a similar interface to
-    a set of packages as to the complete set of all packages in the
-    pkgCache. */
-public:									/*{{{*/
-	/** \brief smell like a pkgCache::PkgIterator */
-	class const_iterator : public std::set<pkgCache::PkgIterator>::const_iterator {/*{{{*/
+class PackageContainerInterface {					/*{{{*/
+/** \class PackageContainerInterface
+
+ * Interface ensuring that all operations can be executed on the yet to
+ * define concrete PackageContainer - access to all methods is possible,
+ * but in general the wrappers provided by the PackageContainer template
+ * are nicer to use.
+
+ * This class mostly protects use from the need to write all implementation
+ * of the methods working on containers in the template */
+public:
+	class const_iterator {						/*{{{*/
 	public:
 	public:
-		const_iterator(std::set<pkgCache::PkgIterator>::const_iterator x) :
-			 std::set<pkgCache::PkgIterator>::const_iterator(x) {}
-
-		operator pkgCache::PkgIterator(void) { return **this; }
-
-		inline const char *Name() const {return (**this).Name(); }
-		inline std::string FullName(bool const &Pretty) const { return (**this).FullName(Pretty); }
-		inline std::string FullName() const { return (**this).FullName(); }
-		inline const char *Section() const {return (**this).Section(); }
-		inline bool Purge() const {return (**this).Purge(); }
-		inline const char *Arch() const {return (**this).Arch(); }
-		inline pkgCache::GrpIterator Group() const { return (**this).Group(); }
-		inline pkgCache::VerIterator VersionList() const { return (**this).VersionList(); }
-		inline pkgCache::VerIterator CurrentVer() const { return (**this).CurrentVer(); }
-		inline pkgCache::DepIterator RevDependsList() const { return (**this).RevDependsList(); }
-		inline pkgCache::PrvIterator ProvidesList() const { return (**this).ProvidesList(); }
-		inline pkgCache::PkgIterator::OkState State() const { return (**this).State(); }
-		inline const char *CandVersion() const { return (**this).CandVersion(); }
-		inline const char *CurVersion() const { return (**this).CurVersion(); }
-		inline pkgCache *Cache() const { return (**this).Cache(); };
-		inline unsigned long Index() const {return (**this).Index();};
+		virtual pkgCache::PkgIterator getPkg() const = 0;
+		operator pkgCache::PkgIterator(void) const { return getPkg(); }
+
+		inline const char *Name() const {return getPkg().Name(); }
+		inline std::string FullName(bool const Pretty) const { return getPkg().FullName(Pretty); }
+		inline std::string FullName() const { return getPkg().FullName(); }
+		inline const char *Section() const {return getPkg().Section(); }
+		inline bool Purge() const {return getPkg().Purge(); }
+		inline const char *Arch() const {return getPkg().Arch(); }
+		inline pkgCache::GrpIterator Group() const { return getPkg().Group(); }
+		inline pkgCache::VerIterator VersionList() const { return getPkg().VersionList(); }
+		inline pkgCache::VerIterator CurrentVer() const { return getPkg().CurrentVer(); }
+		inline pkgCache::DepIterator RevDependsList() const { return getPkg().RevDependsList(); }
+		inline pkgCache::PrvIterator ProvidesList() const { return getPkg().ProvidesList(); }
+		inline pkgCache::PkgIterator::OkState State() const { return getPkg().State(); }
+		inline const char *CandVersion() const { return getPkg().CandVersion(); }
+		inline const char *CurVersion() const { return getPkg().CurVersion(); }
+		inline pkgCache *Cache() const { return getPkg().Cache(); };
+		inline unsigned long Index() const {return getPkg().Index();};
 		// we have only valid iterators here
 		// we have only valid iterators here
 		inline bool end() const { return false; };
 		inline bool end() const { return false; };
 
 
-		friend std::ostream& operator<<(std::ostream& out, const_iterator i) { return operator<<(out, (*i)); }
+		inline pkgCache::Package const * operator->() const {return &*getPkg();};
+	};
+									/*}}}*/
+
+	virtual bool insert(pkgCache::PkgIterator const &P) = 0;
+	virtual bool empty() const = 0;
+	virtual void clear() = 0;
+
+	enum Constructor { UNKNOWN, REGEX, TASK };
+	virtual void setConstructor(Constructor const &con) = 0;
+	virtual Constructor getConstructor() const = 0;
+
+	static bool FromTask(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper);
+	static bool FromRegEx(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper);
+	static pkgCache::PkgIterator FromName(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper);
+	static bool FromString(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper);
+	static bool FromCommandLine(PackageContainerInterface * const pci, pkgCacheFile &Cache, const char **cmdline, CacheSetHelper &helper);
+
+	struct Modifier {
+		enum Position { NONE, PREFIX, POSTFIX };
+		unsigned short ID;
+		const char * const Alias;
+		Position Pos;
+		Modifier (unsigned short const &id, const char * const alias, Position const &pos) : ID(id), Alias(alias), Pos(pos) {};
+	};
 
 
-		inline pkgCache::Package const * operator->() const {
-			return &***this;
-		};
+	static bool FromModifierCommandLine(unsigned short &modID, PackageContainerInterface * const pci,
+					    pkgCacheFile &Cache, const char * cmdline,
+					    std::list<Modifier> const &mods, CacheSetHelper &helper);
+};
+									/*}}}*/
+template<class Container> class PackageContainer : public PackageContainerInterface {/*{{{*/
+/** \class APT::PackageContainer
+
+    Simple wrapper around a container class like std::set to provide a similar
+    interface to a set of packages as to the complete set of all packages in the
+    pkgCache. */
+	Container _cont;
+public:									/*{{{*/
+	/** \brief smell like a pkgCache::PkgIterator */
+	class const_iterator : public PackageContainerInterface::const_iterator,/*{{{*/
+			       public std::iterator<std::forward_iterator_tag, typename Container::const_iterator> {
+		typename Container::const_iterator _iter;
+	public:
+		const_iterator(typename Container::const_iterator i) : _iter(i) {}
+		pkgCache::PkgIterator getPkg(void) const { return *_iter; }
+		inline pkgCache::PkgIterator operator*(void) const { return *_iter; };
+		operator typename Container::const_iterator(void) const { return _iter; }
+		inline const_iterator& operator++() { ++_iter; return *this; }
+		inline const_iterator operator++(int) { const_iterator tmp(*this); operator++(); return tmp; }
+		inline bool operator!=(const_iterator const &i) const { return _iter != i._iter; };
+		inline bool operator==(const_iterator const &i) const { return _iter == i._iter; };
+		friend std::ostream& operator<<(std::ostream& out, const_iterator i) { return operator<<(out, *i); }
+	};
+	class iterator : public PackageContainerInterface::const_iterator,
+			 public std::iterator<std::forward_iterator_tag, typename Container::iterator> {
+		typename Container::iterator _iter;
+	public:
+		iterator(typename Container::iterator i) : _iter(i) {}
+		pkgCache::PkgIterator getPkg(void) const { return *_iter; }
+		inline pkgCache::PkgIterator operator*(void) const { return *_iter; };
+		operator typename Container::iterator(void) const { return _iter; }
+		operator typename PackageContainer<Container>::const_iterator() { return PackageContainer<Container>::const_iterator(_iter); }
+		inline iterator& operator++() { ++_iter; return *this; }
+		inline iterator operator++(int) { iterator tmp(*this); operator++(); return tmp; }
+		inline bool operator!=(iterator const &i) const { return _iter != i._iter; };
+		inline bool operator==(iterator const &i) const { return _iter == i._iter; };
+		friend std::ostream& operator<<(std::ostream& out, iterator i) { return operator<<(out, *i); }
 	};
 	};
-	// 103. set::iterator is required to be modifiable, but this allows modification of keys
-	typedef APT::PackageSet::const_iterator iterator;
 									/*}}}*/
 									/*}}}*/
 
 
-	using std::set<pkgCache::PkgIterator>::insert;
-	inline void insert(pkgCache::PkgIterator const &P) { if (P.end() == false) std::set<pkgCache::PkgIterator>::insert(P); };
-	inline void insert(PackageSet const &pkgset) { insert(pkgset.begin(), pkgset.end()); };
+	bool insert(pkgCache::PkgIterator const &P) { if (P.end() == true) return false; _cont.insert(P); return true; };
+	template<class Cont> void insert(PackageContainer<Cont> const &pkgcont) { _cont.insert((typename Cont::const_iterator)pkgcont.begin(), (typename Cont::const_iterator)pkgcont.end()); };
+	void insert(const_iterator begin, const_iterator end) { _cont.insert(begin, end); };
+
+	bool empty() const { return _cont.empty(); };
+	void clear() { return _cont.clear(); };
+	void erase(iterator position) { _cont.erase((typename Container::iterator)position); };
+	size_t erase(const pkgCache::PkgIterator x) { return _cont.erase(x); };
+	void erase(iterator first, iterator last) { _cont.erase(first, last); };
+	size_t size() const { return _cont.size(); };
+
+	const_iterator begin() const { return const_iterator(_cont.begin()); };
+	const_iterator end() const { return const_iterator(_cont.end()); };
+	iterator begin() { return iterator(_cont.begin()); };
+	iterator end() { return iterator(_cont.end()); };
+	const_iterator find(pkgCache::PkgIterator const &P) const { return const_iterator(_cont.find(P)); };
+
+	void setConstructor(Constructor const &by) { ConstructedBy = by; };
+	Constructor getConstructor() const { return ConstructedBy; };
+
+	PackageContainer() : ConstructedBy(UNKNOWN) {};
+	PackageContainer(Constructor const &by) : ConstructedBy(by) {};
 
 
 	/** \brief returns all packages in the cache who belong to the given task
 	/** \brief returns all packages in the cache who belong to the given task
 
 
@@ -135,8 +226,12 @@ public:									/*{{{*/
 	    \param Cache the packages are in
 	    \param Cache the packages are in
 	    \param pattern name of the task
 	    \param pattern name of the task
 	    \param helper responsible for error and message handling */
 	    \param helper responsible for error and message handling */
-	static APT::PackageSet FromTask(pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper);
-	static APT::PackageSet FromTask(pkgCacheFile &Cache, std::string const &pattern) {
+	static PackageContainer FromTask(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
+		PackageContainer cont(TASK);
+		PackageContainerInterface::FromTask(&cont, Cache, pattern, helper);
+		return cont;
+	}
+	static PackageContainer FromTask(pkgCacheFile &Cache, std::string const &pattern) {
 		CacheSetHelper helper;
 		CacheSetHelper helper;
 		return FromTask(Cache, pattern, helper);
 		return FromTask(Cache, pattern, helper);
 	}
 	}
@@ -149,32 +244,43 @@ public:									/*{{{*/
 	    \param Cache the packages are in
 	    \param Cache the packages are in
 	    \param pattern regular expression for package names
 	    \param pattern regular expression for package names
 	    \param helper responsible for error and message handling */
 	    \param helper responsible for error and message handling */
-	static APT::PackageSet FromRegEx(pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper);
-	static APT::PackageSet FromRegEx(pkgCacheFile &Cache, std::string const &pattern) {
+	static PackageContainer FromRegEx(pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
+		PackageContainer cont(REGEX);
+		PackageContainerInterface::FromRegEx(&cont, Cache, pattern, helper);
+		return cont;
+	}
+
+	static PackageContainer FromRegEx(pkgCacheFile &Cache, std::string const &pattern) {
 		CacheSetHelper helper;
 		CacheSetHelper helper;
 		return FromRegEx(Cache, pattern, helper);
 		return FromRegEx(Cache, pattern, helper);
 	}
 	}
 
 
-	/** \brief returns all packages specified by a string
+	/** \brief returns a package specified by a string
 
 
-	    \param Cache the packages are in
-	    \param string String the package name(s) should be extracted from
+	    \param Cache the package is in
+	    \param pattern String the package name should be extracted from
 	    \param helper responsible for error and message handling */
 	    \param helper responsible for error and message handling */
-	static APT::PackageSet FromString(pkgCacheFile &Cache, std::string const &string, CacheSetHelper &helper);
-	static APT::PackageSet FromString(pkgCacheFile &Cache, std::string const &string) {
+	static pkgCache::PkgIterator FromName(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
+		return PackageContainerInterface::FromName(Cache, pattern, helper);
+	}
+	static pkgCache::PkgIterator FromName(pkgCacheFile &Cache, std::string const &pattern) {
 		CacheSetHelper helper;
 		CacheSetHelper helper;
-		return FromString(Cache, string, helper);
+		return PackageContainerInterface::FromName(Cache, pattern, helper);
 	}
 	}
 
 
-	/** \brief returns a package specified by a string
+	/** \brief returns all packages specified by a string
 
 
-	    \param Cache the package is in
-	    \param string String the package name should be extracted from
+	    \param Cache the packages are in
+	    \param pattern String the package name(s) should be extracted from
 	    \param helper responsible for error and message handling */
 	    \param helper responsible for error and message handling */
-	static pkgCache::PkgIterator FromName(pkgCacheFile &Cache, std::string const &string, CacheSetHelper &helper);
-	static pkgCache::PkgIterator FromName(pkgCacheFile &Cache, std::string const &string) {
+	static PackageContainer FromString(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
+		PackageContainer cont;
+		PackageContainerInterface::FromString(&cont, Cache, pattern, helper);
+		return cont;
+	}
+	static PackageContainer FromString(pkgCacheFile &Cache, std::string const &pattern) {
 		CacheSetHelper helper;
 		CacheSetHelper helper;
-		return FromName(Cache, string, helper);
+		return FromString(Cache, pattern, helper);
 	}
 	}
 
 
 	/** \brief returns all packages specified on the commandline
 	/** \brief returns all packages specified on the commandline
@@ -184,20 +290,16 @@ public:									/*{{{*/
 	    \param Cache the packages are in
 	    \param Cache the packages are in
 	    \param cmdline Command line the package names should be extracted from
 	    \param cmdline Command line the package names should be extracted from
 	    \param helper responsible for error and message handling */
 	    \param helper responsible for error and message handling */
-	static APT::PackageSet FromCommandLine(pkgCacheFile &Cache, const char **cmdline, CacheSetHelper &helper);
-	static APT::PackageSet FromCommandLine(pkgCacheFile &Cache, const char **cmdline) {
+	static PackageContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline, CacheSetHelper &helper) {
+		PackageContainer cont;
+		PackageContainerInterface::FromCommandLine(&cont, Cache, cmdline, helper);
+		return cont;
+	}
+	static PackageContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline) {
 		CacheSetHelper helper;
 		CacheSetHelper helper;
 		return FromCommandLine(Cache, cmdline, helper);
 		return FromCommandLine(Cache, cmdline, helper);
 	}
 	}
 
 
-	struct Modifier {
-		enum Position { NONE, PREFIX, POSTFIX };
-		unsigned short ID;
-		const char * const Alias;
-		Position Pos;
-		Modifier (unsigned short const &id, const char * const alias, Position const &pos) : ID(id), Alias(alias), Pos(pos) {};
-	};
-
 	/** \brief group packages by a action modifiers
 	/** \brief group packages by a action modifiers
 
 
 	    At some point it is needed to get from the same commandline
 	    At some point it is needed to get from the same commandline
@@ -209,76 +311,93 @@ public:									/*{{{*/
 	    \param mods list of modifiers the method should accept
 	    \param mods list of modifiers the method should accept
 	    \param fallback the default modifier group for a package
 	    \param fallback the default modifier group for a package
 	    \param helper responsible for error and message handling */
 	    \param helper responsible for error and message handling */
-	static std::map<unsigned short, PackageSet> GroupedFromCommandLine(
-		pkgCacheFile &Cache, const char **cmdline,
-		std::list<PackageSet::Modifier> const &mods,
-		unsigned short const &fallback, CacheSetHelper &helper);
-	static std::map<unsigned short, PackageSet> GroupedFromCommandLine(
-		pkgCacheFile &Cache, const char **cmdline,
-		std::list<PackageSet::Modifier> const &mods,
-		unsigned short const &fallback) {
+	static std::map<unsigned short, PackageContainer> GroupedFromCommandLine(
+										 pkgCacheFile &Cache,
+										 const char **cmdline,
+										 std::list<Modifier> const &mods,
+										 unsigned short const &fallback,
+										 CacheSetHelper &helper) {
+		std::map<unsigned short, PackageContainer> pkgsets;
+		for (const char **I = cmdline; *I != 0; ++I) {
+			unsigned short modID = fallback;
+			PackageContainer pkgset;
+			PackageContainerInterface::FromModifierCommandLine(modID, &pkgset, Cache, *I, mods, helper);
+			pkgsets[modID].insert(pkgset);
+		}
+		return pkgsets;
+	}
+	static std::map<unsigned short, PackageContainer> GroupedFromCommandLine(
+										 pkgCacheFile &Cache,
+										 const char **cmdline,
+										 std::list<Modifier> const &mods,
+										 unsigned short const &fallback) {
 		CacheSetHelper helper;
 		CacheSetHelper helper;
 		return GroupedFromCommandLine(Cache, cmdline,
 		return GroupedFromCommandLine(Cache, cmdline,
 				mods, fallback, helper);
 				mods, fallback, helper);
 	}
 	}
-
-	enum Constructor { UNKNOWN, REGEX, TASK };
-	Constructor getConstructor() const { return ConstructedBy; };
-
-	PackageSet() : ConstructedBy(UNKNOWN) {};
-	PackageSet(Constructor const &by) : ConstructedBy(by) {};
 									/*}}}*/
 									/*}}}*/
 private:								/*{{{*/
 private:								/*{{{*/
 	Constructor ConstructedBy;
 	Constructor ConstructedBy;
 									/*}}}*/
 									/*}}}*/
 };									/*}}}*/
 };									/*}}}*/
-class VersionSet : public std::set<pkgCache::VerIterator> {		/*{{{*/
-/** \class APT::VersionSet
 
 
-    Simple wrapper around a std::set to provide a similar interface to
-    a set of versions as to the complete set of all versions in the
-    pkgCache. */
-public:									/*{{{*/
+template<> template<class Cont> void PackageContainer<std::list<pkgCache::PkgIterator> >::insert(PackageContainer<Cont> const &pkgcont) {
+	for (typename PackageContainer<Cont>::const_iterator p = pkgcont.begin(); p != pkgcont.end(); ++p)
+		_cont.push_back(*p);
+};
+// these two are 'inline' as otherwise the linker has problems with seeing these untemplated
+// specializations again and again - but we need to see them, so that library users can use them
+template<> inline bool PackageContainer<std::list<pkgCache::PkgIterator> >::insert(pkgCache::PkgIterator const &P) {
+	if (P.end() == true)
+		return false;
+	_cont.push_back(P);
+	return true;
+};
+template<> inline void PackageContainer<std::list<pkgCache::PkgIterator> >::insert(const_iterator begin, const_iterator end) {
+	for (const_iterator p = begin; p != end; ++p)
+		_cont.push_back(*p);
+};
+typedef PackageContainer<std::set<pkgCache::PkgIterator> > PackageSet;
+typedef PackageContainer<std::list<pkgCache::PkgIterator> > PackageList;
+
+class VersionContainerInterface {					/*{{{*/
+/** \class APT::VersionContainerInterface
+
+    Same as APT::PackageContainerInterface, just for Versions */
+public:
 	/** \brief smell like a pkgCache::VerIterator */
 	/** \brief smell like a pkgCache::VerIterator */
-	class const_iterator : public std::set<pkgCache::VerIterator>::const_iterator {/*{{{*/
+	class const_iterator {						/*{{{*/
 	public:
 	public:
-		const_iterator(std::set<pkgCache::VerIterator>::const_iterator x) :
-			 std::set<pkgCache::VerIterator>::const_iterator(x) {}
-
-		operator pkgCache::VerIterator(void) { return **this; }
-
-		inline pkgCache *Cache() const { return (**this).Cache(); };
-		inline unsigned long Index() const {return (**this).Index();};
+		virtual pkgCache::VerIterator getVer() const = 0;
+		operator pkgCache::VerIterator(void) { return getVer(); }
+
+		inline pkgCache *Cache() const { return getVer().Cache(); };
+		inline unsigned long Index() const {return getVer().Index();};
+		inline int CompareVer(const pkgCache::VerIterator &B) const { return getVer().CompareVer(B); };
+		inline const char *VerStr() const { return getVer().VerStr(); };
+		inline const char *Section() const { return getVer().Section(); };
+		inline const char *Arch() const { return getVer().Arch(); };
+		inline pkgCache::PkgIterator ParentPkg() const { return getVer().ParentPkg(); };
+		inline pkgCache::DescIterator DescriptionList() const { return getVer().DescriptionList(); };
+		inline pkgCache::DescIterator TranslatedDescription() const { return getVer().TranslatedDescription(); };
+		inline pkgCache::DepIterator DependsList() const { return getVer().DependsList(); };
+		inline pkgCache::PrvIterator ProvidesList() const { return getVer().ProvidesList(); };
+		inline pkgCache::VerFileIterator FileList() const { return getVer().FileList(); };
+		inline bool Downloadable() const { return getVer().Downloadable(); };
+		inline const char *PriorityType() const { return getVer().PriorityType(); };
+		inline std::string RelStr() const { return getVer().RelStr(); };
+		inline bool Automatic() const { return getVer().Automatic(); };
+		inline pkgCache::VerFileIterator NewestFile() const { return getVer().NewestFile(); };
 		// we have only valid iterators here
 		// we have only valid iterators here
 		inline bool end() const { return false; };
 		inline bool end() const { return false; };
 
 
-		inline pkgCache::Version const * operator->() const {
-			return &***this;
-		};
-
-		inline int CompareVer(const pkgCache::VerIterator &B) const { return (**this).CompareVer(B); };
-		inline const char *VerStr() const { return (**this).VerStr(); };
-		inline const char *Section() const { return (**this).Section(); };
-		inline const char *Arch() const { return (**this).Arch(); };
-		inline pkgCache::PkgIterator ParentPkg() const { return (**this).ParentPkg(); };
-		inline pkgCache::DescIterator DescriptionList() const { return (**this).DescriptionList(); };
-		inline pkgCache::DescIterator TranslatedDescription() const { return (**this).TranslatedDescription(); };
-		inline pkgCache::DepIterator DependsList() const { return (**this).DependsList(); };
-		inline pkgCache::PrvIterator ProvidesList() const { return (**this).ProvidesList(); };
-		inline pkgCache::VerFileIterator FileList() const { return (**this).FileList(); };
-		inline bool Downloadable() const { return (**this).Downloadable(); };
-		inline const char *PriorityType() const { return (**this).PriorityType(); };
-		inline std::string RelStr() const { return (**this).RelStr(); };
-		inline bool Automatic() const { return (**this).Automatic(); };
-		inline pkgCache::VerFileIterator NewestFile() const { return (**this).NewestFile(); };
+		inline pkgCache::Version const * operator->() const { return &*getVer(); };
 	};
 	};
 									/*}}}*/
 									/*}}}*/
-	// 103. set::iterator is required to be modifiable, but this allows modification of keys
-	typedef APT::VersionSet::const_iterator iterator;
 
 
-	using std::set<pkgCache::VerIterator>::insert;
-	inline void insert(pkgCache::VerIterator const &V) { if (V.end() == false) std::set<pkgCache::VerIterator>::insert(V); };
-	inline void insert(VersionSet const &verset) { insert(verset.begin(), verset.end()); };
+	virtual bool insert(pkgCache::VerIterator const &V) = 0;
+	virtual bool empty() const = 0;
+	virtual void clear() = 0;
 
 
 	/** \brief specifies which version(s) will be returned if non is given */
 	/** \brief specifies which version(s) will be returned if non is given */
 	enum Version {
 	enum Version {
@@ -298,6 +417,116 @@ public:									/*{{{*/
 		NEWEST
 		NEWEST
 	};
 	};
 
 
+	struct Modifier {
+		enum Position { NONE, PREFIX, POSTFIX };
+		unsigned short ID;
+		const char * const Alias;
+		Position Pos;
+		Version SelectVersion;
+		Modifier (unsigned short const &id, const char * const alias, Position const &pos,
+			  Version const &select) : ID(id), Alias(alias), Pos(pos),
+			 SelectVersion(select) {};
+	};
+
+	static bool FromCommandLine(VersionContainerInterface * const vci, pkgCacheFile &Cache,
+				    const char **cmdline, Version const &fallback,
+				    CacheSetHelper &helper);
+
+	static bool FromString(VersionContainerInterface * const vci, pkgCacheFile &Cache,
+			       std::string pkg, Version const &fallback, CacheSetHelper &helper,
+			       bool const onlyFromName = false);
+
+	static bool FromPackage(VersionContainerInterface * const vci, pkgCacheFile &Cache,
+				pkgCache::PkgIterator const &P, Version const &fallback,
+				CacheSetHelper &helper);
+
+	static bool FromModifierCommandLine(unsigned short &modID,
+					    VersionContainerInterface * const vci,
+					    pkgCacheFile &Cache, const char * cmdline,
+					    std::list<Modifier> const &mods,
+					    CacheSetHelper &helper);
+
+
+	static bool FromDependency(VersionContainerInterface * const vci,
+				   pkgCacheFile &Cache,
+				   pkgCache::DepIterator const &D,
+				   Version const &selector,
+				   CacheSetHelper &helper);
+
+protected:								/*{{{*/
+
+	/** \brief returns the candidate version of the package
+
+	    \param Cache to be used to query for information
+	    \param Pkg we want the candidate version from this package */
+	static pkgCache::VerIterator getCandidateVer(pkgCacheFile &Cache,
+		pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper);
+
+	/** \brief returns the installed version of the package
+
+	    \param Cache to be used to query for information
+	    \param Pkg we want the installed version from this package */
+	static pkgCache::VerIterator getInstalledVer(pkgCacheFile &Cache,
+		pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper);
+									/*}}}*/
+};
+									/*}}}*/
+template<class Container> class VersionContainer : public VersionContainerInterface {/*{{{*/
+/** \class APT::VersionContainer
+
+    Simple wrapper around a container class like std::set to provide a similar
+    interface to a set of versions as to the complete set of all versions in the
+    pkgCache. */
+	Container _cont;
+public:									/*{{{*/
+	/** \brief smell like a pkgCache::VerIterator */
+	class const_iterator : public VersionContainerInterface::const_iterator,
+			       public std::iterator<std::forward_iterator_tag, typename Container::const_iterator> {/*{{{*/
+		typename Container::const_iterator _iter;
+	public:
+		const_iterator(typename Container::const_iterator i) : _iter(i) {}
+		pkgCache::VerIterator getVer(void) const { return *_iter; }
+		inline pkgCache::VerIterator operator*(void) const { return *_iter; };
+		operator typename Container::const_iterator(void) const { return _iter; }
+		inline const_iterator& operator++() { ++_iter; return *this; }
+		inline const_iterator operator++(int) { const_iterator tmp(*this); operator++(); return tmp; }
+		inline bool operator!=(const_iterator const &i) const { return _iter != i._iter; };
+		inline bool operator==(const_iterator const &i) const { return _iter == i._iter; };
+		friend std::ostream& operator<<(std::ostream& out, const_iterator i) { return operator<<(out, *i); }
+	};
+	class iterator : public VersionContainerInterface::const_iterator,
+			 public std::iterator<std::forward_iterator_tag, typename Container::iterator> {
+		typename Container::iterator _iter;
+	public:
+		iterator(typename Container::iterator i) : _iter(i) {}
+		pkgCache::VerIterator getVer(void) const { return *_iter; }
+		inline pkgCache::VerIterator operator*(void) const { return *_iter; };
+		operator typename Container::iterator(void) const { return _iter; }
+		operator typename VersionContainer<Container>::const_iterator() { return VersionContainer<Container>::const_iterator(_iter); }
+		inline iterator& operator++() { ++_iter; return *this; }
+		inline iterator operator++(int) { iterator tmp(*this); operator++(); return tmp; }
+		inline bool operator!=(iterator const &i) const { return _iter != i._iter; };
+		inline bool operator==(iterator const &i) const { return _iter == i._iter; };
+		friend std::ostream& operator<<(std::ostream& out, iterator i) { return operator<<(out, *i); }
+	};
+									/*}}}*/
+
+	bool insert(pkgCache::VerIterator const &V) { if (V.end() == true) return false; _cont.insert(V); return true; };
+	template<class Cont> void insert(VersionContainer<Cont> const &vercont) { _cont.insert((typename Cont::const_iterator)vercont.begin(), (typename Cont::const_iterator)vercont.end()); };
+	void insert(const_iterator begin, const_iterator end) { _cont.insert(begin, end); };
+	bool empty() const { return _cont.empty(); };
+	void clear() { return _cont.clear(); };
+	void erase(iterator position) { _cont.erase((typename Container::iterator)position); };
+	size_t erase(const pkgCache::VerIterator x) { return _cont.erase(x); };
+	void erase(iterator first, iterator last) { _cont.erase(first, last); };
+	size_t size() const { return _cont.size(); };
+
+	const_iterator begin() const { return const_iterator(_cont.begin()); };
+	const_iterator end() const { return const_iterator(_cont.end()); };
+	iterator begin() { return iterator(_cont.begin()); };
+	iterator end() { return iterator(_cont.end()); };
+	const_iterator find(pkgCache::VerIterator const &V) const { return const_iterator(_cont.find(V)); };
+
 	/** \brief returns all versions specified on the commandline
 	/** \brief returns all versions specified on the commandline
 
 
 	    Get all versions from the commandline, uses given default version if
 	    Get all versions from the commandline, uses given default version if
@@ -305,26 +534,34 @@ public:									/*{{{*/
 	    \param Cache the packages and versions are in
 	    \param Cache the packages and versions are in
 	    \param cmdline Command line the versions should be extracted from
 	    \param cmdline Command line the versions should be extracted from
 	    \param helper responsible for error and message handling */
 	    \param helper responsible for error and message handling */
-	static APT::VersionSet FromCommandLine(pkgCacheFile &Cache, const char **cmdline,
-			APT::VersionSet::Version const &fallback, CacheSetHelper &helper);
-	static APT::VersionSet FromCommandLine(pkgCacheFile &Cache, const char **cmdline,
-			APT::VersionSet::Version const &fallback) {
+	static VersionContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline,
+			Version const &fallback, CacheSetHelper &helper) {
+		VersionContainer vercon;
+		VersionContainerInterface::FromCommandLine(&vercon, Cache, cmdline, fallback, helper);
+		return vercon;
+	}
+	static VersionContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline,
+			Version const &fallback) {
 		CacheSetHelper helper;
 		CacheSetHelper helper;
 		return FromCommandLine(Cache, cmdline, fallback, helper);
 		return FromCommandLine(Cache, cmdline, fallback, helper);
 	}
 	}
-	static APT::VersionSet FromCommandLine(pkgCacheFile &Cache, const char **cmdline) {
+	static VersionContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline) {
 		return FromCommandLine(Cache, cmdline, CANDINST);
 		return FromCommandLine(Cache, cmdline, CANDINST);
 	}
 	}
 
 
-	static APT::VersionSet FromString(pkgCacheFile &Cache, std::string pkg,
-			APT::VersionSet::Version const &fallback, CacheSetHelper &helper,
-			bool const &onlyFromName = false);
-	static APT::VersionSet FromString(pkgCacheFile &Cache, std::string pkg,
-			APT::VersionSet::Version const &fallback) {
+	static VersionContainer FromString(pkgCacheFile &Cache, std::string const &pkg,
+			Version const &fallback, CacheSetHelper &helper,
+			bool const onlyFromName = false) {
+		VersionContainer vercon;
+		VersionContainerInterface::FromString(&vercon, Cache, pkg, fallback, helper);
+		return vercon;
+	}
+	static VersionContainer FromString(pkgCacheFile &Cache, std::string pkg,
+			Version const &fallback) {
 		CacheSetHelper helper;
 		CacheSetHelper helper;
 		return FromString(Cache, pkg, fallback, helper);
 		return FromString(Cache, pkg, fallback, helper);
 	}
 	}
-	static APT::VersionSet FromString(pkgCacheFile &Cache, std::string pkg) {
+	static VersionContainer FromString(pkgCacheFile &Cache, std::string pkg) {
 		return FromString(Cache, pkg, CANDINST);
 		return FromString(Cache, pkg, CANDINST);
 	}
 	}
 
 
@@ -334,57 +571,80 @@ public:									/*{{{*/
 	    \param P the package in question
 	    \param P the package in question
 	    \param fallback the version(s) you want to get
 	    \param fallback the version(s) you want to get
 	    \param helper the helper used for display and error handling */
 	    \param helper the helper used for display and error handling */
-	static APT::VersionSet FromPackage(pkgCacheFile &Cache, pkgCache::PkgIterator const &P,
-		VersionSet::Version const &fallback, CacheSetHelper &helper);
-	static APT::VersionSet FromPackage(pkgCacheFile &Cache, pkgCache::PkgIterator const &P,
-			APT::VersionSet::Version const &fallback) {
+	static VersionContainer FromPackage(pkgCacheFile &Cache, pkgCache::PkgIterator const &P,
+		Version const &fallback, CacheSetHelper &helper) {
+		VersionContainer vercon;
+		VersionContainerInterface::FromPackage(&vercon, Cache, P, fallback, helper);
+		return vercon;
+	}
+	static VersionContainer FromPackage(pkgCacheFile &Cache, pkgCache::PkgIterator const &P,
+					    Version const &fallback) {
 		CacheSetHelper helper;
 		CacheSetHelper helper;
 		return FromPackage(Cache, P, fallback, helper);
 		return FromPackage(Cache, P, fallback, helper);
 	}
 	}
-	static APT::VersionSet FromPackage(pkgCacheFile &Cache, pkgCache::PkgIterator const &P) {
-		return FromPackage(Cache, P, CANDINST);
+	static VersionContainer FromPackage(pkgCacheFile &Cache, pkgCache::PkgIterator const &P) {
+		return FromPackage(Cache, P, CANDIDATE);
 	}
 	}
 
 
-	struct Modifier {
-		enum Position { NONE, PREFIX, POSTFIX };
-		unsigned short ID;
-		const char * const Alias;
-		Position Pos;
-		VersionSet::Version SelectVersion;
-		Modifier (unsigned short const &id, const char * const alias, Position const &pos,
-			  VersionSet::Version const &select) : ID(id), Alias(alias), Pos(pos),
-			 SelectVersion(select) {};
-	};
+	static std::map<unsigned short, VersionContainer> GroupedFromCommandLine(
+										 pkgCacheFile &Cache,
+										 const char **cmdline,
+										 std::list<Modifier> const &mods,
+										 unsigned short const fallback,
+										 CacheSetHelper &helper) {
+		std::map<unsigned short, VersionContainer> versets;
+		for (const char **I = cmdline; *I != 0; ++I) {
+			unsigned short modID = fallback;
+			VersionContainer verset;
+			VersionContainerInterface::FromModifierCommandLine(modID, &verset, Cache, *I, mods, helper);
+			versets[modID].insert(verset);
+		}
+		return versets;
 
 
-	static std::map<unsigned short, VersionSet> GroupedFromCommandLine(
-		pkgCacheFile &Cache, const char **cmdline,
-		std::list<VersionSet::Modifier> const &mods,
-		unsigned short const &fallback, CacheSetHelper &helper);
-	static std::map<unsigned short, VersionSet> GroupedFromCommandLine(
+	}
+	static std::map<unsigned short, VersionContainer> GroupedFromCommandLine(
 		pkgCacheFile &Cache, const char **cmdline,
 		pkgCacheFile &Cache, const char **cmdline,
-		std::list<VersionSet::Modifier> const &mods,
-		unsigned short const &fallback) {
+		std::list<Modifier> const &mods,
+		unsigned short const fallback) {
 		CacheSetHelper helper;
 		CacheSetHelper helper;
 		return GroupedFromCommandLine(Cache, cmdline,
 		return GroupedFromCommandLine(Cache, cmdline,
 				mods, fallback, helper);
 				mods, fallback, helper);
 	}
 	}
-									/*}}}*/
-protected:								/*{{{*/
 
 
-	/** \brief returns the candidate version of the package
-
-	    \param Cache to be used to query for information
-	    \param Pkg we want the candidate version from this package */
-	static pkgCache::VerIterator getCandidateVer(pkgCacheFile &Cache,
-		pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper);
-
-	/** \brief returns the installed version of the package
-
-	    \param Cache to be used to query for information
-	    \param Pkg we want the installed version from this package */
-	static pkgCache::VerIterator getInstalledVer(pkgCacheFile &Cache,
-		pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper);
+	static VersionContainer FromDependency(pkgCacheFile &Cache, pkgCache::DepIterator const &D,
+					       Version const &selector, CacheSetHelper &helper) {
+		VersionContainer vercon;
+		VersionContainerInterface::FromDependency(&vercon, Cache, D, selector, helper);
+		return vercon;
+	}
+	static VersionContainer FromDependency(pkgCacheFile &Cache, pkgCache::DepIterator const &D,
+					       Version const &selector) {
+		CacheSetHelper helper;
+		return FromPackage(Cache, D, selector, helper);
+	}
+	static VersionContainer FromDependency(pkgCacheFile &Cache, pkgCache::DepIterator const &D) {
+		return FromPackage(Cache, D, CANDIDATE);
+	}
 									/*}}}*/
 									/*}}}*/
 };									/*}}}*/
 };									/*}}}*/
+
+template<> template<class Cont> void VersionContainer<std::list<pkgCache::VerIterator> >::insert(VersionContainer<Cont> const &vercont) {
+	for (typename VersionContainer<Cont>::const_iterator v = vercont.begin(); v != vercont.end(); ++v)
+		_cont.push_back(*v);
+};
+// these two are 'inline' as otherwise the linker has problems with seeing these untemplated
+// specializations again and again - but we need to see them, so that library users can use them
+template<> inline bool VersionContainer<std::list<pkgCache::VerIterator> >::insert(pkgCache::VerIterator const &V) {
+	if (V.end() == true)
+		return false;
+	_cont.push_back(V);
+	return true;
+};
+template<> inline void VersionContainer<std::list<pkgCache::VerIterator> >::insert(const_iterator begin, const_iterator end) {
+	for (const_iterator v = begin; v != end; ++v)
+		_cont.push_back(*v);
+};
+typedef VersionContainer<std::set<pkgCache::VerIterator> > VersionSet;
+typedef VersionContainer<std::list<pkgCache::VerIterator> > VersionList;
 }
 }
 #endif
 #endif

+ 77 - 33
apt-pkg/cdrom.cc

@@ -58,66 +58,91 @@ bool pkgCdrom::FindPackages(string CD,
       return _error->Errno("chdir","Unable to change to %s",CD.c_str());
       return _error->Errno("chdir","Unable to change to %s",CD.c_str());
 
 
    // Look for a .disk subdirectory
    // Look for a .disk subdirectory
-   struct stat Buf;
-   if (stat(".disk",&Buf) == 0)
+   if (DirectoryExists(".disk") == true)
    {
    {
       if (InfoDir.empty() == true)
       if (InfoDir.empty() == true)
 	 InfoDir = CD + ".disk/";
 	 InfoDir = CD + ".disk/";
    }
    }
 
 
    // Don't look into directories that have been marked to ingore.
    // Don't look into directories that have been marked to ingore.
-   if (stat(".aptignr",&Buf) == 0)
+   if (RealFileExists(".aptignr") == true)
       return true;
       return true;
 
 
-
    /* Check _first_ for a signature file as apt-cdrom assumes that all files
    /* Check _first_ for a signature file as apt-cdrom assumes that all files
       under a Packages/Source file are in control of that file and stops 
       under a Packages/Source file are in control of that file and stops 
       the scanning
       the scanning
    */
    */
-   if (stat("Release.gpg",&Buf) == 0)
+   if (RealFileExists("Release.gpg") == true || RealFileExists("InRelease") == true)
    {
    {
       SigList.push_back(CD);
       SigList.push_back(CD);
    }
    }
+
    /* Aha! We found some package files. We assume that everything under 
    /* Aha! We found some package files. We assume that everything under 
       this dir is controlled by those package files so we don't look down
       this dir is controlled by those package files so we don't look down
       anymore */
       anymore */
-   if (stat("Packages",&Buf) == 0 || stat("Packages.gz",&Buf) == 0)
+   std::vector<APT::Configuration::Compressor> const compressor = APT::Configuration::getCompressors();
+   for (std::vector<APT::Configuration::Compressor>::const_iterator c = compressor.begin();
+	c != compressor.end(); ++c)
    {
    {
+      if (RealFileExists(std::string("Packages").append(c->Extension).c_str()) == false)
+	 continue;
+
+      if (_config->FindB("Debug::aptcdrom",false) == true)
+	 std::clog << "Found Packages in " << CD << std::endl;
       List.push_back(CD);
       List.push_back(CD);
-      
+
       // Continue down if thorough is given
       // Continue down if thorough is given
       if (_config->FindB("APT::CDROM::Thorough",false) == false)
       if (_config->FindB("APT::CDROM::Thorough",false) == false)
 	 return true;
 	 return true;
+      break;
    }
    }
-   if (stat("Sources.gz",&Buf) == 0 || stat("Sources",&Buf) == 0)
+   for (std::vector<APT::Configuration::Compressor>::const_iterator c = compressor.begin();
+	c != compressor.end(); ++c)
    {
    {
+      if (RealFileExists(std::string("Sources").append(c->Extension).c_str()) == false)
+	 continue;
+
+      if (_config->FindB("Debug::aptcdrom",false) == true)
+	 std::clog << "Found Sources in " << CD << std::endl;
       SList.push_back(CD);
       SList.push_back(CD);
-      
+
       // Continue down if thorough is given
       // Continue down if thorough is given
       if (_config->FindB("APT::CDROM::Thorough",false) == false)
       if (_config->FindB("APT::CDROM::Thorough",false) == false)
 	 return true;
 	 return true;
+      break;
    }
    }
 
 
-   // see if we find translatin indexes
-   if (stat("i18n",&Buf) == 0)
+   // see if we find translation indices
+   if (DirectoryExists("i18n") == true)
    {
    {
       D = opendir("i18n");
       D = opendir("i18n");
       for (struct dirent *Dir = readdir(D); Dir != 0; Dir = readdir(D))
       for (struct dirent *Dir = readdir(D); Dir != 0; Dir = readdir(D))
       {
       {
-	 if(strstr(Dir->d_name,"Translation") != NULL) 
+	 if(strncmp(Dir->d_name, "Translation-", strlen("Translation-")) != 0)
+	    continue;
+	 string file = Dir->d_name;
+	 for (std::vector<APT::Configuration::Compressor>::const_iterator c = compressor.begin();
+	      c != compressor.end(); ++c)
 	 {
 	 {
-	    if (_config->FindB("Debug::aptcdrom",false) == true)
-	       std::clog << "found translations: " << Dir->d_name << "\n";
-	    string file = Dir->d_name;
-	    if(file.substr(file.size()-3,file.size()) == ".gz")
-	       file = file.substr(0,file.size()-3);
-	    TransList.push_back(CD+"i18n/"+ file);
+	    string fileext = flExtension(file);
+	    if (file == fileext)
+	       fileext.clear();
+	    else if (fileext.empty() == false)
+	       fileext = "." + fileext;
+
+	    if (c->Extension == fileext)
+	    {
+	       if (_config->FindB("Debug::aptcdrom",false) == true)
+		  std::clog << "Found translation " << Dir->d_name << " in " << CD << "i18n/" << std::endl;
+	       file.erase(file.size() - fileext.size());
+	       TransList.push_back(CD + "i18n/" + file);
+	       break;
+	    }
 	 }
 	 }
       }
       }
       closedir(D);
       closedir(D);
    }
    }
 
 
-   
    D = opendir(".");
    D = opendir(".");
    if (D == 0)
    if (D == 0)
       return _error->Errno("opendir","Unable to read %s",CD.c_str());
       return _error->Errno("opendir","Unable to read %s",CD.c_str());
@@ -252,30 +277,43 @@ bool pkgCdrom::DropBinaryArch(vector<string> &List)
 /* Here we go and stat every file that we found and strip dup inodes. */
 /* Here we go and stat every file that we found and strip dup inodes. */
 bool pkgCdrom::DropRepeats(vector<string> &List,const char *Name)
 bool pkgCdrom::DropRepeats(vector<string> &List,const char *Name)
 {
 {
+   bool couldFindAllFiles = true;
    // Get a list of all the inodes
    // Get a list of all the inodes
    ino_t *Inodes = new ino_t[List.size()];
    ino_t *Inodes = new ino_t[List.size()];
-   for (unsigned int I = 0; I != List.size(); I++)
+   for (unsigned int I = 0; I != List.size(); ++I)
    {
    {
       struct stat Buf;
       struct stat Buf;
-      if (stat((List[I] + Name).c_str(),&Buf) != 0 &&
-	  stat((List[I] + Name + ".gz").c_str(),&Buf) != 0)
-	 _error->Errno("stat","Failed to stat %s%s",List[I].c_str(),
-		       Name);
-      Inodes[I] = Buf.st_ino;
-   }
-   
-   if (_error->PendingError() == true) {
-      delete[] Inodes;
-      return false;
+      bool found = false;
+
+      std::vector<APT::Configuration::Compressor> const compressor = APT::Configuration::getCompressors();
+      for (std::vector<APT::Configuration::Compressor>::const_iterator c = compressor.begin();
+	   c != compressor.end(); ++c)
+      {
+	 std::string filename = std::string(List[I]).append(Name).append(c->Extension);
+         if (stat(filename.c_str(), &Buf) != 0)
+	    continue;
+	 Inodes[I] = Buf.st_ino;
+	 found = true;
+	 break;
+      }
+
+      if (found == false)
+      {
+	 _error->Errno("stat","Failed to stat %s%s",List[I].c_str(), Name);
+	 couldFindAllFiles = false;
+	 Inodes[I] = 0;
+      }
    }
    }
-   
+
    // Look for dups
    // Look for dups
    for (unsigned int I = 0; I != List.size(); I++)
    for (unsigned int I = 0; I != List.size(); I++)
    {
    {
+      if (Inodes[I] == 0)
+	 continue;
       for (unsigned int J = I+1; J < List.size(); J++)
       for (unsigned int J = I+1; J < List.size(); J++)
       {
       {
 	 // No match
 	 // No match
-	 if (Inodes[J] != Inodes[I])
+	 if (Inodes[J] == 0 || Inodes[J] != Inodes[I])
 	    continue;
 	    continue;
 	 
 	 
 	 // We score the two paths.. and erase one
 	 // We score the two paths.. and erase one
@@ -301,7 +339,7 @@ bool pkgCdrom::DropRepeats(vector<string> &List,const char *Name)
 	 List.erase(List.begin()+I);
 	 List.erase(List.begin()+I);
    }
    }
    
    
-   return true;
+   return couldFindAllFiles;
 }
 }
 									/*}}}*/
 									/*}}}*/
 // ReduceSourceList - Takes the path list and reduces it		/*{{{*/
 // ReduceSourceList - Takes the path list and reduces it		/*{{{*/
@@ -680,7 +718,13 @@ bool pkgCdrom::Add(pkgCdromStatus *log)					/*{{{*/
    DropBinaryArch(List);
    DropBinaryArch(List);
    DropRepeats(List,"Packages");
    DropRepeats(List,"Packages");
    DropRepeats(SourceList,"Sources");
    DropRepeats(SourceList,"Sources");
+   // FIXME: We ignore stat() errors here as we usually have only one of those in use
+   // This has little potencial to drop 'valid' stat() errors as we know that one of these
+   // files need to exist, but it would be better if we would check it here
+   _error->PushToStack();
    DropRepeats(SigList,"Release.gpg");
    DropRepeats(SigList,"Release.gpg");
+   DropRepeats(SigList,"InRelease");
+   _error->RevertToStack();
    DropRepeats(TransList,"");
    DropRepeats(TransList,"");
    if(log != NULL) {
    if(log != NULL) {
       msg.str("");
       msg.str("");

+ 5 - 0
apt-pkg/cdrom.h

@@ -4,6 +4,11 @@
 #include<string>
 #include<string>
 #include<vector>
 #include<vector>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/init.h>
+using namespace std;
+#endif
+
 class Configuration;
 class Configuration;
 class OpProgress;
 class OpProgress;
 
 

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

@@ -12,6 +12,10 @@
 
 
 #include <string>
 #include <string>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+#endif
+
 // mount cdrom, DeviceName (e.g. /dev/sr0) is optional
 // mount cdrom, DeviceName (e.g. /dev/sr0) is optional
 bool MountCdrom(std::string Path, std::string DeviceName="");
 bool MountCdrom(std::string Path, std::string DeviceName="");
 bool UnmountCdrom(std::string Path);
 bool UnmountCdrom(std::string Path);

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

@@ -44,6 +44,10 @@
 #ifndef PKGLIB_CMNDLINE_H
 #ifndef PKGLIB_CMNDLINE_H
 #define PKGLIB_CMNDLINE_H
 #define PKGLIB_CMNDLINE_H
 
 
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/configuration.h>
+#endif
+
 class Configuration;
 class Configuration;
 
 
 class CommandLine
 class CommandLine

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

@@ -34,6 +34,10 @@
 #include <vector>
 #include <vector>
 #include <iostream>
 #include <iostream>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+#endif
+
 class Configuration
 class Configuration
 {
 {
    public:
    public:

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

@@ -24,6 +24,7 @@
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/sptr.h>
 #include <apt-pkg/sptr.h>
+#include <apt-pkg/aptconfiguration.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/configuration.h>
 
 
 #include <cstdlib>
 #include <cstdlib>
@@ -43,6 +44,16 @@
 #include <set>
 #include <set>
 #include <algorithm>
 #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!"
+#endif
+
 #ifdef WORDS_BIGENDIAN
 #ifdef WORDS_BIGENDIAN
 #include <inttypes.h>
 #include <inttypes.h>
 #endif
 #endif
@@ -52,6 +63,23 @@
 
 
 using namespace std;
 using namespace std;
 
 
+class FileFdPrivate {
+	public:
+#if APT_USE_ZLIB
+	gzFile gz;
+#else
+	void* gz;
+#endif
+	int compressed_fd;
+	pid_t compressor_pid;
+	bool pipe;
+	APT::Configuration::Compressor compressor;
+	unsigned int openmode;
+	unsigned long long seekpos;
+	FileFdPrivate() : gz(NULL), compressed_fd(-1), compressor_pid(-1), pipe(false),
+			  openmode(0), seekpos(0) {};
+};
+
 // RunScripts - Run a set of scripts from a configuration subtree	/*{{{*/
 // RunScripts - Run a set of scripts from a configuration subtree	/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
@@ -718,84 +746,287 @@ bool ExecWait(pid_t Pid,const char *Name,bool Reap)
 // FileFd::Open - Open a file						/*{{{*/
 // FileFd::Open - Open a file						/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* The most commonly used open mode combinations are given with Mode */
 /* The most commonly used open mode combinations are given with Mode */
-bool FileFd::Open(string FileName,OpenMode Mode, unsigned long Perms)
+bool FileFd::Open(string FileName,unsigned int const Mode,CompressMode Compress, unsigned long const Perms)
 {
 {
-   Close();
-   Flags = AutoClose;
-   switch (Mode)
+   if (Mode == ReadOnlyGzip)
+      return Open(FileName, ReadOnly, Gzip, Perms);
+
+   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)
    {
    {
-      case ReadOnly:
-      iFd = open(FileName.c_str(),O_RDONLY);
-      break;
-
-      case ReadOnlyGzip:
-      iFd = open(FileName.c_str(),O_RDONLY);
-      if (iFd > 0) {
-	 gz = gzdopen (iFd, "r");
-	 if (gz == NULL) {
-	     close (iFd);
-	     iFd = -1;
-	 }
-      }
-      break;
-      
-      case WriteAtomic:
+      for (; compressor != compressors.end(); ++compressor)
       {
       {
-	 Flags |= Replace;
-	 char *name = strdup((FileName + ".XXXXXX").c_str());
-	 TemporaryFileName = string(mktemp(name));
-	 iFd = open(TemporaryFileName.c_str(),O_RDWR | O_CREAT | O_EXCL,Perms);
-	 free(name);
+	 std::string file = std::string(FileName).append(compressor->Extension);
+	 if (FileExists(file) == false)
+	    continue;
+	 FileName = file;
 	 break;
 	 break;
       }
       }
-
-      case WriteEmpty:
+   }
+   else if (Compress == Extension)
+   {
+      std::string::size_type const found = FileName.find_last_of('.');
+      std::string ext;
+      if (found != std::string::npos)
       {
       {
-      	 struct stat Buf;
-	 if (lstat(FileName.c_str(),&Buf) == 0 && S_ISLNK(Buf.st_mode))
-	    unlink(FileName.c_str());
-	 iFd = open(FileName.c_str(),O_RDWR | O_CREAT | O_TRUNC,Perms);
-	 break;
+	 ext = FileName.substr(found);
+	 if (ext == ".new" || ext == ".bak")
+	 {
+	    std::string::size_type const found2 = FileName.find_last_of('.', found - 1);
+	    if (found2 != std::string::npos)
+	       ext = FileName.substr(found2, found - found2);
+	    else
+	       ext.clear();
+	 }
       }
       }
-      
-      case WriteExists:
-      iFd = open(FileName.c_str(),O_RDWR);
-      break;
+      for (; compressor != compressors.end(); ++compressor)
+	 if (ext == compressor->Extension)
+	    break;
+      // no matching extension - assume uncompressed (imagine files like 'example.org_Packages')
+      if (compressor == compressors.end())
+	 for (compressor = compressors.begin(); compressor != compressors.end(); ++compressor)
+	    if (compressor->Name == ".")
+	       break;
+   }
+   else
+   {
+      std::string name;
+      switch (Compress)
+      {
+      case None: name = "."; break;
+      case Gzip: name = "gzip"; break;
+      case Bzip2: name = "bzip2"; break;
+      case Lzma: name = "lzma"; break;
+      case Xz: name = "xz"; break;
+      case Auto:
+      case Extension:
+	 // Unreachable
+	 return _error->Error("Opening File %s in None, Auto or Extension should be already handled?!?", FileName.c_str());
+      }
+      for (; compressor != compressors.end(); ++compressor)
+	 if (compressor->Name == name)
+	    break;
+      if (compressor == compressors.end())
+	 return _error->Error("Can't find a configured compressor %s for file %s", name.c_str(), FileName.c_str());
+   }
+
+   if (compressor == compressors.end())
+      return _error->Error("Can't find a match for specified compressor mode for file %s", FileName.c_str());
+   return Open(FileName, Mode, *compressor, Perms);
+}
+bool FileFd::Open(string FileName,unsigned int const Mode,APT::Configuration::Compressor const &compressor, unsigned long const Perms)
+{
+   Close();
+   d = new FileFdPrivate;
+   d->openmode = Mode;
+   Flags = AutoClose;
 
 
-      case WriteAny:
-      iFd = open(FileName.c_str(),O_RDWR | O_CREAT,Perms);
-      break;      
+   if ((Mode & WriteOnly) != WriteOnly && (Mode & (Atomic | Create | Empty | Exclusive)) != 0)
+      return _error->Error("ReadOnly mode for %s doesn't accept additional flags!", FileName.c_str());
+   if ((Mode & ReadWrite) == 0)
+      return _error->Error("No openmode provided in FileFd::Open for %s", FileName.c_str());
 
 
-      case WriteTemp:
+   if ((Mode & Atomic) == Atomic)
+   {
+      Flags |= Replace;
+      char *name = strdup((FileName + ".XXXXXX").c_str());
+      TemporaryFileName = string(mktemp(name));
+      free(name);
+   }
+   else if ((Mode & (Exclusive | Create)) == (Exclusive | Create))
+   {
+      // for atomic, this will be done by rename in Close()
       unlink(FileName.c_str());
       unlink(FileName.c_str());
-      iFd = open(FileName.c_str(),O_RDWR | O_CREAT | O_EXCL,Perms);
-      break;
-   }  
+   }
+   if ((Mode & Empty) == Empty)
+   {
+      struct stat Buf;
+      if (lstat(FileName.c_str(),&Buf) == 0 && S_ISLNK(Buf.st_mode))
+	 unlink(FileName.c_str());
+   }
+
+   int fileflags = 0;
+   #define if_FLAGGED_SET(FLAG, MODE) if ((Mode & FLAG) == FLAG) fileflags |= MODE
+   if_FLAGGED_SET(ReadWrite, O_RDWR);
+   else if_FLAGGED_SET(ReadOnly, O_RDONLY);
+   else if_FLAGGED_SET(WriteOnly, O_WRONLY);
+
+   if_FLAGGED_SET(Create, O_CREAT);
+   if_FLAGGED_SET(Empty, O_TRUNC);
+   if_FLAGGED_SET(Exclusive, O_EXCL);
+   else if_FLAGGED_SET(Atomic, O_EXCL);
+   #undef if_FLAGGED_SET
+
+   if (TemporaryFileName.empty() == false)
+      iFd = open(TemporaryFileName.c_str(), fileflags, Perms);
+   else
+      iFd = open(FileName.c_str(), fileflags, Perms);
+
+   if (iFd == -1 || OpenInternDescriptor(Mode, compressor) == false)
+   {
+      if (iFd != -1)
+      {
+	 close (iFd);
+	 iFd = -1;
+      }
+      return _error->Errno("open",_("Could not open file %s"), FileName.c_str());
+   }
 
 
-   if (iFd < 0)
-      return _error->Errno("open",_("Could not open file %s"),FileName.c_str());
-   
    this->FileName = FileName;
    this->FileName = FileName;
    SetCloseExec(iFd,true);
    SetCloseExec(iFd,true);
    return true;
    return true;
 }
 }
+									/*}}}*/
+// FileFd::OpenDescriptor - Open a filedescriptor			/*{{{*/
+// ---------------------------------------------------------------------
+/* */
+bool FileFd::OpenDescriptor(int Fd, unsigned int const Mode, CompressMode Compress, bool AutoClose)
+{
+   std::vector<APT::Configuration::Compressor> const compressors = APT::Configuration::getCompressors();
+   std::vector<APT::Configuration::Compressor>::const_iterator compressor = compressors.begin();
+   std::string name;
+   switch (Compress)
+   {
+   case None: name = "."; break;
+   case Gzip: name = "gzip"; break;
+   case Bzip2: name = "bzip2"; break;
+   case Lzma: name = "lzma"; break;
+   case Xz: name = "xz"; break;
+   case Auto:
+   case Extension:
+      return _error->Error("Opening Fd %d in Auto or Extension compression mode is not supported", Fd);
+   }
+   for (; compressor != compressors.end(); ++compressor)
+      if (compressor->Name == name)
+	 break;
+   if (compressor == compressors.end())
+      return _error->Error("Can't find a configured compressor %s for file %s", name.c_str(), FileName.c_str());
 
 
-bool FileFd::OpenDescriptor(int Fd, OpenMode Mode, bool AutoClose)
+   return OpenDescriptor(Fd, Mode, *compressor, AutoClose);
+}
+bool FileFd::OpenDescriptor(int Fd, unsigned int const Mode, APT::Configuration::Compressor const &compressor, bool AutoClose)
 {
 {
    Close();
    Close();
+   d = new FileFdPrivate;
+   d->openmode = Mode;
    Flags = (AutoClose) ? FileFd::AutoClose : 0;
    Flags = (AutoClose) ? FileFd::AutoClose : 0;
    iFd = Fd;
    iFd = Fd;
-   if (Mode == ReadOnlyGzip) {
-      gz = gzdopen (iFd, "r");
-      if (gz == NULL) {
-	 if (AutoClose)
-	    close (iFd);
-	 return _error->Errno("gzdopen",_("Could not open file descriptor %d"),
-			      Fd);
-      }
+   if (OpenInternDescriptor(Mode, compressor) == false)
+   {
+      if (AutoClose)
+	 close (iFd);
+      return _error->Errno("gzdopen",_("Could not open file descriptor %d"), Fd);
    }
    }
    this->FileName = "";
    this->FileName = "";
    return true;
    return true;
+}
+bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::Compressor const &compressor)
+{
+   d->compressor = compressor;
+   if (compressor.Name == "." || compressor.Binary.empty() == true)
+      return true;
+#if APT_USE_ZLIB
+   else if (compressor.Name == "gzip")
+   {
+      if ((Mode & ReadWrite) == ReadWrite)
+	 d->gz = gzdopen(iFd, "r+");
+      else if ((Mode & WriteOnly) == WriteOnly)
+	 d->gz = gzdopen(iFd, "w");
+      else
+	 d->gz = gzdopen (iFd, "r");
+      if (d->gz == 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());
+
+   bool const Comp = (Mode & WriteOnly) == WriteOnly;
+   // Handle 'decompression' of empty files
+   if (Comp == false)
+   {
+      struct stat Buf;
+      fstat(iFd, &Buf);
+      if (Buf.st_size == 0 && S_ISFIFO(Buf.st_mode) == false)
+	 return true;
+
+      // We don't need the file open - instead let the compressor open it
+      // as he properly knows better how to efficiently read from 'his' file
+      if (FileName.empty() == false)
+	 close(iFd);
+   }
+
+   // Create a data pipe
+   int Pipe[2] = {-1,-1};
+   if (pipe(Pipe) != 0)
+      return _error->Errno("pipe",_("Failed to create subprocess IPC"));
+   for (int J = 0; J != 2; J++)
+      SetCloseExec(Pipe[J],true);
+
+   d->compressed_fd = iFd;
+   d->pipe = true;
+
+   if (Comp == true)
+      iFd = Pipe[1];
+   else
+      iFd = Pipe[0];
+
+   // The child..
+   d->compressor_pid = ExecFork();
+   if (d->compressor_pid == 0)
+   {
+      if (Comp == true)
+      {
+	 dup2(d->compressed_fd,STDOUT_FILENO);
+	 dup2(Pipe[0],STDIN_FILENO);
+      }
+      else
+      {
+	 if (FileName.empty() == true)
+	    dup2(d->compressed_fd,STDIN_FILENO);
+	 dup2(Pipe[1],STDOUT_FILENO);
+      }
+
+      SetCloseExec(STDOUT_FILENO,false);
+      SetCloseExec(STDIN_FILENO,false);
+
+      std::vector<char const*> Args;
+      Args.push_back(compressor.Binary.c_str());
+      std::vector<std::string> const * const addArgs =
+		(Comp == true) ? &(compressor.CompressArgs) : &(compressor.UncompressArgs);
+      for (std::vector<std::string>::const_iterator a = addArgs->begin();
+	   a != addArgs->end(); ++a)
+	 Args.push_back(a->c_str());
+      if (Comp == false && FileName.empty() == false)
+      {
+	 Args.push_back("--stdout");
+	 if (TemporaryFileName.empty() == false)
+	    Args.push_back(TemporaryFileName.c_str());
+	 else
+	    Args.push_back(FileName.c_str());
+      }
+      Args.push_back(NULL);
+
+      execvp(Args[0],(char **)&Args[0]);
+      cerr << _("Failed to exec compressor ") << Args[0] << endl;
+      _exit(100);
+   }
+   if (Comp == true)
+      close(Pipe[0]);
+   else
+      close(Pipe[1]);
+   if (Comp == true || FileName.empty() == true)
+      close(d->compressed_fd);
+
+   return true;
 }
 }
 									/*}}}*/
 									/*}}}*/
 // FileFd::~File - Closes the file					/*{{{*/
 // FileFd::~File - Closes the file					/*{{{*/
@@ -817,12 +1048,14 @@ bool FileFd::Read(void *To,unsigned long long Size,unsigned long long *Actual)
    errno = 0;
    errno = 0;
    if (Actual != 0)
    if (Actual != 0)
       *Actual = 0;
       *Actual = 0;
-   
+   *((char *)To) = '\0';
    do
    do
    {
    {
-      if (gz != NULL)
-         Res = gzread(gz,To,Size);
+#if APT_USE_ZLIB
+      if (d->gz != NULL)
+         Res = gzread(d->gz,To,Size);
       else
       else
+#endif
          Res = read(iFd,To,Size);
          Res = read(iFd,To,Size);
       if (Res < 0 && errno == EINTR)
       if (Res < 0 && errno == EINTR)
 	 continue;
 	 continue;
@@ -834,6 +1067,7 @@ bool FileFd::Read(void *To,unsigned long long Size,unsigned long long *Actual)
       
       
       To = (char *)To + Res;
       To = (char *)To + Res;
       Size -= Res;
       Size -= Res;
+      d->seekpos += Res;
       if (Actual != 0)
       if (Actual != 0)
 	 *Actual += Res;
 	 *Actual += Res;
    }
    }
@@ -853,6 +1087,35 @@ bool FileFd::Read(void *To,unsigned long long Size,unsigned long long *Actual)
    return _error->Error(_("read, still have %llu to read but none left"), Size);
    return _error->Error(_("read, still have %llu to read but none left"), Size);
 }
 }
 									/*}}}*/
 									/*}}}*/
+// FileFd::ReadLine - Read a complete line from the file		/*{{{*/
+// ---------------------------------------------------------------------
+/* Beware: This method can be quiet slow for big buffers on UNcompressed
+   files because of the naive implementation! */
+char* FileFd::ReadLine(char *To, unsigned long long const Size)
+{
+   *To = '\0';
+#if APT_USE_ZLIB
+   if (d->gz != NULL)
+      return gzgets(d->gz, To, Size);
+#endif
+
+   unsigned long long read = 0;
+   while ((Size - 1) != read)
+   {
+      unsigned long long done = 0;
+      if (Read(To + read, 1, &done) == false)
+	 return NULL;
+      if (done == 0)
+	 break;
+      if (To[read++] == '\n')
+	 break;
+   }
+   if (read == 0)
+      return NULL;
+   To[read] = '\0';
+   return To;
+}
+									/*}}}*/
 // FileFd::Write - Write to the file					/*{{{*/
 // FileFd::Write - Write to the file					/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
@@ -862,9 +1125,11 @@ bool FileFd::Write(const void *From,unsigned long long Size)
    errno = 0;
    errno = 0;
    do
    do
    {
    {
-      if (gz != NULL)
-         Res = gzwrite(gz,From,Size);
+#if APT_USE_ZLIB
+      if (d->gz != NULL)
+         Res = gzwrite(d->gz,From,Size);
       else
       else
+#endif
          Res = write(iFd,From,Size);
          Res = write(iFd,From,Size);
       if (Res < 0 && errno == EINTR)
       if (Res < 0 && errno == EINTR)
 	 continue;
 	 continue;
@@ -876,6 +1141,7 @@ bool FileFd::Write(const void *From,unsigned long long Size)
       
       
       From = (char *)From + Res;
       From = (char *)From + Res;
       Size -= Res;
       Size -= Res;
+      d->seekpos += Res;
    }
    }
    while (Res > 0 && Size > 0);
    while (Res > 0 && Size > 0);
    
    
@@ -891,17 +1157,55 @@ bool FileFd::Write(const void *From,unsigned long long Size)
 /* */
 /* */
 bool FileFd::Seek(unsigned long long To)
 bool FileFd::Seek(unsigned long long To)
 {
 {
+   if (d->pipe == true)
+   {
+      // Our poor man seeking in pipes is costly, so try to avoid it
+      unsigned long long seekpos = Tell();
+      if (seekpos == To)
+	 return true;
+      else if (seekpos < To)
+	 return Skip(To - seekpos);
+
+      if ((d->openmode & ReadOnly) != ReadOnly)
+	 return _error->Error("Reopen is only implemented for read-only files!");
+      close(iFd);
+      iFd = 0;
+      if (TemporaryFileName.empty() == false)
+	 iFd = open(TemporaryFileName.c_str(), O_RDONLY);
+      else if (FileName.empty() == false)
+	 iFd = open(FileName.c_str(), O_RDONLY);
+      else
+      {
+	 if (d->compressed_fd > 0)
+	    if (lseek(d->compressed_fd, 0, SEEK_SET) != 0)
+	       iFd = d->compressed_fd;
+	 if (iFd <= 0)
+	    return _error->Error("Reopen is not implemented for pipes opened with FileFd::OpenDescriptor()!");
+      }
+
+      if (OpenInternDescriptor(d->openmode, d->compressor) == false)
+	 return _error->Error("Seek on file %s because it couldn't be reopened", FileName.c_str());
+
+      if (To != 0)
+	 return Skip(To);
+
+      d->seekpos = To;
+      return true;
+   }
    int res;
    int res;
-   if (gz)
-      res = gzseek(gz,To,SEEK_SET);
+#if APT_USE_ZLIB
+   if (d->gz)
+      res = gzseek(d->gz,To,SEEK_SET);
    else
    else
+#endif
       res = lseek(iFd,To,SEEK_SET);
       res = lseek(iFd,To,SEEK_SET);
    if (res != (signed)To)
    if (res != (signed)To)
    {
    {
       Flags |= Fail;
       Flags |= Fail;
       return _error->Error("Unable to seek to %llu", To);
       return _error->Error("Unable to seek to %llu", To);
    }
    }
-   
+
+   d->seekpos = To;
    return true;
    return true;
 }
 }
 									/*}}}*/
 									/*}}}*/
@@ -910,17 +1214,34 @@ bool FileFd::Seek(unsigned long long To)
 /* */
 /* */
 bool FileFd::Skip(unsigned long long Over)
 bool FileFd::Skip(unsigned long long Over)
 {
 {
+   if (d->pipe == true)
+   {
+      d->seekpos += Over;
+      char buffer[1024];
+      while (Over != 0)
+      {
+	 unsigned long long toread = std::min((unsigned long long) sizeof(buffer), Over);
+	 if (Read(buffer, toread) == false)
+	    return _error->Error("Unable to seek ahead %llu",Over);
+	 Over -= toread;
+      }
+      return true;
+   }
+
    int res;
    int res;
-   if (gz)
-      res = gzseek(gz,Over,SEEK_CUR);
+#if APT_USE_ZLIB
+   if (d->gz != NULL)
+      res = gzseek(d->gz,Over,SEEK_CUR);
    else
    else
+#endif
       res = lseek(iFd,Over,SEEK_CUR);
       res = lseek(iFd,Over,SEEK_CUR);
    if (res < 0)
    if (res < 0)
    {
    {
       Flags |= Fail;
       Flags |= Fail;
       return _error->Error("Unable to seek ahead %llu",Over);
       return _error->Error("Unable to seek ahead %llu",Over);
    }
    }
-   
+   d->seekpos = res;
+
    return true;
    return true;
 }
 }
 									/*}}}*/
 									/*}}}*/
@@ -929,7 +1250,7 @@ bool FileFd::Skip(unsigned long long Over)
 /* */
 /* */
 bool FileFd::Truncate(unsigned long long To)
 bool FileFd::Truncate(unsigned long long To)
 {
 {
-   if (gz)
+   if (d->gz != NULL)
    {
    {
       Flags |= Fail;
       Flags |= Fail;
       return _error->Error("Truncating gzipped files is not implemented (%s)", FileName.c_str());
       return _error->Error("Truncating gzipped files is not implemented (%s)", FileName.c_str());
@@ -948,13 +1269,23 @@ bool FileFd::Truncate(unsigned long long To)
 /* */
 /* */
 unsigned long long FileFd::Tell()
 unsigned long long FileFd::Tell()
 {
 {
+   // In theory, we could just return seekpos here always instead of
+   // 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)
+      return d->seekpos;
+
    off_t Res;
    off_t Res;
-   if (gz)
-     Res = gztell(gz);
+#if APT_USE_ZLIB
+   if (d->gz != NULL)
+     Res = gztell(d->gz);
    else
    else
+#endif
      Res = lseek(iFd,0,SEEK_CUR);
      Res = lseek(iFd,0,SEEK_CUR);
    if (Res == (off_t)-1)
    if (Res == (off_t)-1)
       _error->Errno("lseek","Failed to determine the current file position");
       _error->Errno("lseek","Failed to determine the current file position");
+   d->seekpos = Res;
    return Res;
    return Res;
 }
 }
 									/*}}}*/
 									/*}}}*/
@@ -964,9 +1295,19 @@ unsigned long long FileFd::Tell()
 unsigned long long FileFd::FileSize()
 unsigned long long FileFd::FileSize()
 {
 {
    struct stat Buf;
    struct stat Buf;
-
-   if (fstat(iFd,&Buf) != 0)
+   if (d->pipe == false && fstat(iFd,&Buf) != 0)
       return _error->Errno("fstat","Unable to determine the file size");
       return _error->Errno("fstat","Unable to determine the file size");
+
+   // for compressor pipes st_size is undefined and at 'best' zero
+   if (d->pipe == true || S_ISFIFO(Buf.st_mode))
+   {
+      // we set it here, too, as we get the info here for free
+      // in theory the Open-methods should take care of it already
+      d->pipe = true;
+      if (stat(FileName.c_str(), &Buf) != 0)
+	 return _error->Errno("stat","Unable to determine the file size");
+   }
+
    return Buf.st_size;
    return Buf.st_size;
 }
 }
 									/*}}}*/
 									/*}}}*/
@@ -977,16 +1318,29 @@ unsigned long long FileFd::Size()
 {
 {
    unsigned long long size = FileSize();
    unsigned long long size = FileSize();
 
 
+   // 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)
+   {
+      unsigned long long const oldSeek = Tell();
+      char ignore[1000];
+      unsigned long long read = 0;
+      do {
+	 Read(ignore, sizeof(ignore), &read);
+      } while(read != 0);
+      size = Tell();
+      Seek(oldSeek);
+   }
+#if APT_USE_ZLIB
    // only check gzsize if we are actually a gzip file, just checking for
    // only check gzsize if we are actually a gzip file, just checking for
-   // "gz" is not sufficient as uncompressed files will be opened with
+   // "gz" is not sufficient as uncompressed files could be opened with
    // gzopen in "direct" mode as well
    // gzopen in "direct" mode as well
-   if (gz && !gzdirect(gz) && size > 0)
+   else if (d->gz && !gzdirect(d->gz) && size > 0)
    {
    {
        /* unfortunately zlib.h doesn't provide a gzsize(), so we have to do
        /* unfortunately zlib.h doesn't provide a gzsize(), so we have to do
 	* this ourselves; the original (uncompressed) file size is the last 32
 	* this ourselves; the original (uncompressed) file size is the last 32
 	* bits of the file */
 	* bits of the file */
        // FIXME: Size for gz-files is limited by 32bit… no largefile support
        // FIXME: Size for gz-files is limited by 32bit… no largefile support
-       off_t orig_pos = lseek(iFd, 0, SEEK_CUR);
        if (lseek(iFd, -4, SEEK_END) < 0)
        if (lseek(iFd, -4, SEEK_END) < 0)
 	   return _error->Errno("lseek","Unable to seek to end of gzipped file");
 	   return _error->Errno("lseek","Unable to seek to end of gzipped file");
        size = 0L;
        size = 0L;
@@ -1000,28 +1354,62 @@ unsigned long long FileFd::Size()
        size = tmp_size;
        size = tmp_size;
 #endif
 #endif
 
 
-       if (lseek(iFd, orig_pos, SEEK_SET) < 0)
+       if (lseek(iFd, d->seekpos, SEEK_SET) < 0)
 	   return _error->Errno("lseek","Unable to seek in gzipped file");
 	   return _error->Errno("lseek","Unable to seek in gzipped file");
        return size;
        return size;
    }
    }
+#endif
 
 
    return size;
    return size;
 }
 }
 									/*}}}*/
 									/*}}}*/
+// FileFd::ModificationTime - Return the time of last touch		/*{{{*/
+// ---------------------------------------------------------------------
+/* */
+time_t FileFd::ModificationTime()
+{
+   struct stat Buf;
+   if (d->pipe == false && fstat(iFd,&Buf) != 0)
+   {
+      _error->Errno("fstat","Unable to determine the modification time of file %s", FileName.c_str());
+      return 0;
+   }
+
+   // for compressor pipes st_size is undefined and at 'best' zero
+   if (d->pipe == true || S_ISFIFO(Buf.st_mode))
+   {
+      // we set it here, too, as we get the info here for free
+      // in theory the Open-methods should take care of it already
+      d->pipe = true;
+      if (stat(FileName.c_str(), &Buf) != 0)
+      {
+	 _error->Errno("fstat","Unable to determine the modification time of file %s", FileName.c_str());
+	 return 0;
+      }
+   }
+
+   return Buf.st_mtime;
+}
+									/*}}}*/
 // FileFd::Close - Close the file if the close flag is set		/*{{{*/
 // FileFd::Close - Close the file if the close flag is set		/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
 bool FileFd::Close()
 bool FileFd::Close()
 {
 {
+   if (iFd == -1)
+      return true;
+
    bool Res = true;
    bool Res = true;
    if ((Flags & AutoClose) == AutoClose)
    if ((Flags & AutoClose) == AutoClose)
    {
    {
-      if (gz != NULL) {
-	 int const e = gzclose(gz);
+#if APT_USE_ZLIB
+      if (d != NULL && d->gz != NULL) {
+	 int const e = gzclose(d->gz);
 	 // gzdopen() on empty files always fails with "buffer error" here, ignore that
 	 // gzdopen() on empty files always fails with "buffer error" here, ignore that
 	 if (e != 0 && e != Z_BUF_ERROR)
 	 if (e != 0 && e != Z_BUF_ERROR)
 	    Res &= _error->Errno("close",_("Problem closing the gzip file %s"), FileName.c_str());
 	    Res &= _error->Errno("close",_("Problem closing the gzip file %s"), FileName.c_str());
       } else
       } else
+#endif
 	 if (iFd > 0 && close(iFd) != 0)
 	 if (iFd > 0 && close(iFd) != 0)
 	    Res &= _error->Errno("close",_("Problem closing the file %s"), FileName.c_str());
 	    Res &= _error->Errno("close",_("Problem closing the file %s"), FileName.c_str());
    }
    }
@@ -1031,16 +1419,23 @@ bool FileFd::Close()
 	 Res &= _error->Errno("rename",_("Problem renaming the file %s to %s"), TemporaryFileName.c_str(), FileName.c_str());
 	 Res &= _error->Errno("rename",_("Problem renaming the file %s to %s"), TemporaryFileName.c_str(), FileName.c_str());
 
 
       FileName = TemporaryFileName; // for the unlink() below.
       FileName = TemporaryFileName; // for the unlink() below.
+      TemporaryFileName.clear();
    }
    }
 
 
    iFd = -1;
    iFd = -1;
-   gz = NULL;
 
 
    if ((Flags & Fail) == Fail && (Flags & DelOnFail) == DelOnFail &&
    if ((Flags & Fail) == Fail && (Flags & DelOnFail) == DelOnFail &&
        FileName.empty() == false)
        FileName.empty() == false)
       if (unlink(FileName.c_str()) != 0)
       if (unlink(FileName.c_str()) != 0)
 	 Res &= _error->WarningE("unlnk",_("Problem unlinking the file %s"), FileName.c_str());
 	 Res &= _error->WarningE("unlnk",_("Problem unlinking the file %s"), FileName.c_str());
 
 
+   if (d != NULL)
+   {
+      if (d->compressor_pid > 0)
+	 ExecWait(d->compressor_pid, "FileFdCompressor", true);
+      delete d;
+      d = NULL;
+   }
 
 
    return Res;
    return Res;
 }
 }
@@ -1057,3 +1452,5 @@ bool FileFd::Sync()
    return true;
    return true;
 }
 }
 									/*}}}*/
 									/*}}}*/
+
+gzFile FileFd::gzFd() { return (gzFile) d->gz; }

+ 59 - 12
apt-pkg/contrib/fileutl.h

@@ -22,30 +22,51 @@
 #define PKGLIB_FILEUTL_H
 #define PKGLIB_FILEUTL_H
 
 
 #include <apt-pkg/macros.h>
 #include <apt-pkg/macros.h>
+#include <apt-pkg/aptconfiguration.h>
 
 
 #include <string>
 #include <string>
 #include <vector>
 #include <vector>
 
 
 #include <zlib.h>
 #include <zlib.h>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+#endif
+
 /* Define this for python-apt */
 /* Define this for python-apt */
 #define APT_HAS_GZIP 1
 #define APT_HAS_GZIP 1
 
 
+class FileFdPrivate;
 class FileFd
 class FileFd
 {
 {
    protected:
    protected:
    int iFd;
    int iFd;
  
  
    enum LocalFlags {AutoClose = (1<<0),Fail = (1<<1),DelOnFail = (1<<2),
    enum LocalFlags {AutoClose = (1<<0),Fail = (1<<1),DelOnFail = (1<<2),
-                    HitEof = (1<<3), Replace = (1<<4) };
+                    HitEof = (1<<3), Replace = (1<<4), Compressed = (1<<5) };
    unsigned long Flags;
    unsigned long Flags;
    std::string FileName;
    std::string FileName;
    std::string TemporaryFileName;
    std::string TemporaryFileName;
-   gzFile gz;
 
 
    public:
    public:
-   enum OpenMode {ReadOnly,WriteEmpty,WriteExists,WriteAny,WriteTemp,ReadOnlyGzip,
-                  WriteAtomic};
+   enum OpenMode {
+	ReadOnly = (1 << 0),
+	WriteOnly = (1 << 1),
+	ReadWrite = ReadOnly | WriteOnly,
+
+	Create = (1 << 2),
+	Exclusive = (1 << 3),
+	Atomic = Exclusive | (1 << 4),
+	Empty = (1 << 5),
+
+	WriteEmpty = ReadWrite | Create | Empty,
+	WriteExists = ReadWrite,
+	WriteAny = ReadWrite | Create,
+	WriteTemp = ReadWrite | Create | Exclusive,
+	ReadOnlyGzip,
+	WriteAtomic = ReadWrite | Create | Atomic
+   };
+   enum CompressMode { Auto = 'A', None = 'N', Extension = 'E', Gzip = 'G', Bzip2 = 'B', Lzma = 'L', Xz = 'X' };
    
    
    inline bool Read(void *To,unsigned long long Size,bool AllowEof)
    inline bool Read(void *To,unsigned long long Size,bool AllowEof)
    {
    {
@@ -55,6 +76,7 @@ class FileFd
       return Read(To,Size);
       return Read(To,Size);
    }   
    }   
    bool Read(void *To,unsigned long long Size,unsigned long long *Actual = 0);
    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 Write(const void *From,unsigned long long Size);
    bool Seek(unsigned long long To);
    bool Seek(unsigned long long To);
    bool Skip(unsigned long long To);
    bool Skip(unsigned long long To);
@@ -62,6 +84,7 @@ class FileFd
    unsigned long long Tell();
    unsigned long long Tell();
    unsigned long long Size();
    unsigned long long Size();
    unsigned long long FileSize();
    unsigned long long FileSize();
+   time_t ModificationTime();
 
 
    /* You want to use 'unsigned long long' if you are talking about a file
    /* You want to use 'unsigned long long' if you are talking about a file
       to be able to support large files (>2 or >4 GB) properly.
       to be able to support large files (>2 or >4 GB) properly.
@@ -77,30 +100,54 @@ class FileFd
 	return T;
 	return T;
    }
    }
 
 
-   bool Open(std::string FileName,OpenMode Mode,unsigned long Perms = 0666);
-   bool OpenDescriptor(int Fd, OpenMode Mode, bool AutoClose=false);
+   bool Open(std::string FileName,unsigned int const Mode,CompressMode Compress,unsigned long const Perms = 0666);
+   bool Open(std::string FileName,unsigned int const Mode,APT::Configuration::Compressor const &compressor,unsigned long const Perms = 0666);
+   inline bool Open(std::string const &FileName,unsigned int const Mode, unsigned long const Perms = 0666) {
+      return Open(FileName, Mode, None, Perms);
+   };
+   bool OpenDescriptor(int Fd, unsigned int const Mode, CompressMode Compress, bool AutoClose=false);
+   bool OpenDescriptor(int Fd, unsigned int const Mode, APT::Configuration::Compressor const &compressor, bool AutoClose=false);
+   inline bool OpenDescriptor(int Fd, unsigned int const Mode, bool AutoClose=false) {
+      return OpenDescriptor(Fd, Mode, None, AutoClose);
+   };
    bool Close();
    bool Close();
    bool Sync();
    bool Sync();
    
    
    // Simple manipulators
    // Simple manipulators
    inline int Fd() {return iFd;};
    inline int Fd() {return iFd;};
    inline void Fd(int fd) {iFd = fd;};
    inline void Fd(int fd) {iFd = fd;};
-   inline gzFile gzFd() {return gz;};
+   __deprecated gzFile gzFd();
+
    inline bool IsOpen() {return iFd >= 0;};
    inline bool IsOpen() {return iFd >= 0;};
    inline bool Failed() {return (Flags & Fail) == Fail;};
    inline bool Failed() {return (Flags & Fail) == Fail;};
    inline void EraseOnFailure() {Flags |= DelOnFail;};
    inline void EraseOnFailure() {Flags |= DelOnFail;};
    inline void OpFail() {Flags |= Fail;};
    inline void OpFail() {Flags |= Fail;};
    inline bool Eof() {return (Flags & HitEof) == HitEof;};
    inline bool Eof() {return (Flags & HitEof) == HitEof;};
+   inline bool IsCompressed() {return (Flags & Compressed) == Compressed;};
    inline std::string &Name() {return FileName;};
    inline std::string &Name() {return FileName;};
    
    
-   FileFd(std::string FileName,OpenMode Mode,unsigned long Perms = 0666) : iFd(-1), 
-            Flags(0), gz(NULL)
+   FileFd(std::string FileName,unsigned int const Mode,unsigned long Perms = 0666) : iFd(-1), Flags(0), d(NULL)
    {
    {
-      Open(FileName,Mode,Perms);
+      Open(FileName,Mode, None, Perms);
+   };
+   FileFd(std::string FileName,unsigned int const Mode, CompressMode Compress, unsigned long Perms = 0666) : iFd(-1), Flags(0), d(NULL)
+   {
+      Open(FileName,Mode, Compress, Perms);
+   };
+   FileFd() : iFd(-1), Flags(AutoClose), d(NULL) {};
+   FileFd(int const Fd, unsigned int const Mode = ReadWrite, CompressMode Compress = None) : iFd(-1), Flags(0), d(NULL)
+   {
+      OpenDescriptor(Fd, Mode, Compress);
+   };
+   FileFd(int const Fd, bool const AutoClose) : iFd(-1), Flags(0), d(NULL)
+   {
+      OpenDescriptor(Fd, ReadWrite, None, AutoClose);
    };
    };
-   FileFd(int Fd = -1) : iFd(Fd), Flags(AutoClose), gz(NULL) {};
-   FileFd(int Fd,bool) : iFd(Fd), Flags(0), gz(NULL) {};
    virtual ~FileFd();
    virtual ~FileFd();
+
+   private:
+   FileFdPrivate* d;
+   bool OpenInternDescriptor(unsigned int const Mode, APT::Configuration::Compressor const &compressor);
 };
 };
 
 
 bool RunScripts(const char *Cnf);
 bool RunScripts(const char *Cnf);

+ 35 - 5
apt-pkg/contrib/hashes.cc

@@ -61,25 +61,25 @@ bool HashString::VerifyFile(std::string filename) const			/*{{{*/
    if(Type == "MD5Sum")
    if(Type == "MD5Sum")
    {
    {
       MD5Summation MD5;
       MD5Summation MD5;
-      MD5.AddFD(Fd.Fd(), Fd.Size());
+      MD5.AddFD(Fd);
       fileHash = (std::string)MD5.Result();
       fileHash = (std::string)MD5.Result();
    }
    }
    else if (Type == "SHA1")
    else if (Type == "SHA1")
    {
    {
       SHA1Summation SHA1;
       SHA1Summation SHA1;
-      SHA1.AddFD(Fd.Fd(), Fd.Size());
+      SHA1.AddFD(Fd);
       fileHash = (std::string)SHA1.Result();
       fileHash = (std::string)SHA1.Result();
    }
    }
    else if (Type == "SHA256")
    else if (Type == "SHA256")
    {
    {
       SHA256Summation SHA256;
       SHA256Summation SHA256;
-      SHA256.AddFD(Fd.Fd(), Fd.Size());
+      SHA256.AddFD(Fd);
       fileHash = (std::string)SHA256.Result();
       fileHash = (std::string)SHA256.Result();
    }
    }
    else if (Type == "SHA512")
    else if (Type == "SHA512")
    {
    {
       SHA512Summation SHA512;
       SHA512Summation SHA512;
-      SHA512.AddFD(Fd.Fd(), Fd.Size());
+      SHA512.AddFD(Fd);
       fileHash = (std::string)SHA512.Result();
       fileHash = (std::string)SHA512.Result();
    }
    }
    Fd.Close();
    Fd.Close();
@@ -134,6 +134,36 @@ bool Hashes::AddFD(int const Fd,unsigned long long Size, bool const addMD5,
 	 SHA512.Add(Buf,Res);
 	 SHA512.Add(Buf,Res);
    }
    }
    return true;
    return true;
+}
+bool Hashes::AddFD(FileFd &Fd,unsigned long long Size, bool const addMD5,
+		   bool const addSHA1, bool const addSHA256, bool const addSHA512)
+{
+   unsigned char Buf[64*64];
+   bool const ToEOF = (Size == 0);
+   while (Size != 0 || ToEOF)
+   {
+      unsigned long long n = sizeof(Buf);
+      if (!ToEOF) n = std::min(Size, n);
+      unsigned long long a = 0;
+      if (Fd.Read(Buf, n, &a) == false) // error
+	 return false;
+      if (ToEOF == false)
+      {
+	 if (a != n) // short read
+	    return false;
+      }
+      else if (a == 0) // EOF
+	 break;
+      Size -= a;
+      if (addMD5 == true)
+	 MD5.Add(Buf, a);
+      if (addSHA1 == true)
+	 SHA1.Add(Buf, a);
+      if (addSHA256 == true)
+	 SHA256.Add(Buf, a);
+      if (addSHA512 == true)
+	 SHA512.Add(Buf, a);
+   }
+   return true;
 }
 }
 									/*}}}*/
 									/*}}}*/
-

+ 11 - 0
apt-pkg/contrib/hashes.h

@@ -17,11 +17,18 @@
 #include <apt-pkg/md5.h>
 #include <apt-pkg/md5.h>
 #include <apt-pkg/sha1.h>
 #include <apt-pkg/sha1.h>
 #include <apt-pkg/sha2.h>
 #include <apt-pkg/sha2.h>
+#include <apt-pkg/fileutl.h>
 
 
 #include <algorithm>
 #include <algorithm>
 #include <vector>
 #include <vector>
 #include <cstring>
 #include <cstring>
 
 
+
+#ifndef APT_8_CLEANER_HEADERS
+using std::min;
+using std::vector;
+#endif
+
 // helper class that contains hash function name
 // helper class that contains hash function name
 // and hash
 // and hash
 class HashString
 class HashString
@@ -68,6 +75,10 @@ class Hashes
    { return AddFD(Fd, Size, true, true, true, true); };
    { return AddFD(Fd, Size, true, true, true, true); };
    bool AddFD(int const Fd, unsigned long long Size, bool const addMD5,
    bool AddFD(int const Fd, unsigned long long Size, bool const addMD5,
 	      bool const addSHA1, bool const addSHA256, bool const addSHA512);
 	      bool const addSHA1, bool const addSHA256, bool const addSHA512);
+   inline bool AddFD(FileFd &Fd,unsigned long long Size = 0)
+   { return AddFD(Fd, Size, true, true, true, true); };
+   bool AddFD(FileFd &Fd, unsigned long long Size, bool const addMD5,
+	      bool const addSHA1, bool const addSHA256, bool const addSHA512);
    inline bool Add(const unsigned char *Beg,const unsigned char *End) 
    inline bool Add(const unsigned char *Beg,const unsigned char *End) 
                   {return Add(Beg,End-Beg);};
                   {return Add(Beg,End-Beg);};
 };
 };

+ 22 - 0
apt-pkg/contrib/hashsum.cc

@@ -24,5 +24,27 @@ bool SummationImplementation::AddFD(int const Fd, unsigned long long Size) {
       Add(Buf,Res);
       Add(Buf,Res);
    }
    }
    return true;
    return true;
+}
+bool SummationImplementation::AddFD(FileFd &Fd, unsigned long long Size) {
+   unsigned char Buf[64 * 64];
+   bool ToEOF = (Size == 0);
+   while (Size != 0 || ToEOF)
+   {
+      unsigned long long n = sizeof(Buf);
+      if (!ToEOF) n = std::min(Size, n);
+      unsigned long long a = 0;
+      if (Fd.Read(Buf, n, &a) == false) // error
+	 return false;
+      if (ToEOF == false)
+      {
+	 if (a != n) // short read
+	    return false;
+      }
+      else if (a == 0) // EOF
+	 break;
+      Size -= a;
+      Add(Buf, a);
+   }
+   return true;
 }
 }
 									/*}}}*/
 									/*}}}*/

+ 8 - 0
apt-pkg/contrib/hashsum_template.h

@@ -10,6 +10,8 @@
 #ifndef APTPKG_HASHSUM_TEMPLATE_H
 #ifndef APTPKG_HASHSUM_TEMPLATE_H
 #define APTPKG_HASHSUM_TEMPLATE_H
 #define APTPKG_HASHSUM_TEMPLATE_H
 
 
+#include <apt-pkg/fileutl.h>
+
 #include <string>
 #include <string>
 #include <cstring>
 #include <cstring>
 #include <algorithm>
 #include <algorithm>
@@ -17,6 +19,11 @@
 
 
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/strutl.h>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+using std::min;
+#endif
+
 template<int N>
 template<int N>
 class HashSumValue
 class HashSumValue
 {
 {
@@ -105,6 +112,7 @@ class SummationImplementation
    { return Add((const unsigned char *)Beg, End - Beg); };
    { return Add((const unsigned char *)Beg, End - Beg); };
 
 
    bool AddFD(int Fd, unsigned long long Size = 0);
    bool AddFD(int Fd, unsigned long long Size = 0);
+   bool AddFD(FileFd &Fd, unsigned long long Size = 0);
 };
 };
 
 
 #endif
 #endif

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

@@ -31,6 +31,11 @@
 
 
 #include "hashsum_template.h"
 #include "hashsum_template.h"
 
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+using std::min;
+#endif
+
 typedef HashSumValue<128> MD5SumValue;
 typedef HashSumValue<128> MD5SumValue;
 
 
 class MD5Summation : public SummationImplementation
 class MD5Summation : public SummationImplementation

+ 20 - 2
apt-pkg/contrib/mmap.cc

@@ -66,7 +66,7 @@ MMap::~MMap()
 bool MMap::Map(FileFd &Fd)
 bool MMap::Map(FileFd &Fd)
 {
 {
    iSize = Fd.Size();
    iSize = Fd.Size();
-   
+
    // Set the permissions.
    // Set the permissions.
    int Prot = PROT_READ;
    int Prot = PROT_READ;
    int Map = MAP_SHARED;
    int Map = MAP_SHARED;
@@ -77,7 +77,18 @@ bool MMap::Map(FileFd &Fd)
    
    
    if (iSize == 0)
    if (iSize == 0)
       return _error->Error(_("Can't mmap an empty file"));
       return _error->Error(_("Can't mmap an empty file"));
-   
+
+   // We can't mmap compressed fd's directly, so we need to read it completely
+   if (Fd.IsCompressed() == true)
+   {
+      if ((Flags & ReadOnly) != ReadOnly)
+	 return _error->Error("Compressed file %s can only be mapped readonly", Fd.Name().c_str());
+      Base = new unsigned char[iSize];
+      if (Fd.Seek(0L) == false || Fd.Read(Base, iSize) == false)
+	 return false;
+      return true;
+   }
+
    // Map it.
    // Map it.
    Base = mmap(0,iSize,Prot,Map,Fd.Fd(),0);
    Base = mmap(0,iSize,Prot,Map,Fd.Fd(),0);
    if (Base == (void *)-1)
    if (Base == (void *)-1)
@@ -86,6 +97,13 @@ bool MMap::Map(FileFd &Fd)
       {
       {
 	 // The filesystem doesn't support this particular kind of mmap.
 	 // The filesystem doesn't support this particular kind of mmap.
 	 // So we allocate a buffer and read the whole file into it.
 	 // So we allocate a buffer and read the whole file into it.
+	 if ((Flags & ReadOnly) == ReadOnly)
+	 {
+	    // for readonly, we don't need sync, so make it simple
+	    Base = new unsigned char[iSize];
+	    return Fd.Read(Base, iSize);
+	 }
+	 // FIXME: Writing to compressed fd's ?
 	 int const dupped_fd = dup(Fd.Fd());
 	 int const dupped_fd = dup(Fd.Fd());
 	 if (dupped_fd == -1)
 	 if (dupped_fd == -1)
 	    return _error->Errno("mmap", _("Couldn't duplicate file descriptor %i"), Fd.Fd());
 	    return _error->Errno("mmap", _("Couldn't duplicate file descriptor %i"), Fd.Fd());

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

@@ -28,6 +28,11 @@
 
 
 #include <string>
 #include <string>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/fileutl.h>
+using std::string;
+#endif
+
 class FileFd;
 class FileFd;
 
 
 /* This should be a 32 bit type, larger tyes use too much ram and smaller
 /* This should be a 32 bit type, larger tyes use too much ram and smaller

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

@@ -16,6 +16,10 @@
 
 
 #include <string>
 #include <string>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/strutl.h>
+#endif
+
 #define DOT_CHAR "."
 #define DOT_CHAR "."
 #define DIR_CHAR "/"
 #define DIR_CHAR "/"
 
 

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

@@ -25,6 +25,10 @@
 #include <string>
 #include <string>
 #include <sys/time.h>
 #include <sys/time.h>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+#endif
+
 class Configuration;
 class Configuration;
 class OpProgress
 class OpProgress
 {
 {

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

@@ -20,6 +20,11 @@
 
 
 #include "hashsum_template.h"
 #include "hashsum_template.h"
 
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+using std::min;
+#endif
+
 typedef  HashSumValue<160> SHA1SumValue;
 typedef  HashSumValue<160> SHA1SumValue;
 
 
 class SHA1Summation : public SummationImplementation
 class SHA1Summation : public SummationImplementation

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

@@ -27,6 +27,12 @@
 
 
 #include "macros.h"
 #include "macros.h"
 
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+using std::vector;
+using std::ostream;
+#endif
+
 bool UTF8ToCodeset(const char *codeset, const std::string &orig, std::string *dest);
 bool UTF8ToCodeset(const char *codeset, const std::string &orig, std::string *dest);
 char *_strstrip(char *String);
 char *_strstrip(char *String);
 char *_strtabexpand(char *String,size_t Len);
 char *_strtabexpand(char *String,size_t Len);

+ 14 - 21
apt-pkg/deb/debindexfile.cc

@@ -26,6 +26,8 @@
 #include <sys/stat.h>
 #include <sys/stat.h>
 									/*}}}*/
 									/*}}}*/
 
 
+using std::string;
+
 // SourcesIndex::debSourcesIndex - Constructor				/*{{{*/
 // SourcesIndex::debSourcesIndex - Constructor				/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
@@ -159,7 +161,7 @@ unsigned long debSourcesIndex::Size() const
    /* we need to ignore errors here; if the lists are absent, just return 0 */
    /* we need to ignore errors here; if the lists are absent, just return 0 */
    _error->PushToStack();
    _error->PushToStack();
 
 
-   FileFd f = FileFd (IndexFile("Sources"), FileFd::ReadOnlyGzip);
+   FileFd f = FileFd (IndexFile("Sources"), FileFd::ReadOnly, FileFd::Extension);
    if (!f.Failed())
    if (!f.Failed())
       size = f.Size();
       size = f.Size();
 
 
@@ -288,7 +290,7 @@ unsigned long debPackagesIndex::Size() const
    /* we need to ignore errors here; if the lists are absent, just return 0 */
    /* we need to ignore errors here; if the lists are absent, just return 0 */
    _error->PushToStack();
    _error->PushToStack();
 
 
-   FileFd f = FileFd (IndexFile("Packages"), FileFd::ReadOnlyGzip);
+   FileFd f = FileFd (IndexFile("Packages"), FileFd::ReadOnly, FileFd::Extension);
    if (!f.Failed())
    if (!f.Failed())
       size = f.Size();
       size = f.Size();
 
 
@@ -305,7 +307,7 @@ unsigned long debPackagesIndex::Size() const
 bool debPackagesIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
 bool debPackagesIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
 {
 {
    string PackageFile = IndexFile("Packages");
    string PackageFile = IndexFile("Packages");
-   FileFd Pkg(PackageFile,FileFd::ReadOnlyGzip);
+   FileFd Pkg(PackageFile,FileFd::ReadOnly, FileFd::Extension);
    debListParser Parser(&Pkg, Architecture);
    debListParser Parser(&Pkg, Architecture);
 
 
    if (_error->PendingError() == true)
    if (_error->PendingError() == true)
@@ -319,11 +321,8 @@ bool debPackagesIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
    // Store the IMS information
    // Store the IMS information
    pkgCache::PkgFileIterator File = Gen.GetCurFile();
    pkgCache::PkgFileIterator File = Gen.GetCurFile();
    pkgCacheGenerator::Dynamic<pkgCache::PkgFileIterator> DynFile(File);
    pkgCacheGenerator::Dynamic<pkgCache::PkgFileIterator> DynFile(File);
-   struct stat St;
-   if (fstat(Pkg.Fd(),&St) != 0)
-      return _error->Errno("fstat","Failed to stat");
-   File->Size = St.st_size;
-   File->mtime = St.st_mtime;
+   File->Size = Pkg.FileSize();
+   File->mtime = Pkg.ModificationTime();
    
    
    if (Gen.MergeList(Parser) == false)
    if (Gen.MergeList(Parser) == false)
       return _error->Error("Problem with MergeList %s",PackageFile.c_str());
       return _error->Error("Problem with MergeList %s",PackageFile.c_str());
@@ -489,7 +488,7 @@ unsigned long debTranslationsIndex::Size() const
    /* we need to ignore errors here; if the lists are absent, just return 0 */
    /* we need to ignore errors here; if the lists are absent, just return 0 */
    _error->PushToStack();
    _error->PushToStack();
 
 
-   FileFd f = FileFd (IndexFile(Language), FileFd::ReadOnlyGzip);
+   FileFd f = FileFd (IndexFile(Language), FileFd::ReadOnly, FileFd::Extension);
    if (!f.Failed())
    if (!f.Failed())
       size = f.Size();
       size = f.Size();
 
 
@@ -509,7 +508,7 @@ bool debTranslationsIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
    string TranslationFile = IndexFile(Language);
    string TranslationFile = IndexFile(Language);
    if (FileExists(TranslationFile))
    if (FileExists(TranslationFile))
    {
    {
-     FileFd Trans(TranslationFile,FileFd::ReadOnlyGzip);
+     FileFd Trans(TranslationFile,FileFd::ReadOnly, FileFd::Extension);
      debListParser TransParser(&Trans);
      debListParser TransParser(&Trans);
      if (_error->PendingError() == true)
      if (_error->PendingError() == true)
        return false;
        return false;
@@ -521,11 +520,8 @@ bool debTranslationsIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
 
 
      // Store the IMS information
      // Store the IMS information
      pkgCache::PkgFileIterator TransFile = Gen.GetCurFile();
      pkgCache::PkgFileIterator TransFile = Gen.GetCurFile();
-     struct stat TransSt;
-     if (fstat(Trans.Fd(),&TransSt) != 0)
-       return _error->Errno("fstat","Failed to stat");
-     TransFile->Size = TransSt.st_size;
-     TransFile->mtime = TransSt.st_mtime;
+     TransFile->Size = Trans.FileSize();
+     TransFile->mtime = Trans.ModificationTime();
    
    
      if (Gen.MergeList(TransParser) == false)
      if (Gen.MergeList(TransParser) == false)
        return _error->Error("Problem with MergeList %s",TranslationFile.c_str());
        return _error->Error("Problem with MergeList %s",TranslationFile.c_str());
@@ -590,7 +586,7 @@ unsigned long debStatusIndex::Size() const
 /* */
 /* */
 bool debStatusIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
 bool debStatusIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
 {
 {
-   FileFd Pkg(File,FileFd::ReadOnlyGzip);
+   FileFd Pkg(File,FileFd::ReadOnly, FileFd::Extension);
    if (_error->PendingError() == true)
    if (_error->PendingError() == true)
       return false;
       return false;
    debListParser Parser(&Pkg);
    debListParser Parser(&Pkg);
@@ -604,11 +600,8 @@ bool debStatusIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
 
 
    // Store the IMS information
    // Store the IMS information
    pkgCache::PkgFileIterator CFile = Gen.GetCurFile();
    pkgCache::PkgFileIterator CFile = Gen.GetCurFile();
-   struct stat St;
-   if (fstat(Pkg.Fd(),&St) != 0)
-      return _error->Errno("fstat","Failed to stat");
-   CFile->Size = St.st_size;
-   CFile->mtime = St.st_mtime;
+   CFile->Size = Pkg.FileSize();
+   CFile->mtime = Pkg.ModificationTime();
    CFile->Archive = Gen.WriteUniqString("now");
    CFile->Archive = Gen.WriteUniqString("now");
    
    
    if (Gen.MergeList(Parser) == false)
    if (Gen.MergeList(Parser) == false)

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

@@ -773,6 +773,7 @@ bool debListParser::LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,
    // file. to provide Component pinning we use the section name now
    // file. to provide Component pinning we use the section name now
    FileI->Component = WriteUniqString(component);
    FileI->Component = WriteUniqString(component);
 
 
+   // FIXME: Code depends on the fact that Release files aren't compressed
    FILE* release = fdopen(dup(File.Fd()), "r");
    FILE* release = fdopen(dup(File.Fd()), "r");
    if (release == NULL)
    if (release == NULL)
       return false;
       return false;

+ 4 - 0
apt-pkg/deb/deblistparser.h

@@ -14,6 +14,10 @@
 #include <apt-pkg/pkgcachegen.h>
 #include <apt-pkg/pkgcachegen.h>
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/tagfile.h>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/indexfile.h>
+#endif
+
 class debListParser : public pkgCacheGenerator::ListParser
 class debListParser : public pkgCacheGenerator::ListParser
 {
 {
    public:
    public:

+ 4 - 0
apt-pkg/deb/debmetaindex.h

@@ -8,6 +8,10 @@
 #include <string>
 #include <string>
 #include <vector>
 #include <vector>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/sourcelist.h>
+#endif
+
 class debReleaseIndex : public metaIndex {
 class debReleaseIndex : public metaIndex {
    public:
    public:
 
 

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

@@ -25,7 +25,7 @@ using std::string;
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
 debRecordParser::debRecordParser(string FileName,pkgCache &Cache) : 
 debRecordParser::debRecordParser(string FileName,pkgCache &Cache) : 
-                  File(FileName,FileFd::ReadOnlyGzip), 
+                  File(FileName,FileFd::ReadOnly, FileFd::Extension),
                   Tags(&File, std::max(Cache.Head().MaxVerFileSize, 
                   Tags(&File, std::max(Cache.Head().MaxVerFileSize, 
 				       Cache.Head().MaxDescFileSize) + 200)
 				       Cache.Head().MaxDescFileSize) + 200)
 {
 {

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

@@ -18,6 +18,10 @@
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/fileutl.h>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/indexfile.h>
+#endif
+
 class debRecordParser : public pkgRecords::Parser
 class debRecordParser : public pkgRecords::Parser
 {
 {
    /** \brief dpointer placeholder (for later in case we need it) */
    /** \brief dpointer placeholder (for later in case we need it) */

+ 1 - 1
apt-pkg/deb/debsrcrecords.h

@@ -50,7 +50,7 @@ class debSrcRecordParser : public pkgSrcRecords::Parser
    virtual bool Files(std::vector<pkgSrcRecords::File> &F);
    virtual bool Files(std::vector<pkgSrcRecords::File> &F);
 
 
    debSrcRecordParser(std::string const &File,pkgIndexFile const *Index) 
    debSrcRecordParser(std::string const &File,pkgIndexFile const *Index) 
-      : Parser(Index), Fd(File,FileFd::ReadOnlyGzip), Tags(&Fd,102400), 
+      : Parser(Index), Fd(File,FileFd::ReadOnly, FileFd::Extension), Tags(&Fd,102400), 
         Buffer(NULL) {}
         Buffer(NULL) {}
    virtual ~debSrcRecordParser();
    virtual ~debSrcRecordParser();
 };
 };

+ 52 - 21
apt-pkg/deb/dpkgpm.cc

@@ -108,7 +108,7 @@ ionice(int PID)
 {
 {
    if (!FileExists("/usr/bin/ionice"))
    if (!FileExists("/usr/bin/ionice"))
       return false;
       return false;
-   pid_t Process = ExecFork();      
+   pid_t Process = ExecFork();
    if (Process == 0)
    if (Process == 0)
    {
    {
       char buf[32];
       char buf[32];
@@ -829,6 +829,40 @@ static int racy_pselect(int nfds, fd_set *readfds, fd_set *writefds,
 */
 */
 bool pkgDPkgPM::Go(int OutStatusFd)
 bool pkgDPkgPM::Go(int OutStatusFd)
 {
 {
+   // Generate the base argument list for dpkg
+   std::vector<const char *> Args;
+   unsigned long StartSize = 0;
+   string const Tmp = _config->Find("Dir::Bin::dpkg","dpkg");
+   Args.push_back(Tmp.c_str());
+   StartSize += Tmp.length();
+
+   // Stick in any custom dpkg options
+   Configuration::Item const *Opts = _config->Tree("DPkg::Options");
+   if (Opts != 0)
+   {
+      Opts = Opts->Child;
+      for (; Opts != 0; Opts = Opts->Next)
+      {
+	 if (Opts->Value.empty() == true)
+	    continue;
+	 Args.push_back(Opts->Value.c_str());
+	 StartSize += Opts->Value.length();
+      }
+   }
+
+   size_t const BaseArgs = Args.size();
+   // we need to detect if we can qualify packages with the architecture or not
+   Args.push_back("--assert-multi-arch");
+   Args.push_back(NULL);
+
+   pid_t dpkgAssertMultiArch = ExecFork();
+   if (dpkgAssertMultiArch == 0)
+   {
+      execv(Args[0], (char**) &Args[0]);
+      _error->WarningE("dpkgGo", "Can't detect if dpkg supports multi-arch!");
+      _exit(2);
+   }
+
    fd_set rfds;
    fd_set rfds;
    struct timespec tv;
    struct timespec tv;
    sigset_t sigmask;
    sigset_t sigmask;
@@ -905,27 +939,20 @@ bool pkgDPkgPM::Go(int OutStatusFd)
    // create log
    // create log
    OpenLog();
    OpenLog();
 
 
-   // Generate the base argument list for dpkg
-   std::vector<const char *> Args;
-   unsigned long StartSize = 0;
-   string const Tmp = _config->Find("Dir::Bin::dpkg","dpkg");
-   Args.push_back(Tmp.c_str());
-   StartSize += Tmp.length();
-
-   // Stick in any custom dpkg options
-   Configuration::Item const *Opts = _config->Tree("DPkg::Options");
-   if (Opts != 0)
+   bool dpkgMultiArch = false;
+   if (dpkgAssertMultiArch > 0)
    {
    {
-      Opts = Opts->Child;
-      for (; Opts != 0; Opts = Opts->Next)
+      int Status = 0;
+      while (waitpid(dpkgAssertMultiArch, &Status, 0) != dpkgAssertMultiArch)
       {
       {
-	 if (Opts->Value.empty() == true)
+	 if (errno == EINTR)
 	    continue;
 	    continue;
-	 Args.push_back(Opts->Value.c_str());
-	 StartSize += Opts->Value.length();
+	 _error->WarningE("dpkgGo", _("Waited for %s but it wasn't there"), "dpkg --assert-multi-arch");
+	 break;
       }
       }
+      if (WIFEXITED(Status) == true && WEXITSTATUS(Status) == 0)
+	 dpkgMultiArch = true;
    }
    }
-   size_t const BaseArgs = Args.size();
 
 
    // this loop is runs once per operation
    // this loop is runs once per operation
    for (vector<Item>::const_iterator I = List.begin(); I != List.end();)
    for (vector<Item>::const_iterator I = List.begin(); I != List.end();)
@@ -965,14 +992,17 @@ bool pkgDPkgPM::Go(int OutStatusFd)
       if (J - I > (signed)MaxArgs)
       if (J - I > (signed)MaxArgs)
       {
       {
 	 J = I + MaxArgs;
 	 J = I + MaxArgs;
-	 Args.reserve(MaxArgs + 10);
+	 unsigned long const size = MaxArgs + 10;
+	 Args.reserve(size);
+	 Packages.reserve(size);
       }
       }
       else
       else
       {
       {
-	 Args.reserve((J - I) + 10);
+	 unsigned long const size = (J - I) + 10;
+	 Args.reserve(size);
+	 Packages.reserve(size);
       }
       }
 
 
-      
       int fd[2];
       int fd[2];
       pipe(fd);
       pipe(fd);
 
 
@@ -1047,7 +1077,8 @@ bool pkgDPkgPM::Go(int OutStatusFd)
 	       continue;
 	       continue;
 	    if (I->Op == Item::Configure && disappearedPkgs.find(I->Pkg.Name()) != disappearedPkgs.end())
 	    if (I->Op == Item::Configure && disappearedPkgs.find(I->Pkg.Name()) != disappearedPkgs.end())
 	       continue;
 	       continue;
-	    if (I->Pkg.Arch() == nativeArch || !strcmp(I->Pkg.Arch(), "all"))
+	    // We keep this here to allow "smooth" transitions from e.g. multiarch dpkg/ubuntu to dpkg/debian
+	    if (dpkgMultiArch == false && (I->Pkg.Arch() == nativeArch || !strcmp(I->Pkg.Arch(), "all")))
 	    {
 	    {
 	       char const * const name = I->Pkg.Name();
 	       char const * const name = I->Pkg.Name();
 	       ADDARG(name);
 	       ADDARG(name);

+ 5 - 0
apt-pkg/deb/dpkgpm.h

@@ -15,6 +15,11 @@
 #include <map>
 #include <map>
 #include <stdio.h>
 #include <stdio.h>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::vector;
+using std::map;
+#endif
+
 class pkgDPkgPMPrivate;
 class pkgDPkgPMPrivate;
 
 
 class pkgDPkgPM : public pkgPackageManager
 class pkgDPkgPM : public pkgPackageManager

+ 65 - 33
apt-pkg/depcache.cc

@@ -23,7 +23,9 @@
 #include <apt-pkg/pkgsystem.h>
 #include <apt-pkg/pkgsystem.h>
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/progress.h>
 #include <apt-pkg/progress.h>
+#include <apt-pkg/cacheset.h>
 
 
+#include <algorithm>
 #include <iostream>
 #include <iostream>
 #include <sstream>
 #include <sstream>
 #include <set>
 #include <set>
@@ -369,14 +371,11 @@ bool pkgDepCache::CheckDep(DepIterator Dep,int Type,PkgIterator &Res)
    
    
    // Check the providing packages
    // Check the providing packages
    PrvIterator P = Dep.TargetPkg().ProvidesList();
    PrvIterator P = Dep.TargetPkg().ProvidesList();
-   PkgIterator Pkg = Dep.ParentPkg();
    for (; P.end() != true; ++P)
    for (; P.end() != true; ++P)
    {
    {
-      /* Provides may never be applied against the same package (or group)
-         if it is a conflicts. See the comment above. */
-      if (P.OwnerPkg()->Group == Pkg->Group && Dep.IsNegative() == true)
+      if (Dep.IsIgnorable(P) == true)
 	 continue;
 	 continue;
-      
+
       // Check if the provides is a hit
       // Check if the provides is a hit
       if (Type == NowVersion)
       if (Type == NowVersion)
       {
       {
@@ -940,6 +939,51 @@ bool pkgDepCache::IsModeChangeOk(ModeList const mode, PkgIterator const &Pkg,
 // DepCache::MarkInstall - Put the package in the install state		/*{{{*/
 // DepCache::MarkInstall - Put the package in the install state		/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
+struct CompareProviders {
+   pkgCache::PkgIterator const Pkg;
+   CompareProviders(pkgCache::DepIterator const &Dep) : Pkg(Dep.TargetPkg()) {};
+   //bool operator() (APT::VersionList::iterator const &AV, APT::VersionList::iterator const &BV)
+   bool operator() (pkgCache::VerIterator const &AV, pkgCache::VerIterator const &BV)
+   {
+      pkgCache::PkgIterator const A = AV.ParentPkg();
+      pkgCache::PkgIterator const B = BV.ParentPkg();
+      // Prefer packages in the same group as the target; e.g. foo:i386, foo:amd64
+      if (A->Group != B->Group)
+      {
+	 if (A->Group == Pkg->Group && B->Group != Pkg->Group)
+	    return false;
+	 else if (B->Group == Pkg->Group && A->Group != Pkg->Group)
+	    return true;
+      }
+      // we like essentials
+      if ((A->Flags & pkgCache::Flag::Essential) != (B->Flags & pkgCache::Flag::Essential))
+      {
+	 if ((A->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential)
+	    return false;
+	 else if ((B->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential)
+	    return true;
+      }
+      // higher priority seems like a good idea
+      if (AV->Priority != BV->Priority)
+	 return AV->Priority < BV->Priority;
+      // prefer native architecture
+      if (strcmp(A.Arch(), B.Arch()) != 0)
+      {
+	 if (strcmp(A.Arch(), A.Cache()->NativeArch()) == 0)
+	    return false;
+	 else if (strcmp(B.Arch(), B.Cache()->NativeArch()) == 0)
+	    return true;
+	 std::vector<std::string> archs = APT::Configuration::getArchitectures();
+	 for (std::vector<std::string>::const_iterator a = archs.begin(); a != archs.end(); ++a)
+	    if (*a == A.Arch())
+	       return false;
+	    else if (*a == B.Arch())
+	       return true;
+      }
+      // unable to decide…
+      return A->ID < B->ID;
+   }
+};
 bool pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
 bool pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
 			      unsigned long Depth, bool FromUser,
 			      unsigned long Depth, bool FromUser,
 			      bool ForceImportantDeps)
 			      bool ForceImportantDeps)
@@ -1102,41 +1146,28 @@ bool pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
 
 
       /* This bit is for processing the possibilty of an install/upgrade
       /* This bit is for processing the possibilty of an install/upgrade
          fixing the problem */
          fixing the problem */
-      SPtrArray<Version *> List = Start.AllTargets();
       if (Start->Type != Dep::DpkgBreaks &&
       if (Start->Type != Dep::DpkgBreaks &&
 	  (DepState[Start->ID] & DepCVer) == DepCVer)
 	  (DepState[Start->ID] & DepCVer) == DepCVer)
       {
       {
-	 // Right, find the best version to install..
-	 Version **Cur = List;
-	 PkgIterator P = Start.TargetPkg();
-	 PkgIterator InstPkg(*Cache,0);
-	 
-	 // See if there are direct matches (at the start of the list)
-	 for (; *Cur != 0 && (*Cur)->ParentPkg == P.Index(); Cur++)
+	 APT::VersionList verlist;
+	 pkgCache::VerIterator Cand = PkgState[Start.TargetPkg()->ID].CandidateVerIter(*this);
+	 if (Cand.end() == false && VS().CheckDep(Cand.VerStr(), Start->CompareOp, Start.TargetVer()) == true)
+	    verlist.insert(Cand);
+	 for (PrvIterator Prv = Start.TargetPkg().ProvidesList(); Prv.end() != true; ++Prv)
 	 {
 	 {
-	    PkgIterator Pkg(*Cache,Cache->PkgP + (*Cur)->ParentPkg);
-	    if (PkgState[Pkg->ID].CandidateVer != *Cur)
+	    pkgCache::VerIterator V = Prv.OwnerVer();
+	    pkgCache::VerIterator Cand = PkgState[Prv.OwnerPkg()->ID].CandidateVerIter(*this);
+	    if (Cand.end() == true || V != Cand ||
+		VS().CheckDep(Cand.VerStr(), Start->CompareOp, Start.TargetVer()) == false)
 	       continue;
 	       continue;
-	    InstPkg = Pkg;
-	    break;
+	    verlist.insert(Cand);
 	 }
 	 }
+	 CompareProviders comp(Start);
+	 APT::VersionList::iterator InstVer = std::max_element(verlist.begin(), verlist.end(), comp);
 
 
-	 // Select the highest priority providing package
-	 if (InstPkg.end() == true)
-	 {
-	    pkgPrioSortList(*Cache,Cur);
-	    for (; *Cur != 0; Cur++)
-	    {
-	       PkgIterator Pkg(*Cache,Cache->PkgP + (*Cur)->ParentPkg);
-	       if (PkgState[Pkg->ID].CandidateVer != *Cur)
-		  continue;
-	       InstPkg = Pkg;
-	       break;
-	    }
-	 }
-	 
-	 if (InstPkg.end() == false)
+	 if (InstVer != verlist.end())
 	 {
 	 {
+	    pkgCache::PkgIterator InstPkg = InstVer.ParentPkg();
 	    if(DebugAutoInstall == true)
 	    if(DebugAutoInstall == true)
 	       std::clog << OutputInDepth(Depth) << "Installing " << InstPkg.Name()
 	       std::clog << OutputInDepth(Depth) << "Installing " << InstPkg.Name()
 			 << " as " << Start.DepType() << " of " << Pkg.Name()
 			 << " as " << Start.DepType() << " of " << Pkg.Name()
@@ -1154,7 +1185,7 @@ bool pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
  	       // mark automatic dependency
  	       // mark automatic dependency
  	       MarkInstall(InstPkg,true,Depth + 1, false, ForceImportantDeps);
  	       MarkInstall(InstPkg,true,Depth + 1, false, ForceImportantDeps);
  	       // Set the autoflag, after MarkInstall because MarkInstall unsets it
  	       // Set the autoflag, after MarkInstall because MarkInstall unsets it
- 	       if (P->CurrentVer == 0)
+ 	       if (InstPkg->CurrentVer == 0)
  		  PkgState[InstPkg->ID].Flags |= Flag::Auto;
  		  PkgState[InstPkg->ID].Flags |= Flag::Auto;
  	    }
  	    }
 	 }
 	 }
@@ -1166,6 +1197,7 @@ bool pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
          upgrade the package. */
          upgrade the package. */
       if (Start.IsNegative() == true)
       if (Start.IsNegative() == true)
       {
       {
+	 SPtrArray<Version *> List = Start.AllTargets();
 	 for (Version **I = List; *I != 0; I++)
 	 for (Version **I = List; *I != 0; I++)
 	 {
 	 {
 	    VerIterator Ver(*this,*I);
 	    VerIterator Ver(*this,*I);

+ 5 - 0
apt-pkg/depcache.h

@@ -46,6 +46,11 @@
 #include <set>
 #include <set>
 #include <list>
 #include <list>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/progress.h>
+#include <apt-pkg/error.h>
+#endif
+
 class OpProgress;
 class OpProgress;
 
 
 class pkgDepCache : protected pkgCache::Namespace
 class pkgDepCache : protected pkgCache::Namespace

+ 6 - 3
apt-pkg/edsp.h

@@ -10,13 +10,16 @@
 #define PKGLIB_EDSP_H
 #define PKGLIB_EDSP_H
 
 
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/pkgcache.h>
+#include <apt-pkg/cacheset.h>
 
 
 #include <list>
 #include <list>
 #include <string>
 #include <string>
 
 
-namespace APT {
-	class PackageSet;
-};
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/depcache.h>
+#include <apt-pkg/progress.h>
+#endif
+
 class pkgDepCache;
 class pkgDepCache;
 class OpProgress;
 class OpProgress;
 
 

+ 4 - 7
apt-pkg/edsp/edspindexfile.cc

@@ -24,7 +24,7 @@
 // edspIndex::edspIndex - Constructor					/*{{{*/
 // edspIndex::edspIndex - Constructor					/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-edspIndex::edspIndex(string File) : debStatusIndex(File)
+edspIndex::edspIndex(std::string File) : debStatusIndex(File)
 {
 {
 }
 }
 									/*}}}*/
 									/*}}}*/
@@ -44,16 +44,13 @@ bool edspIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
 
 
    if (Prog != NULL)
    if (Prog != NULL)
       Prog->SubProgress(0,File);
       Prog->SubProgress(0,File);
-   if (Gen.SelectFile(File,string(),*this) == false)
+   if (Gen.SelectFile(File,std::string(),*this) == false)
       return _error->Error("Problem with SelectFile %s",File.c_str());
       return _error->Error("Problem with SelectFile %s",File.c_str());
 
 
    // Store the IMS information
    // Store the IMS information
    pkgCache::PkgFileIterator CFile = Gen.GetCurFile();
    pkgCache::PkgFileIterator CFile = Gen.GetCurFile();
-   struct stat St;
-   if (fstat(Pkg.Fd(),&St) != 0)
-      return _error->Errno("fstat","Failed to stat");
-   CFile->Size = St.st_size;
-   CFile->mtime = St.st_mtime;
+   CFile->Size = Pkg.FileSize();
+   CFile->mtime = Pkg.ModificationTime();
    CFile->Archive = Gen.WriteUniqString("edsp::scenario");
    CFile->Archive = Gen.WriteUniqString("edsp::scenario");
 
 
    if (Gen.MergeList(Parser) == false)
    if (Gen.MergeList(Parser) == false)

+ 4 - 0
apt-pkg/edsp/edspindexfile.h

@@ -10,6 +10,10 @@
 
 
 #include <apt-pkg/debindexfile.h>
 #include <apt-pkg/debindexfile.h>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/indexfile.h>
+#endif
+
 class edspIndex : public debStatusIndex
 class edspIndex : public debStatusIndex
 {
 {
    /** \brief dpointer placeholder (for later in case we need it) */
    /** \brief dpointer placeholder (for later in case we need it) */

+ 6 - 0
apt-pkg/edsp/edsplistparser.h

@@ -13,6 +13,12 @@
 
 
 #include <apt-pkg/deblistparser.h>
 #include <apt-pkg/deblistparser.h>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/pkgcachegen.h>
+#include <apt-pkg/indexfile.h>
+#include <apt-pkg/tagfile.h>
+#endif
+
 class FileFd;
 class FileFd;
 
 
 class edspListParser : public debListParser
 class edspListParser : public debListParser

+ 59 - 116
apt-pkg/indexcopy.cc

@@ -16,6 +16,7 @@
 #include <apt-pkg/progress.h>
 #include <apt-pkg/progress.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/fileutl.h>
+#include <apt-pkg/aptconfiguration.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/indexrecords.h>
 #include <apt-pkg/indexrecords.h>
@@ -37,8 +38,6 @@
 
 
 using namespace std;
 using namespace std;
 
 
-
-
 // IndexCopy::CopyPackages - Copy the package files from the CD		/*{{{*/
 // IndexCopy::CopyPackages - Copy the package files from the CD		/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
@@ -57,15 +56,25 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector<string> &List,
    
    
    // Prepare the progress indicator
    // Prepare the progress indicator
    off_t TotalSize = 0;
    off_t TotalSize = 0;
+   std::vector<APT::Configuration::Compressor> const compressor = APT::Configuration::getCompressors();
    for (vector<string>::iterator I = List.begin(); I != List.end(); ++I)
    for (vector<string>::iterator I = List.begin(); I != List.end(); ++I)
    {
    {
       struct stat Buf;
       struct stat Buf;
-      if (stat(string(*I + GetFileName()).c_str(),&Buf) != 0 &&
-	  stat(string(*I + GetFileName() + ".gz").c_str(),&Buf) != 0)
-	 return _error->Errno("stat","Stat failed for %s",
-			      string(*I + GetFileName()).c_str());
+      bool found = false;
+      std::string file = std::string(*I).append(GetFileName());
+      for (std::vector<APT::Configuration::Compressor>::const_iterator c = compressor.begin();
+	   c != compressor.end(); ++c)
+      {
+	 if (stat(std::string(file + c->Extension).c_str(), &Buf) != 0)
+	    continue;
+	 found = true;
+	 break;
+      }
+
+      if (found == false)
+	 return _error->Errno("stat", "Stat failed for %s", file.c_str());
       TotalSize += Buf.st_size;
       TotalSize += Buf.st_size;
-   }	
+   }
 
 
    off_t CurrentSize = 0;
    off_t CurrentSize = 0;
    unsigned int NotFound = 0;
    unsigned int NotFound = 0;
@@ -74,57 +83,11 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector<string> &List,
    for (vector<string>::iterator I = List.begin(); I != List.end(); ++I)
    for (vector<string>::iterator I = List.begin(); I != List.end(); ++I)
    {      
    {      
       string OrigPath = string(*I,CDROM.length());
       string OrigPath = string(*I,CDROM.length());
-      off_t FileSize = 0;
       
       
       // Open the package file
       // Open the package file
-      FileFd Pkg;
-      if (RealFileExists(*I + GetFileName()) == true)
-      {
-	 Pkg.Open(*I + GetFileName(),FileFd::ReadOnly);
-	 FileSize = Pkg.Size();
-      }      
-      else
-      {
-	 FileFd From(*I + GetFileName() + ".gz",FileFd::ReadOnly);
-	 if (_error->PendingError() == true)
-	    return false;
-	 FileSize = From.Size();
-	 
-	 // Get a temp file
-	 FILE *tmp = tmpfile();
-	 if (tmp == 0)
-	    return _error->Errno("tmpfile","Unable to create a tmp file");
-	 Pkg.Fd(dup(fileno(tmp)));
-	 fclose(tmp);
-	 
-	 // Fork gzip
-	 pid_t Process = fork();
-	 if (Process < 0)
-	    return _error->Errno("fork","Couldn't fork gzip");
-	 
-	 // The child
-	 if (Process == 0)
-	 {	    
-	    dup2(From.Fd(),STDIN_FILENO);
-	    dup2(Pkg.Fd(),STDOUT_FILENO);
-	    SetCloseExec(STDIN_FILENO,false);
-	    SetCloseExec(STDOUT_FILENO,false);
-	    
-	    const char *Args[3];
-	    string Tmp =  _config->Find("Dir::bin::gzip","gzip");
-	    Args[0] = Tmp.c_str();
-	    Args[1] = "-d";
-	    Args[2] = 0;
-	    execvp(Args[0],(char **)Args);
-	    exit(100);
-	 }
-	 
-	 // Wait for gzip to finish
-	 if (ExecWait(Process,_config->Find("Dir::bin::gzip","gzip").c_str(),false) == false)
-	    return _error->Error("gzip failed, perhaps the disk is full.");
-	 
-	 Pkg.Seek(0);
-      }
+      FileFd Pkg(*I + GetFileName(), FileFd::ReadOnly, FileFd::Extension);
+      off_t const FileSize = Pkg.Size();
+
       pkgTagFile Parser(&Pkg);
       pkgTagFile Parser(&Pkg);
       if (_error->PendingError() == true)
       if (_error->PendingError() == true)
 	 return false;
 	 return false;
@@ -602,13 +565,19 @@ bool SigVerify::CopyAndVerify(string CDROM,string Name,vector<string> &SigList,
 
 
       string const releasegpg = *I+"Release.gpg";
       string const releasegpg = *I+"Release.gpg";
       string const release = *I+"Release";
       string const release = *I+"Release";
+      string const inrelease = *I+"InRelease";
+      bool useInRelease = true;
 
 
       // a Release.gpg without a Release should never happen
       // a Release.gpg without a Release should never happen
-      if(RealFileExists(release) == false)
+      if (RealFileExists(inrelease) == true)
+	 ;
+      else if(RealFileExists(release) == false || RealFileExists(releasegpg) == false)
       {
       {
 	 delete MetaIndex;
 	 delete MetaIndex;
 	 continue;
 	 continue;
       }
       }
+      else
+	 useInRelease = false;
 
 
       pid_t pid = ExecFork();
       pid_t pid = ExecFork();
       if(pid < 0) {
       if(pid < 0) {
@@ -616,11 +585,16 @@ bool SigVerify::CopyAndVerify(string CDROM,string Name,vector<string> &SigList,
 	 return false;
 	 return false;
       }
       }
       if(pid == 0)
       if(pid == 0)
-	 RunGPGV(release, releasegpg);
+      {
+	 if (useInRelease == true)
+	    RunGPGV(inrelease, inrelease);
+	 else
+	    RunGPGV(release, releasegpg);
+      }
 
 
       if(!ExecWait(pid, "gpgv")) {
       if(!ExecWait(pid, "gpgv")) {
 	 _error->Warning("Signature verification failed for: %s",
 	 _error->Warning("Signature verification failed for: %s",
-			 releasegpg.c_str());
+			 (useInRelease ? inrelease.c_str() : releasegpg.c_str()));
 	 // something went wrong, don't copy the Release.gpg
 	 // something went wrong, don't copy the Release.gpg
 	 // FIXME: delete any existing gpg file?
 	 // FIXME: delete any existing gpg file?
 	 continue;
 	 continue;
@@ -650,8 +624,13 @@ bool SigVerify::CopyAndVerify(string CDROM,string Name,vector<string> &SigList,
       delete MetaIndex;
       delete MetaIndex;
    
    
       // everything was fine, copy the Release and Release.gpg file
       // everything was fine, copy the Release and Release.gpg file
-      CopyMetaIndex(CDROM, Name, prefix, "Release");
-      CopyMetaIndex(CDROM, Name, prefix, "Release.gpg");
+      if (useInRelease == true)
+	 CopyMetaIndex(CDROM, Name, prefix, "InRelease");
+      else
+      {
+	 CopyMetaIndex(CDROM, Name, prefix, "Release");
+	 CopyMetaIndex(CDROM, Name, prefix, "Release.gpg");
+      }
    }   
    }   
 
 
    return true;
    return true;
@@ -789,15 +768,25 @@ bool TranslationsCopy::CopyTranslations(string CDROM,string Name,	/*{{{*/
    
    
    // Prepare the progress indicator
    // Prepare the progress indicator
    off_t TotalSize = 0;
    off_t TotalSize = 0;
+   std::vector<APT::Configuration::Compressor> const compressor = APT::Configuration::getCompressors();
    for (vector<string>::iterator I = List.begin(); I != List.end(); ++I)
    for (vector<string>::iterator I = List.begin(); I != List.end(); ++I)
    {
    {
       struct stat Buf;
       struct stat Buf;
-      if (stat(string(*I).c_str(),&Buf) != 0 &&
-	  stat(string(*I + ".gz").c_str(),&Buf) != 0)
-	 return _error->Errno("stat","Stat failed for %s",
-			      string(*I).c_str());
+      bool found = false;
+      std::string file = *I;
+      for (std::vector<APT::Configuration::Compressor>::const_iterator c = compressor.begin();
+	   c != compressor.end(); ++c)
+      {
+	 if (stat(std::string(file + c->Extension).c_str(), &Buf) != 0)
+	    continue;
+	 found = true;
+	 break;
+      }
+
+      if (found == false)
+	 return _error->Errno("stat", "Stat failed for %s", file.c_str());
       TotalSize += Buf.st_size;
       TotalSize += Buf.st_size;
-   }	
+   }
 
 
    off_t CurrentSize = 0;
    off_t CurrentSize = 0;
    unsigned int NotFound = 0;
    unsigned int NotFound = 0;
@@ -806,57 +795,11 @@ bool TranslationsCopy::CopyTranslations(string CDROM,string Name,	/*{{{*/
    for (vector<string>::iterator I = List.begin(); I != List.end(); ++I)
    for (vector<string>::iterator I = List.begin(); I != List.end(); ++I)
    {      
    {      
       string OrigPath = string(*I,CDROM.length());
       string OrigPath = string(*I,CDROM.length());
-      off_t FileSize = 0;
-      
+
       // Open the package file
       // Open the package file
-      FileFd Pkg;
-      if (RealFileExists(*I) == true)
-      {
-	 Pkg.Open(*I,FileFd::ReadOnly);
-	 FileSize = Pkg.Size();
-      }      
-      else
-      {
-	 FileFd From(*I + ".gz",FileFd::ReadOnly);
-	 if (_error->PendingError() == true)
-	    return false;
-	 FileSize = From.Size();
-	 
-	 // Get a temp file
-	 FILE *tmp = tmpfile();
-	 if (tmp == 0)
-	    return _error->Errno("tmpfile","Unable to create a tmp file");
-	 Pkg.Fd(dup(fileno(tmp)));
-	 fclose(tmp);
-	 
-	 // Fork gzip
-	 pid_t Process = fork();
-	 if (Process < 0)
-	    return _error->Errno("fork","Couldn't fork gzip");
-	 
-	 // The child
-	 if (Process == 0)
-	 {	    
-	    dup2(From.Fd(),STDIN_FILENO);
-	    dup2(Pkg.Fd(),STDOUT_FILENO);
-	    SetCloseExec(STDIN_FILENO,false);
-	    SetCloseExec(STDOUT_FILENO,false);
-	    
-	    const char *Args[3];
-	    string Tmp =  _config->Find("Dir::bin::gzip","gzip");
-	    Args[0] = Tmp.c_str();
-	    Args[1] = "-d";
-	    Args[2] = 0;
-	    execvp(Args[0],(char **)Args);
-	    exit(100);
-	 }
-	 
-	 // Wait for gzip to finish
-	 if (ExecWait(Process,_config->Find("Dir::bin::gzip","gzip").c_str(),false) == false)
-	    return _error->Error("gzip failed, perhaps the disk is full.");
-	 
-	 Pkg.Seek(0);
-      }
+      FileFd Pkg(*I, FileFd::ReadOnly, FileFd::Extension);
+      off_t const FileSize = Pkg.Size();
+
       pkgTagFile Parser(&Pkg);
       pkgTagFile Parser(&Pkg);
       if (_error->PendingError() == true)
       if (_error->PendingError() == true)
 	 return false;
 	 return false;

+ 5 - 0
apt-pkg/indexcopy.h

@@ -14,6 +14,11 @@
 #include <string>
 #include <string>
 #include <stdio.h>
 #include <stdio.h>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+using std::vector;
+#endif
+
 class pkgTagSection;
 class pkgTagSection;
 class FileFd;
 class FileFd;
 class indexRecords;
 class indexRecords;

+ 4 - 0
apt-pkg/indexfile.h

@@ -29,6 +29,10 @@
 #include <apt-pkg/pkgrecords.h>
 #include <apt-pkg/pkgrecords.h>
 #include <apt-pkg/macros.h>
 #include <apt-pkg/macros.h>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+#endif
+
 class pkgAcquire;
 class pkgAcquire;
 class pkgCacheGenerator;
 class pkgCacheGenerator;
 class OpProgress;
 class OpProgress;

+ 4 - 0
apt-pkg/indexrecords.h

@@ -13,6 +13,10 @@
 #include <vector>
 #include <vector>
 #include <ctime>
 #include <ctime>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/fileutl.h>
+#endif
+
 class indexRecords
 class indexRecords
 {
 {
    bool parseSumData(const char *&Start, const char *End, std::string &Name,
    bool parseSumData(const char *&Start, const char *End, std::string &Name,

+ 5 - 0
apt-pkg/init.h

@@ -13,6 +13,11 @@
 #ifndef PKGLIB_INIT_H
 #ifndef PKGLIB_INIT_H
 #define PKGLIB_INIT_H
 #define PKGLIB_INIT_H
 
 
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/pkgsystem.h>
+#endif
+
 class pkgSystem;
 class pkgSystem;
 class Configuration;
 class Configuration;
 
 

+ 7 - 0
apt-pkg/metaindex.h

@@ -6,6 +6,13 @@
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/indexfile.h>
 #include <apt-pkg/indexfile.h>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/srcrecords.h>
+#include <apt-pkg/pkgrecords.h>
+#include <apt-pkg/vendor.h>
+using std::string;
+#endif
+
 class pkgAcquire;
 class pkgAcquire;
 class pkgCacheGenerator;
 class pkgCacheGenerator;
 class OpProgress;
 class OpProgress;

+ 1 - 1
apt-pkg/packagemanager.cc

@@ -250,7 +250,7 @@ bool pkgPackageManager::CheckRConflicts(PkgIterator Pkg,DepIterator D,
 	 continue;
 	 continue;
       
       
       // Ignore self conflicts, ignore conflicts from irrelevent versions
       // Ignore self conflicts, ignore conflicts from irrelevent versions
-      if (D.ParentPkg() == Pkg || D.ParentVer() != D.ParentPkg().CurrentVer())
+      if (D.IsIgnorable(Pkg) || D.ParentVer() != D.ParentPkg().CurrentVer())
 	 continue;
 	 continue;
       
       
       if (Cache.VS().CheckDep(Ver,D->CompareOp,D.TargetVer()) == false)
       if (Cache.VS().CheckDep(Ver,D->CompareOp,D.TargetVer()) == false)

+ 5 - 0
apt-pkg/packagemanager.h

@@ -29,6 +29,11 @@
 #include <iostream>
 #include <iostream>
 #include <set>
 #include <set>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/depcache.h>
+using std::string;
+#endif
+
 class pkgAcquire;
 class pkgAcquire;
 class pkgDepCache;
 class pkgDepCache;
 class pkgSourceList;
 class pkgSourceList;

+ 35 - 9
apt-pkg/pkgcache.cc

@@ -619,13 +619,12 @@ pkgCache::Version **pkgCache::DepIterator::AllTargets() const
       // Walk along the actual package providing versions
       // Walk along the actual package providing versions
       for (VerIterator I = DPkg.VersionList(); I.end() == false; ++I)
       for (VerIterator I = DPkg.VersionList(); I.end() == false; ++I)
       {
       {
-	 if (Owner->VS->CheckDep(I.VerStr(),S->CompareOp,TargetVer()) == false)
+	 if (IsIgnorable(I.ParentPkg()) == true)
 	    continue;
 	    continue;
 
 
-	 if (IsNegative() == true &&
-	     ParentPkg() == I.ParentPkg())
+	 if (Owner->VS->CheckDep(I.VerStr(),S->CompareOp,TargetVer()) == false)
 	    continue;
 	    continue;
-	 
+
 	 Size++;
 	 Size++;
 	 if (Res != 0)
 	 if (Res != 0)
 	    *End++ = I;
 	    *End++ = I;
@@ -634,13 +633,12 @@ pkgCache::Version **pkgCache::DepIterator::AllTargets() const
       // Follow all provides
       // Follow all provides
       for (PrvIterator I = DPkg.ProvidesList(); I.end() == false; ++I)
       for (PrvIterator I = DPkg.ProvidesList(); I.end() == false; ++I)
       {
       {
-	 if (Owner->VS->CheckDep(I.ProvideVersion(),S->CompareOp,TargetVer()) == false)
+	 if (IsIgnorable(I) == true)
 	    continue;
 	    continue;
-	 
-	 if (IsNegative() == true &&
-	     ParentPkg()->Group == I.OwnerPkg()->Group)
+
+	 if (Owner->VS->CheckDep(I.ProvideVersion(),S->CompareOp,TargetVer()) == false)
 	    continue;
 	    continue;
-	 
+
 	 Size++;
 	 Size++;
 	 if (Res != 0)
 	 if (Res != 0)
 	    *End++ = I.OwnerVer();
 	    *End++ = I.OwnerVer();
@@ -682,6 +680,34 @@ void pkgCache::DepIterator::GlobOr(DepIterator &Start,DepIterator &End)
    }
    }
 }
 }
 									/*}}}*/
 									/*}}}*/
+// DepIterator::IsIgnorable - should this packag/providr be ignored?	/*{{{*/
+// ---------------------------------------------------------------------
+/* Deps like self-conflicts should be ignored as well as implicit conflicts
+   on virtual packages. */
+bool pkgCache::DepIterator::IsIgnorable(PkgIterator const &Pkg) const
+{
+   if (ParentPkg() == TargetPkg())
+      return IsNegative();
+
+   return false;
+}
+bool pkgCache::DepIterator::IsIgnorable(PrvIterator const &Prv) const
+{
+   if (IsNegative() == false)
+      return false;
+
+   PkgIterator const Pkg = ParentPkg();
+   /* Provides may never be applied against the same package (or group)
+      if it is a conflicts. See the comment above. */
+   if (Prv.OwnerPkg()->Group == Pkg->Group)
+      return true;
+   // Implicit group-conflicts should not be applied on providers of other groups
+   if (Pkg->Group == TargetPkg()->Group && Prv.OwnerPkg()->Group != Pkg->Group)
+      return true;
+
+   return false;
+}
+									/*}}}*/
 // ostream operator to handle string representation of a dependecy	/*{{{*/
 // ostream operator to handle string representation of a dependecy	/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */

+ 5 - 2
apt-pkg/pkgcache.h

@@ -74,11 +74,14 @@
 #ifndef PKGLIB_PKGCACHE_H
 #ifndef PKGLIB_PKGCACHE_H
 #define PKGLIB_PKGCACHE_H
 #define PKGLIB_PKGCACHE_H
 
 
-
 #include <string>
 #include <string>
 #include <time.h>
 #include <time.h>
 #include <apt-pkg/mmap.h>
 #include <apt-pkg/mmap.h>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+#endif
+
 class pkgVersioningSystem;
 class pkgVersioningSystem;
 class pkgCache								/*{{{*/
 class pkgCache								/*{{{*/
 {
 {
@@ -198,6 +201,7 @@ class pkgCache								/*{{{*/
    inline PkgFileIterator FileEnd();
    inline PkgFileIterator FileEnd();
 
 
    inline bool MultiArchCache() const { return MultiArchEnabled; };
    inline bool MultiArchCache() const { return MultiArchEnabled; };
+   inline char const * const NativeArch() const;
 
 
    // Make me a function
    // Make me a function
    pkgVersioningSystem *VS;
    pkgVersioningSystem *VS;
@@ -213,7 +217,6 @@ class pkgCache								/*{{{*/
 private:
 private:
    bool MultiArchEnabled;
    bool MultiArchEnabled;
    PkgIterator SingleArchFindPkg(const std::string &Name);
    PkgIterator SingleArchFindPkg(const std::string &Name);
-   inline char const * const NativeArch() const;
 };
 };
 									/*}}}*/
 									/*}}}*/
 // Header structure							/*{{{*/
 // Header structure							/*{{{*/

+ 9 - 7
apt-pkg/pkgcachegen.cc

@@ -35,12 +35,14 @@
 
 
 #include <apti18n.h>
 #include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
-typedef vector<pkgIndexFile *>::iterator FileIterator;
+typedef std::vector<pkgIndexFile *>::iterator FileIterator;
 template <typename Iter> std::vector<Iter*> pkgCacheGenerator::Dynamic<Iter>::toReMap;
 template <typename Iter> std::vector<Iter*> pkgCacheGenerator::Dynamic<Iter>::toReMap;
 
 
 bool IsDuplicateDescription(pkgCache::DescIterator Desc,
 bool IsDuplicateDescription(pkgCache::DescIterator Desc,
 			    MD5SumValue const &CurMd5, std::string const &CurLang);
 			    MD5SumValue const &CurMd5, std::string const &CurLang);
 
 
+using std::string;
+
 // CacheGenerator::pkgCacheGenerator - Constructor			/*{{{*/
 // CacheGenerator::pkgCacheGenerator - Constructor			/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* We set the dirty flag and make sure that is written to the disk */
 /* We set the dirty flag and make sure that is written to the disk */
@@ -1221,14 +1223,14 @@ bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress
 			MMap **OutMap,bool AllowMem)
 			MMap **OutMap,bool AllowMem)
 {
 {
    bool const Debug = _config->FindB("Debug::pkgCacheGen", false);
    bool const Debug = _config->FindB("Debug::pkgCacheGen", false);
-   
-   vector<pkgIndexFile *> Files;
-   for (vector<metaIndex *>::const_iterator i = List.begin();
+
+   std::vector<pkgIndexFile *> Files;
+   for (std::vector<metaIndex *>::const_iterator i = List.begin();
         i != List.end();
         i != List.end();
         ++i)
         ++i)
    {
    {
-      vector <pkgIndexFile *> *Indexes = (*i)->GetIndexFiles();
-      for (vector<pkgIndexFile *>::const_iterator j = Indexes->begin();
+      std::vector <pkgIndexFile *> *Indexes = (*i)->GetIndexFiles();
+      for (std::vector<pkgIndexFile *>::const_iterator j = Indexes->begin();
 	   j != Indexes->end();
 	   j != Indexes->end();
 	   ++j)
 	   ++j)
          Files.push_back (*j);
          Files.push_back (*j);
@@ -1418,7 +1420,7 @@ __deprecated bool pkgMakeOnlyStatusCache(OpProgress &Progress,DynamicMMap **OutM
    { return pkgCacheGenerator::MakeOnlyStatusCache(&Progress, OutMap); }
    { return pkgCacheGenerator::MakeOnlyStatusCache(&Progress, OutMap); }
 bool pkgCacheGenerator::MakeOnlyStatusCache(OpProgress *Progress,DynamicMMap **OutMap)
 bool pkgCacheGenerator::MakeOnlyStatusCache(OpProgress *Progress,DynamicMMap **OutMap)
 {
 {
-   vector<pkgIndexFile *> Files;
+   std::vector<pkgIndexFile *> Files;
    unsigned long EndOfSource = Files.size();
    unsigned long EndOfSource = Files.size();
    if (_system->AddStatusFiles(Files) == false)
    if (_system->AddStatusFiles(Files) == false)
       return false;
       return false;

+ 4 - 0
apt-pkg/pkgsystem.h

@@ -41,6 +41,10 @@
 
 
 #include <vector>
 #include <vector>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/depcache.h>
+#endif
+
 class pkgDepCache;
 class pkgDepCache;
 class pkgPackageManager;
 class pkgPackageManager;
 class pkgVersioningSystem;
 class pkgVersioningSystem;

+ 4 - 0
apt-pkg/policy.h

@@ -38,6 +38,10 @@
 #include <apt-pkg/versionmatch.h>
 #include <apt-pkg/versionmatch.h>
 #include <vector>
 #include <vector>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::vector;
+#endif
+
 class pkgPolicy : public pkgDepCache::Policy
 class pkgPolicy : public pkgDepCache::Policy
 {
 {
    protected:
    protected:

+ 15 - 13
apt-pkg/sourcelist.h

@@ -32,9 +32,11 @@
 #include <map>
 #include <map>
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/pkgcache.h>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/metaindex.h>
 using std::string;
 using std::string;
 using std::vector;
 using std::vector;
-    
+#endif
 
 
 class pkgAcquire;
 class pkgAcquire;
 class pkgIndexFile;
 class pkgIndexFile;
@@ -57,32 +59,32 @@ class pkgSourceList
       const char *Name;
       const char *Name;
       const char *Label;
       const char *Label;
 
 
-      bool FixupURI(string &URI) const;
-      virtual bool ParseLine(vector<metaIndex *> &List,
+      bool FixupURI(std::string &URI) const;
+      virtual bool ParseLine(std::vector<metaIndex *> &List,
 			     const char *Buffer,
 			     const char *Buffer,
-			     unsigned long const &CurLine,string const &File) const;
-      virtual bool CreateItem(vector<metaIndex *> &List,string const &URI,
-			      string const &Dist,string const &Section,
-			      std::map<string, string> const &Options) const = 0;
+			     unsigned long const &CurLine,std::string const &File) const;
+      virtual bool CreateItem(std::vector<metaIndex *> &List,std::string const &URI,
+			      std::string const &Dist,std::string const &Section,
+			      std::map<std::string, std::string> const &Options) const = 0;
       Type();
       Type();
       virtual ~Type() {};
       virtual ~Type() {};
    };
    };
    
    
-   typedef vector<metaIndex *>::const_iterator const_iterator;
+   typedef std::vector<metaIndex *>::const_iterator const_iterator;
    
    
    protected:
    protected:
 
 
-   vector<metaIndex *> SrcList;
+   std::vector<metaIndex *> SrcList;
    
    
    public:
    public:
 
 
    bool ReadMainList();
    bool ReadMainList();
-   bool Read(string File);
+   bool Read(std::string File);
 
 
    // CNC:2003-03-03
    // CNC:2003-03-03
    void Reset();
    void Reset();
-   bool ReadAppend(string File);
-   bool ReadSourceDir(string Dir);
+   bool ReadAppend(std::string File);
+   bool ReadSourceDir(std::string Dir);
    
    
    // List accessors
    // List accessors
    inline const_iterator begin() const {return SrcList.begin();};
    inline const_iterator begin() const {return SrcList.begin();};
@@ -98,7 +100,7 @@ class pkgSourceList
    time_t GetLastModifiedTime();
    time_t GetLastModifiedTime();
 
 
    pkgSourceList();
    pkgSourceList();
-   pkgSourceList(string File);
+   pkgSourceList(std::string File);
    ~pkgSourceList();      
    ~pkgSourceList();      
 };
 };
 
 

+ 4 - 4
apt-pkg/srcrecords.cc

@@ -29,8 +29,8 @@ pkgSrcRecords::pkgSrcRecords(pkgSourceList &List) : Files(0), Current(0)
 {
 {
    for (pkgSourceList::const_iterator I = List.begin(); I != List.end(); ++I)
    for (pkgSourceList::const_iterator I = List.begin(); I != List.end(); ++I)
    {
    {
-      vector<pkgIndexFile *> *Indexes = (*I)->GetIndexFiles();
-      for (vector<pkgIndexFile *>::const_iterator J = Indexes->begin();
+      std::vector<pkgIndexFile *> *Indexes = (*I)->GetIndexFiles();
+      for (std::vector<pkgIndexFile *>::const_iterator J = Indexes->begin();
 	   J != Indexes->end(); ++J)
 	   J != Indexes->end(); ++J)
       {
       {
          Parser* P = (*J)->CreateSrcParser();
          Parser* P = (*J)->CreateSrcParser();
@@ -58,7 +58,7 @@ pkgSrcRecords::pkgSrcRecords(pkgSourceList &List) : Files(0), Current(0)
 pkgSrcRecords::~pkgSrcRecords()
 pkgSrcRecords::~pkgSrcRecords()
 {
 {
    // Blow away all the parser objects
    // Blow away all the parser objects
-   for(vector<Parser*>::iterator I = Files.begin(); I != Files.end(); ++I)
+   for(std::vector<Parser*>::iterator I = Files.begin(); I != Files.end(); ++I)
       delete *I;
       delete *I;
 }
 }
 									/*}}}*/
 									/*}}}*/
@@ -68,7 +68,7 @@ pkgSrcRecords::~pkgSrcRecords()
 bool pkgSrcRecords::Restart()
 bool pkgSrcRecords::Restart()
 {
 {
    Current = Files.begin();
    Current = Files.begin();
-   for (vector<Parser*>::iterator I = Files.begin();
+   for (std::vector<Parser*>::iterator I = Files.begin();
         I != Files.end(); ++I)
         I != Files.end(); ++I)
       (*I)->Restart();
       (*I)->Restart();
    
    

+ 5 - 0
apt-pkg/srcrecords.h

@@ -17,6 +17,11 @@
 #include <string>
 #include <string>
 #include <vector>
 #include <vector>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+using std::vector;
+#endif
+
 class pkgSourceList;
 class pkgSourceList;
 class pkgIndexFile;
 class pkgIndexFile;
 class pkgSrcRecords
 class pkgSrcRecords

+ 4 - 0
apt-pkg/tagfile.h

@@ -24,6 +24,10 @@
 
 
 #include <string>
 #include <string>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/fileutl.h>
+#endif
+
 class FileFd;
 class FileFd;
 
 
 class pkgTagSection
 class pkgTagSection

+ 4 - 0
apt-pkg/vendor.h

@@ -6,6 +6,10 @@
 
 
 #include <apt-pkg/macros.h>
 #include <apt-pkg/macros.h>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+#endif
+
 // A class representing a particular software provider.
 // A class representing a particular software provider.
 class __deprecated Vendor
 class __deprecated Vendor
 {
 {

+ 7 - 0
apt-pkg/vendorlist.h

@@ -17,6 +17,13 @@
 #include <vector>
 #include <vector>
 #include <apt-pkg/macros.h>
 #include <apt-pkg/macros.h>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/vendor.h>
+#include <apt-pkg/configuration.h>
+using std::string;
+using std::vector;
+#endif
+
 class Vendor;
 class Vendor;
 class Configuration;
 class Configuration;
 
 

+ 4 - 0
apt-pkg/version.h

@@ -23,6 +23,10 @@
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/strutl.h>
 #include <string>
 #include <string>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+#endif
+
 class pkgVersioningSystem
 class pkgVersioningSystem
 {
 {
    public:
    public:

+ 4 - 0
apt-pkg/versionmatch.h

@@ -39,6 +39,10 @@
 #include <string>
 #include <string>
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/pkgcache.h>
 
 
+#ifndef APT_8_CLEANER_HEADERS
+using std::string;
+#endif
+
 class pkgVersionMatch
 class pkgVersionMatch
 {   
 {   
    // Version Matching
    // Version Matching

+ 2 - 0
buildlib/config.h.in

@@ -44,3 +44,5 @@
 
 
 /* The package name string */
 /* The package name string */
 #undef PACKAGE
 #undef PACKAGE
+
+#define APT_8_CLEANER_HEADERS

+ 19 - 19
cmdline/apt-cache.cc

@@ -65,12 +65,12 @@ public:
       return CacheSetHelper::canNotFindNewestVer(Cache, Pkg);
       return CacheSetHelper::canNotFindNewestVer(Cache, Pkg);
    }
    }
 
 
-   virtual APT::VersionSet canNotFindAllVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) {
+   virtual void canNotFindAllVer(APT::VersionContainerInterface * vci, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) {
       virtualPkgs.insert(Pkg);
       virtualPkgs.insert(Pkg);
-      return CacheSetHelper::canNotFindAllVer(Cache, Pkg);
+      CacheSetHelper::canNotFindAllVer(vci, Cache, Pkg);
    }
    }
 
 
-   CacheSetHelperVirtuals(bool const &ShowErrors = true, GlobalError::MsgType const &ErrorType = GlobalError::NOTICE) : CacheSetHelper(ShowErrors, ErrorType) {}
+   CacheSetHelperVirtuals(bool const ShowErrors = true, GlobalError::MsgType const &ErrorType = GlobalError::NOTICE) : CacheSetHelper(ShowErrors, ErrorType) {}
 };
 };
 									/*}}}*/
 									/*}}}*/
 // LocalitySort - Sort a version list by package file locality		/*{{{*/
 // LocalitySort - Sort a version list by package file locality		/*{{{*/
@@ -108,7 +108,7 @@ void LocalitySort(pkgCache::DescFile **begin,
 // UnMet - Show unmet dependencies					/*{{{*/
 // UnMet - Show unmet dependencies					/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-bool ShowUnMet(pkgCache::VerIterator const &V, bool const &Important)
+bool ShowUnMet(pkgCache::VerIterator const &V, bool const Important)
 {
 {
 	 bool Header = false;
 	 bool Header = false;
 	 for (pkgCache::DepIterator D = V.DependsList(); D.end() == false;)
 	 for (pkgCache::DepIterator D = V.DependsList(); D.end() == false;)
@@ -199,9 +199,9 @@ bool UnMet(CommandLine &CmdL)
    else
    else
    {
    {
       CacheSetHelperVirtuals helper(true, GlobalError::NOTICE);
       CacheSetHelperVirtuals helper(true, GlobalError::NOTICE);
-      APT::VersionSet verset = APT::VersionSet::FromCommandLine(CacheFile, CmdL.FileList + 1,
-				APT::VersionSet::CANDIDATE, helper);
-      for (APT::VersionSet::iterator V = verset.begin(); V != verset.end(); ++V)
+      APT::VersionList verset = APT::VersionList::FromCommandLine(CacheFile, CmdL.FileList + 1,
+				APT::VersionList::CANDIDATE, helper);
+      for (APT::VersionList::iterator V = verset.begin(); V != verset.end(); ++V)
 	 if (ShowUnMet(V, Important) == false)
 	 if (ShowUnMet(V, Important) == false)
 	    return false;
 	    return false;
    }
    }
@@ -215,9 +215,9 @@ bool DumpPackage(CommandLine &CmdL)
 {
 {
    pkgCacheFile CacheFile;
    pkgCacheFile CacheFile;
    APT::CacheSetHelper helper(true, GlobalError::NOTICE);
    APT::CacheSetHelper helper(true, GlobalError::NOTICE);
-   APT::PackageSet pkgset = APT::PackageSet::FromCommandLine(CacheFile, CmdL.FileList + 1, helper);
+   APT::PackageList pkgset = APT::PackageList::FromCommandLine(CacheFile, CmdL.FileList + 1, helper);
 
 
-   for (APT::PackageSet::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
+   for (APT::PackageList::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
    {
    {
       cout << "Package: " << Pkg.FullName(true) << endl;
       cout << "Package: " << Pkg.FullName(true) << endl;
       cout << "Versions: " << endl;
       cout << "Versions: " << endl;
@@ -588,7 +588,7 @@ bool ShowDepends(CommandLine &CmdL, bool const RevDepends)
       return false;
       return false;
 
 
    CacheSetHelperVirtuals helper(false);
    CacheSetHelperVirtuals helper(false);
-   APT::VersionSet verset = APT::VersionSet::FromCommandLine(CacheFile, CmdL.FileList + 1, APT::VersionSet::CANDIDATE, helper);
+   APT::VersionList verset = APT::VersionList::FromCommandLine(CacheFile, CmdL.FileList + 1, APT::VersionList::CANDIDATE, helper);
    if (verset.empty() == true && helper.virtualPkgs.empty() == true)
    if (verset.empty() == true && helper.virtualPkgs.empty() == true)
       return _error->Error(_("No packages found"));
       return _error->Error(_("No packages found"));
    std::vector<bool> Shown(Cache->Head().PackageCount);
    std::vector<bool> Shown(Cache->Head().PackageCount);
@@ -1143,7 +1143,7 @@ bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V)
       return _error->Error(_("Package file %s is out of sync."),I.FileName());
       return _error->Error(_("Package file %s is out of sync."),I.FileName());
 
 
    FileFd PkgF;
    FileFd PkgF;
-   if (PkgF.Open(I.FileName(), FileFd::ReadOnlyGzip) == false)
+   if (PkgF.Open(I.FileName(), FileFd::ReadOnly, FileFd::Extension) == false)
       return false;
       return false;
 
 
    // Read the record
    // Read the record
@@ -1365,10 +1365,10 @@ bool ShowPackage(CommandLine &CmdL)
 {
 {
    pkgCacheFile CacheFile;
    pkgCacheFile CacheFile;
    CacheSetHelperVirtuals helper(true, GlobalError::NOTICE);
    CacheSetHelperVirtuals helper(true, GlobalError::NOTICE);
-   APT::VersionSet::Version const select = _config->FindB("APT::Cache::AllVersions", true) ?
-			APT::VersionSet::ALL : APT::VersionSet::CANDIDATE;
-   APT::VersionSet const verset = APT::VersionSet::FromCommandLine(CacheFile, CmdL.FileList + 1, select, helper);
-   for (APT::VersionSet::const_iterator Ver = verset.begin(); Ver != verset.end(); ++Ver)
+   APT::VersionList::Version const select = _config->FindB("APT::Cache::AllVersions", true) ?
+			APT::VersionList::ALL : APT::VersionList::CANDIDATE;
+   APT::VersionList const verset = APT::VersionList::FromCommandLine(CacheFile, CmdL.FileList + 1, select, helper);
+   for (APT::VersionList::const_iterator Ver = verset.begin(); Ver != verset.end(); ++Ver)
       if (DisplayRecord(CacheFile, Ver) == false)
       if (DisplayRecord(CacheFile, Ver) == false)
 	 return false;
 	 return false;
 
 
@@ -1531,8 +1531,8 @@ bool Policy(CommandLine &CmdL)
 
 
    // Print out detailed information for each package
    // Print out detailed information for each package
    APT::CacheSetHelper helper(true, GlobalError::NOTICE);
    APT::CacheSetHelper helper(true, GlobalError::NOTICE);
-   APT::PackageSet pkgset = APT::PackageSet::FromCommandLine(CacheFile, CmdL.FileList + 1, helper);
-   for (APT::PackageSet::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
+   APT::PackageList pkgset = APT::PackageList::FromCommandLine(CacheFile, CmdL.FileList + 1, helper);
+   for (APT::PackageList::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
    {
    {
       cout << Pkg.FullName(true) << ":" << endl;
       cout << Pkg.FullName(true) << ":" << endl;
 
 
@@ -1608,8 +1608,8 @@ bool Madison(CommandLine &CmdL)
    for (const char **I = CmdL.FileList + 1; *I != 0; I++)
    for (const char **I = CmdL.FileList + 1; *I != 0; I++)
    {
    {
       _error->PushToStack();
       _error->PushToStack();
-      APT::PackageSet pkgset = APT::PackageSet::FromString(CacheFile, *I, helper);
-      for (APT::PackageSet::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
+      APT::PackageList pkgset = APT::PackageList::FromString(CacheFile, *I, helper);
+      for (APT::PackageList::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
       {
       {
          for (pkgCache::VerIterator V = Pkg.VersionList(); V.end() == false; ++V)
          for (pkgCache::VerIterator V = Pkg.VersionList(); V.end() == false; ++V)
          {
          {

+ 16 - 0
cmdline/apt-config.cc

@@ -134,6 +134,22 @@ int main(int argc,const char *argv[])					/*{{{*/
    for (std::vector<std::string>::const_iterator a = archs.begin(); a != archs.end(); ++a)
    for (std::vector<std::string>::const_iterator a = archs.begin(); a != archs.end(); ++a)
       _config->Set("APT::Architectures::", *a);
       _config->Set("APT::Architectures::", *a);
 
 
+   std::vector<APT::Configuration::Compressor> const compressors = APT::Configuration::getCompressors();
+   _config->Clear("APT::Compressor");
+   string conf = "APT::Compressor::";
+   for (std::vector<APT::Configuration::Compressor>::const_iterator c = compressors.begin(); c != compressors.end(); ++c)
+   {
+      string comp = conf + c->Name + "::";
+      _config->Set(comp + "Name", c->Name);
+      _config->Set(comp + "Extension", c->Extension);
+      _config->Set(comp + "Binary", c->Binary);
+      _config->Set(std::string(comp + "Cost").c_str(), c->Cost);
+      for (std::vector<std::string>::const_iterator a = c->CompressArgs.begin(); a != c->CompressArgs.end(); ++a)
+	 _config->Set(comp + "CompressArg::", *a);
+      for (std::vector<std::string>::const_iterator a = c->UncompressArgs.begin(); a != c->UncompressArgs.end(); ++a)
+	 _config->Set(comp + "UncompressArg::", *a);
+   }
+
    // Match the operation
    // Match the operation
    CmdL.DispatchArg(Cmds);
    CmdL.DispatchArg(Cmds);
    
    

+ 6 - 4
cmdline/apt-extracttemplates.h

@@ -14,6 +14,8 @@
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/dirstream.h>
 #include <apt-pkg/dirstream.h>
 
 
+#include <string>
+
 class DebFile : public pkgDirStream
 class DebFile : public pkgDirStream
 {
 {
 	FileFd File;
 	FileFd File;
@@ -31,11 +33,11 @@ public:
 	bool Go();
 	bool Go();
 	bool ParseInfo();
 	bool ParseInfo();
 
 
-	static string GetInstalledVer(const string &package);
+	static std::string GetInstalledVer(const std::string &package);
 
 
-	string Package;
-	string Version;
-	string DepVer, PreDepVer;
+	std::string Package;
+	std::string Version;
+	std::string DepVer, PreDepVer;
 	unsigned int DepOp, PreDepOp;
 	unsigned int DepOp, PreDepOp;
 
 
 	char *Config;
 	char *Config;

+ 29 - 18
cmdline/apt-get.cc

@@ -628,20 +628,18 @@ public:
 		explicitlyNamed = true;
 		explicitlyNamed = true;
 	}
 	}
 
 
-	virtual void showTaskSelection(APT::PackageSet const &pkgset, string const &pattern) {
-		for (APT::PackageSet::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
-			ioprintf(out, _("Note, selecting '%s' for task '%s'\n"),
-				 Pkg.FullName(true).c_str(), pattern.c_str());
+	virtual void showTaskSelection(pkgCache::PkgIterator const &Pkg, string const &pattern) {
+		ioprintf(out, _("Note, selecting '%s' for task '%s'\n"),
+				Pkg.FullName(true).c_str(), pattern.c_str());
 		explicitlyNamed = false;
 		explicitlyNamed = false;
 	}
 	}
-	virtual void showRegExSelection(APT::PackageSet const &pkgset, string const &pattern) {
-		for (APT::PackageSet::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
-			ioprintf(out, _("Note, selecting '%s' for regex '%s'\n"),
-				 Pkg.FullName(true).c_str(), pattern.c_str());
+	virtual void showRegExSelection(pkgCache::PkgIterator const &Pkg, string const &pattern) {
+		ioprintf(out, _("Note, selecting '%s' for regex '%s'\n"),
+				Pkg.FullName(true).c_str(), pattern.c_str());
 		explicitlyNamed = false;
 		explicitlyNamed = false;
 	}
 	}
 	virtual void showSelectedVersion(pkgCache::PkgIterator const &Pkg, pkgCache::VerIterator const Ver,
 	virtual void showSelectedVersion(pkgCache::PkgIterator const &Pkg, pkgCache::VerIterator const Ver,
-				 string const &ver, bool const &verIsRel) {
+				 string const &ver, bool const verIsRel) {
 		if (ver == Ver.VerStr())
 		if (ver == Ver.VerStr())
 			return;
 			return;
 		selectedByRelease.push_back(make_pair(Ver, ver));
 		selectedByRelease.push_back(make_pair(Ver, ver));
@@ -707,7 +705,7 @@ public:
 		APT::VersionSet const verset = tryVirtualPackage(Cache, Pkg, APT::VersionSet::CANDIDATE);
 		APT::VersionSet const verset = tryVirtualPackage(Cache, Pkg, APT::VersionSet::CANDIDATE);
 		if (verset.empty() == false)
 		if (verset.empty() == false)
 			return *(verset.begin());
 			return *(verset.begin());
-		if (ShowError == true) {
+		else if (ShowError == true) {
 			_error->Error(_("Package '%s' has no installation candidate"),Pkg.FullName(true).c_str());
 			_error->Error(_("Package '%s' has no installation candidate"),Pkg.FullName(true).c_str());
 			virtualPkgs.insert(Pkg);
 			virtualPkgs.insert(Pkg);
 		}
 		}
@@ -744,6 +742,19 @@ public:
 				Prov = PPkg;
 				Prov = PPkg;
 				found_one = true;
 				found_one = true;
 			} else if (PPkg != Prov) {
 			} else if (PPkg != Prov) {
+				// same group, so it's a foreign package
+				if (PPkg->Group == Prov->Group) {
+					// do we already have the requested arch?
+					if (strcmp(Pkg.Arch(), Prov.Arch()) == 0 ||
+					    strcmp(Prov.Arch(), "all") == 0 ||
+					    unlikely(strcmp(PPkg.Arch(), Prov.Arch()) == 0)) // packages have only on candidate, but just to be sure
+						continue;
+					// see which architecture we prefer more and switch to it
+					std::vector<std::string> archs = APT::Configuration::getArchitectures();
+					if (std::find(archs.begin(), archs.end(), PPkg.Arch()) < std::find(archs.begin(), archs.end(), Prov.Arch()))
+						Prov = PPkg;
+					continue;
+				}
 				found_one = false; // we found at least two
 				found_one = false; // we found at least two
 				break;
 				break;
 			}
 			}
@@ -769,7 +780,7 @@ struct TryToInstall {
    unsigned long AutoMarkChanged;
    unsigned long AutoMarkChanged;
    APT::PackageSet doAutoInstallLater;
    APT::PackageSet doAutoInstallLater;
 
 
-   TryToInstall(pkgCacheFile &Cache, pkgProblemResolver *PM, bool const &FixBroken) : Cache(&Cache), Fix(PM),
+   TryToInstall(pkgCacheFile &Cache, pkgProblemResolver *PM, bool const FixBroken) : Cache(&Cache), Fix(PM),
 			FixBroken(FixBroken), AutoMarkChanged(0) {};
 			FixBroken(FixBroken), AutoMarkChanged(0) {};
 
 
    void operator() (pkgCache::VerIterator const &Ver) {
    void operator() (pkgCache::VerIterator const &Ver) {
@@ -2295,8 +2306,8 @@ bool DoDownload(CommandLine &CmdL)
       return false;
       return false;
    
    
    APT::CacheSetHelper helper(c0out);
    APT::CacheSetHelper helper(c0out);
-   APT::VersionSet verset = APT::VersionSet::FromCommandLine(Cache,
-		CmdL.FileList + 1, APT::VersionSet::CANDIDATE, helper);
+   APT::VersionList verset = APT::VersionList::FromCommandLine(Cache,
+		CmdL.FileList + 1, APT::VersionList::CANDIDATE, helper);
 
 
    if (verset.empty() == true)
    if (verset.empty() == true)
       return false;
       return false;
@@ -2308,7 +2319,7 @@ bool DoDownload(CommandLine &CmdL)
 
 
    pkgRecords Recs(Cache);
    pkgRecords Recs(Cache);
    pkgSourceList *SrcList = Cache.GetSourceList();
    pkgSourceList *SrcList = Cache.GetSourceList();
-   for (APT::VersionSet::const_iterator Ver = verset.begin(); 
+   for (APT::VersionList::const_iterator Ver = verset.begin(); 
         Ver != verset.end(); 
         Ver != verset.end(); 
         ++Ver) 
         ++Ver) 
    {
    {
@@ -3167,14 +3178,14 @@ bool DoChangelog(CommandLine &CmdL)
       return false;
       return false;
    
    
    APT::CacheSetHelper helper(c0out);
    APT::CacheSetHelper helper(c0out);
-   APT::VersionSet verset = APT::VersionSet::FromCommandLine(Cache,
-		CmdL.FileList + 1, APT::VersionSet::CANDIDATE, helper);
+   APT::VersionList verset = APT::VersionList::FromCommandLine(Cache,
+		CmdL.FileList + 1, APT::VersionList::CANDIDATE, helper);
    if (verset.empty() == true)
    if (verset.empty() == true)
       return false;
       return false;
    pkgAcquire Fetcher;
    pkgAcquire Fetcher;
 
 
    if (_config->FindB("APT::Get::Print-URIs", false) == true)
    if (_config->FindB("APT::Get::Print-URIs", false) == true)
-      for (APT::VersionSet::const_iterator Ver = verset.begin();
+      for (APT::VersionList::const_iterator Ver = verset.begin();
 	   Ver != verset.end(); ++Ver)
 	   Ver != verset.end(); ++Ver)
 	 return DownloadChangelog(Cache, Fetcher, Ver, "");
 	 return DownloadChangelog(Cache, Fetcher, Ver, "");
 
 
@@ -3197,7 +3208,7 @@ bool DoChangelog(CommandLine &CmdL)
 	 return _error->Errno("mkdtemp", "mkdtemp failed");
 	 return _error->Errno("mkdtemp", "mkdtemp failed");
    }
    }
 
 
-   for (APT::VersionSet::const_iterator Ver = verset.begin(); 
+   for (APT::VersionList::const_iterator Ver = verset.begin(); 
         Ver != verset.end(); 
         Ver != verset.end(); 
         ++Ver) 
         ++Ver) 
    {
    {

+ 8 - 8
cmdline/apt-mark.cc

@@ -35,14 +35,14 @@ bool DoAuto(CommandLine &CmdL)
    if (unlikely(Cache == NULL || DepCache == NULL))
    if (unlikely(Cache == NULL || DepCache == NULL))
       return false;
       return false;
 
 
-   APT::PackageSet pkgset = APT::PackageSet::FromCommandLine(CacheFile, CmdL.FileList + 1);
+   APT::PackageList pkgset = APT::PackageList::FromCommandLine(CacheFile, CmdL.FileList + 1);
    if (pkgset.empty() == true)
    if (pkgset.empty() == true)
       return _error->Error(_("No packages found"));
       return _error->Error(_("No packages found"));
 
 
    bool MarkAuto = strcasecmp(CmdL.FileList[0],"auto") == 0;
    bool MarkAuto = strcasecmp(CmdL.FileList[0],"auto") == 0;
    int AutoMarkChanged = 0;
    int AutoMarkChanged = 0;
 
 
-   for (APT::PackageSet::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
+   for (APT::PackageList::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
    {
    {
       if (Pkg->CurrentVer == 0)
       if (Pkg->CurrentVer == 0)
       {
       {
@@ -82,7 +82,7 @@ bool DoMarkAuto(CommandLine &CmdL)
    if (unlikely(Cache == NULL || DepCache == NULL))
    if (unlikely(Cache == NULL || DepCache == NULL))
       return false;
       return false;
 
 
-   APT::PackageSet pkgset = APT::PackageSet::FromCommandLine(CacheFile, CmdL.FileList + 1);
+   APT::PackageList pkgset = APT::PackageList::FromCommandLine(CacheFile, CmdL.FileList + 1);
    if (pkgset.empty() == true)
    if (pkgset.empty() == true)
       return _error->Error(_("No packages found"));
       return _error->Error(_("No packages found"));
 
 
@@ -90,7 +90,7 @@ bool DoMarkAuto(CommandLine &CmdL)
    bool const Verbose = _config->FindB("APT::MarkAuto::Verbose", false);
    bool const Verbose = _config->FindB("APT::MarkAuto::Verbose", false);
    int AutoMarkChanged = 0;
    int AutoMarkChanged = 0;
 
 
-   for (APT::PackageSet::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
+   for (APT::PackageList::const_iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
    {
    {
       if (Pkg->CurrentVer == 0 ||
       if (Pkg->CurrentVer == 0 ||
 	  (((*DepCache)[Pkg].Flags & pkgCache::Flag::Auto) == pkgCache::Flag::Auto) == MarkAuto)
 	  (((*DepCache)[Pkg].Flags & pkgCache::Flag::Auto) == pkgCache::Flag::Auto) == MarkAuto)
@@ -158,13 +158,13 @@ bool DoHold(CommandLine &CmdL)
    if (unlikely(Cache == NULL))
    if (unlikely(Cache == NULL))
       return false;
       return false;
 
 
-   APT::PackageSet pkgset = APT::PackageSet::FromCommandLine(CacheFile, CmdL.FileList + 1);
+   APT::PackageList pkgset = APT::PackageList::FromCommandLine(CacheFile, CmdL.FileList + 1);
    if (pkgset.empty() == true)
    if (pkgset.empty() == true)
       return _error->Error(_("No packages found"));
       return _error->Error(_("No packages found"));
 
 
    bool const MarkHold = strcasecmp(CmdL.FileList[0],"hold") == 0;
    bool const MarkHold = strcasecmp(CmdL.FileList[0],"hold") == 0;
 
 
-   for (APT::PackageSet::iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
+   for (APT::PackageList::iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
    {
    {
       if ((Pkg->SelectedState == pkgCache::State::Hold) == MarkHold)
       if ((Pkg->SelectedState == pkgCache::State::Hold) == MarkHold)
       {
       {
@@ -182,7 +182,7 @@ bool DoHold(CommandLine &CmdL)
 
 
    if (_config->FindB("APT::Mark::Simulate", false) == true)
    if (_config->FindB("APT::Mark::Simulate", false) == true)
    {
    {
-      for (APT::PackageSet::iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
+      for (APT::PackageList::iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
       {
       {
 	 if (MarkHold == false)
 	 if (MarkHold == false)
 	    ioprintf(c1out,_("%s set on hold.\n"), Pkg.FullName(true).c_str());
 	    ioprintf(c1out,_("%s set on hold.\n"), Pkg.FullName(true).c_str());
@@ -202,7 +202,7 @@ bool DoHold(CommandLine &CmdL)
    if (dpkg == NULL)
    if (dpkg == NULL)
       return _error->Errno("DoHold", "fdopen on dpkg stdin failed");
       return _error->Errno("DoHold", "fdopen on dpkg stdin failed");
 
 
-   for (APT::PackageSet::iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
+   for (APT::PackageList::iterator Pkg = pkgset.begin(); Pkg != pkgset.end(); ++Pkg)
    {
    {
       if (MarkHold == true)
       if (MarkHold == true)
       {
       {

+ 1 - 1
configure.in

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

+ 71 - 5
debian/changelog

@@ -1,6 +1,63 @@
+apt (0.8.16~exp10) UNRELEASED; urgency=low
+
+  [ David Kalnischkies ]
+  * apt-pkg/depcache.cc:
+    - implicit conflicts (for multiarch) are supposed to conflict
+      only with real packages, not with virtual providers
+  * apt-pkg/pkgcache.cc:
+    - ignore implicit conflicts on providers in AllTarget, too
+  * apt-pkg/deb/dpkgpm.cc:
+    - check if dpkg supports multiarch with --assert-multi-arch
+      and if it does be always explicit about the architecture
+
+ -- David Kalnischkies <kalnischkies@gmail.com>  Fri, 13 Jan 2012 17:29:07 +0100
+
+apt (0.8.16~exp9) experimental; urgency=low
+
+  [ Julian Andres Klode ]
+  * apt-pkg/cdrom.cc:
+    - Accept .bz2, .xz files in addition to .gz files (Closes: #649451)
+
+  [ Michael Vogt ]
+  * apt-pkg/cdrom.cc:
+    - use aptconfiguration to get the supported compression types
+  * debian/control:
+    - bump debhelper build-dep to debhelper (>= 8.1.3~)
+    - set libapt-pkg-dev to multi-arch: same too
+  * g++ 4.7 fixes
+
+  [ Colin Watson ]
+  * Convert libapt-pkg4.12 and libapt-inst1.4 to Multi-Arch: same.
+
+  [ David Kalnischkies ]
+  * apt-pkg/cacheset.cc:
+    - make the cachesets real containers which can embedding any container
+      to be able to use the same interface regardless of set or list usage
+    - provide a {Package,Version}List similar to {Package,Version}Set
+  * cmdline/apt-{get,cache,mark}.cc:
+    - use Lists instead of Sets if input order should be preserved for
+      commands accepting lists of packages, e.g. policy (Closes: #625960)
+  * apt-pkg/depcache.cc:
+    - prefer native providers over foreigns even if the chain is foreign
+  * cmdline/apt-get.cc:
+    - ignore foreign architectures if we check if a provides has only one
+      resolver as it's basically the same for the user, so no need to choose
+  * cmdline/apt-config.cc:
+    - dump the APT::Compressor settings correctly and completely
+  * apt-pkg/contrib/fileutl.{h,cc}:
+    - implement a ModificationTime method for FileFd
+    - add a ReadLine method
+    - drop the explicit export of gz-compression handling
+  * apt-pkg/cdrom.cc:
+    - support InRelease files on cdrom
+
+ -- Michael Vogt <mvo@debian.org>  Thu, 05 Jan 2012 20:26:31 +0100
+
 apt (0.8.16~exp8) experimental; urgency=low
 apt (0.8.16~exp8) experimental; urgency=low
 
 
   [ David Kalnischkies ]
   [ David Kalnischkies ]
+  * algorithms.cc:
+    - show a debug why a package was kept by ResolveByKeep()
   * apt-pkg/packagemanager.cc:
   * apt-pkg/packagemanager.cc:
     - do not fail on unpacked packages in SmartUnPack, just don't
     - do not fail on unpacked packages in SmartUnPack, just don't
       shedule them for unpack, but do all checks and configure them
       shedule them for unpack, but do all checks and configure them
@@ -9,9 +66,6 @@ apt (0.8.16~exp8) experimental; urgency=low
     - use a pointer-union to peace gcc strict-aliasing warning
     - use a pointer-union to peace gcc strict-aliasing warning
   * apt-pkg/deb/deblistparser.cc:
   * apt-pkg/deb/deblistparser.cc:
     - M-A: foreign packages provide for other archs, too
     - M-A: foreign packages provide for other archs, too
-  
-  [ Michael Vogt ]
-  * g++ 4.7 fixes
 
 
  -- David Kalnischkies <kalnischkies@gmail.com>  Thu, 03 Nov 2011 09:40:29 -0500
  -- David Kalnischkies <kalnischkies@gmail.com>  Thu, 03 Nov 2011 09:40:29 -0500
 
 
@@ -199,13 +253,25 @@ apt (0.8.16~exp1) experimental; urgency=low
 
 
  -- Michael Vogt <mvo@debian.org>  Wed, 29 Jun 2011 12:40:31 +0200
  -- Michael Vogt <mvo@debian.org>  Wed, 29 Jun 2011 12:40:31 +0200
 
 
-apt (1.8.15.9+nmu1) unstable; urgency=low
+apt (0.8.15.10) UNRELEASEDunstable; urgency=low
 
 
   [ David Kalnischkies ]
   [ David Kalnischkies ]
   * algorithms.cc:
   * algorithms.cc:
     - show a debug why a package was kept by ResolveByKeep()
     - show a debug why a package was kept by ResolveByKeep()
+  * doc/manpage-style.xml:
+    - put <brackets> around email addresses
+  * doc/po/de.po:
+    - apply typo-fix from Michael Basse, thanks! (LP: #900770)
+
+  [ Chris Leick ]
+  * German manpage translation update
+  * doc/*.xml:
+    - find and fix a bunch of misspellings
+
+  [ Program translation updatex ]
+  * Dutch (Jeroen Schot). Closes: #652230
 
 
- -- David Kalnischkies <kalnischkies@gmail.com>  Mon, 17 Oct 2011 16:36:22 +0200
+ -- David Kalnischkies <kalnischkies@gmail.com>  Tue, 06 Dec 2011 16:35:39 +0100
 
 
 apt (0.8.15.9) unstable; urgency=low
 apt (0.8.15.9) unstable; urgency=low
 
 

+ 7 - 1
debian/control

@@ -6,7 +6,7 @@ Uploaders: Michael Vogt <mvo@debian.org>, Otavio Salvador <otavio@debian.org>,
  Christian Perrier <bubulle@debian.org>, Daniel Burrows <dburrows@debian.org>,
  Christian Perrier <bubulle@debian.org>, Daniel Burrows <dburrows@debian.org>,
  Julian Andres Klode <jak@debian.org>
  Julian Andres Klode <jak@debian.org>
 Standards-Version: 3.9.2
 Standards-Version: 3.9.2
-Build-Depends: dpkg-dev (>= 1.15.8), debhelper (>= 7.2.3~), libdb-dev,
+Build-Depends: dpkg-dev (>= 1.15.8), debhelper (>= 8.1.3~), libdb-dev,
  gettext (>= 0.12), libcurl4-gnutls-dev (>= 7.19.0), 
  gettext (>= 0.12), libcurl4-gnutls-dev (>= 7.19.0), 
  zlib1g-dev | libz-dev, debiandoc-sgml, xsltproc, docbook-xsl, docbook-xml, 
  zlib1g-dev | libz-dev, debiandoc-sgml, xsltproc, docbook-xsl, docbook-xml, 
  po4a (>= 0.34-2), autotools-dev, autoconf, automake, doxygen
  po4a (>= 0.34-2), autotools-dev, autoconf, automake, doxygen
@@ -37,6 +37,8 @@ Description: APT's commandline package manager
 
 
 Package: libapt-pkg4.12
 Package: libapt-pkg4.12
 Architecture: any
 Architecture: any
+Multi-Arch: same
+Pre-Depends: ${misc:Pre-Depends}
 Depends: ${shlibs:Depends}, ${misc:Depends}
 Depends: ${shlibs:Depends}, ${misc:Depends}
 Description: APT's package managment runtime library
 Description: APT's package managment runtime library
  This library provides the common functionality for searching and
  This library provides the common functionality for searching and
@@ -56,6 +58,8 @@ Description: APT's package managment runtime library
 
 
 Package: libapt-inst1.4
 Package: libapt-inst1.4
 Architecture: any
 Architecture: any
+Multi-Arch: same
+Pre-Depends: ${misc:Pre-Depends}
 Depends: ${shlibs:Depends}, ${misc:Depends}
 Depends: ${shlibs:Depends}, ${misc:Depends}
 Description: APT's deb package format runtime library
 Description: APT's deb package format runtime library
  This library provides methods to query and extract information 
  This library provides methods to query and extract information 
@@ -73,7 +77,9 @@ Description: Documentation for APT
 
 
 Package: libapt-pkg-dev
 Package: libapt-pkg-dev
 Architecture: any
 Architecture: any
+Multi-Arch: same
 Priority: optional
 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 | zlib-dev
 Section: libdevel
 Section: libdevel
 Description: Development files for APT's libapt-pkg and libapt-inst
 Description: Development files for APT's libapt-pkg and libapt-inst

+ 0 - 2
debian/libapt-inst1.4.install

@@ -1,2 +0,0 @@
-bin/libapt-inst*.so.* usr/lib/
-usr/share/locale/*/*/libapt-inst*.mo

+ 2 - 0
debian/libapt-inst1.4.install.in

@@ -0,0 +1,2 @@
+bin/libapt-inst*.so.* usr/lib/@DEB_HOST_MULTIARCH@/
+usr/share/locale/*/*/libapt-inst*.mo

+ 0 - 2
debian/libapt-pkg-dev.dirs

@@ -1,2 +0,0 @@
-usr/lib
-usr/include/apt-pkg

+ 0 - 3
debian/libapt-pkg-dev.install

@@ -1,3 +0,0 @@
-bin/libapt-pkg*.so usr/lib/
-bin/libapt-inst*.so usr/lib/
-include/apt-pkg/*.h usr/include/apt-pkg/

+ 3 - 0
debian/libapt-pkg-dev.install.in

@@ -0,0 +1,3 @@
+bin/libapt-pkg*.so usr/lib/@DEB_HOST_MULTIARCH@/
+bin/libapt-inst*.so usr/lib/@DEB_HOST_MULTIARCH@/
+include/apt-pkg/*.h usr/include/apt-pkg/

+ 0 - 2
debian/libapt-pkg4.12.install

@@ -1,2 +0,0 @@
-bin/libapt-pkg*.so.* usr/lib/
-usr/share/locale/*/*/libapt-pkg*.mo

+ 2 - 0
debian/libapt-pkg4.12.install.in

@@ -0,0 +1,2 @@
+bin/libapt-pkg*.so.* usr/lib/@DEB_HOST_MULTIARCH@/
+usr/share/locale/*/*/libapt-pkg*.mo

+ 9 - 3
debian/rules

@@ -5,6 +5,7 @@
 
 
 export DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 export DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+export DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
 
 
 # FOR AUTOCONF 2.52 AND NEWER ONLY
 # FOR AUTOCONF 2.52 AND NEWER ONLY
 ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
 ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
@@ -118,6 +119,11 @@ clean:
 
 
 	[ ! -f Makefile ] || $(MAKE) clean distclean
 	[ ! -f Makefile ] || $(MAKE) clean distclean
 	rm -rf build
 	rm -rf build
+	rm -f debian/$(LIBAPT_PKG).install debian/$(LIBAPT_INST).install \
+	      debian/libapt-pkg-dev.install
+
+debian/%.install: debian/%.install.in
+	sed 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' $< > $@
 
 
 binary-indep: apt-doc libapt-pkg-doc
 binary-indep: apt-doc libapt-pkg-doc
 # Build architecture-independent files here.
 # Build architecture-independent files here.
@@ -217,7 +223,7 @@ apt: build build-doc
 	dh_md5sums -p$@
 	dh_md5sums -p$@
 	dh_builddeb -p$@
 	dh_builddeb -p$@
 
 
-libapt-pkg-dev: build
+libapt-pkg-dev: build debian/libapt-pkg-dev.install
 	dh_testdir -p$@
 	dh_testdir -p$@
 	dh_testroot -p$@
 	dh_testroot -p$@
 	dh_prep -p$@
 	dh_prep -p$@
@@ -265,7 +271,7 @@ apt-utils: build
 	dh_md5sums -p$@
 	dh_md5sums -p$@
 	dh_builddeb -p$@
 	dh_builddeb -p$@
 
 
-$(LIBAPT_PKG): build
+$(LIBAPT_PKG): build debian/$(LIBAPT_PKG).install
 	dh_testdir -p$@
 	dh_testdir -p$@
 	dh_testroot -p$@
 	dh_testroot -p$@
 	dh_prep -p$@
 	dh_prep -p$@
@@ -284,7 +290,7 @@ $(LIBAPT_PKG): build
 	dh_md5sums -p$@
 	dh_md5sums -p$@
 	dh_builddeb -p$@
 	dh_builddeb -p$@
 
 
-$(LIBAPT_INST): build
+$(LIBAPT_INST): build debian/$(LIBAPT_INST).install
 	dh_testdir -p$@
 	dh_testdir -p$@
 	dh_testroot -p$@
 	dh_testroot -p$@
 	dh_prep -p$@
 	dh_prep -p$@

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

@@ -280,7 +280,7 @@
      <varlistentry><term>build-dep</term>
      <varlistentry><term>build-dep</term>
      <listitem><para><literal>build-dep</literal> causes apt-get to install/remove packages in an 
      <listitem><para><literal>build-dep</literal> causes apt-get to install/remove packages in an 
      attempt to satisfy the build dependencies for a source package. By default the dependencies are
      attempt to satisfy the build dependencies for a source package. By default the dependencies are
-     satisfied to build the package nativly. If desired a host-architecture can be specified
+     satisfied to build the package natively. If desired a host-architecture can be specified
      with the <option>--host-architecture</option> option instead.</para></listitem>
      with the <option>--host-architecture</option> option instead.</para></listitem>
      </varlistentry>
      </varlistentry>
 
 
@@ -453,8 +453,8 @@
                    <term><option>--host-architecture</option></term>
                    <term><option>--host-architecture</option></term>
      <listitem><para>This option controls the architecture packages are built for
      <listitem><para>This option controls the architecture packages are built for
      by <command>apt-get source --compile</command> and how cross-builddependencies
      by <command>apt-get source --compile</command> and how cross-builddependencies
-     are satisfied. By default is not set which means that the host architecture
-     is the same as the build architecture (which is defined by <literal>APT::Architecture</literal>)
+     are satisfied. By default is it not set which means that the host architecture
+     is the same as the build architecture (which is defined by <literal>APT::Architecture</literal>).
      Configuration Item: <literal>APT::Get::Host-Architecture</literal>
      Configuration Item: <literal>APT::Get::Host-Architecture</literal>
      </para></listitem>
      </para></listitem>
      </varlistentry>
      </varlistentry>

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

@@ -165,7 +165,7 @@
       <listitem><para>With this option it is possible to specify a specific keyring
       <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
       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
       on the <filename>trusted.gpg</filename> file as well as on all parts in the
-      <filename>trusted.gpg.d</filename> directory, through <filename>trusted.gpg</filename>
+      <filename>trusted.gpg.d</filename> directory, though <filename>trusted.gpg</filename>
       is the primary keyring which means that e.g. new keys are added to this one.
       is the primary keyring which means that e.g. new keys are added to this one.
       </para></listitem>
       </para></listitem>
       </varlistentry>
       </varlistentry>

+ 1 - 1
doc/apt.conf.5.xml

@@ -281,7 +281,7 @@ DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt";};
 	 valid after it was created (indicated by the <literal>Date</literal> header).
 	 valid after it was created (indicated by the <literal>Date</literal> header).
 	 Use this if you need to use a seldomly updated (local) mirror of a more
 	 Use this if you need to use a seldomly updated (local) mirror of a more
 	 regular updated archive with a <literal>Valid-Until</literal> header
 	 regular updated archive with a <literal>Valid-Until</literal> header
-	 instead of competely disabling the expiration date checking.
+	 instead of completely disabling the expiration date checking.
 	 Archive specific settings can and should be used by appending the label of
 	 Archive specific settings can and should be used by appending the label of
 	 the archive to the option name.
 	 the archive to the option name.
 	 </para></listitem>
 	 </para></listitem>

+ 2 - 0
doc/manpage-style.xsl

@@ -6,4 +6,6 @@
 
 
 <xsl:param name="man.output.encoding" select="'UTF-8'" />
 <xsl:param name="man.output.encoding" select="'UTF-8'" />
 
 
+<xsl:template match="email">&lt;<xsl:apply-templates/>&gt;</xsl:template>
+
 </xsl:stylesheet>
 </xsl:stylesheet>

Plik diff jest za duży
+ 255 - 360
doc/po/de.po


+ 127 - 1
doc/po/es.po

@@ -1466,6 +1466,13 @@ msgstr "<option>--no-enhances</option>"
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt-cache.8.xml:317
 #: apt-cache.8.xml:317
+#, fuzzy
+#| msgid ""
+#| "Per default the <literal>depends</literal> and <literal>rdepends</"
+#| "literal> print all dependencies. This can be twicked with these flags "
+#| "which will omit the specified dependency type.  Configuration Item: "
+#| "<literal>APT::Cache::Show<replaceable>DependencyType</replaceable></"
+#| "literal> e.g. <literal>APT::Cache::ShowRecommends</literal>."
 msgid ""
 msgid ""
 "Per default the <literal>depends</literal> and <literal>rdepends</literal> "
 "Per default the <literal>depends</literal> and <literal>rdepends</literal> "
 "print all dependencies. This can be twicked with these flags which will omit "
 "print all dependencies. This can be twicked with these flags which will omit "
@@ -3448,6 +3455,35 @@ msgstr ""
 
 
 #. type: Content of: <refentry><refsynopsisdiv><cmdsynopsis>
 #. type: Content of: <refentry><refsynopsisdiv><cmdsynopsis>
 #: apt-get.8.xml:39
 #: apt-get.8.xml:39
+#, fuzzy
+#| msgid ""
+#| "<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> <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>"
 msgid ""
 msgid ""
 "<command>apt-get</command> <arg><option>-sqdyfmubV</option></arg> <arg> "
 "<command>apt-get</command> <arg><option>-sqdyfmubV</option></arg> <arg> "
 "<option>-o= <replaceable>config_string</replaceable> </option> </arg> <arg> "
 "<option>-o= <replaceable>config_string</replaceable> </option> </arg> <arg> "
@@ -3815,6 +3851,12 @@ msgstr ""
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt-get.8.xml:255
 #: apt-get.8.xml:255
+#, fuzzy
+#| msgid ""
+#| "If the <option>--compile</option> option is specified then the package "
+#| "will be compiled to a binary .deb using <command>dpkg-buildpackage</"
+#| "command>, if <option>--download-only</option> is specified then the "
+#| "source package will not be unpacked."
 msgid ""
 msgid ""
 "If the <option>--compile</option> option is specified then the package will "
 "If the <option>--compile</option> option is specified then the package will "
 "be compiled to a binary .deb using <command>dpkg-buildpackage</command>, if "
 "be compiled to a binary .deb using <command>dpkg-buildpackage</command>, if "
@@ -3859,6 +3901,10 @@ msgstr "build-dep"
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt-get.8.xml:272
 #: apt-get.8.xml:272
+#, fuzzy
+#| msgid ""
+#| "<literal>build-dep</literal> causes apt-get to install/remove packages in "
+#| "an attempt to satisfy the build dependencies for a source package."
 msgid ""
 msgid ""
 "<literal>build-dep</literal> causes apt-get to install/remove packages in an "
 "<literal>build-dep</literal> causes apt-get to install/remove packages in an "
 "attempt to satisfy the build dependencies for a source package."
 "attempt to satisfy the build dependencies for a source package."
@@ -3943,6 +3989,11 @@ msgstr "autoremove"
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt-get.8.xml:308
 #: apt-get.8.xml:308
+#, fuzzy
+#| msgid ""
+#| "<literal>autoremove</literal> is used to remove packages that were "
+#| "automatically installed to satisfy dependencies for some package and that "
+#| "are no more needed."
 msgid ""
 msgid ""
 "<literal>autoremove</literal> is used to remove packages that were "
 "<literal>autoremove</literal> is used to remove packages that were "
 "automatically installed to satisfy dependencies for some package and that "
 "automatically installed to satisfy dependencies for some package and that "
@@ -4803,6 +4854,14 @@ msgstr "--keyring <replaceable>nombre-de-fichero</replaceable>"
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt-key.8.xml:162
 #: apt-key.8.xml:162
+#, fuzzy
+#| msgid ""
+#| "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 "
+#| "<filename>trusted.gpg.d</filename> directory, though <filename>trusted."
+#| "gpg</filename> is the primary keyring which means that e.g. new keys are "
+#| "added to this one."
 msgid ""
 msgid ""
 "With this option it is possible to specify a specific keyring file the "
 "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 "
 "command should operate on. The default is that a command is executed on the "
@@ -6118,6 +6177,17 @@ msgstr "Max-ValidTime"
 
 
 #. type: Content of: <refentry><refsect1><para><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><para><variablelist><varlistentry><listitem><para>
 #: apt.conf.5.xml:261
 #: apt.conf.5.xml:261
+#, fuzzy
+#| msgid ""
+#| "Seconds the Release file should be considered valid after it was created. "
+#| "The default is \"for ever\" (0) if the Release file of the archive "
+#| "doesn't include a <literal>Valid-Until</literal> header.  If it does then "
+#| "this date is the default. The date from the Release file or the date "
+#| "specified by the creation time of the Release file (<literal>Date</"
+#| "literal> header) plus the seconds specified with this options are used to "
+#| "check if the validation of a file has expired by using the earlier date "
+#| "of the two. Archive specific settings can be made by appending the label "
+#| "of the archive to the option name."
 msgid ""
 msgid ""
 "Seconds the Release file should be considered valid after it was created. "
 "Seconds the Release file should be considered valid after it was created. "
 "The default is \"for ever\" (0) if the Release file of the archive doesn't "
 "The default is \"for ever\" (0) if the Release file of the archive doesn't "
@@ -9365,7 +9435,8 @@ msgstr ""
 
 
 #. type: Content of: <refentry><refsect1><literallayout>
 #. type: Content of: <refentry><refsect1><literallayout>
 #: sources.list.5.xml:81
 #: sources.list.5.xml:81
-#, no-wrap
+#, fuzzy, no-wrap
+#| msgid "deb uri distribution [component1] [component2] [...]"
 msgid "deb uri distribution [component1] [component2] [...]"
 msgid "deb uri distribution [component1] [component2] [...]"
 msgstr "deb uri distribución [componente1] [componente2] [...]"
 msgstr "deb uri distribución [componente1] [componente2] [...]"
 
 
@@ -11255,6 +11326,61 @@ msgstr "  # apt-get -o dir::cache::archives=\"/disc/\" dist-upgrade"
 msgid "Which will use the already fetched archives on the disc."
 msgid "Which will use the already fetched archives on the disc."
 msgstr "Ésto usará los archivos del disco previamente obtenidos."
 msgstr "Ésto usará los archivos del disco previamente obtenidos."
 
 
+#, fuzzy
+#~| msgid "<option>--recurse</option>"
+#~ msgid "<option>--host-architecture</option>"
+#~ msgstr "<option>--recurse</option>"
+
+#, fuzzy
+#~| msgid "Max-ValidTime"
+#~ msgid "Min-ValidTime"
+#~ msgstr "Max-ValidTime"
+
+#, fuzzy
+#~| msgid ""
+#~| "Seconds the Release file should be considered valid after it was "
+#~| "created. The default is \"for ever\" (0) if the Release file of the "
+#~| "archive doesn't include a <literal>Valid-Until</literal> header.  If it "
+#~| "does then this date is the default. The date from the Release file or "
+#~| "the date specified by the creation time of the Release file "
+#~| "(<literal>Date</literal> header) plus the seconds specified with this "
+#~| "options are used to check if the validation of a file has expired by "
+#~| "using the earlier date of the two. Archive specific settings can be made "
+#~| "by appending the label of the archive to the option name."
+#~ msgid ""
+#~ "Minimum of seconds the Release file should be considered valid after it "
+#~ "was created (indicated by the <literal>Date</literal> header).  Use this "
+#~ "if you need to use a seldomly updated (local) mirror of a more regular "
+#~ "updated archive with a <literal>Valid-Until</literal> header instead of "
+#~ "completely disabling the expiration date checking.  Archive specific "
+#~ "settings can and should be used by appending the label of the archive to "
+#~ "the option name."
+#~ msgstr ""
+#~ "Los segundos que el fichero «Release» se considerará válido después de su "
+#~ "creación. El valor predeterminado es «para siempre» (cero) si el fichero "
+#~ "«Release» del archivo no incluye una cabecera <literal>Valid-Until</"
+#~ "literal>. Si lo incluye, el valor predeterminado es esta fecha. La fecha "
+#~ "del fichero «Release» o la fecha definida por la hora de creación del "
+#~ "fichero «Release» (cabecera <literal>Date</literal>), a lo que se añaden "
+#~ "los segundos definidos con estas opciones, se usan para comprobar si la "
+#~ "validez de un fichero a expirado, usando la fecha más antigua de las dos "
+#~ "anteriormente mencionadas. Se pueden definir opciones de configuración "
+#~ "específicas al archivo añadiendo la etiqueta del archivo al nombre de la "
+#~ "opción."
+
+#, fuzzy
+#~| msgid ""
+#~| "deb http://ftp.debian.org/debian &stable-codename; main contrib non-free\n"
+#~| "deb http://security.debian.org/ &stable-codename;/updates main contrib non-free\n"
+#~| "   "
+#~ msgid ""
+#~ "deb http://ftp.debian.org/debian &stable-codename; main\n"
+#~ "deb [ arch=amd64,armel ] http://ftp.debian.org/debian &stable-codename; main"
+#~ msgstr ""
+#~ "deb http://ftp.debian.org/debian &stable-codename; main contrib non-free\n"
+#~ "deb http://security.debian.org/ &stable-codename;/updates main contrib non-free\n"
+#~ "   "
+
 #~ msgid "<option>--md5</option>"
 #~ msgid "<option>--md5</option>"
 #~ msgstr "<option>--md5</option>"
 #~ msgstr "<option>--md5</option>"
 
 

+ 167 - 1
doc/po/fr.po

@@ -1391,6 +1391,13 @@ msgstr "<option>--no-enhances</option>"
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt-cache.8.xml:317
 #: apt-cache.8.xml:317
+#, fuzzy
+#| msgid ""
+#| "Per default the <literal>depends</literal> and <literal>rdepends</"
+#| "literal> print all dependencies. This can be twicked with these flags "
+#| "which will omit the specified dependency type.  Configuration Item: "
+#| "<literal>APT::Cache::Show<replaceable>DependencyType</replaceable></"
+#| "literal> e.g. <literal>APT::Cache::ShowRecommends</literal>."
 msgid ""
 msgid ""
 "Per default the <literal>depends</literal> and <literal>rdepends</literal> "
 "Per default the <literal>depends</literal> and <literal>rdepends</literal> "
 "print all dependencies. This can be twicked with these flags which will omit "
 "print all dependencies. This can be twicked with these flags which will omit "
@@ -3377,6 +3384,35 @@ msgstr ""
 
 
 #. type: Content of: <refentry><refsynopsisdiv><cmdsynopsis>
 #. type: Content of: <refentry><refsynopsisdiv><cmdsynopsis>
 #: apt-get.8.xml:39
 #: apt-get.8.xml:39
+#, fuzzy
+#| msgid ""
+#| "<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> <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>"
 msgid ""
 msgid ""
 "<command>apt-get</command> <arg><option>-sqdyfmubV</option></arg> <arg> "
 "<command>apt-get</command> <arg><option>-sqdyfmubV</option></arg> <arg> "
 "<option>-o= <replaceable>config_string</replaceable> </option> </arg> <arg> "
 "<option>-o= <replaceable>config_string</replaceable> </option> </arg> <arg> "
@@ -3748,6 +3784,12 @@ msgstr ""
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt-get.8.xml:255
 #: apt-get.8.xml:255
+#, fuzzy
+#| msgid ""
+#| "If the <option>--compile</option> option is specified then the package "
+#| "will be compiled to a binary .deb using <command>dpkg-buildpackage</"
+#| "command>, if <option>--download-only</option> is specified then the "
+#| "source package will not be unpacked."
 msgid ""
 msgid ""
 "If the <option>--compile</option> option is specified then the package will "
 "If the <option>--compile</option> option is specified then the package will "
 "be compiled to a binary .deb using <command>dpkg-buildpackage</command>, if "
 "be compiled to a binary .deb using <command>dpkg-buildpackage</command>, if "
@@ -3791,6 +3833,10 @@ msgstr "build-dep"
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt-get.8.xml:272
 #: apt-get.8.xml:272
+#, fuzzy
+#| msgid ""
+#| "<literal>build-dep</literal> causes apt-get to install/remove packages in "
+#| "an attempt to satisfy the build dependencies for a source package."
 msgid ""
 msgid ""
 "<literal>build-dep</literal> causes apt-get to install/remove packages in an "
 "<literal>build-dep</literal> causes apt-get to install/remove packages in an "
 "attempt to satisfy the build dependencies for a source package."
 "attempt to satisfy the build dependencies for a source package."
@@ -3820,6 +3866,10 @@ msgstr "download"
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt-get.8.xml:282
 #: apt-get.8.xml:282
+#, fuzzy
+#| msgid ""
+#| "<literal>download</literal> will download the given binary package into "
+#| "the current directory."
 msgid ""
 msgid ""
 "<literal>download</literal> will download the given binary package into the "
 "<literal>download</literal> will download the given binary package into the "
 "current directoy."
 "current directoy."
@@ -3877,6 +3927,11 @@ msgstr "autoremove"
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt-get.8.xml:308
 #: apt-get.8.xml:308
+#, fuzzy
+#| msgid ""
+#| "<literal>autoremove</literal> is used to remove packages that were "
+#| "automatically installed to satisfy dependencies for some package and that "
+#| "are no more needed."
 msgid ""
 msgid ""
 "<literal>autoremove</literal> is used to remove packages that were "
 "<literal>autoremove</literal> is used to remove packages that were "
 "automatically installed to satisfy dependencies for some package and that "
 "automatically installed to satisfy dependencies for some package and that "
@@ -4741,6 +4796,14 @@ msgstr "--keyring <replaceable>fichier</replaceable>"
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt-key.8.xml:162
 #: apt-key.8.xml:162
+#, fuzzy
+#| msgid ""
+#| "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 "
+#| "<filename>trusted.gpg.d</filename> directory, though <filename>trusted."
+#| "gpg</filename> is the primary keyring which means that e.g. new keys are "
+#| "added to this one."
 msgid ""
 msgid ""
 "With this option it is possible to specify a specific keyring file the "
 "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 "
 "command should operate on. The default is that a command is executed on the "
@@ -5497,6 +5560,15 @@ msgstr ""
 
 
 #. type: Content of: <refentry><refsect1><orderedlist><listitem><para>
 #. type: Content of: <refentry><refsect1><orderedlist><listitem><para>
 #: apt.conf.5.xml:52
 #: apt.conf.5.xml:52
+#, fuzzy
+#| msgid ""
+#| "all files in <literal>Dir::Etc::Parts</literal> in alphanumeric ascending "
+#| "order which have no or \"<literal>conf</literal>\" as filename extension "
+#| "and which only contain alphanumeric, hyphen (-), underscore (_) and "
+#| "period (.) characters.  Otherwise APT will print a notice that it has "
+#| "ignored a file if the file doesn't match a pattern in the <literal>Dir::"
+#| "Ignore-Files-Silently</literal> configuration list - in this case it will "
+#| "be silently ignored."
 msgid ""
 msgid ""
 "all files in <literal>Dir::Etc::Parts</literal> in alphanumeric ascending "
 "all files in <literal>Dir::Etc::Parts</literal> in alphanumeric ascending "
 "order which have no or \"<literal>conf</literal>\" as filename extension and "
 "order which have no or \"<literal>conf</literal>\" as filename extension and "
@@ -6052,6 +6124,17 @@ msgstr "Max-ValidTime"
 
 
 #. type: Content of: <refentry><refsect1><para><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><para><variablelist><varlistentry><listitem><para>
 #: apt.conf.5.xml:261
 #: apt.conf.5.xml:261
+#, fuzzy
+#| msgid ""
+#| "Seconds the Release file should be considered valid after it was created. "
+#| "The default is \"for ever\" (0) if the Release file of the archive "
+#| "doesn't include a <literal>Valid-Until</literal> header.  If it does then "
+#| "this date is the default. The date from the Release file or the date "
+#| "specified by the creation time of the Release file (<literal>Date</"
+#| "literal> header) plus the seconds specified with this options are used to "
+#| "check if the validation of a file has expired by using the earlier date "
+#| "of the two. Archive specific settings can be made by appending the label "
+#| "of the archive to the option name."
 msgid ""
 msgid ""
 "Seconds the Release file should be considered valid after it was created. "
 "Seconds the Release file should be considered valid after it was created. "
 "The default is \"for ever\" (0) if the Release file of the archive doesn't "
 "The default is \"for ever\" (0) if the Release file of the archive doesn't "
@@ -6547,6 +6630,18 @@ msgstr "Dir::Bin::bzip2 \"/bin/bzip2\";"
 
 
 #. type: Content of: <refentry><refsect1><para><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><para><variablelist><varlistentry><listitem><para>
 #: apt.conf.5.xml:442
 #: apt.conf.5.xml:442
+#, fuzzy
+#| msgid ""
+#| "Note that at run time the <literal>Dir::Bin::<replaceable>Methodname</"
+#| "replaceable></literal> will be checked: If this setting exists the method "
+#| "will only be used if this file exists, e.g. for the bzip2 method (the "
+#| "inbuilt) setting is <placeholder type=\"literallayout\" id=\"0\"/> Note "
+#| "also that list entries specified on the command line will be added at the "
+#| "end of the list specified in the configuration files, but before the "
+#| "default entries. To prefer a type in this case over the ones specified in "
+#| "the configuration files you can set the option direct - not in list "
+#| "style.  This will not override the defined list, it will only prefix the "
+#| "list with this type."
 msgid ""
 msgid ""
 "Note that at run time the <literal>Dir::Bin::<replaceable>Methodname</"
 "Note that at run time the <literal>Dir::Bin::<replaceable>Methodname</"
 "replaceable></literal> will be checked: If this setting exists the method "
 "replaceable></literal> will be checked: If this setting exists the method "
@@ -6573,6 +6668,12 @@ msgstr ""
 
 
 #. type: Content of: <refentry><refsect1><para><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><para><variablelist><varlistentry><listitem><para>
 #: apt.conf.5.xml:449
 #: apt.conf.5.xml:449
+#, fuzzy
+#| msgid ""
+#| "The special type <literal>uncompressed</literal> can be used to give "
+#| "uncompressed files a preference, but note that most archives don't "
+#| "provide uncompressed files so this is mostly only useable for local "
+#| "mirrors."
 msgid ""
 msgid ""
 "The special type <literal>uncompressed</literal> can be used to give "
 "The special type <literal>uncompressed</literal> can be used to give "
 "uncompressed files a preference, but note that most archives doesn't provide "
 "uncompressed files a preference, but note that most archives doesn't provide "
@@ -7863,6 +7964,16 @@ msgstr ""
 
 
 #. type: Content of: <refentry><refsect1><para>
 #. type: Content of: <refentry><refsect1><para>
 #: apt_preferences.5.xml:70
 #: apt_preferences.5.xml:70
+#, fuzzy
+#| msgid ""
+#| "Note that the files in the <filename>/etc/apt/preferences.d</filename> "
+#| "directory are parsed in alphanumeric ascending order and need to obey the "
+#| "following naming convention: The files have no or \"<literal>pref</"
+#| "literal>\" as filename extension and which only contain alphanumeric, "
+#| "hyphen (-), underscore (_) and period (.) characters.  Otherwise APT will "
+#| "print a notice that it has ignored a file if the file doesn't match a "
+#| "pattern in the <literal>Dir::Ignore-Files-Silently</literal> "
+#| "configuration list - in this case it will be silently ignored."
 msgid ""
 msgid ""
 "Note that the files in the <filename>/etc/apt/preferences.d</filename> "
 "Note that the files in the <filename>/etc/apt/preferences.d</filename> "
 "directory are parsed in alphanumeric ascending order and need to obey the "
 "directory are parsed in alphanumeric ascending order and need to obey the "
@@ -9267,7 +9378,8 @@ msgstr ""
 
 
 #. type: Content of: <refentry><refsect1><literallayout>
 #. type: Content of: <refentry><refsect1><literallayout>
 #: sources.list.5.xml:81
 #: sources.list.5.xml:81
-#, no-wrap
+#, fuzzy, no-wrap
+#| msgid "deb uri distribution [component1] [component2] [...]"
 msgid "deb uri distribution [component1] [component2] [...]"
 msgid "deb uri distribution [component1] [component2] [...]"
 msgstr "deb uri distribution [composant1] [composant2] [...]"
 msgstr "deb uri distribution [composant1] [composant2] [...]"
 
 
@@ -11193,6 +11305,60 @@ msgstr "  # apt-get -o dir::cache::archives=\"/disc/\" dist-upgrade"
 msgid "Which will use the already fetched archives on the disc."
 msgid "Which will use the already fetched archives on the disc."
 msgstr "Cette commande utilisera les fichiers récupérés sur le disque."
 msgstr "Cette commande utilisera les fichiers récupérés sur le disque."
 
 
+#, fuzzy
+#~| msgid "<option>--recurse</option>"
+#~ msgid "<option>--host-architecture</option>"
+#~ msgstr "<option>--recurse</option>"
+
+#, fuzzy
+#~| msgid "Max-ValidTime"
+#~ msgid "Min-ValidTime"
+#~ msgstr "Max-ValidTime"
+
+#, fuzzy
+#~| msgid ""
+#~| "Seconds the Release file should be considered valid after it was "
+#~| "created. The default is \"for ever\" (0) if the Release file of the "
+#~| "archive doesn't include a <literal>Valid-Until</literal> header.  If it "
+#~| "does then this date is the default. The date from the Release file or "
+#~| "the date specified by the creation time of the Release file "
+#~| "(<literal>Date</literal> header) plus the seconds specified with this "
+#~| "options are used to check if the validation of a file has expired by "
+#~| "using the earlier date of the two. Archive specific settings can be made "
+#~| "by appending the label of the archive to the option name."
+#~ msgid ""
+#~ "Minimum of seconds the Release file should be considered valid after it "
+#~ "was created (indicated by the <literal>Date</literal> header).  Use this "
+#~ "if you need to use a seldomly updated (local) mirror of a more regular "
+#~ "updated archive with a <literal>Valid-Until</literal> header instead of "
+#~ "completely disabling the expiration date checking.  Archive specific "
+#~ "settings can and should be used by appending the label of the archive to "
+#~ "the option name."
+#~ msgstr ""
+#~ "Durée (en secondes) pendant laquelle un fichier Release est considéré "
+#~ "comme valable, à partir du moment de sa création. La valeur par défaut "
+#~ "est 0 (fichier valable indéfiniment) si le fichier Release de l'archive "
+#~ "ne comporte pas d'en-tête <literal>Valid-Until</literal>. Dans le cas "
+#~ "contraire, c'est la valeur de cet en-tête qui est la valeur par défaut du "
+#~ "paramètre. La date du fichier Release ou la date indiquée dans l'en-tête "
+#~ "<literal>Date</literal>, augmentées du nombre de secondes indiquées sont "
+#~ "comparées à la date courante pour déterminer si un fichier Release donné "
+#~ "est obsolète ou pas. Un réglage spécifique pour une archive donnée peut "
+#~ "être défini en ajoutant l'étiquette de l'archive au nom de l'option."
+
+#, fuzzy
+#~| msgid ""
+#~| "deb http://ftp.debian.org/debian &stable-codename; main contrib non-free\n"
+#~| "deb http://security.debian.org/ &stable-codename;/updates main contrib non-free\n"
+#~| "   "
+#~ msgid ""
+#~ "deb http://ftp.debian.org/debian &stable-codename; main\n"
+#~ "deb [ arch=amd64,armel ] http://ftp.debian.org/debian &stable-codename; main"
+#~ msgstr ""
+#~ "deb http://ftp.debian.org/debian &stable-codename; main contrib non-free\n"
+#~ "deb http://security.debian.org/ &stable-codename;/updates main contrib non-free\n"
+#~ "   "
+
 #~ msgid "<option>--md5</option>"
 #~ msgid "<option>--md5</option>"
 #~ msgstr "<option>--md5</option>"
 #~ msgstr "<option>--md5</option>"
 
 

+ 77 - 1
doc/po/ja.po

@@ -3540,6 +3540,35 @@ msgstr "APT パッケージ操作ユーティリティ -- コマンドライン
 
 
 #. type: Content of: <refentry><refsynopsisdiv><cmdsynopsis>
 #. type: Content of: <refentry><refsynopsisdiv><cmdsynopsis>
 #: apt-get.8.xml:39
 #: apt-get.8.xml:39
+#, fuzzy
+#| msgid ""
+#| "<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> <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>"
 msgid ""
 msgid ""
 "<command>apt-get</command> <arg><option>-sqdyfmubV</option></arg> <arg> "
 "<command>apt-get</command> <arg><option>-sqdyfmubV</option></arg> <arg> "
 "<option>-o= <replaceable>config_string</replaceable> </option> </arg> <arg> "
 "<option>-o= <replaceable>config_string</replaceable> </option> </arg> <arg> "
@@ -3908,6 +3937,12 @@ msgstr ""
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt-get.8.xml:255
 #: apt-get.8.xml:255
+#, fuzzy
+#| msgid ""
+#| "If the <option>--compile</option> option is specified then the package "
+#| "will be compiled to a binary .deb using <command>dpkg-buildpackage</"
+#| "command>, if <option>--download-only</option> is specified then the "
+#| "source package will not be unpacked."
 msgid ""
 msgid ""
 "If the <option>--compile</option> option is specified then the package will "
 "If the <option>--compile</option> option is specified then the package will "
 "be compiled to a binary .deb using <command>dpkg-buildpackage</command>, if "
 "be compiled to a binary .deb using <command>dpkg-buildpackage</command>, if "
@@ -3953,6 +3988,10 @@ msgstr "build-dep"
 # type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 # type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt-get.8.xml:272
 #: apt-get.8.xml:272
+#, fuzzy
+#| msgid ""
+#| "<literal>build-dep</literal> causes apt-get to install/remove packages in "
+#| "an attempt to satisfy the build dependencies for a source package."
 msgid ""
 msgid ""
 "<literal>build-dep</literal> causes apt-get to install/remove packages in an "
 "<literal>build-dep</literal> causes apt-get to install/remove packages in an "
 "attempt to satisfy the build dependencies for a source package."
 "attempt to satisfy the build dependencies for a source package."
@@ -4039,6 +4078,11 @@ msgstr "autoremove"
 # type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 # type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt-get.8.xml:308
 #: apt-get.8.xml:308
+#, fuzzy
+#| msgid ""
+#| "<literal>autoremove</literal> is used to remove packages that were "
+#| "automatically installed to satisfy dependencies for some package and that "
+#| "are no more needed."
 msgid ""
 msgid ""
 "<literal>autoremove</literal> is used to remove packages that were "
 "<literal>autoremove</literal> is used to remove packages that were "
 "automatically installed to satisfy dependencies for some package and that "
 "automatically installed to satisfy dependencies for some package and that "
@@ -4917,6 +4961,14 @@ msgstr "--keyring <replaceable>filename</replaceable>"
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt-key.8.xml:162
 #: apt-key.8.xml:162
+#, fuzzy
+#| msgid ""
+#| "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 "
+#| "<filename>trusted.gpg.d</filename> directory, though <filename>trusted."
+#| "gpg</filename> is the primary keyring which means that e.g. new keys are "
+#| "added to this one."
 msgid ""
 msgid ""
 "With this option it is possible to specify a specific keyring file the "
 "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 "
 "command should operate on. The default is that a command is executed on the "
@@ -9368,7 +9420,8 @@ msgstr ""
 
 
 #. type: Content of: <refentry><refsect1><literallayout>
 #. type: Content of: <refentry><refsect1><literallayout>
 #: sources.list.5.xml:81
 #: sources.list.5.xml:81
-#, no-wrap
+#, fuzzy, no-wrap
+#| msgid "deb uri distribution [component1] [component2] [...]"
 msgid "deb uri distribution [component1] [component2] [...]"
 msgid "deb uri distribution [component1] [component2] [...]"
 msgstr "deb uri distribution [component1] [component2] [...]"
 msgstr "deb uri distribution [component1] [component2] [...]"
 
 
@@ -10932,6 +10985,29 @@ msgstr "  # apt-get -o dir::cache::archives=\"/disc/\" dist-upgrade"
 msgid "Which will use the already fetched archives on the disc."
 msgid "Which will use the already fetched archives on the disc."
 msgstr "これで、disc にある取得済みのアーカイブを使用するようになります。"
 msgstr "これで、disc にある取得済みのアーカイブを使用するようになります。"
 
 
+#, fuzzy
+#~| msgid "<option>--recurse</option>"
+#~ msgid "<option>--host-architecture</option>"
+#~ msgstr "<option>--recurse</option>"
+
+#, fuzzy
+#~| msgid "Max-ValidTime"
+#~ msgid "Min-ValidTime"
+#~ msgstr "Max-ValidTime"
+
+#, fuzzy
+#~| msgid ""
+#~| "deb http://ftp.debian.org/debian &stable-codename; main contrib non-free\n"
+#~| "deb http://security.debian.org/ &stable-codename;/updates main contrib non-free\n"
+#~| "   "
+#~ msgid ""
+#~ "deb http://ftp.debian.org/debian &stable-codename; main\n"
+#~ "deb [ arch=amd64,armel ] http://ftp.debian.org/debian &stable-codename; main"
+#~ msgstr ""
+#~ "deb http://ftp.debian.org/debian &stable-codename; main contrib non-free\n"
+#~ "deb http://security.debian.org/ &stable-codename;/updates main contrib non-free\n"
+#~ "   "
+
 #~ msgid "<option>--md5</option>"
 #~ msgid "<option>--md5</option>"
 #~ msgstr "<option>--md5</option>"
 #~ msgstr "<option>--md5</option>"
 
 

+ 71 - 1
doc/po/pl.po

@@ -3754,6 +3754,12 @@ msgstr ""
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt-get.8.xml:255
 #: apt-get.8.xml:255
+#, fuzzy
+#| msgid ""
+#| "If the <option>--compile</option> option is specified then the package "
+#| "will be compiled to a binary .deb using <command>dpkg-buildpackage</"
+#| "command>, if <option>--download-only</option> is specified then the "
+#| "source package will not be unpacked."
 msgid ""
 msgid ""
 "If the <option>--compile</option> option is specified then the package will "
 "If the <option>--compile</option> option is specified then the package will "
 "be compiled to a binary .deb using <command>dpkg-buildpackage</command>, if "
 "be compiled to a binary .deb using <command>dpkg-buildpackage</command>, if "
@@ -3801,6 +3807,10 @@ msgstr "build-dep"
 #
 #
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt-get.8.xml:272
 #: apt-get.8.xml:272
+#, fuzzy
+#| msgid ""
+#| "<literal>build-dep</literal> causes apt-get to install/remove packages in "
+#| "an attempt to satisfy the build dependencies for a source package."
 msgid ""
 msgid ""
 "<literal>build-dep</literal> causes apt-get to install/remove packages in an "
 "<literal>build-dep</literal> causes apt-get to install/remove packages in an "
 "attempt to satisfy the build dependencies for a source package."
 "attempt to satisfy the build dependencies for a source package."
@@ -3889,6 +3899,11 @@ msgstr "autoremove"
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt-get.8.xml:308
 #: apt-get.8.xml:308
+#, fuzzy
+#| msgid ""
+#| "<literal>autoremove</literal> is used to remove packages that were "
+#| "automatically installed to satisfy dependencies for some package and that "
+#| "are no more needed."
 msgid ""
 msgid ""
 "<literal>autoremove</literal> is used to remove packages that were "
 "<literal>autoremove</literal> is used to remove packages that were "
 "automatically installed to satisfy dependencies for some package and that "
 "automatically installed to satisfy dependencies for some package and that "
@@ -4785,6 +4800,14 @@ msgstr "--keyring <replaceable>nazwa_pliku</replaceable>"
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt-key.8.xml:162
 #: apt-key.8.xml:162
+#, fuzzy
+#| msgid ""
+#| "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 "
+#| "<filename>trusted.gpg.d</filename> directory, though <filename>trusted."
+#| "gpg</filename> is the primary keyring which means that e.g. new keys are "
+#| "added to this one."
 msgid ""
 msgid ""
 "With this option it is possible to specify a specific keyring file the "
 "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 "
 "command should operate on. The default is that a command is executed on the "
@@ -5456,6 +5479,14 @@ msgstr ""
 
 
 #. type: Content of: <refentry><refsect1><orderedlist><listitem><para>
 #. type: Content of: <refentry><refsect1><orderedlist><listitem><para>
 #: apt.conf.5.xml:52
 #: apt.conf.5.xml:52
+#, fuzzy
+#| msgid ""
+#| "The <filename>/etc/apt/sources.list.d</filename> directory provides a way "
+#| "to add sources.list entries in separate files.  The format is the same as "
+#| "for the regular <filename>sources.list</filename> file.  File names need "
+#| "to end with <filename>.list</filename> and may only contain letters (a-z "
+#| "and A-Z), digits (0-9), underscore (_), hyphen (-) and period (.) "
+#| "characters.  Otherwise they will be silently ignored."
 msgid ""
 msgid ""
 "all files in <literal>Dir::Etc::Parts</literal> in alphanumeric ascending "
 "all files in <literal>Dir::Etc::Parts</literal> in alphanumeric ascending "
 "order which have no or \"<literal>conf</literal>\" as filename extension and "
 "order which have no or \"<literal>conf</literal>\" as filename extension and "
@@ -5464,6 +5495,12 @@ msgid ""
 "the file doesn't match a pattern in the <literal>Dir::Ignore-Files-Silently</"
 "the file doesn't match a pattern in the <literal>Dir::Ignore-Files-Silently</"
 "literal> configuration list - in this case it will be silently ignored."
 "literal> configuration list - in this case it will be silently ignored."
 msgstr ""
 msgstr ""
+"Katalog <filename>/etc/apt/sources.list.d</filename>  umożliwia podzielenie "
+"pliku źródeł na osobne pliki. Format jest dokładnie taki sam, jak w "
+"przypadku zwykłego pliku <filename>sources.list</filename>. Nazwy plików w "
+"tym katalogu muszą się kończyć rozszerzeniem <filename>.list</filename> i "
+"mogą składać się tylko z liter (a-z i A-Z), cyfr (0-9), znaku podkreślenia "
+"(_), pauzy (-) i kropki (.). Inne pliki zostaną zignorowane."
 
 
 #. type: Content of: <refentry><refsect1><orderedlist><listitem><para>
 #. type: Content of: <refentry><refsect1><orderedlist><listitem><para>
 #: apt.conf.5.xml:59
 #: apt.conf.5.xml:59
@@ -7137,6 +7174,14 @@ msgstr ""
 
 
 #. type: Content of: <refentry><refsect1><para>
 #. type: Content of: <refentry><refsect1><para>
 #: apt_preferences.5.xml:70
 #: apt_preferences.5.xml:70
+#, fuzzy
+#| msgid ""
+#| "The <filename>/etc/apt/sources.list.d</filename> directory provides a way "
+#| "to add sources.list entries in separate files.  The format is the same as "
+#| "for the regular <filename>sources.list</filename> file.  File names need "
+#| "to end with <filename>.list</filename> and may only contain letters (a-z "
+#| "and A-Z), digits (0-9), underscore (_), hyphen (-) and period (.) "
+#| "characters.  Otherwise they will be silently ignored."
 msgid ""
 msgid ""
 "Note that the files in the <filename>/etc/apt/preferences.d</filename> "
 "Note that the files in the <filename>/etc/apt/preferences.d</filename> "
 "directory are parsed in alphanumeric ascending order and need to obey the "
 "directory are parsed in alphanumeric ascending order and need to obey the "
@@ -7147,6 +7192,12 @@ msgid ""
 "<literal>Dir::Ignore-Files-Silently</literal> configuration list - in this "
 "<literal>Dir::Ignore-Files-Silently</literal> configuration list - in this "
 "case it will be silently ignored."
 "case it will be silently ignored."
 msgstr ""
 msgstr ""
+"Katalog <filename>/etc/apt/sources.list.d</filename>  umożliwia podzielenie "
+"pliku źródeł na osobne pliki. Format jest dokładnie taki sam, jak w "
+"przypadku zwykłego pliku <filename>sources.list</filename>. Nazwy plików w "
+"tym katalogu muszą się kończyć rozszerzeniem <filename>.list</filename> i "
+"mogą składać się tylko z liter (a-z i A-Z), cyfr (0-9), znaku podkreślenia "
+"(_), pauzy (-) i kropki (.). Inne pliki zostaną zignorowane."
 
 
 #. type: Content of: <refentry><refsect1><refsect2><title>
 #. type: Content of: <refentry><refsect1><refsect2><title>
 #: apt_preferences.5.xml:79
 #: apt_preferences.5.xml:79
@@ -8308,7 +8359,8 @@ msgstr ""
 
 
 #. type: Content of: <refentry><refsect1><literallayout>
 #. type: Content of: <refentry><refsect1><literallayout>
 #: sources.list.5.xml:81
 #: sources.list.5.xml:81
-#, no-wrap
+#, fuzzy, no-wrap
+#| msgid "deb uri distribution [component1] [component2] [...]"
 msgid "deb uri distribution [component1] [component2] [...]"
 msgid "deb uri distribution [component1] [component2] [...]"
 msgstr "deb URI dystrybucja [komponent1] [komponent2] [...]"
 msgstr "deb URI dystrybucja [komponent1] [komponent2] [...]"
 
 
@@ -10217,6 +10269,24 @@ msgstr "  # apt-get -o dir::cache::archives=\"/disc/\" dist-upgrade"
 msgid "Which will use the already fetched archives on the disc."
 msgid "Which will use the already fetched archives on the disc."
 msgstr "Które użyje pobranych uprzednio archiwów z dysku."
 msgstr "Które użyje pobranych uprzednio archiwów z dysku."
 
 
+#, fuzzy
+#~| msgid "<option>--recurse</option>"
+#~ msgid "<option>--host-architecture</option>"
+#~ msgstr "<option>--recurse</option>"
+
+#, fuzzy
+#~| msgid ""
+#~| "deb http://http.us.debian.org/debian stable main contrib non-free\n"
+#~| "deb http://http.us.debian.org/debian dists/stable-updates/\n"
+#~| "   "
+#~ msgid ""
+#~ "deb http://ftp.debian.org/debian &stable-codename; main\n"
+#~ "deb [ arch=amd64,armel ] http://ftp.debian.org/debian &stable-codename; main"
+#~ msgstr ""
+#~ "deb http://http.us.debian.org/debian stable main contrib non-free\n"
+#~ "deb http://http.us.debian.org/debian dists/stable-updates/\n"
+#~ "   "
+
 #~ msgid "<option>--md5</option>"
 #~ msgid "<option>--md5</option>"
 #~ msgstr "<option>--md5</option>"
 #~ msgstr "<option>--md5</option>"
 
 

+ 125 - 1
doc/po/pt.po

@@ -1418,6 +1418,13 @@ msgstr "<option>--no-enhances</option>"
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt-cache.8.xml:317
 #: apt-cache.8.xml:317
+#, fuzzy
+#| msgid ""
+#| "Per default the <literal>depends</literal> and <literal>rdepends</"
+#| "literal> print all dependencies. This can be twicked with these flags "
+#| "which will omit the specified dependency type.  Configuration Item: "
+#| "<literal>APT::Cache::Show<replaceable>DependencyType</replaceable></"
+#| "literal> e.g. <literal>APT::Cache::ShowRecommends</literal>."
 msgid ""
 msgid ""
 "Per default the <literal>depends</literal> and <literal>rdepends</literal> "
 "Per default the <literal>depends</literal> and <literal>rdepends</literal> "
 "print all dependencies. This can be twicked with these flags which will omit "
 "print all dependencies. This can be twicked with these flags which will omit "
@@ -3386,6 +3393,35 @@ msgstr ""
 
 
 #. type: Content of: <refentry><refsynopsisdiv><cmdsynopsis>
 #. type: Content of: <refentry><refsynopsisdiv><cmdsynopsis>
 #: apt-get.8.xml:39
 #: apt-get.8.xml:39
+#, fuzzy
+#| msgid ""
+#| "<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> <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>"
 msgid ""
 msgid ""
 "<command>apt-get</command> <arg><option>-sqdyfmubV</option></arg> <arg> "
 "<command>apt-get</command> <arg><option>-sqdyfmubV</option></arg> <arg> "
 "<option>-o= <replaceable>config_string</replaceable> </option> </arg> <arg> "
 "<option>-o= <replaceable>config_string</replaceable> </option> </arg> <arg> "
@@ -3750,6 +3786,12 @@ msgstr ""
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt-get.8.xml:255
 #: apt-get.8.xml:255
+#, fuzzy
+#| msgid ""
+#| "If the <option>--compile</option> option is specified then the package "
+#| "will be compiled to a binary .deb using <command>dpkg-buildpackage</"
+#| "command>, if <option>--download-only</option> is specified then the "
+#| "source package will not be unpacked."
 msgid ""
 msgid ""
 "If the <option>--compile</option> option is specified then the package will "
 "If the <option>--compile</option> option is specified then the package will "
 "be compiled to a binary .deb using <command>dpkg-buildpackage</command>, if "
 "be compiled to a binary .deb using <command>dpkg-buildpackage</command>, if "
@@ -3794,6 +3836,10 @@ msgstr "build-dep"
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt-get.8.xml:272
 #: apt-get.8.xml:272
+#, fuzzy
+#| msgid ""
+#| "<literal>build-dep</literal> causes apt-get to install/remove packages in "
+#| "an attempt to satisfy the build dependencies for a source package."
 msgid ""
 msgid ""
 "<literal>build-dep</literal> causes apt-get to install/remove packages in an "
 "<literal>build-dep</literal> causes apt-get to install/remove packages in an "
 "attempt to satisfy the build dependencies for a source package."
 "attempt to satisfy the build dependencies for a source package."
@@ -3877,6 +3923,11 @@ msgstr "autoremove"
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt-get.8.xml:308
 #: apt-get.8.xml:308
+#, fuzzy
+#| msgid ""
+#| "<literal>autoremove</literal> is used to remove packages that were "
+#| "automatically installed to satisfy dependencies for some package and that "
+#| "are no more needed."
 msgid ""
 msgid ""
 "<literal>autoremove</literal> is used to remove packages that were "
 "<literal>autoremove</literal> is used to remove packages that were "
 "automatically installed to satisfy dependencies for some package and that "
 "automatically installed to satisfy dependencies for some package and that "
@@ -4726,6 +4777,14 @@ msgstr "--keyring <replaceable>nome-de-ficheiro</replaceable>"
 
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt-key.8.xml:162
 #: apt-key.8.xml:162
+#, fuzzy
+#| msgid ""
+#| "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 "
+#| "<filename>trusted.gpg.d</filename> directory, though <filename>trusted."
+#| "gpg</filename> is the primary keyring which means that e.g. new keys are "
+#| "added to this one."
 msgid ""
 msgid ""
 "With this option it is possible to specify a specific keyring file the "
 "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 "
 "command should operate on. The default is that a command is executed on the "
@@ -6039,6 +6098,17 @@ msgstr "Max-ValidTime"
 
 
 #. type: Content of: <refentry><refsect1><para><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><para><variablelist><varlistentry><listitem><para>
 #: apt.conf.5.xml:261
 #: apt.conf.5.xml:261
+#, fuzzy
+#| msgid ""
+#| "Seconds the Release file should be considered valid after it was created. "
+#| "The default is \"for ever\" (0) if the Release file of the archive "
+#| "doesn't include a <literal>Valid-Until</literal> header.  If it does then "
+#| "this date is the default. The date from the Release file or the date "
+#| "specified by the creation time of the Release file (<literal>Date</"
+#| "literal> header) plus the seconds specified with this options are used to "
+#| "check if the validation of a file has expired by using the earlier date "
+#| "of the two. Archive specific settings can be made by appending the label "
+#| "of the archive to the option name."
 msgid ""
 msgid ""
 "Seconds the Release file should be considered valid after it was created. "
 "Seconds the Release file should be considered valid after it was created. "
 "The default is \"for ever\" (0) if the Release file of the archive doesn't "
 "The default is \"for ever\" (0) if the Release file of the archive doesn't "
@@ -9253,7 +9323,8 @@ msgstr ""
 
 
 #. type: Content of: <refentry><refsect1><literallayout>
 #. type: Content of: <refentry><refsect1><literallayout>
 #: sources.list.5.xml:81
 #: sources.list.5.xml:81
-#, no-wrap
+#, fuzzy, no-wrap
+#| msgid "deb uri distribution [component1] [component2] [...]"
 msgid "deb uri distribution [component1] [component2] [...]"
 msgid "deb uri distribution [component1] [component2] [...]"
 msgstr "deb uri distribuição [componente1] [componente2] [...]"
 msgstr "deb uri distribuição [componente1] [componente2] [...]"
 
 
@@ -11138,6 +11209,59 @@ msgstr "  # apt-get -o dir::cache::archives=\"/disc/\" dist-upgrade"
 msgid "Which will use the already fetched archives on the disc."
 msgid "Which will use the already fetched archives on the disc."
 msgstr "O qual irá usar os arquivos já obtidos e que estão no disco."
 msgstr "O qual irá usar os arquivos já obtidos e que estão no disco."
 
 
+#, fuzzy
+#~| msgid "<option>--recurse</option>"
+#~ msgid "<option>--host-architecture</option>"
+#~ msgstr "<option>--recurse</option>"
+
+#, fuzzy
+#~| msgid "Max-ValidTime"
+#~ msgid "Min-ValidTime"
+#~ msgstr "Max-ValidTime"
+
+#, fuzzy
+#~| msgid ""
+#~| "Seconds the Release file should be considered valid after it was "
+#~| "created. The default is \"for ever\" (0) if the Release file of the "
+#~| "archive doesn't include a <literal>Valid-Until</literal> header.  If it "
+#~| "does then this date is the default. The date from the Release file or "
+#~| "the date specified by the creation time of the Release file "
+#~| "(<literal>Date</literal> header) plus the seconds specified with this "
+#~| "options are used to check if the validation of a file has expired by "
+#~| "using the earlier date of the two. Archive specific settings can be made "
+#~| "by appending the label of the archive to the option name."
+#~ msgid ""
+#~ "Minimum of seconds the Release file should be considered valid after it "
+#~ "was created (indicated by the <literal>Date</literal> header).  Use this "
+#~ "if you need to use a seldomly updated (local) mirror of a more regular "
+#~ "updated archive with a <literal>Valid-Until</literal> header instead of "
+#~ "completely disabling the expiration date checking.  Archive specific "
+#~ "settings can and should be used by appending the label of the archive to "
+#~ "the option name."
+#~ msgstr ""
+#~ "Segundos em que o ficheiro Release deve considerado válido após ser "
+#~ "criado. A predefinição é \"para sempre\" (0) se o ficheiro Release do "
+#~ "arquivo não conter um cabeçalho <literal>Valid-Until</literal>. Se o "
+#~ "tiver então esta data é a predefinida. A data do ficheiro Release ou a "
+#~ "data especificada pela hora de criação do do ficheiro Release (cabeçalho "
+#~ "<literal>Date</literal>) mais os segundos especificados com esta opção "
+#~ "são usados para verificar se a validação de um ficheiro já expirou ao "
+#~ "usar uma data anterior às duas. Definições específicas do Arquivo podem "
+#~ "ser feitas ao adicionar a etiqueta do arquivo ao nome da opção. "
+
+#, fuzzy
+#~| msgid ""
+#~| "deb http://ftp.debian.org/debian &stable-codename; main contrib non-free\n"
+#~| "deb http://security.debian.org/ &stable-codename;/updates main contrib non-free\n"
+#~| "   "
+#~ msgid ""
+#~ "deb http://ftp.debian.org/debian &stable-codename; main\n"
+#~ "deb [ arch=amd64,armel ] http://ftp.debian.org/debian &stable-codename; main"
+#~ msgstr ""
+#~ "deb http://ftp.debian.org/debian &stable-codename; main contrib non-free\n"
+#~ "deb http://security.debian.org/ &stable-codename;/updates main contrib non-free\n"
+#~ "   "
+
 #~ msgid "<option>--md5</option>"
 #~ msgid "<option>--md5</option>"
 #~ msgstr "<option>--md5</option>"
 #~ msgstr "<option>--md5</option>"
 
 

+ 1 - 1
doc/sources.list.5.xml

@@ -113,7 +113,7 @@
    square brackets. It can consist of multiple settings in the form
    square brackets. It can consist of multiple settings in the form
    <literal><replaceable>setting</replaceable>=<replaceable>value</replaceable></literal>.
    <literal><replaceable>setting</replaceable>=<replaceable>value</replaceable></literal>.
    Multiple settings are separated by spaces. The following settings are supported by APT,
    Multiple settings are separated by spaces. The following settings are supported by APT,
-   note through that unsupported settings will be ignored silently:
+   note though that unsupported settings will be ignored silently:
    <itemizedlist><listitem><para><literal>arch=<replaceable>arch1</replaceable>,<replaceable>arch2</replaceable>,…</literal>
    <itemizedlist><listitem><para><literal>arch=<replaceable>arch1</replaceable>,<replaceable>arch2</replaceable>,…</literal>
    can be used to specify for which architectures packages information should
    can be used to specify for which architectures packages information should
    be downloaded. If this option is not set all architectures defined by the
    be downloaded. If this option is not set all architectures defined by the

+ 4 - 4
ftparchive/cachedb.cc

@@ -351,7 +351,7 @@ bool CacheDB::GetMD5(bool const &GenOnly)
       return false;
       return false;
    }
    }
    MD5Summation MD5;
    MD5Summation MD5;
-   if (Fd->Seek(0) == false || MD5.AddFD(Fd->Fd(),CurStat.FileSize) == false)
+   if (Fd->Seek(0) == false || MD5.AddFD(*Fd, CurStat.FileSize) == false)
       return false;
       return false;
    
    
    MD5Res = MD5.Result();
    MD5Res = MD5.Result();
@@ -382,7 +382,7 @@ bool CacheDB::GetSHA1(bool const &GenOnly)
       return false;
       return false;
    }
    }
    SHA1Summation SHA1;
    SHA1Summation SHA1;
-   if (Fd->Seek(0) == false || SHA1.AddFD(Fd->Fd(),CurStat.FileSize) == false)
+   if (Fd->Seek(0) == false || SHA1.AddFD(*Fd, CurStat.FileSize) == false)
       return false;
       return false;
    
    
    SHA1Res = SHA1.Result();
    SHA1Res = SHA1.Result();
@@ -413,7 +413,7 @@ bool CacheDB::GetSHA256(bool const &GenOnly)
       return false;
       return false;
    }
    }
    SHA256Summation SHA256;
    SHA256Summation SHA256;
-   if (Fd->Seek(0) == false || SHA256.AddFD(Fd->Fd(),CurStat.FileSize) == false)
+   if (Fd->Seek(0) == false || SHA256.AddFD(*Fd, CurStat.FileSize) == false)
       return false;
       return false;
    
    
    SHA256Res = SHA256.Result();
    SHA256Res = SHA256.Result();
@@ -444,7 +444,7 @@ bool CacheDB::GetSHA512(bool const &GenOnly)
       return false;
       return false;
    }
    }
    SHA512Summation SHA512;
    SHA512Summation SHA512;
-   if (Fd->Seek(0) == false || SHA512.AddFD(Fd->Fd(),CurStat.FileSize) == false)
+   if (Fd->Seek(0) == false || SHA512.AddFD(*Fd, CurStat.FileSize) == false)
       return false;
       return false;
    
    
    SHA512Res = SHA512.Result();
    SHA512Res = SHA512.Result();

+ 13 - 127
ftparchive/multicompress.cc

@@ -16,6 +16,7 @@
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
 #include <config.h>
 #include <config.h>
 
 
+#include <apt-pkg/fileutl.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/md5.h>
 #include <apt-pkg/md5.h>
@@ -90,7 +91,7 @@ MultiCompress::MultiCompress(string const &Output,string const &Compress,
    /* Open all the temp files now so we can report any errors. File is 
    /* Open all the temp files now so we can report any errors. File is 
       made unreable to prevent people from touching it during creating. */
       made unreable to prevent people from touching it during creating. */
    for (Files *I = Outputs; I != 0; I = I->Next)
    for (Files *I = Outputs; I != 0; I = I->Next)
-      I->TmpFile.Open(I->Output + ".new",FileFd::WriteEmpty,0600);
+      I->TmpFile.Open(I->Output + ".new", FileFd::WriteOnly | FileFd::Create | FileFd::Empty, FileFd::Extension, 0600);
    if (_error->PendingError() == true)
    if (_error->PendingError() == true)
       return;
       return;
 
 
@@ -182,11 +183,6 @@ bool MultiCompress::Start()
       _exit(0);
       _exit(0);
    };
    };
 
 
-   /* Tidy up the temp files, we open them in the constructor so as to
-      get proper error reporting. Close them now. */
-   for (Files *I = Outputs; I != 0; I = I->Next)
-      I->TmpFile.Close();
-   
    close(Pipe[0]);
    close(Pipe[0]);
    Input = fdopen(Pipe[1],"w");
    Input = fdopen(Pipe[1],"w");
    if (Input == 0)
    if (Input == 0)
@@ -261,77 +257,10 @@ bool MultiCompress::Finalize(unsigned long long &OutSize)
    return true;
    return true;
 }
 }
 									/*}}}*/
 									/*}}}*/
-// MultiCompress::OpenCompress - Open the compressor			/*{{{*/
-// ---------------------------------------------------------------------
-/* This opens the compressor, either in compress mode or decompress 
-   mode. FileFd is always the compressor input/output file, 
-   OutFd is the created pipe, Input for Compress, Output for Decompress. */
-bool MultiCompress::OpenCompress(APT::Configuration::Compressor const &Prog,
-				 pid_t &Pid,int const &FileFd,int &OutFd,bool const &Comp)
-{
-   Pid = -1;
-   
-   // No compression
-   if (Prog.Binary.empty() == true)
-   {
-      OutFd = dup(FileFd);
-      return true;
-   }
-      
-   // Create a data pipe
-   int Pipe[2] = {-1,-1};
-   if (pipe(Pipe) != 0)
-      return _error->Errno("pipe",_("Failed to create subprocess IPC"));
-   for (int J = 0; J != 2; J++)
-      SetCloseExec(Pipe[J],true);
-
-   if (Comp == true)
-      OutFd = Pipe[1];
-   else
-      OutFd = Pipe[0];
-   
-   // The child..
-   Pid = ExecFork();
-   if (Pid == 0)
-   {
-      if (Comp == true)
-      {
-	 dup2(FileFd,STDOUT_FILENO);
-	 dup2(Pipe[0],STDIN_FILENO);
-      }   
-      else
-      {
-	 dup2(FileFd,STDIN_FILENO);
-	 dup2(Pipe[1],STDOUT_FILENO);
-      }
-      
-      SetCloseExec(STDOUT_FILENO,false);
-      SetCloseExec(STDIN_FILENO,false);
-
-      std::vector<char const*> Args;
-      Args.push_back(Prog.Binary.c_str());
-      std::vector<std::string> const * const addArgs =
-		(Comp == true) ? &(Prog.CompressArgs) : &(Prog.UncompressArgs);
-      for (std::vector<std::string>::const_iterator a = addArgs->begin();
-	   a != addArgs->end(); ++a)
-	 Args.push_back(a->c_str());
-      Args.push_back(NULL);
-
-      execvp(Args[0],(char **)&Args[0]);
-      cerr << _("Failed to exec compressor ") << Args[0] << endl;
-      _exit(100);
-   };      
-   if (Comp == true)
-      close(Pipe[0]);
-   else
-      close(Pipe[1]);
-   return true;
-}
-									/*}}}*/
 // MultiCompress::OpenOld - Open an old file				/*{{{*/
 // MultiCompress::OpenOld - Open an old file				/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* This opens one of the original output files, possibly decompressing it. */
 /* This opens one of the original output files, possibly decompressing it. */
-bool MultiCompress::OpenOld(int &Fd,pid_t &Proc)
+bool MultiCompress::OpenOld(FileFd &Fd)
 {
 {
    Files *Best = Outputs;
    Files *Best = Outputs;
    for (Files *I = Outputs; I != 0; I = I->Next)
    for (Files *I = Outputs; I != 0; I = I->Next)
@@ -339,29 +268,9 @@ bool MultiCompress::OpenOld(int &Fd,pid_t &Proc)
 	 Best = I;
 	 Best = I;
 
 
    // Open the file
    // Open the file
-   FileFd F(Best->Output,FileFd::ReadOnly);
-   if (_error->PendingError() == true)
-      return false;
-   
-   // Decompress the file so we can read it
-   if (OpenCompress(Best->CompressProg,Proc,F.Fd(),Fd,false) == false)
-      return false;
-   
-   return true;
+   return Fd.Open(Best->Output, FileFd::ReadOnly, FileFd::Extension);
 }
 }
 									/*}}}*/
 									/*}}}*/
-// MultiCompress::CloseOld - Close the old file				/*{{{*/
-// ---------------------------------------------------------------------
-/* */
-bool MultiCompress::CloseOld(int Fd,pid_t Proc)
-{
-   close(Fd);
-   if (Proc != -1)
-      if (ExecWait(Proc,_("decompressor"),false) == false)
-	 return false;
-   return true;
-}   
-									/*}}}*/
 // MultiCompress::Child - The writer child				/*{{{*/
 // MultiCompress::Child - The writer child				/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* The child process forks a bunch of compression children and takes 
 /* The child process forks a bunch of compression children and takes 
@@ -371,14 +280,6 @@ bool MultiCompress::CloseOld(int Fd,pid_t Proc)
    is new then the temp files are renamed, otherwise they are erased. */
    is new then the temp files are renamed, otherwise they are erased. */
 bool MultiCompress::Child(int const &FD)
 bool MultiCompress::Child(int const &FD)
 {
 {
-   // Start the compression children.
-   for (Files *I = Outputs; I != 0; I = I->Next)
-   {
-      if (OpenCompress(I->CompressProg,I->CompressProc,I->TmpFile.Fd(),
-		       I->Fd,true) == false)
-	 return false;      
-   }
-
    /* Okay, now we just feed data from FD to all the other FDs. Also
    /* Okay, now we just feed data from FD to all the other FDs. Also
       stash a hash of the data to use later. */
       stash a hash of the data to use later. */
    SetNonBlock(FD,false);
    SetNonBlock(FD,false);
@@ -398,25 +299,14 @@ bool MultiCompress::Child(int const &FD)
       FileSize += Res;
       FileSize += Res;
       for (Files *I = Outputs; I != 0; I = I->Next)
       for (Files *I = Outputs; I != 0; I = I->Next)
       {
       {
-	 if (write(I->Fd,Buffer,Res) != Res)
+	 if (I->TmpFile.Write(Buffer, Res) == false)
 	 {
 	 {
 	    _error->Errno("write",_("IO to subprocess/file failed"));
 	    _error->Errno("write",_("IO to subprocess/file failed"));
 	    break;
 	    break;
 	 }
 	 }
       }      
       }      
    }   
    }   
-   
-   // Close all the writers
-   for (Files *I = Outputs; I != 0; I = I->Next)
-      close(I->Fd);
-   
-   // Wait for the compressors to exit
-   for (Files *I = Outputs; I != 0; I = I->Next)
-   {
-      if (I->CompressProc != -1)
-	 ExecWait(I->CompressProc, I->CompressProg.Binary.c_str(), false);
-   }
-   
+
    if (_error->PendingError() == true)
    if (_error->PendingError() == true)
       return false;
       return false;
    
    
@@ -435,31 +325,27 @@ bool MultiCompress::Child(int const &FD)
    // Check the MD5 of the lowest cost entity.
    // Check the MD5 of the lowest cost entity.
    while (Missing == false)
    while (Missing == false)
    {
    {
-      int CompFd = -1;
-      pid_t Proc = -1;
-      if (OpenOld(CompFd,Proc) == false)
+      FileFd CompFd;
+      if (OpenOld(CompFd) == false)
       {
       {
 	 _error->Discard();
 	 _error->Discard();
 	 break;
 	 break;
       }
       }
-            
+
       // Compute the hash
       // Compute the hash
       MD5Summation OldMD5;
       MD5Summation OldMD5;
       unsigned long long NewFileSize = 0;
       unsigned long long NewFileSize = 0;
       while (1)
       while (1)
       {
       {
-	 int Res = read(CompFd,Buffer,sizeof(Buffer));
+	 unsigned long long Res = 0;
+	 if (CompFd.Read(Buffer,sizeof(Buffer), &Res) == false)
+	    return _error->Errno("read",_("Failed to read while computing MD5"));
 	 if (Res == 0)
 	 if (Res == 0)
 	    break;
 	    break;
-	 if (Res < 0)
-	    return _error->Errno("read",_("Failed to read while computing MD5"));
 	 NewFileSize += Res;
 	 NewFileSize += Res;
 	 OldMD5.Add(Buffer,Res);
 	 OldMD5.Add(Buffer,Res);
       }
       }
-      
-      // Tidy the compressor
-      if (CloseOld(CompFd,Proc) == false)
-	 return false;
+      CompFd.Close();
 
 
       // Check the hash
       // Check the hash
       if (OldMD5.Result() == MD5.Result() &&
       if (OldMD5.Result() == MD5.Result() &&

+ 1 - 5
ftparchive/multicompress.h

@@ -34,15 +34,12 @@ class MultiCompress
       FileFd TmpFile;
       FileFd TmpFile;
       pid_t CompressProc;
       pid_t CompressProc;
       time_t OldMTime;
       time_t OldMTime;
-      int Fd;
    };
    };
    
    
    Files *Outputs;
    Files *Outputs;
    pid_t Outputter;
    pid_t Outputter;
    mode_t Permissions;
    mode_t Permissions;
 
 
-   bool OpenCompress(APT::Configuration::Compressor const &Prog,
-		     pid_t &Pid,int const &FileFd, int &OutFd,bool const &Comp);
    bool Child(int const &Fd);
    bool Child(int const &Fd);
    bool Start();
    bool Start();
    bool Die();
    bool Die();
@@ -54,8 +51,7 @@ class MultiCompress
    unsigned long UpdateMTime;
    unsigned long UpdateMTime;
    
    
    bool Finalize(unsigned long long &OutSize);
    bool Finalize(unsigned long long &OutSize);
-   bool OpenOld(int &Fd,pid_t &Proc);
-   bool CloseOld(int Fd,pid_t Proc);
+   bool OpenOld(FileFd &Fd);
    static bool GetStat(std::string const &Output,std::string const &Compress,struct stat &St);
    static bool GetStat(std::string const &Output,std::string const &Compress,struct stat &St);
    
    
    MultiCompress(std::string const &Output,std::string const &Compress,
    MultiCompress(std::string const &Output,std::string const &Compress,

+ 0 - 0
ftparchive/writer.cc


Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików