summaryrefslogtreecommitdiff
path: root/apt-inst
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2014-02-16 23:30:48 +0100
committerMichael Vogt <mvo@debian.org>2014-02-22 20:06:59 +0100
commite7f56293f029505f59670be2bad244f6d9912369 (patch)
treebc54d05e0854421e696906362b6114dc08be78f7 /apt-inst
parent50b942e9a228337a2ca20931036c7cfd8cdba90d (diff)
downloadapt-e7f56293f029505f59670be2bad244f6d9912369.tar.gz
Add support for data.tar, control.tar and control.tar.xz
Sync the deb(5) format support with latest dpkg, by allowing uncompressed tar members and xz compressed control.tar. This also refactors the control.tar member extraction by using ExtractTarMember(), which also means future changes only need to be implemented in a single place.
Diffstat (limited to 'apt-inst')
-rw-r--r--apt-inst/deb/debfile.cc21
1 files changed, 10 insertions, 11 deletions
diff --git a/apt-inst/deb/debfile.cc b/apt-inst/deb/debfile.cc
index 15db1a7fc..a811bbe88 100644
--- a/apt-inst/deb/debfile.cc
+++ b/apt-inst/deb/debfile.cc
@@ -42,12 +42,15 @@ debDebFile::debDebFile(FileFd &File) : File(File), AR(File)
return;
}
- if (!CheckMember("control.tar.gz")) {
- _error->Error(_("This is not a valid DEB archive, missing '%s' member"), "control.tar.gz");
+ if (!CheckMember("control.tar") &&
+ !CheckMember("control.tar.gz") &&
+ !CheckMember("control.tar.xz")) {
+ _error->Error(_("This is not a valid DEB archive, missing '%s' member"), "control.tar");
return;
}
- if (!CheckMember("data.tar.gz") &&
+ if (!CheckMember("data.tar") &&
+ !CheckMember("data.tar.gz") &&
!CheckMember("data.tar.bz2") &&
!CheckMember("data.tar.lzma") &&
!CheckMember("data.tar.xz")) {
@@ -109,6 +112,9 @@ bool debDebFile::ExtractTarMember(pkgDirStream &Stream,const char *Name)
}
if (Member == NULL)
+ Member = AR.FindMember(std::string(Name).c_str());
+
+ if (Member == NULL)
{
std::string ext = std::string(Name) + ".{";
for (std::vector<APT::Configuration::Compressor>::const_iterator c = compressor.begin();
@@ -201,14 +207,7 @@ bool debDebFile::MemControlExtract::Process(Item &Itm,const unsigned char *Data,
it parses it into a tag section parser. */
bool debDebFile::MemControlExtract::Read(debDebFile &Deb)
{
- // Get the archive member and positition the file
- const ARArchive::Member *Member = Deb.GotoMember("control.tar.gz");
- if (Member == 0)
- return false;
-
- // Extract it.
- ExtractTar Tar(Deb.GetFile(),Member->Size,"gzip");
- if (Tar.Go(*this) == false)
+ if (Deb.ExtractTarMember(*this, "control.tar") == false)
return false;
if (Control == 0)