Package: dpkg
Version: 1.13.11
Severity: wishlist
Tags: patch

Hi!

Please could you add p7zip support for data.tar.7z ?  It is analogous to the
gzip/bzip2/cat options already present.  Patch attached.

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.12-1-k7
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ANSI_X3.4-1968) (ignored: LC_ALL 
set to C)

Versions of packages dpkg depends on:
ii  coreutils [textutils]         5.93-5     The GNU core utilities

dpkg recommends no packages.

-- no debconf information
diff -ur dpkg-1.13.11.old/debian/control dpkg-1.13.11/debian/control
--- dpkg-1.13.11.old/debian/control     2005-08-14 20:56:53.000000000 +0200
+++ dpkg-1.13.11/debian/control 2006-01-12 10:12:23.000000000 +0100
@@ -27,7 +27,7 @@
 Priority: standard
 Architecture: all
 Depends: dpkg (>= 1.13.1), perl5, perl-modules, cpio (>= 2.4.2-2), patch (>= 
2.2-1), make, binutils
-Recommends: gcc | c-compiler, bzip2
+Recommends: gcc | c-compiler, bzip2, p7zip
 Suggests: gnupg, debian-keyring
 Conflicts: dpkgname
 Replaces: dpkgname, dpkg (<< 1.4.1.8), dpkg-doc-ja
diff -ur dpkg-1.13.11.old/dpkg-deb/build.c dpkg-1.13.11/dpkg-deb/build.c
--- dpkg-1.13.11.old/dpkg-deb/build.c   2005-06-06 06:07:12.000000000 +0200
+++ dpkg-1.13.11/dpkg-deb/build.c       2006-01-12 10:00:39.000000000 +0100
@@ -443,6 +443,7 @@
     switch (compress_type) {
       case GZ: datamember= DATAMEMBER_GZ; break;
       case BZ2: datamember= DATAMEMBER_BZ2; break;
+      case P7Z: datamember= DATAMEMBER_P7Z; break;
       case CAT: datamember= DATAMEMBER_CAT; break;
       default:
         ohshit(_("Internal error, compress_type `%i' unknown!"), 
compress_type);
diff -ur dpkg-1.13.11.old/dpkg-deb/dpkg-deb.h dpkg-1.13.11/dpkg-deb/dpkg-deb.h
--- dpkg-1.13.11.old/dpkg-deb/dpkg-deb.h        2005-06-06 06:07:12.000000000 
+0200
+++ dpkg-1.13.11/dpkg-deb/dpkg-deb.h    2006-01-12 10:00:17.000000000 +0100
@@ -45,6 +45,8 @@
 #define DATAMEMBER_COMPAT_GZ   "data.tar.gz/    "
 #define DATAMEMBER_BZ2         "data.tar.bz2    "
 #define DATAMEMBER_COMPAT_BZ2          "data.tar.bz2/   "
+#define DATAMEMBER_P7Z         "data.tar.7z     "
+#define DATAMEMBER_COMPAT_P7Z          "data.tar.7z/    "
 #define DATAMEMBER_CAT         "data.tar        "
 #define DATAMEMBER_COMPAT_CAT          "data.tar/       "
 
diff -ur dpkg-1.13.11.old/dpkg-deb/extract.c dpkg-1.13.11/dpkg-deb/extract.c
--- dpkg-1.13.11.old/dpkg-deb/extract.c 2005-06-06 06:07:12.000000000 +0200
+++ dpkg-1.13.11/dpkg-deb/extract.c     2006-01-12 10:01:05.000000000 +0100
@@ -157,6 +157,10 @@
                     
!memcmp(arh.ar_name,DATAMEMBER_COMPAT_BZ2,sizeof(arh.ar_name))) {
            adminmember= 0;
            compress_type= BZ2;
+         } else if (!memcmp(arh.ar_name,DATAMEMBER_P7Z,sizeof(arh.ar_name)) ||
+                    
!memcmp(arh.ar_name,DATAMEMBER_COMPAT_P7Z,sizeof(arh.ar_name))) {
+           adminmember= 0;
+           compress_type= P7Z;
          } else if (!memcmp(arh.ar_name,DATAMEMBER_CAT,sizeof(arh.ar_name)) ||
                     
!memcmp(arh.ar_name,DATAMEMBER_COMPAT_CAT,sizeof(arh.ar_name))) {
            adminmember= 0;
diff -ur dpkg-1.13.11.old/dpkg-deb/main.c dpkg-1.13.11/dpkg-deb/main.c
--- dpkg-1.13.11.old/dpkg-deb/main.c    2005-06-16 05:19:47.000000000 +0200
+++ dpkg-1.13.11/dpkg-deb/main.c        2006-01-12 10:14:43.000000000 +0100
@@ -79,7 +79,7 @@
 "  --nocheck                  suppress control file check (build bad 
package).\n"
 "  -z# to set the compression when building\n"
 "  -Z<type>                   set the compression type to use when building.\n"
-"                             allowed values: gzip, bzip2, none\n"
+"                             allowed values: gzip, bzip2, p7zip, none\n"
 "\n"
 "Format syntax:\n"
 "  A format is a string that will be output for each package. The format\n"
@@ -170,6 +170,8 @@
     compress_type= GZ;
   else if (!strcmp(value, "bzip2"))
     compress_type= BZ2;
+  else if (!strcmp(value, "p7zip"))
+    compress_type= P7Z;
   else if (!strcmp(value, "none"))
     compress_type= CAT;
   else
diff -ur dpkg-1.13.11.old/lib/compression.c dpkg-1.13.11/lib/compression.c
--- dpkg-1.13.11.old/lib/compression.c  2005-06-06 06:07:12.000000000 +0200
+++ dpkg-1.13.11/lib/compression.c      2006-01-12 09:59:58.000000000 +0100
@@ -90,6 +90,16 @@
       }
       execlp(BZIP2,"bzip2","-dc",(char*)0); ohshite(_("%s: failed to exec 
bzip2 -dc"), v.buf);
 #endif
+    case P7Z:
+      if (fd_in != 0) {
+        m_dup2(fd_in, 0);
+        close(fd_in);
+      }
+      if (fd_out != 1) {
+        m_dup2(fd_out, 1);
+        close(fd_out);
+      }
+      execlp(P7ZIP,"p7zip","-d",(char*)0); ohshite(_("%s: failed to exec p7zip 
-d"), v.buf);
     case CAT:
       fd_fd_copy(fd_in, fd_out, -1, _("%s: decompression"), v.buf);
       exit(0);
@@ -199,6 +209,16 @@
       combuf[1]= *compression;
       execlp(BZIP2,"bzip2",combuf,(char*)0); ohshit(_("%s: failed to exec 
bzip2 %s"), v.buf, combuf);
 #endif
+    case P7Z:
+      if (fd_in != 0) {
+        m_dup2(fd_in, 0);
+        close(fd_in);
+      }
+      if (fd_out != 1) {
+        m_dup2(fd_out, 1);
+        close(fd_out);
+      }
+      execlp(P7ZIP,"p7zip",(char*)0); ohshit(_("%s: failed to exec p7zip"), 
v.buf);
     case CAT:
       fd_fd_copy(fd_in, fd_out, -1, _("%s: compression"), v.buf);
       exit(0);
diff -ur dpkg-1.13.11.old/lib/dpkg.h dpkg-1.13.11/lib/dpkg.h
--- dpkg-1.13.11.old/lib/dpkg.h 2005-06-06 06:07:12.000000000 +0200
+++ dpkg-1.13.11/lib/dpkg.h     2006-01-12 09:59:29.000000000 +0100
@@ -139,6 +139,7 @@
 #define TAR            "tar"
 #define GZIP           "gzip"
 #define BZIP2          "bzip2"
+#define P7ZIP          "p7zip"
 #define RM             "rm"
 #define FIND           "find"
 #define SHELL          "sh"
@@ -373,7 +374,7 @@
 
 /*** from compression.c ***/
 
-enum compression_type { CAT, GZ, BZ2 };
+enum compression_type { CAT, GZ, BZ2, P7Z };
 
 void decompress_cat(enum compression_type type, int fd_in, int fd_out, char 
*desc, ...) NONRETURNING;
 void compress_cat(enum compression_type type, int fd_in, int fd_out, const 
char *compression, char *desc, ...) NONRETURNING;

Reply via email to