[Pkg-mozext-commits] [adblock-plus] 11/24: Issue 1363 - Make sure source code archives created by release automation consider the new dependencies mechanism

David Prévot taffit at moszumanska.debian.org
Mon Oct 20 02:15:23 UTC 2014


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

taffit pushed a commit to branch master
in repository adblock-plus.

commit 1624319b63d53c63881ca7f353728d3b130872ca
Author: Wladimir Palant <trev at adblockplus.org>
Date:   Thu Sep 11 21:05:49 2014 +0200

    Issue 1363 - Make sure source code archives created by release automation consider the new dependencies mechanism
    
    --HG--
    extra : amend_source : f35873b1a7d7da741f5ab96f2e00cfe55b4c437a
    extra : histedit_source : 1201ac5763e841583bedfca82d1735e94bf474ba
---
 releaseAutomation.py | 47 ++++++++++++++++++++++++++++++++---------------
 1 file changed, 32 insertions(+), 15 deletions(-)

diff --git a/releaseAutomation.py b/releaseAutomation.py
index 5f25dbf..969d822 100644
--- a/releaseAutomation.py
+++ b/releaseAutomation.py
@@ -5,7 +5,37 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 import os, re, codecs, subprocess, tarfile, json
-from StringIO import StringIO
+
+def get_dependencies(prefix, repos):
+  from ensure_dependencies import read_deps, safe_join
+  repo = repos[prefix]
+  deps = read_deps(repo)
+  if deps:
+    for subpath in deps:
+      if subpath.startswith('_'):
+        continue
+      depprefix = prefix + subpath + '/'
+      deppath = safe_join(repo, subpath)
+      repos[depprefix] = deppath
+      get_dependencies(depprefix, repos)
+
+def create_sourcearchive(repo, output):
+  with tarfile.open(output, mode='w:gz') as archive:
+    repos = {'': repo}
+    get_dependencies('', repos)
+    for prefix, path in repos.iteritems():
+      process = subprocess.Popen(['hg', 'archive', '-R', path, '-t', 'tar', '-S', '-'], stdout=subprocess.PIPE)
+      try:
+        with tarfile.open(fileobj=process.stdout, mode='r|') as repoarchive:
+          for fileinfo in repoarchive:
+            if os.path.basename(fileinfo.name) in ('.hgtags', '.hgignore'):
+              continue
+            filedata = repoarchive.extractfile(fileinfo)
+            fileinfo.name = re.sub(r'^[^/]+/', prefix, fileinfo.name)
+            archive.addfile(fileinfo, filedata)
+      finally:
+        process.stdout.close()
+        process.wait()
 
 def run(baseDir, type, version, keyFiles, downloadsRepo):
   if type == "gecko":
@@ -74,20 +104,7 @@ def run(baseDir, type, version, keyFiles, downloadsRepo):
 
   # Create source archive
   archivePath = os.path.splitext(buildPath)[0] + '-source.tgz'
-
-  archiveHandle = open(archivePath, 'wb')
-  archive = tarfile.open(fileobj=archiveHandle, name=os.path.basename(archivePath), mode='w:gz')
-  data = subprocess.check_output(['hg', 'archive', '-R', baseDir, '-t', 'tar', '-S', '-'])
-  repoArchive = tarfile.open(fileobj=StringIO(data), mode='r:')
-  for fileInfo in repoArchive:
-    if os.path.basename(fileInfo.name) in ('.hgtags', '.hgignore'):
-      continue
-    fileData = repoArchive.extractfile(fileInfo)
-    fileInfo.name = re.sub(r'^[^/]+/', '', fileInfo.name)
-    archive.addfile(fileInfo, fileData)
-  repoArchive.close()
-  archive.close()
-  archiveHandle.close()
+  create_sourcearchive(baseDir, archivePath)
   downloads.append(archivePath)
 
   # Now add the downloads and commit

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git



More information about the Pkg-mozext-commits mailing list