[Pkg-mozext-commits] [adblock-plus] 401/464: Added Chrome/Opera release automation

David Prévot taffit at moszumanska.debian.org
Tue Jul 22 20:44:37 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 cd44c47593305b821300b61f1007b6f233668c22
Author: Wladimir Palant <trev at adblockplus.org>
Date:   Mon Sep 2 09:35:42 2013 +0200

    Added Chrome/Opera release automation
    
    --HG--
    rename : releaseAutomationGecko.py => releaseAutomation.py
    extra : rebase_source : 827b621b0902bed7b91a0781f0b0236602b5f662
---
 build.py                                          | 34 ++++++++--------
 releaseAutomationGecko.py => releaseAutomation.py | 47 ++++++++++++++++++-----
 2 files changed, 57 insertions(+), 24 deletions(-)

diff --git a/build.py b/build.py
index 1f3f66a..4db8f94 100644
--- a/build.py
+++ b/build.py
@@ -391,22 +391,26 @@ def runReleaseAutomation(baseDir, scriptName, opts, args, type):
     elif option in ('-d', '--downloads'):
       downloadsRepo = value
 
-  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'
+  if len(args) == 0:
+    print 'No version number specified for the release'
+    usage(scriptName, type, 'release')
+    return
+  version = args[0]
+  if re.search(r'[^\d\.]', version):
+    print 'Wrong version number format'
+    usage(scriptName, type, 'release')
+    return
+
+  if keyFile == None:
+    if type == "gecko":
+      print >>sys.stderr, "Warning: no key file specified, creating an unsigned release build\n"
+    else:
+      print >>sys.stderr, "Error: key file is required for the release"
       usage(scriptName, type, 'release')
       return
 
-    if keyFile == None:
-      print 'Warning: no key file specified, creating an unsigned release build\n'
-
-    import buildtools.releaseAutomationGecko as releaseAutomation
-    releaseAutomation.run(baseDir, type, version, keyFile, downloadsRepo)
+  import buildtools.releaseAutomation as releaseAutomation
+  releaseAutomation.run(baseDir, type, version, keyFile, downloadsRepo)
 
 def updatePSL(baseDir, scriptName, opts, args, type):
   import buildtools.publicSuffixListUpdater as publicSuffixListUpdater
@@ -484,10 +488,10 @@ with addCommand(runReleaseAutomation, 'release') as command:
     'probably don\'t want to run this!\n\n'\
     'Runs release automation: creates downloads for the new version, tags '\
     'source code repository as well as downloads and buildtools repository.'
-  command.addOption('File containing private key and certificates required to sign the release', short='k', long='key', value='file', types=('gecko'))
+  command.addOption('File containing private key and certificates required to sign the release', short='k', long='key', value='file', types=('gecko', 'chrome'))
   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', 'chrome')
 
 with addCommand(updatePSL, 'updatepsl') as command:
   command.shortDescription = 'Updates Public Suffix List'
diff --git a/releaseAutomationGecko.py b/releaseAutomation.py
similarity index 54%
rename from releaseAutomationGecko.py
rename to releaseAutomation.py
index b44d5fd..87d92b8 100644
--- a/releaseAutomationGecko.py
+++ b/releaseAutomation.py
@@ -15,11 +15,15 @@
 # You should have received a copy of the GNU General Public License
 # along with Adblock Plus.  If not, see <http://www.gnu.org/licenses/>.
 
-import os, re, subprocess, tarfile
+import os, re, codecs, subprocess, tarfile, json
 from StringIO import StringIO
-import buildtools.packagerGecko as packager
 
 def run(baseDir, type, version, keyFile, downloadsRepo):
+  if type == "gecko":
+    import buildtools.packagerGecko as packager
+  elif type == "chrome":
+    import buildtools.packagerChrome as packager
+
   # Replace version number in metadata file "manually", ConfigParser will mess
   # up the order of lines.
   handle = open(packager.getMetadataPath(baseDir, type), 'rb')
@@ -31,19 +35,43 @@ def run(baseDir, type, version, keyFile, downloadsRepo):
   handle.write(rawMetadata)
   handle.close()
 
-  # Read extension name and branch name
-  locales = packager.readLocaleMetadata(baseDir, [packager.defaultLocale])
-  extensionName = locales[packager.defaultLocale]['name']
+  # Read extension name from locale data
+  import buildtools.packagerGecko as packagerGecko
+  if type == "gecko":
+    locales_base = baseDir
+  else:
+    # This is somewhat of a hack but reading out locale import config here would be too much
+    locales_base = os.path.join(baseDir, "adblockplus")
 
-  metadata = packager.readMetadata(baseDir, type)
+  locales = packagerGecko.readLocaleMetadata(locales_base, [packagerGecko.defaultLocale])
+  extensionName = locales[packagerGecko.defaultLocale]['name']
 
   # Now commit the change and tag it
   subprocess.check_call(['hg', 'commit', '-R', baseDir, '-m', 'Releasing %s %s' % (extensionName, version)])
   subprocess.check_call(['hg', 'tag', '-R', baseDir, '-f', version])
 
   # Create a release build
-  buildPath = os.path.join(downloadsRepo, packager.getDefaultFileName(baseDir, metadata, version, 'xpi'))
-  packager.createBuild(baseDir, type=type, outFile=buildPath, releaseBuild=True, keyFile=keyFile)
+  downloads = []
+  if type == "gecko":
+    metadata = packager.readMetadata(baseDir, type)
+    buildPath = os.path.join(downloadsRepo, packager.getDefaultFileName(baseDir, metadata, version, 'xpi'))
+    packager.createBuild(baseDir, type=type, outFile=buildPath, releaseBuild=True, keyFile=keyFile)
+    downloads.append(buildPath)
+  elif type == "chrome":
+    # We actually have to create three different builds for Chrome: signed a unsigned Chrome builds
+    # (the latter for Chrome Web Store) and a signed Opera build.
+    metadata = packager.readMetadata(baseDir, type)
+    buildPath = os.path.join(downloadsRepo, packager.getDefaultFileName(baseDir, metadata, version, 'crx'))
+    packager.createBuild(baseDir, type=type, outFile=buildPath, releaseBuild=True, keyFile=keyFile)
+    downloads.append(buildPath)
+
+    buildPathUnsigned = os.path.join(baseDir, packager.getDefaultFileName(baseDir, metadata, version, 'zip'))
+    packager.createBuild(baseDir, type=type, outFile=buildPathUnsigned, releaseBuild=True, keyFile=None)
+
+    metadataOpera = packager.readMetadata(baseDir, "opera")
+    buildPathOpera = os.path.join(downloadsRepo, packager.getDefaultFileName(baseDir, metadataOpera, version, 'crx'))
+    packager.createBuild(baseDir, type="opera", outFile=buildPathOpera, releaseBuild=True, keyFile=keyFile)
+    downloads.append(buildPathOpera)
 
   # Create source archive
   archivePath = os.path.splitext(buildPath)[0] + '-source.tgz'
@@ -61,9 +89,10 @@ def run(baseDir, type, version, keyFile, downloadsRepo):
   repoArchive.close()
   archive.close()
   archiveHandle.close()
+  downloads.append(archivePath)
 
   # Now add the downloads and commit
-  subprocess.check_call(['hg', 'add', '-R', downloadsRepo, buildPath, archivePath])
+  subprocess.check_call(['hg', 'add', '-R', downloadsRepo] + downloads)
   subprocess.check_call(['hg', 'commit', '-R', downloadsRepo, '-m', 'Releasing %s %s' % (extensionName, version)])
 
   # Push all changes

-- 
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