From b0e1a43f95a3a6817dff6aed303a9823827ea0cf Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 27 Feb 2011 23:31:25 +0100 Subject: [PATCH] support every compression we have a compressor configured --- apt-pkg/aptconfiguration.cc | 13 +++++++++++++ apt-pkg/aptconfiguration.h | 3 +++ apt-pkg/deb/debsrcrecords.cc | 9 ++++++--- debian/changelog | 3 ++- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc index 2a441fce..b23e12ac 100644 --- a/apt-pkg/aptconfiguration.cc +++ b/apt-pkg/aptconfiguration.cc @@ -388,6 +388,19 @@ const Configuration::getCompressors(bool const Cached) { return compressors; } /*}}}*/ +// getCompressorExtensions - supported data.tar extensions /*{{{*/ +// --------------------------------------------------------------------- +/* */ +std::vector const Configuration::getCompressorExtensions() { + std::vector const compressors = getCompressors(); + std::vector ext; + for (std::vector::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 /*{{{*/ // --------------------------------------------------------------------- /* */ diff --git a/apt-pkg/aptconfiguration.h b/apt-pkg/aptconfiguration.h index e4bc5e68..815db6ca 100644 --- a/apt-pkg/aptconfiguration.h +++ b/apt-pkg/aptconfiguration.h @@ -105,6 +105,9 @@ public: /*{{{*/ * \return a vector of Compressors */ std::vector static const getCompressors(bool const Cached = true); + + /** \brief Return a vector of extensions supported for data.tar's */ + std::vector static const getCompressorExtensions(); /*}}}*/ private: /*{{{*/ void static setDefaultConfigurationForCompressors(); diff --git a/apt-pkg/deb/debsrcrecords.cc b/apt-pkg/deb/debsrcrecords.cc index 3809ee74..74930500 100644 --- a/apt-pkg/deb/debsrcrecords.cc +++ b/apt-pkg/deb/debsrcrecords.cc @@ -14,6 +14,7 @@ #include #include #include +#include using std::max; /*}}}*/ @@ -111,7 +112,9 @@ bool debSrcRecordParser::Files(vector &List) string Base = Sect.FindS("Directory"); if (Base.empty() == false && Base[Base.length()-1] != '/') Base += '/'; - + + std::vector 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 &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; diff --git a/debian/changelog b/debian/changelog index 499150d5..58a1a365 100644 --- a/debian/changelog +++ b/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 Sun, 27 Feb 2011 23:00:07 +0100 + -- David Kalnischkies Sun, 27 Feb 2011 23:30:36 +0100 apt (0.8.11.5) unstable; urgency=low -- 2.20.1