genorig.py: Make orig tarballs really reproducible

- Override umask while extracting/exporting files
- Override user and group names in tarball
This commit is contained in:
Ben Hutchings 2016-01-08 19:31:40 +00:00
parent 56b9798cd8
commit 6f7f065366
2 changed files with 7 additions and 1 deletions

View File

@ -73,6 +73,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])
@ -92,8 +93,10 @@ class Main(object):
.st_mtime))
self.generate()
os.umask(old_umask)
self.tar(orig_date)
finally:
os.umask(old_umask)
shutil.rmtree(self.dir)
def upstream_export(self, input_repo):
@ -222,7 +225,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]):

3
debian/changelog vendored
View File

@ -6,6 +6,9 @@ linux-tools (4.4-1~exp1) UNRELEASED; urgency=medium
* linux-perf: Fix reading of build-id from vDSO
* linux-perf: Leave -rc suffix out of version in package description
* 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 <ben@decadent.org.uk> Tue, 19 Jan 2016 00:04:27 +0000