]> git.saurik.com Git - apt.git/commitdiff
Merge bzip2-debs branch
authorMatt Zimmerman <matt.zimmerman@canonical.com>
Sun, 12 Dec 2004 17:51:33 +0000 (17:51 +0000)
committerMatt Zimmerman <matt.zimmerman@canonical.com>
Sun, 12 Dec 2004 17:51:33 +0000 (17:51 +0000)
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

apt-inst/contrib/extracttar.cc
apt-inst/contrib/extracttar.h
apt-inst/deb/debfile.cc
apt-inst/makefile
cmdline/apt-extracttemplates.cc
debian/changelog
ftparchive/contents.cc
po/apt-all.pot

index 63bb2ba804ba53827512e0a0920798bd8db531e4..b719d5b812f41a26f6373fbbe80cbc3767e39438 100644 (file)
@@ -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);
    }
index aaca987f279f72430448076bec0f4423a7be4c6c..ec930ca22c441662c43e40380895fd5a7d41ab71 100644 (file)
@@ -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();
 };
 
index d3a39911d6ae27832d67a752f21488001523c9a5..b838185d8f65b30c45996db9b3c935f6318974b5 100644 (file)
@@ -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;
 
index 0b02d4c7931ff4a46486d7d8d02d532e87531ef5..cc61841b9743922f68af0ac4f4147258cd8f68d2 100644 (file)
@@ -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)
index eecb7fe2f4003bf500e5e3f4e0c37cd0d25de3fb..d6894a7323864f9b8173dc37f4f82d0cda137d0d 100644 (file)
@@ -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);
 }
                                                                        /*}}}*/
index a1ce75377ef5c363e84aa2f8911c4dd91f4db076..c73fa522d673cedb790b184a0ac784e4bdc3282f 100644 (file)
@@ -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
 
index 4f2b1d163e12ce696a017ea69d67c51243bde925..e11c16ca292c9dec602ea8e1e41c3d04a8681d53 100644 (file)
@@ -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;   
index 93485a4da6412d38c3c210cb5e498a8de703f9dd..fbbb5834b16ae8c9b8de905d712aefaad06d30de 100644 (file)
@@ -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 ""