Jérémy Bobbio:
> Jérémy Bobbio:
> > Jérémy Bobbio:
> > > Here are four patches based on the current master (1e059955) that will
> > > write files in deterministic order in the control and data archives.
> > > File names are sorted by forking `sort` before being piped to `tar`.
> > 
> > Attached are the patch based on current master (36eda4c1bc).
> 
> Attached are the patch based on master (1b8c20ad2).

Attached is a much simpler replacement for the earlier 3 patches:
> Subject: [PATCH 2/4] Extract the creation of the control tarball to a
> Subject: [PATCH 3/4] Rename create_control_tar() variables to more meaningful
> Subject: [PATCH 4/4] Also write control.tar.gz in deterministic order

Instead of feeding the list of control files using `find+sort`, we now
use the new `--sort=name` option that has been added in GNU Tar 1.28.
This makes making the order of control.tar deterministic a simple
one-line change.

tar/1.28-1 is already in testing. I think it's fine to ask a more recent
tar to be used when building packages with a more recent version of
dpkg-dev.

-- 
Lunar                                .''`. 
lu...@debian.org                    : :Ⓐ  :  # apt-get install anarchism
                                    `. `'` 
                                      `-   
From 1c5a4b8c8b35dbec822399cce4e40b41611251df Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Bobbio?= <lu...@debian.org>
Date: Thu, 8 Oct 2015 14:24:57 +0000
Subject: [PATCH] Write control.tar in a deterministic order

This requires the new `--sort=name` option available since
GNU Tar 1.28. Adding the required Depends for dpkg-dev.

Closes: #719845
---
 debian/control   | 3 ++-
 dpkg-deb/build.c | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/debian/control b/debian/control
index 68c8f6a..c0e8e51 100644
--- a/debian/control
+++ b/debian/control
@@ -51,7 +51,8 @@ Priority: optional
 Architecture: all
 Multi-Arch: foreign
 Depends: libdpkg-perl (= ${source:Version}), bzip2, xz-utils,
- patch (>= 2.7), make, binutils, base-files (>= 5.0.0), ${misc:Depends}
+ patch (>= 2.7), make, binutils, base-files (>= 5.0.0), tar (>= 1.28)
+ ${misc:Depends}
 Recommends: gcc | c-compiler, build-essential, fakeroot,
  gnupg | gnupg2, gpgv | gpgv2, libalgorithm-merge-perl
 Suggests: debian-keyring
diff --git a/dpkg-deb/build.c b/dpkg-deb/build.c
index 3e028fd..e3235db 100644
--- a/dpkg-deb/build.c
+++ b/dpkg-deb/build.c
@@ -522,7 +522,7 @@ do_build(const char *const *argv)
       ohshite(_("failed to chdir to '%.255s'"), dir);
     if (chdir(BUILDCONTROLDIR))
       ohshite(_("failed to chdir to '%.255s'"), ".../DEBIAN");
-    execlp(TAR, "tar", "-cf", "-", "--format=gnu", ".", NULL);
+    execlp(TAR, "tar", "-cf", "-", "--format=gnu", "--sort=name", ".", NULL);
     ohshite(_("unable to execute %s (%s)"), "tar -cf", TAR);
   }
   close(p1[1]);
-- 
2.6.1

Attachment: signature.asc
Description: Digital signature

Reply via email to