From 0c23e537455be4451b48b1bb9117083634060fc3 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Fri, 8 Jan 2016 19:31:40 +0000 Subject: [PATCH] genorig.py: Make orig tarballs really reproducible - Override umask while extracting/exporting files - Override user and group names in tarball --- debian/bin/genorig.py | 5 ++++- debian/changelog | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/bin/genorig.py b/debian/bin/genorig.py index b83f31c09..c3a4eea26 100755 --- a/debian/bin/genorig.py +++ b/debian/bin/genorig.py @@ -40,6 +40,7 @@ class Main(object): def __call__(self): import tempfile self.dir = tempfile.mkdtemp(prefix='genorig', dir='debian') + old_umask = os.umask(0o022) try: if os.path.isdir(self.input_files[0]): self.upstream_export(self.input_files[0]) @@ -59,8 +60,10 @@ class Main(object): .st_mtime)) self.debian_patch() + os.umask(old_umask) self.tar(orig_date) finally: + os.umask(old_umask) shutil.rmtree(self.dir) def upstream_export(self, input_repo): @@ -131,7 +134,7 @@ class Main(object): self.log("Generate tarball %s\n" % out) cmdline = '''(cd '%s' && find '%s' -print0) | LC_ALL=C sort -z | - tar -C '%s' --no-recursion --null -T - --mtime '%s' -caf '%s' + tar -C '%s' --no-recursion --null -T - --mtime '%s' --owner root --group root -caf '%s' ''' % (self.dir, self.orig, self.dir, orig_date, out) try: if os.spawnv(os.P_WAIT, '/bin/sh', ['sh', '-c', cmdline]): diff --git a/debian/changelog b/debian/changelog index ba7ff0efc..9f6c60588 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,9 @@ linux (4.3.3-6) UNRELEASED; urgency=medium * debian.py: Implement stable order of fields in debian/tests/control * debian.py: Implement stable order of fields not in the predefined order + * genorig.py: Make orig tarballs really reproducible: + - Override umask while extracting/exporting files + - Override user and group names in tarball -- Ben Hutchings Fri, 08 Jan 2016 12:08:13 +0000