summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Zimmerman <matt.zimmerman@canonical.com>2004-12-12 17:51:33 +0000
committerMatt Zimmerman <matt.zimmerman@canonical.com>2004-12-12 17:51:33 +0000
commitb21c043804b1be7f4d79ac3f5a6615dc96f26a42 (patch)
tree6c00f8b2637fe3f2fff706a8af7d34105a45c7a0
parentef86e052e562d84c87fc2280887cb95cc9676b8f (diff)
Merge bzip2-debs branch
Patches applied: * apt@packages.debian.org/apt--bzip2-debs--0--base-0 tag of apt@packages.debian.org/apt--main--0--patch-30 * apt@packages.debian.org/apt--bzip2-debs--0--patch-1 Create baz branch * apt@packages.debian.org/apt--bzip2-debs--0--patch-2 Implement data.tar.bz2 support
-rw-r--r--apt-inst/contrib/extracttar.cc12
-rw-r--r--apt-inst/contrib/extracttar.h3
-rw-r--r--apt-inst/deb/debfile.cc33
-rw-r--r--apt-inst/makefile2
-rw-r--r--cmdline/apt-extracttemplates.cc2
-rw-r--r--debian/changelog3
-rw-r--r--ftparchive/contents.cc11
-rw-r--r--po/apt-all.pot45
8 files changed, 70 insertions, 41 deletions
diff --git a/apt-inst/contrib/extracttar.cc b/apt-inst/contrib/extracttar.cc
index 63bb2ba80..b719d5b81 100644
--- a/apt-inst/contrib/extracttar.cc
+++ b/apt-inst/contrib/extracttar.cc
@@ -58,8 +58,8 @@ struct ExtractTar::TarHeader
// 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;
@@ -93,7 +93,8 @@ bool ExtractTar::Done(bool Force)
// 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;
@@ -134,10 +135,11 @@ bool ExtractTar::StartGzip()
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);
}
diff --git a/apt-inst/contrib/extracttar.h b/apt-inst/contrib/extracttar.h
index aaca987f2..ec930ca22 100644
--- a/apt-inst/contrib/extracttar.h
+++ b/apt-inst/contrib/extracttar.h
@@ -38,6 +38,7 @@ class ExtractTar
int GZPid;
FileFd InFd;
bool Eof;
+ string DecompressProg;
// Fork and reap gzip
bool StartGzip();
@@ -47,7 +48,7 @@ class ExtractTar
bool Go(pkgDirStream &Stream);
- ExtractTar(FileFd &Fd,unsigned long Max);
+ ExtractTar(FileFd &Fd,unsigned long Max,string DecompressionProgram);
virtual ~ExtractTar();
};
diff --git a/apt-inst/deb/debfile.cc b/apt-inst/deb/debfile.cc
index d3a39911d..b838185d8 100644
--- a/apt-inst/deb/debfile.cc
+++ b/apt-inst/deb/debfile.cc
@@ -37,12 +37,21 @@ debDebFile::debDebFile(FileFd &File) : File(File), AR(File)
{
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 /*{{{*/
@@ -52,7 +61,7 @@ debDebFile::debDebFile(FileFd &File) : File(File), AR(File)
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;
}
/*}}}*/
@@ -69,7 +78,6 @@ const ARArchive::Member *debDebFile::GotoMember(const char *Name)
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)
@@ -91,7 +99,7 @@ bool debDebFile::ExtractControl(pkgDataBase &DB)
// Prepare Tar
ControlExtract Extract;
- ExtractTar Tar(File,Member->Size);
+ ExtractTar Tar(File,Member->Size,"gzip");
if (_error->PendingError() == true)
return false;
@@ -121,13 +129,18 @@ 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)
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);
@@ -230,7 +243,7 @@ bool debDebFile::MemControlExtract::Read(debDebFile &Deb)
return false;
// Extract it.
- ExtractTar Tar(Deb.GetFile(),Member->Size);
+ ExtractTar Tar(Deb.GetFile(),Member->Size,"gzip");
if (Tar.Go(*this) == false)
return false;
diff --git a/apt-inst/makefile b/apt-inst/makefile
index 0b02d4c79..cc61841b9 100644
--- a/apt-inst/makefile
+++ b/apt-inst/makefile
@@ -12,7 +12,7 @@ include ../buildlib/defaults.mak
# 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)
diff --git a/cmdline/apt-extracttemplates.cc b/cmdline/apt-extracttemplates.cc
index eecb7fe2f..d6894a732 100644
--- a/cmdline/apt-extracttemplates.cc
+++ b/cmdline/apt-extracttemplates.cc
@@ -99,7 +99,7 @@ bool DebFile::Go()
if (File.Seek(Member->Start) == false)
return false;
- ExtractTar Tar(File, Member->Size);
+ ExtractTar Tar(File, Member->Size,"gzip");
return Tar.Go(*this);
}
/*}}}*/
diff --git a/debian/changelog b/debian/changelog
index a1ce75377..c73fa522d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,8 +2,9 @@ apt (0.5.32) unstable; urgency=low
* 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
diff --git a/ftparchive/contents.cc b/ftparchive/contents.cc
index 4f2b1d163..e11c16ca2 100644
--- a/ftparchive/contents.cc
+++ b/ftparchive/contents.cc
@@ -308,11 +308,18 @@ bool ContentsExtract::Read(debDebFile &Deb)
// 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;
diff --git a/po/apt-all.pot b/po/apt-all.pot
index 93485a4da..fbbb5834b 100644
--- a/po/apt-all.pot
+++ b/po/apt-all.pot
@@ -7,7 +7,7 @@ msgid ""
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"
@@ -424,7 +424,12 @@ msgstr ""
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 ""
@@ -1124,23 +1129,23 @@ 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 ""
@@ -1363,30 +1368,30 @@ 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 ""
@@ -1567,7 +1572,7 @@ msgstr ""
msgid "Query"
msgstr ""
-#: methods/ftp.cc:1104
+#: methods/ftp.cc:1106
msgid "Unable to invoke "
msgstr ""
@@ -2244,31 +2249,31 @@ 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 ""