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

support every compression we have a compressor configured

David Kalnischkies лет назад: 15
Родитель
Сommit
b0e1a43f95
4 измененных файлов с 24 добавлено и 4 удалено
  1. 13 0
      apt-pkg/aptconfiguration.cc
  2. 3 0
      apt-pkg/aptconfiguration.h
  3. 6 3
      apt-pkg/deb/debsrcrecords.cc
  4. 2 1
      debian/changelog

+ 13 - 0
apt-pkg/aptconfiguration.cc

@@ -388,6 +388,19 @@ const Configuration::getCompressors(bool const Cached) {
 	return compressors;
 }
 									/*}}}*/
+// getCompressorExtensions - supported data.tar extensions		/*{{{*/
+// ---------------------------------------------------------------------
+/* */
+std::vector<std::string> const Configuration::getCompressorExtensions() {
+	std::vector<APT::Configuration::Compressor> const compressors = getCompressors();
+	std::vector<std::string> ext;
+	for (std::vector<APT::Configuration::Compressor>::const_iterator c = compressors.begin();
+	     c != compressors.end(); ++c)
+		if (c->Extension.empty() == false && c->Extension != ".")
+			ext.push_back(c->Extension);
+	return ext;
+}
+									/*}}}*/
 // Compressor constructor						/*{{{*/
 // ---------------------------------------------------------------------
 /* */

+ 3 - 0
apt-pkg/aptconfiguration.h

@@ -105,6 +105,9 @@ public:									/*{{{*/
 	 *  \return a vector of Compressors
 	 */
 	std::vector<Compressor> static const getCompressors(bool const Cached = true);
+
+	/** \brief Return a vector of extensions supported for data.tar's */
+	std::vector<std::string> static const getCompressorExtensions();
 									/*}}}*/
 	private:							/*{{{*/
 	void static setDefaultConfigurationForCompressors();

+ 6 - 3
apt-pkg/deb/debsrcrecords.cc

@@ -14,6 +14,7 @@
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/configuration.h>
+#include <apt-pkg/aptconfiguration.h>
 
 using std::max;
 									/*}}}*/
@@ -111,7 +112,9 @@ bool debSrcRecordParser::Files(vector<pkgSrcRecords::File> &List)
    string Base = Sect.FindS("Directory");
    if (Base.empty() == false && Base[Base.length()-1] != '/')
       Base += '/';
-   
+
+   std::vector<std::string> const compExts = APT::Configuration::getCompressorExtensions();
+
    // Iterate over the entire list grabbing each triplet
    const char *C = Files.c_str();
    while (*C != 0)
@@ -144,8 +147,8 @@ bool debSrcRecordParser::Files(vector<pkgSrcRecords::File> &List)
 	 }
 	 F.Type = string(F.Path,Tmp+1,Pos-Tmp);
 	 
-	 if (F.Type == "gz" || F.Type == "bz2" || F.Type == "lzma" ||
-	     F.Type == "xz" || F.Type == "tar")
+	 if (std::find(compExts.begin(), compExts.end(), std::string(".").append(F.Type)) != compExts.end() ||
+	     F.Type == "tar")
 	 {
 	    Pos = Tmp-1;
 	    continue;

+ 2 - 1
debian/changelog

@@ -19,10 +19,11 @@ apt (0.8.11.6) UNRELEASED; urgency=low
     - support adding new compressors by configuration
   * apt-pkg/deb/debsrcrecords.cc:
     - support xz-compressed source v3 debian.tar files
+    - support every compression we have a compressor configured
   * ftparchive/contents.cc:
     - remove ExtractArchive codecopy from apt-inst/deb/debfile.cc
 
- -- David Kalnischkies <kalnischkies@gmail.com>  Sun, 27 Feb 2011 23:00:07 +0100
+ -- David Kalnischkies <kalnischkies@gmail.com>  Sun, 27 Feb 2011 23:30:36 +0100
 
 apt (0.8.11.5) unstable; urgency=low