From bc33e0f0b6b1fdb010dcd4a49a78b827530052aa Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 22 Feb 2011 12:50:47 +0100 Subject: * ftparchive/multicompress.cc, apt-inst/deb/debfile.cc: - support xz compressor to create xz-compressed Indexes and be able to open data.tar.xz files --- apt-inst/deb/debfile.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'apt-inst/deb') diff --git a/apt-inst/deb/debfile.cc b/apt-inst/deb/debfile.cc index cd7a88808..edd78adbb 100644 --- a/apt-inst/deb/debfile.cc +++ b/apt-inst/deb/debfile.cc @@ -46,7 +46,9 @@ debDebFile::debDebFile(FileFd &File) : File(File), AR(File) if (!CheckMember("data.tar.gz") && !CheckMember("data.tar.bz2") && - !CheckMember("data.tar.lzma")) { + !CheckMember("data.tar.lzma") && + !CheckMember("data.tar.xz")) { + // FIXME: add data.tar.xz here - adding it now would require a Translation round for a very small gain _error->Error(_("This is not a valid DEB archive, it has no '%s', '%s' or '%s' member"), "data.tar.gz", "data.tar.bz2", "data.tar.lzma"); return; } @@ -136,6 +138,10 @@ bool debDebFile::ExtractArchive(pkgDirStream &Stream) Member = AR.FindMember("data.tar.lzma"); Compressor = "lzma"; } + if (Member == 0) { + Member = AR.FindMember("data.tar.xz"); + Compressor = "xz"; + } if (Member == 0) return _error->Error(_("Internal error, could not locate member")); if (File.Seek(Member->Start) == false) -- cgit v1.2.3 From dc7eb288ff95230f9a0f81c6b3485b6b06802480 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 24 Feb 2011 12:24:51 +0100 Subject: * ftparchive/contents.cc: - remove ExtractArchive codecopy from apt-inst/deb/debfile.cc --- apt-inst/deb/debfile.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-inst/deb') diff --git a/apt-inst/deb/debfile.cc b/apt-inst/deb/debfile.cc index edd78adbb..2b1fdedc8 100644 --- a/apt-inst/deb/debfile.cc +++ b/apt-inst/deb/debfile.cc @@ -143,7 +143,7 @@ bool debDebFile::ExtractArchive(pkgDirStream &Stream) Compressor = "xz"; } if (Member == 0) - return _error->Error(_("Internal error, could not locate member")); + return _error->Error(_("Internal error, could not locate member %s"), "data.tar.{gz,bz2,lzma,xz}"); if (File.Seek(Member->Start) == false) return false; -- cgit v1.2.3 From 7296f1e6e65ae1926e4bbee3acb52a285e376a3a Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 28 Feb 2011 00:20:35 +0100 Subject: * apt-inst/deb/debfile.cc: - support data.tar's compressed with any configured compressor --- apt-inst/deb/debfile.cc | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) (limited to 'apt-inst/deb') 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 #include #include +#include #include #include @@ -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 compressor = APT::Configuration::getCompressors(); + for (std::vector::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::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) -- cgit v1.2.3