summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2014-01-07 04:33:17 +0100
committerGuillem Jover <guillem@debian.org>2014-01-15 15:02:16 +0100
commit5dd25afbfa71b37eeaaa7f1577f51263d2a2d45c (patch)
tree38db79c4b982ccde47b69fc8dda08da2c7227b6a
parentc17be3cbfc58e5b54ae1d5ae4714460d7ae2e15c (diff)
downloaddpkg-5dd25afbfa71b37eeaaa7f1577f51263d2a2d45c.tar.gz
dpkg-deb: Allow to use the same compression for control.tar as data.tar
Add a new --uniform-compression, that allows to use the same compression parameters on the control.tar member as for the data.tar member. This is a transitional need, once a dpkg-deb supporting other control.tar compressions is widely deployed, ideally on stable distribution releases, then the default could possibly get switched.
-rw-r--r--debian/changelog2
-rw-r--r--dpkg-deb/build.c21
-rw-r--r--dpkg-deb/dpkg-deb.h1
-rw-r--r--dpkg-deb/main.c10
-rw-r--r--man/dpkg-deb.17
5 files changed, 32 insertions, 9 deletions
diff --git a/debian/changelog b/debian/changelog
index 1e7314c07..4d9637fb1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -45,6 +45,8 @@ dpkg (1.17.6) UNRELEASED; urgency=low
as if -Znone had been passed, as documented. Closes: #718295
* Add support for .deb archives with a control member not compressed
(control.tar) or compressed with xz (control.tar.xz).
+ * Add support for creating uniformly compressed .deb archive members,
+ with the new dpkg-deb option --uniform-compression.
[ Updated dpkg translations ]
* Swedish (Peter Krefting).
diff --git a/dpkg-deb/build.c b/dpkg-deb/build.c
index e816e0ab6..2871234a0 100644
--- a/dpkg-deb/build.c
+++ b/dpkg-deb/build.c
@@ -432,6 +432,7 @@ pkg_get_pathname(const char *dir, struct pkginfo *pkg)
int
do_build(const char *const *argv)
{
+ struct compress_params control_compress_params;
struct dpkg_error err;
const char *debar, *dir;
bool subdir;
@@ -516,16 +517,18 @@ do_build(const char *const *argv)
tfbuf);
free(tfbuf);
- /* And run gzip to compress our control archive. */
+ /* And run the compressor on our control archive. */
+ if (opt_uniform_compression) {
+ control_compress_params = compress_params;
+ } else {
+ control_compress_params.type = compressor_type_gzip;
+ control_compress_params.strategy = compressor_strategy_none;
+ control_compress_params.level = -1;
+ }
+
c2 = subproc_fork();
if (!c2) {
- struct compress_params params;
-
- params.type = compressor_type_gzip;
- params.strategy = compressor_strategy_none;
- params.level = -1;
-
- compress_filter(&params, p1[0], gzfd, _("compressing control member"));
+ compress_filter(&control_compress_params, p1[0], gzfd, _("compressing control member"));
exit(0);
}
close(p1[0]);
@@ -555,7 +558,7 @@ do_build(const char *const *argv)
char adminmember[16 + 1];
sprintf(adminmember, "%s%s", ADMINMEMBER,
- compressor_get_extension(compressor_type_gzip));
+ compressor_get_extension(control_compress_params.type));
dpkg_ar_put_magic(debar, arfd);
dpkg_ar_member_put_mem(debar, arfd, DEBMAGIC, deb_magic, strlen(deb_magic));
diff --git a/dpkg-deb/dpkg-deb.h b/dpkg-deb/dpkg-deb.h
index 1238d1407..d89c5ab22 100644
--- a/dpkg-deb/dpkg-deb.h
+++ b/dpkg-deb/dpkg-deb.h
@@ -36,6 +36,7 @@ action_func do_raw_extract;
action_func do_fsystarfile;
extern int opt_verbose;
+extern int opt_uniform_compression;
extern int debugflag, nocheckflag;
extern struct deb_version deb_format;
diff --git a/dpkg-deb/main.c b/dpkg-deb/main.c
index 5470b1e24..e6a74c49a 100644
--- a/dpkg-deb/main.c
+++ b/dpkg-deb/main.c
@@ -107,6 +107,7 @@ usage(const struct cmdinfo *cip, const char *value)
" --new Legacy alias for '--deb-format=2.0'.\n"
" --nocheck Suppress control file check (build bad\n"
" packages).\n"
+" --uniform-compression Use the compression params on all members.\n"
" -z# Set the compression level when building.\n"
" -Z<type> Set the compression type used when building.\n"
" Allowed types: gzip, xz, bzip2, none.\n"
@@ -142,6 +143,7 @@ static const char printforhelp[] =
int debugflag = 0;
int nocheckflag = 0;
int opt_verbose = 0;
+int opt_uniform_compression = 0;
struct deb_version deb_format = DEB_VERSION(2, 0);
@@ -233,6 +235,7 @@ static const struct cmdinfo cmdinfos[]= {
{ "debug", 'D', 0, &debugflag, NULL, NULL, 1 },
{ "verbose", 'v', 0, &opt_verbose, NULL, NULL, 1 },
{ "nocheck", 0, 0, &nocheckflag, NULL, NULL, 1 },
+ { "uniform-compression", 0, 0, &opt_uniform_compression, NULL, NULL, 1 },
{ NULL, 'z', 1, NULL, NULL, set_compress_level },
{ NULL, 'Z', 1, NULL, NULL, set_compress_type },
{ NULL, 'S', 1, NULL, NULL, set_compress_strategy },
@@ -255,6 +258,13 @@ int main(int argc, const char *const *argv) {
if (!compressor_check_params(&compress_params, &err))
badusage(_("invalid compressor parameters: %s"), err.str);
+ if (opt_uniform_compression &&
+ (compress_params.type != compressor_type_none &&
+ compress_params.type != compressor_type_gzip &&
+ compress_params.type != compressor_type_xz))
+ badusage(_("unsupported compression type '%s' with uniform compression"),
+ compressor_get_name(compress_params.type));
+
ret = cipaction->action(argv);
dpkg_program_done();
diff --git a/man/dpkg-deb.1 b/man/dpkg-deb.1
index b1556011e..1850b5893 100644
--- a/man/dpkg-deb.1
+++ b/man/dpkg-deb.1
@@ -232,6 +232,13 @@ Specify which compression type to use when building a package. Allowed
values are \fIgzip\fP, \fIxz\fP, \fIbzip2\fP, \fIlzma\fP, and \fInone\fP
(default is \fIxz\fP).
.TP
+.B \-\-uniform\-compression
+Specify that the same compression parameters should be used for all archive
+members (i.e. \fBcontrol.tar\fP and \fBdata.tar\fP). Otherwise only the
+\fBdata.tar\fP member will use those parameters. The only supported
+compression types allowed to be uniformly used are \fInone\fP, \fIgzip\fP
+and \fIxz\fP.
+.TP
.BI \-\-deb\-format= format
Set the archive format version used when building (since dpkg 1.17.0).
Allowed values are \fI2.0\fP for the new format, and \fI0.939000\fP