Package: dpkg
Version: 1.16.3
Severity: important
Justification: http://bugs.debian.org/673283

Hi,

In debhelper 9.20120513 and later, dh_builddeb passes the options -z1
-Zxz -Sextreme to dpkg-deb when building udebs.  Unfortunately this
means there is no way to use a different compression type if the
packager prefers to do so:

 dh_builddeb -- -Zgzip -z9
 dpkg-deb: building package `btrfs-tools' in 
`../btrfs-tools_0.19+20120328-1_amd64.deb'.
 dpkg-deb: building package `btrfs-tools-dbg' in 
`../btrfs-tools-dbg_0.19+20120328-1_amd64.deb'.
 dpkg-deb: error: invalid compressor parameters: unknown compression strategy
[...]
 dh_builddeb: dpkg-deb -z1 -Zxz -Sextreme -Zgzip -z9 --build 
debian/btrfs-tools-udeb ../btrfs-tools-udeb_0.19+20120328-1_amd64.udeb returned 
exit code 2

Once a strategy has been set to "extreme" with -S, there is no way for
the packager to return to the default strategy using another option.
Compression types other than xz do not accept the extreme strategy, so
the upshot is that they cannot be used for udebs.

Here's a patch to address that.  Strategies are only meaningful in the
context of a particular compression type, so this patch teaches the -Z
option to reset the strategy to the default.

Without this change "dpkg-deb -Sextreme -Zxz" uses the extreme
strategy and this change breaks that.  A quick Google search does not
reveal anyone using those options out of order, but if there's a clean
way to avoid breaking the interface then I'd be interested.  (For
example, maybe the first -Z option should not reset the strategy,
while later ones would?  I can imagine the result being very
confusing.)

So I don't want to see this patch applied as is, but perhaps it can
provide some amusement.  What do you think?

Signed-off-by: Jonathan Nieder <jrnie...@gmail.com>
---
 debian/changelog |    5 +++++
 dpkg-deb/main.c  |    1 +
 man/dpkg-deb.1   |    2 ++
 3 files changed, 8 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index c7543114..cb00a08e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -38,6 +38,11 @@ dpkg (1.16.4) UNRELEASED; urgency=low
     a new -A option to dpkg-checkbuilddeps. Closes: #629480
     Thanks to Roger Leigh <rle...@debian.org>.
 
+  [ Jonathan Nieder ]
+  * Teach dpkg-deb -Z to reset the compression strategy so that one can
+    override ‘-Zxz -Sextreme’ settings with a later ‘-Zgzip’ on the command
+    line.
+
   [ Updated man page translations ]
   * German (Helge Kreutzmann).
   * French (Christian Perrier). Fixes a mistranslation and some
diff --git a/dpkg-deb/main.c b/dpkg-deb/main.c
index f56eda27..9e810271 100644
--- a/dpkg-deb/main.c
+++ b/dpkg-deb/main.c
@@ -167,6 +167,7 @@ static void
 setcompresstype(const struct cmdinfo *cip, const char *value)
 {
   compress_params.type = compressor_find_by_name(value);
+  compress_params.strategy = NULL;
   if (compress_params.type == compressor_type_unknown)
     ohshit(_("unknown compression type `%s'!"), value);
   if (compress_params.type == compressor_type_lzma)
diff --git a/man/dpkg-deb.1 b/man/dpkg-deb.1
index 414ca3be..c002870c 100644
--- a/man/dpkg-deb.1
+++ b/man/dpkg-deb.1
@@ -230,6 +230,8 @@ xz.
 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 \fIgzip\fP).
+
+Setting a compression type also resets the compression strategy.
 .TP
 .BR \-\-new
 Ensures that
-- 
1.7.10




--
To UNSUBSCRIBE, email to debian-dpkg-bugs-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to