summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-02-28 00:20:35 +0100
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-02-28 00:20:35 +0100
commit7296f1e6e65ae1926e4bbee3acb52a285e376a3a (patch)
tree7825765d06c09c50fbba7ff68c3d1a1658bdc05e
parentb0e1a43f95a3a6817dff6aed303a9823827ea0cf (diff)
* apt-inst/deb/debfile.cc:
- support data.tar's compressed with any configured compressor
-rw-r--r--apt-inst/deb/debfile.cc42
-rw-r--r--debian/changelog4
2 files changed, 29 insertions, 17 deletions
diff --git a/apt-inst/deb/debfile.cc b/apt-inst/deb/debfile.cc
index 2b1fdedc8..a40cd1ae8 100644
--- a/apt-inst/deb/debfile.cc
+++ b/apt-inst/deb/debfile.cc
@@ -20,6 +20,7 @@
#include <apt-pkg/extracttar.h>
#include <apt-pkg/error.h>
#include <apt-pkg/deblistparser.h>
+#include <apt-pkg/aptconfiguration.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -127,26 +128,35 @@ bool debDebFile::ExtractControl(pkgDataBase &DB)
/* Simple wrapper around tar.. */
bool debDebFile::ExtractArchive(pkgDirStream &Stream)
{
- // Get the archive member and positition the file
- const ARArchive::Member *Member = AR.FindMember("data.tar.gz");
- const char *Compressor = "gzip";
- if (Member == 0) {
- Member = AR.FindMember("data.tar.bz2");
- Compressor = "bzip2";
- }
- if (Member == 0) {
- Member = AR.FindMember("data.tar.lzma");
- Compressor = "lzma";
+ // Get the archive member
+ const ARArchive::Member *Member = NULL;
+ std::string Compressor;
+
+ std::string const data = "data.tar";
+ std::vector<APT::Configuration::Compressor> compressor = APT::Configuration::getCompressors();
+ for (std::vector<APT::Configuration::Compressor>::const_iterator c = compressor.begin();
+ c != compressor.end(); ++c)
+ {
+ Member = AR.FindMember(std::string(data).append(c->Extension).c_str());
+ if (Member == NULL)
+ continue;
+ Compressor = c->Binary;
+ break;
}
- if (Member == 0) {
- Member = AR.FindMember("data.tar.xz");
- Compressor = "xz";
+
+ if (Member == NULL)
+ {
+ std::string ext = "data.tar.{";
+ for (std::vector<APT::Configuration::Compressor>::const_iterator c = compressor.begin();
+ c != compressor.end(); ++c)
+ ext.append(c->Extension.substr(1));
+ ext.append("}");
+ return _error->Error(_("Internal error, could not locate member %s"), ext.c_str());
}
- if (Member == 0)
- return _error->Error(_("Internal error, could not locate member %s"), "data.tar.{gz,bz2,lzma,xz}");
+
if (File.Seek(Member->Start) == false)
return false;
-
+
// Prepare Tar
ExtractTar Tar(File,Member->Size,Compressor);
if (_error->PendingError() == true)
diff --git a/debian/changelog b/debian/changelog
index 58a1a365f..c012023ff 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -22,8 +22,10 @@ apt (0.8.11.6) UNRELEASED; urgency=low
- support every compression we have a compressor configured
* ftparchive/contents.cc:
- remove ExtractArchive codecopy from apt-inst/deb/debfile.cc
+ * apt-inst/deb/debfile.cc:
+ - support data.tar's compressed with any configured compressor
- -- David Kalnischkies <kalnischkies@gmail.com> Sun, 27 Feb 2011 23:30:36 +0100
+ -- David Kalnischkies <kalnischkies@gmail.com> Mon, 28 Feb 2011 00:19:55 +0100
apt (0.8.11.5) unstable; urgency=low