summaryrefslogtreecommitdiff
path: root/apt-inst/deb
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2014-02-23 00:45:56 +0100
committerMichael Vogt <mvo@debian.org>2014-02-23 00:45:56 +0100
commiteccff323a093d91fff379e7c8460d7e5c8db8ad1 (patch)
treed539d21c6716af3122edabae91feadccfb3c12ad /apt-inst/deb
parent2c678b0a026ac9d44c8ade07aa8bf318faf5a9e2 (diff)
parentb7ed961b8099c05f65e18d4c73ead50cc5c8bff1 (diff)
Merge branch 'debian/sid' into ubuntu/master
Conflicts: debian/changelog
Diffstat (limited to 'apt-inst/deb')
-rw-r--r--apt-inst/deb/debfile.cc38
-rw-r--r--apt-inst/deb/debfile.h1
2 files changed, 23 insertions, 16 deletions
diff --git a/apt-inst/deb/debfile.cc b/apt-inst/deb/debfile.cc
index 79434d8b5..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")) {
@@ -88,21 +91,20 @@ const ARArchive::Member *debDebFile::GotoMember(const char *Name)
return Member;
}
/*}}}*/
-// DebFile::ExtractArchive - Extract the archive data itself /*{{{*/
+// DebFile::ExtractTarMember - Extract the contents of a tar member /*{{{*/
// ---------------------------------------------------------------------
/* Simple wrapper around tar.. */
-bool debDebFile::ExtractArchive(pkgDirStream &Stream)
+bool debDebFile::ExtractTarMember(pkgDirStream &Stream,const char *Name)
{
// 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());
+ Member = AR.FindMember(std::string(Name).append(c->Extension).c_str());
if (Member == NULL)
continue;
Compressor = c->Binary;
@@ -110,8 +112,11 @@ bool debDebFile::ExtractArchive(pkgDirStream &Stream)
}
if (Member == NULL)
+ Member = AR.FindMember(std::string(Name).c_str());
+
+ if (Member == NULL)
{
- std::string ext = "data.tar.{";
+ std::string ext = std::string(Name) + ".{";
for (std::vector<APT::Configuration::Compressor>::const_iterator c = compressor.begin();
c != compressor.end(); ++c)
ext.append(c->Extension.substr(1));
@@ -129,6 +134,14 @@ bool debDebFile::ExtractArchive(pkgDirStream &Stream)
return Tar.Go(Stream);
}
/*}}}*/
+// DebFile::ExtractArchive - Extract the archive data itself /*{{{*/
+// ---------------------------------------------------------------------
+/* Simple wrapper around DebFile::ExtractTarMember. */
+bool debDebFile::ExtractArchive(pkgDirStream &Stream)
+{
+ return ExtractTarMember(Stream, "data.tar");
+}
+ /*}}}*/
// DebFile::ControlExtract::DoItem - Control Tar Extraction /*{{{*/
// ---------------------------------------------------------------------
@@ -194,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)
diff --git a/apt-inst/deb/debfile.h b/apt-inst/deb/debfile.h
index 38211fb0f..ecef71d21 100644
--- a/apt-inst/deb/debfile.h
+++ b/apt-inst/deb/debfile.h
@@ -48,6 +48,7 @@ class debDebFile
class ControlExtract;
class MemControlExtract;
+ bool ExtractTarMember(pkgDirStream &Stream, const char *Name);
bool ExtractArchive(pkgDirStream &Stream);
const ARArchive::Member *GotoMember(const char *Name);
inline FileFd &GetFile() {return File;};