[linux-tools] 06/07: genorig.py: Make orig tarballs really reproducible

debian-kernel at lists.debian.org debian-kernel at lists.debian.org
Tue Jan 19 01:27:32 UTC 2016


This is an automated email from the git hooks/post-receive script.

benh pushed a commit to branch master
in repository linux-tools.

commit 6f7f065366ad3526ba86cac966f683cb6c657a1c
Author: Ben Hutchings <ben at decadent.org.uk>
Date:   Fri Jan 8 19:31:40 2016 +0000

    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 97183eb..f1f9423 100755
--- a/debian/bin/genorig.py
+++ b/debian/bin/genorig.py
@@ -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]):
diff --git a/debian/changelog b/debian/changelog
index f4beb33..2839663 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -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 at decadent.org.uk>  Tue, 19 Jan 2016 00:04:27 +0000
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/linux-tools.git



More information about the Kernel-svn-changes mailing list