From 28319f585317baffae4b2a2912aedbde5c690747 Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@debian.org>
Date: Thu, 24 Apr 2014 18:19:49 +0200
Subject: [PATCH] c/deb-format.pm: Warn on deprecated compression formats for
 data.tar
Status: applied
Debbug: 745740

The lzma and bzip2 compressions are deprecated, and dpkg-deb emits
warnings (since 1.16.4 and 1.17.7 respectively) when trying to build
such packages.

We emit the new tag uses-deprecated-compression-for-data-tarball for
these, instead of reusing malformed-deb-archive, because these packages
are just fine and will keep being supported at extraction time for the
foreseeable future, even when creating them is disallowed.

Signed-off-by: Guillem Jover <guillem@debian.org>
---
 checks/deb-format.desc | 12 ++++++++++++
 checks/deb-format.pm   |  3 +++
 2 files changed, 15 insertions(+)

diff --git a/checks/deb-format.desc b/checks/deb-format.desc
index 8a4f214..0d46f20 100644
--- a/checks/deb-format.desc
+++ b/checks/deb-format.desc
@@ -56,3 +56,15 @@ Info: The data tarball of this udeb package is not compressed in format
  .
  Currently, udpkg supports .gz and .xz compressed tarballs.
 
+Tag: uses-deprecated-compression-for-data-tarball
+Severity: important
+Certainty: certain
+Info: The data portion of this binary package uses a deprecated compression
+ format.  Creating such binary packages is supported by dpkg-deb for now,
+ although a warning is emitted for lzma since dpkg 1.16.4 and for bzip2
+ since dpkg 1.17.7, but will eventually be disallowed, although extraction
+ will keep being supported for the foreseeable future.
+ .
+ For lzma, xz is the direct replacement.  For bzip2 either gzip or xz can
+ be used as a substitue, depending on the wanted properties, gzip for
+ maxium compatibility and speed, and xz for maximum compression ratio.
diff --git a/checks/deb-format.pm b/checks/deb-format.pm
index 946b5a9..cc057bd 100644
--- a/checks/deb-format.pm
+++ b/checks/deb-format.pm
@@ -134,8 +134,11 @@ sub run {
                 && $data_member !~ m/^data\.tar\.[gx]z$/) {
                 tag 'udeb-uses-unsupported-compression-for-data-tarball';
             } elsif ($data_member eq 'data.tar.lzma') {
+                tag 'uses-deprecated-compression-for-data-tarball', 'lzma';
                 # Ubuntu's archive allows lzma packages.
                 tag 'lzma-deb-archive';
+            } elsif ($data_member eq 'data.tar.bz2') {
+                tag 'uses-deprecated-compression-for-data-tarball', 'bzip2';
             }
             if (not $okay) {
                 tag 'malformed-deb-archive',
-- 
2.0.0.rc0.280.gacc62aa

