[Pkg-mozext-commits] [adblock-plus] 161/464: Added release automation for K-Meleon
David Prévot
taffit at moszumanska.debian.org
Tue Jul 22 20:44:13 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 9b033fb34eb5117b499a6e376b1ffa8a941ff2ae
Author: Wladimir Palant <trev at adblockplus.org>
Date: Fri May 20 15:58:12 2011 +0200
Added release automation for K-Meleon
---
build.py | 36 +++++++++++++----------
releaseAutomationKMeleon.py | 72 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 92 insertions(+), 16 deletions(-)
diff --git a/build.py b/build.py
index 495e9d4..0f2ddd8 100644
--- a/build.py
+++ b/build.py
@@ -225,21 +225,25 @@ def runReleaseAutomation(baseDir, scriptName, opts, args, type):
elif option in ('-d', '--downloads'):
downloadsRepo = value
- if len(args) == 0:
- print 'No version number specified for the release'
- usage(scriptName, type, 'release')
- return
- version = args[0]
- if re.search(r'[^\w\.]', version):
- print 'Wrong version number format'
- usage(scriptName, type, 'release')
- return
-
- if keyFile == None:
- print 'Warning: no key file specified, creating an unsigned release build\n'
-
- import buildtools.releaseAutomation as releaseAutomation
- releaseAutomation.run(baseDir, version, keyFile, downloadsRepo, buildtoolsRepo)
+ if type == 'gecko':
+ if len(args) == 0:
+ print 'No version number specified for the release'
+ usage(scriptName, type, 'release')
+ return
+ version = args[0]
+ if re.search(r'[^\w\.]', version):
+ print 'Wrong version number format'
+ usage(scriptName, type, 'release')
+ return
+
+ if keyFile == None:
+ print 'Warning: no key file specified, creating an unsigned release build\n'
+
+ import buildtools.releaseAutomation as releaseAutomation
+ releaseAutomation.run(baseDir, version, keyFile, downloadsRepo, buildtoolsRepo)
+ else:
+ import buildtools.releaseAutomationKMeleon as releaseAutomationKMeleon
+ releaseAutomationKMeleon.run(baseDir, downloadsRepo, buildtoolsRepo)
with addCommand(lambda baseDir, scriptName, opts, args, type: usage(scriptName, type), ('help', '-h', '--help')) as command:
command.shortDescription = 'Show this message'
@@ -282,7 +286,7 @@ with addCommand(runReleaseAutomation, 'release') as command:
command.addOption('File containing private key and certificates required to sign the release', short='k', long='key', value='file')
command.addOption('Directory containing downloads repository (if omitted ../downloads is assumed)', short='d', long='downloads', value='dir')
command.params = '[options] <version>'
- command.supportedTypes = ('gecko')
+ command.supportedTypes = ('gecko', 'kmeleon')
def processArgs(baseDir, args, type='gecko'):
global commands
diff --git a/releaseAutomationKMeleon.py b/releaseAutomationKMeleon.py
new file mode 100644
index 0000000..b1b0a65
--- /dev/null
+++ b/releaseAutomationKMeleon.py
@@ -0,0 +1,72 @@
+# coding: utf-8
+
+# The contents of this file are subject to the Mozilla Public License
+# Version 1.1 (the "License"); you may not use this file except in
+# compliance with the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+
+import os, re, subprocess, tarfile
+from StringIO import StringIO
+import buildtools.packager as packager
+import buildtools.packagerKMeleon as packagerKMeleon
+
+def run(baseDir, downloadsRepo, buildtoolsRepo):
+ baseExtDir = packagerKMeleon.getBaseExtensionDir(baseDir)
+
+ # Read extension name, version and branch name
+ locales = packager.readLocaleMetadata(baseExtDir, [packager.defaultLocale])
+ extensionName = locales[packager.defaultLocale]['name'] + ' for K-Meleon'
+
+ metadata = packager.readMetadata(baseExtDir)
+ metadata.read(packager.getMetadataPath(baseDir))
+ branchName = metadata.get('general', 'branchname')
+ version = metadata.get('general', 'version')
+
+ # Tag our source repository
+ subprocess.Popen(['hg', 'tag', '-R', baseDir, '-f', version]).communicate()
+
+ # Create a release build
+ buildPath = os.path.join(downloadsRepo, packager.getDefaultFileName(baseDir, metadata, version, 'zip'))
+ packagerKMeleon.createBuild(baseDir, outFile=buildPath, releaseBuild=True)
+
+ # 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, dummy) = subprocess.Popen(['hg', 'archive', '-R', baseDir, '-t', 'tar', '-X', os.path.join(baseDir, '.hgtags'), '-'], stdout=subprocess.PIPE).communicate()
+ repoArchive = tarfile.open(fileobj=StringIO(data), mode='r:')
+ for fileInfo in repoArchive:
+ fileData = repoArchive.extractfile(fileInfo)
+ fileInfo.name = re.sub(r'^[^/]+/', '', fileInfo.name)
+ archive.addfile(fileInfo, fileData)
+ repoArchive.close()
+ (data, dummy) = subprocess.Popen(['hg', 'archive', '-R', buildtoolsRepo, '-t', 'tar', '-X', os.path.join(buildtoolsRepo, '.hgtags'), '-'], stdout=subprocess.PIPE).communicate()
+ repoArchive = tarfile.open(fileobj=StringIO(data), mode='r:')
+ for fileInfo in repoArchive:
+ fileData = repoArchive.extractfile(fileInfo)
+ fileInfo.name = re.sub(r'^[^/]+/', 'buildtools/', fileInfo.name)
+ archive.addfile(fileInfo, fileData)
+ (data, dummy) = subprocess.Popen(['hg', 'archive', '-R', baseExtDir, '-t', 'tar', '-X', os.path.join(baseExtDir, '.hgtags'), '-'], stdout=subprocess.PIPE).communicate()
+ repoArchive = tarfile.open(fileobj=StringIO(data), mode='r:')
+ for fileInfo in repoArchive:
+ fileData = repoArchive.extractfile(fileInfo)
+ fileInfo.name = re.sub(r'^[^/]+/', '%s/' % os.path.basename(baseExtDir), fileInfo.name)
+ archive.addfile(fileInfo, fileData)
+ repoArchive.close()
+ archive.close()
+ archiveHandle.close()
+
+ # Now add the downloads, commit and tag the downloads repo
+ tagName = '%s_%s_RELEASE' % (branchName, version.replace('.', '_'))
+ subprocess.Popen(['hg', 'add', '-R', downloadsRepo, buildPath, archivePath]).communicate()
+ subprocess.Popen(['hg', 'commit', '-R', downloadsRepo, '-m', 'Releasing %s %s' % (extensionName, version)]).communicate()
+ subprocess.Popen(['hg', 'tag', '-R', downloadsRepo, '-f', tagName]).communicate()
+
+ # Tag buildtools repository as well
+ subprocess.Popen(['hg', 'tag', '-R', buildtoolsRepo, '-f', tagName]).communicate()
+
+ # Push all changes
+ subprocess.Popen(['hg', 'push', '-R', baseDir]).communicate()
+ subprocess.Popen(['hg', 'push', '-R', downloadsRepo]).communicate()
+ subprocess.Popen(['hg', 'push', '-R', buildtoolsRepo]).communicate()
--
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