Chad has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/405347 )

Change subject: releases: Swap tar/gzip pipe for `git archive`
......................................................................

releases: Swap tar/gzip pipe for `git archive`

By using .gitattributes, we can skip on files we want to exclude.
Then we also don't need to specify a tar command

Change-Id: Iac2d02e98128710b5dbc76fbe8e0202ac8b48fa8
---
M make-release/makerelease.py
1 file changed, 11 insertions(+), 21 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/tools/release 
refs/changes/47/405347/1

diff --git a/make-release/makerelease.py b/make-release/makerelease.py
index e2c83ca..acb07f9 100755
--- a/make-release/makerelease.py
+++ b/make-release/makerelease.py
@@ -77,11 +77,6 @@
         help='skip gpg signing'
     )
     parser.add_argument(
-        '--tar-command', dest='tar_command',
-        default='tar',
-        help='path to tar, we are expecting a GNU tar. (defaults to tar)'
-    )
-    parser.add_argument(
         '--patch-dir', dest='patch_dir', default=None,
         help='Where to source patch files from'
     )
@@ -440,29 +435,24 @@
         logging.info('Done with making patch')
         return diff_status == 1
 
-    def make_tar(self, package, input_dir, build_dir, add_args=None):
+    def make_tar(self, package, input_dir, build_dir, include_submodules=True):
         """Tar up a directory"""
-        tar = self.options.tar_command
-
         # Generate the .tar.gz file
         filename = package + '.tar.gz'
+        cwd = os.getcwd()
+        os.chdir(input_dir)
         out_file = open(os.path.join(build_dir, filename), "w")
-        args = [tar, '--format=gnu', '--exclude-vcs', '-C', build_dir]
-        if self.config.get('tar', {}).get('ignore', []):
-            for patt in self.config['tar']['ignore']:
-                args += ['--exclude', patt]
-        if add_args:
-            args += add_args
-        args += ['-c', input_dir]
+        if include_submodules:
+            subprocess.check_call(['/usr/bin/git', 'config', 
'submodule.active', 'false'])
         logging.debug("Creating %s", filename)
-        tar_proc = subprocess.Popen(args, stdout=subprocess.PIPE)
-        gzip_proc = subprocess.Popen(['gzip', '-9'], stdin=tar_proc.stdout,
-                                     stdout=out_file)
+        tar_proc = subprocess.Popen(
+            ['/usr/bin/git', 'archive', '--format', 'tar.gz', '-9', '-o', 
filename, 'HEAD'])
 
-        if tar_proc.wait() != 0 or gzip_proc.wait() != 0:
-            logging.error("tar/gzip failed, exiting")
+        if tar_proc.wait() != 0:
+            logging.error("git-archive failed, exiting")
             sys.exit(1)
         out_file.close()
+        os.chdir(cwd)
         logging.info('%s written', filename)
         return filename
 
@@ -517,7 +507,7 @@
                 package='mediawiki-core-' + version.raw,
                 input_dir=package,
                 build_dir=build_dir,
-                add_args=ext_exclude)
+                include_submodules=False)
         ]
 
         # Patch

-- 
To view, visit https://gerrit.wikimedia.org/r/405347
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iac2d02e98128710b5dbc76fbe8e0202ac8b48fa8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/tools/release
Gerrit-Branch: master
Gerrit-Owner: Chad <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to