// ExtractTar::ExtractTar - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */
-ExtractTar::ExtractTar(FileFd &Fd,unsigned long Max) : File(Fd),
- MaxInSize(Max)
+ExtractTar::ExtractTar(FileFd &Fd,unsigned long Max,string DecompressionProgram) : File(Fd),
+ MaxInSize(Max), DecompressProg(DecompressionProgram)
{
GZPid = -1;
// Make sure we clean it up!
kill(GZPid,SIGINT);
- if (ExecWait(GZPid,_config->Find("dir::bin::gzip","/bin/gzip").c_str(),
+ string confvar = string("dir::bin::") + DecompressProg;
+ if (ExecWait(GZPid,_config->Find(confvar.c_str(),DecompressProg.c_str()).c_str(),
Force) == false)
{
GZPid = -1;
SetCloseExec(STDERR_FILENO,false);
const char *Args[3];
- Args[0] = _config->Find("dir::bin::gzip","/bin/gzip").c_str();
+ string confvar = string("dir::bin::") + DecompressProg;
+ Args[0] = _config->Find(confvar.c_str(),DecompressProg.c_str()).c_str();
Args[1] = "-d";
Args[2] = 0;
- execv(Args[0],(char **)Args);
+ execvp(Args[0],(char **)Args);
cerr << _("Failed to exec gzip ") << Args[0] << endl;
_exit(100);
}
int GZPid;
FileFd InFd;
bool Eof;
+ string DecompressProg;
// Fork and reap gzip
bool StartGzip();
bool Go(pkgDirStream &Stream);
- ExtractTar(FileFd &Fd,unsigned long Max);
+ ExtractTar(FileFd &Fd,unsigned long Max,string DecompressionProgram);
virtual ~ExtractTar();
};
{
if (_error->PendingError() == true)
return;
-
- // Check the members for validity
- if (CheckMember("debian-binary") == false ||
- CheckMember("control.tar.gz") == false ||
- CheckMember("data.tar.gz") == false)
+
+ if (!CheckMember("debian-binary")) {
+ _error->Error(_("This is not a valid DEB archive, missing '%s' member"), "debian-binary");
+ return;
+ }
+
+ if (!CheckMember("control.tar.gz")) {
+ _error->Error(_("This is not a valid DEB archive, missing '%s' member"), "control.tar.gz");
return;
+ }
+
+ if (!CheckMember("data.tar.gz") && !CheckMember("data.tar.bz2")) {
+ _error->Error(_("This is not a valid DEB archive, it has no '%s' or '%s' member"), "data.tar.gz", "data.tar.bz2");
+ return;
+ }
}
/*}}}*/
// DebFile::CheckMember - Check if a named member is in the archive /*{{{*/
bool debDebFile::CheckMember(const char *Name)
{
if (AR.FindMember(Name) == 0)
- return _error->Error(_("This is not a valid DEB archive, missing '%s' member"),Name);
+ return false;
return true;
}
/*}}}*/
const ARArchive::Member *Member = AR.FindMember(Name);
if (Member == 0)
{
- _error->Error(_("Internal Error, could not locate member %s"),Name);
return 0;
}
if (File.Seek(Member->Start) == false)
// Prepare Tar
ControlExtract Extract;
- ExtractTar Tar(File,Member->Size);
+ ExtractTar Tar(File,Member->Size,"gzip");
if (_error->PendingError() == true)
return false;
{
// 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)
return _error->Error(_("Internal Error, could not locate member"));
if (File.Seek(Member->Start) == false)
return false;
// Prepare Tar
- ExtractTar Tar(File,Member->Size);
+ ExtractTar Tar(File,Member->Size,Compressor);
if (_error->PendingError() == true)
return false;
return Tar.Go(Stream);
return false;
// Extract it.
- ExtractTar Tar(Deb.GetFile(),Member->Size);
+ ExtractTar Tar(Deb.GetFile(),Member->Size,"gzip");
if (Tar.Go(*this) == false)
return false;
# The library name
LIBRARY=apt-inst
LIBEXT=$(GLIBC_VER)$(LIBSTDCPP_VER)
-MAJOR=1.0
+MAJOR=1.1
MINOR=0
SLIBS=$(PTHREADLIB) -lapt-pkg
APT_DOMAIN:=libapt-inst$(MAJOR)
if (File.Seek(Member->Start) == false)
return false;
- ExtractTar Tar(File, Member->Size);
+ ExtractTar Tar(File, Member->Size,"gzip");
return Tar.Go(*this);
}
/*}}}*/
* Call setlocale in the methods, so that the messages are properly
localised (Closes: #282700)
+ * Implement support for bzip2-compressed debs (data.tar.bz2)
- --
+ -- Matt Zimmerman <mdz@debian.org> Sat, 11 Dec 2004 09:05:52 -0800
apt (0.5.31) unstable; urgency=low
// Get the archive member and positition the file
const ARArchive::Member *Member = Deb.GotoMember("data.tar.gz");
- if (Member == 0)
+ const char *Compressor = "gzip";
+ if (Member == 0) {
+ Member = Deb.GotoMember("data.tar.bz2");
+ Compressor = "bzip2";
+ }
+ if (Member == 0) {
+ _error->Error(_("Internal Error, could not locate member %s"),"data.tar.gz");
return false;
+ }
// Extract it.
- ExtractTar Tar(Deb.GetFile(),Member->Size);
+ ExtractTar Tar(Deb.GetFile(),Member->Size,Compressor);
if (Tar.Go(*this) == false)
return false;
return true;
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2004-07-29 09:38-0700\n"
+"POT-Creation-Date: 2004-12-08 09:30-0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
msgid " %s maintainer is %s not %s\n"
msgstr ""
-#: ftparchive/contents.cc:346 ftparchive/contents.cc:377
+#: ftparchive/contents.cc:317
+#, c-format
+msgid "Internal Error, could not locate member %s"
+msgstr ""
+
+#: ftparchive/contents.cc:353 ftparchive/contents.cc:384
msgid "realloc - Failed to allocate memory"
msgstr ""
msgid "Merging Available information"
msgstr ""
-#: apt-inst/contrib/extracttar.cc:116
+#: apt-inst/contrib/extracttar.cc:117
msgid "Failed to create pipes"
msgstr ""
-#: apt-inst/contrib/extracttar.cc:141
+#: apt-inst/contrib/extracttar.cc:143
msgid "Failed to exec gzip "
msgstr ""
-#: apt-inst/contrib/extracttar.cc:178 apt-inst/contrib/extracttar.cc:204
+#: apt-inst/contrib/extracttar.cc:180 apt-inst/contrib/extracttar.cc:206
msgid "Corrupted archive"
msgstr ""
-#: apt-inst/contrib/extracttar.cc:193
+#: apt-inst/contrib/extracttar.cc:195
msgid "Tar Checksum failed, archive corrupted"
msgstr ""
-#: apt-inst/contrib/extracttar.cc:296
+#: apt-inst/contrib/extracttar.cc:298
#, c-format
msgid "Unknown TAR header type %u, member %s"
msgstr ""
msgid "Error parsing MD5. Offset %lu"
msgstr ""
-#: apt-inst/deb/debfile.cc:55
+#: apt-inst/deb/debfile.cc:42 apt-inst/deb/debfile.cc:47
#, c-format
msgid "This is not a valid DEB archive, missing '%s' member"
msgstr ""
-#: apt-inst/deb/debfile.cc:72
+#: apt-inst/deb/debfile.cc:52
#, c-format
-msgid "Internal Error, could not locate member %s"
+msgid "This is not a valid DEB archive, it has no '%s' or '%s' member"
msgstr ""
-#: apt-inst/deb/debfile.cc:104
+#: apt-inst/deb/debfile.cc:112
#, c-format
msgid "Couldn't change to %s"
msgstr ""
-#: apt-inst/deb/debfile.cc:125
+#: apt-inst/deb/debfile.cc:138
msgid "Internal Error, could not locate member"
msgstr ""
-#: apt-inst/deb/debfile.cc:158
+#: apt-inst/deb/debfile.cc:171
msgid "Failed to locate a valid control file"
msgstr ""
-#: apt-inst/deb/debfile.cc:243
+#: apt-inst/deb/debfile.cc:256
msgid "Unparsible control file"
msgstr ""
msgid "Query"
msgstr ""
-#: methods/ftp.cc:1104
+#: methods/ftp.cc:1106
msgid "Unable to invoke "
msgstr ""
msgid "rename failed, %s (%s -> %s)."
msgstr ""
-#: apt-pkg/acquire-item.cc:353
+#: apt-pkg/acquire-item.cc:382
#, c-format
msgid ""
"I wasn't able to locate a file for the %s package. This might mean you need "
"to manually fix this package. (due to missing arch)"
msgstr ""
-#: apt-pkg/acquire-item.cc:388
+#: apt-pkg/acquire-item.cc:417
#, c-format
msgid ""
"I wasn't able to locate file for the %s package. This might mean you need to "
"manually fix this package."
msgstr ""
-#: apt-pkg/acquire-item.cc:419
+#: apt-pkg/acquire-item.cc:448
#, c-format
msgid ""
"The package index files are corrupted. No Filename: field for package %s."
msgstr ""
-#: apt-pkg/acquire-item.cc:501
+#: apt-pkg/acquire-item.cc:530
msgid "Size mismatch"
msgstr ""
-#: apt-pkg/acquire-item.cc:511
+#: apt-pkg/acquire-item.cc:540
msgid "MD5Sum mismatch"
msgstr ""