The following commit has been merged in the master branch:
commit 9bb208a8338253a1c9e1d0642cf1ef039a335951
Author: Guillem Jover <[email protected]>
Date: Mon Feb 1 05:16:33 2010 +0100
Add support for xz compressed data.tar member of binary packages
Use the xz command from xz-utils to support xz-compressed binary
packages. Add xz-utils to dpkg's Pre-Depends.
The xz format is very similar to the lzma format, but it fixes
some omissions in the latter, most notably a magic number for
identification by file(1).
Closes: #542160
Based-on-patch-by: Jonathan Nieder <[email protected]>
diff --git a/debian/changelog b/debian/changelog
index 3522d43..25483c9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -115,6 +115,9 @@ dpkg (1.15.6) UNRELEASED; urgency=low
* Securely remove newly installed files when rolling-back a failed unpack.
* Change default lzma compression level from 9 to 6.
Thanks to Jonathan Nieder for the initial patch.
+ * Add support for xz compressed data.tar member of binary packages. Add
+ xz-utils to dpkg's Pre-Depends. Closes: #542160
+ Thanks to Jonathan Nieder for the initial patch.
[ Modestas Vainius ]
* Implement symbol patterns (Closes: #563752). From now on, it is possible to
diff --git a/debian/control b/debian/control
index d4e8d10..d36039b 100644
--- a/debian/control
+++ b/debian/control
@@ -17,7 +17,7 @@ Build-Depends: debhelper (>= 6.0.7), pkg-config, po4a (>=
0.33.1),
Package: dpkg
Architecture: any
Essential: yes
-Pre-Depends: ${shlibs:Depends}, coreutils (>= 5.93-1), lzma
+Pre-Depends: ${shlibs:Depends}, coreutils (>= 5.93-1), lzma, xz-utils
Depends: ${misc:Depends}
Conflicts: sysvinit (<< 2.82-1), dpkg-iasearch (<< 0.11),
dpkg-dev (<< 1.14.16), apt (<< 0.7.7), aptitude (<< 0.4.7-1)
diff --git a/dpkg-deb/main.c b/dpkg-deb/main.c
index 1b77acf..319e715 100644
--- a/dpkg-deb/main.c
+++ b/dpkg-deb/main.c
@@ -103,7 +103,7 @@ usage(const struct cmdinfo *cip, const char *value)
" packages).\n"
" -z# Set the compression level when building.\n"
" -Z<type> Set the compression type used when
building.\n"
-" Allowed values: gzip, bzip2, lzma,
none.\n"
+" Allowed types: gzip, xz, bzip2, lzma,
none.\n"
"\n"));
printf(_(
diff --git a/lib/dpkg/compress.c b/lib/dpkg/compress.c
index e63d64c..51f5b89 100644
--- a/lib/dpkg/compress.c
+++ b/lib/dpkg/compress.c
@@ -322,6 +322,33 @@ struct compressor compressor_bzip2 = {
};
/*
+ * Xz compressor.
+ */
+
+static void
+decompress_xz(int fd_in, int fd_out, const char *desc)
+{
+ fd_fd_filter(fd_in, fd_out, desc, XZ, "-dc", NULL);
+}
+
+static void
+compress_xz(int fd_in, int fd_out, int compress_level, const char *desc)
+{
+ char combuf[6];
+
+ snprintf(combuf, sizeof(combuf), "-c%d", compress_level);
+ fd_fd_filter(fd_in, fd_out, desc, XZ, combuf, NULL);
+}
+
+struct compressor compressor_xz = {
+ .name = "xz",
+ .extension = ".xz",
+ .default_level = 6,
+ .compress = compress_xz,
+ .decompress = decompress_xz,
+};
+
+/*
* Lzma compressor.
*/
@@ -355,6 +382,7 @@ struct compressor compressor_lzma = {
static struct compressor *compressor_array[] = {
&compressor_none,
&compressor_gzip,
+ &compressor_xz,
&compressor_bzip2,
&compressor_lzma,
};
diff --git a/lib/dpkg/compress.h b/lib/dpkg/compress.h
index 947a800..3a3d0b5 100644
--- a/lib/dpkg/compress.h
+++ b/lib/dpkg/compress.h
@@ -27,6 +27,7 @@
DPKG_BEGIN_DECLS
#define GZIP "gzip"
+#define XZ "xz"
#define BZIP2 "bzip2"
#define LZMA "lzma"
@@ -42,6 +43,7 @@ struct compressor {
struct compressor compressor_none;
struct compressor compressor_gzip;
+struct compressor compressor_xz;
struct compressor compressor_bzip2;
struct compressor compressor_lzma;
diff --git a/man/deb.5 b/man/deb.5
index c51ed12..a6f79aa 100644
--- a/man/deb.5
+++ b/man/deb.5
@@ -56,6 +56,7 @@ The third, last required member is named
It contains the filesystem as a tar archive, either
not compressed (supported since dpkg 1.10.24), or compressed with
gzip (with \fB.gz\fP extension),
+xz (with \fB.xz\fP extension, supported since dpkg 1.15.6),
bzip2 (with \fB.bz2\fP extension, supported since dpkg 1.10.24) or
lzma (with \fB.lzma\fP extension, supported since dpkg 1.13.25).
.PP
diff --git a/man/dpkg-deb.1 b/man/dpkg-deb.1
index 8f5c5df..1137f26 100644
--- a/man/dpkg-deb.1
+++ b/man/dpkg-deb.1
@@ -191,8 +191,8 @@ when building a package.
.TP
.BI \-Z compress_type
Specify which compression type to use when building a package. Allowed
-values are \fIgzip\fP, \fIbzip2\fP, \fIlzma\fP, and \fInone\fP (default
-is \fIgzip\fP).
+values are \fIgzip\fP, \fIxz\fP, \fIbzip2\fP, \fIlzma\fP, and \fInone\fP
+(default is \fIgzip\fP).
.TP
.BR \-\-new
Ensures that
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]