[PATCH v2] Add support for creating tarballs with scm data still inside

Peter Jönsson peter.jonsson at klarna.com
Fri Feb 28 23:24:55 UTC 2014


For some build systems the git information is required at build time
so we add an option to include the git data in the source tar
ball. Default is still to exclude vcs information if the tar
executable supports this option.

Signed-off-by: Peter Jönsson <peter.jonsson at klarna.com>
---
 py/mockbuild/scm.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/py/mockbuild/scm.py b/py/mockbuild/scm.py
index 9d130b7..0178491 100644
--- a/py/mockbuild/scm.py
+++ b/py/mockbuild/scm.py
@@ -65,6 +65,7 @@ class scmWorker(object):
 
         self.ext_src_dir = opts['ext_src_dir']
         self.write_tar = opts['write_tar']
+        self.exclude_vcs = opts['exclude_vcs']
 
         self.git_timestamps = opts['git_timestamps']
 
@@ -147,9 +148,11 @@ class scmWorker(object):
             tarball = tardir + ".tar.gz"
             taropts = ""
 
-            proc = subprocess.Popen(['tar', '--help'], shell=False, stdout=subprocess.PIPE)
-            if "--exclude-vcs" in proc.communicate()[0]:
-                taropts = "--exclude-vcs"
+            # Always exclude vcs data from tarball unless told not to
+            if not str(self.exclude_vcs).lower() == "false":
+                proc = subprocess.Popen(['tar', '--help'], shell=False, stdout=subprocess.PIPE)
+                if "--exclude-vcs" in proc.communicate()[0]:
+                    taropts = "--exclude-vcs"
 
             self.log.debug("Writing " + self.src_dir + "/" + tarball + "...")
             dir = os.getcwd()
-- 
1.9.0



More information about the buildsys mailing list