| Index: sitescripts/extensions/bin/createNightlies.py |
| =================================================================== |
| --- a/sitescripts/extensions/bin/createNightlies.py |
| +++ b/sitescripts/extensions/bin/createNightlies.py |
| @@ -15,17 +15,16 @@ Nightly builds generation script |
| """ |
| import sys, os, os.path, subprocess, ConfigParser, traceback, json, hashlib |
| import tempfile, re, shutil, urlparse, pipes |
| from datetime import datetime |
| from xml.dom.minidom import parse as parseXml |
| from sitescripts.utils import get_config, setupStderr, get_template |
| from sitescripts.extensions.utils import compareVersions, Configuration |
| -import buildtools.packagerGecko as packager |
| MAX_BUILDS = 50 |
| class NightlyBuild(object): |
| """ |
| Performs the build process for an extension, |
| generating changelogs and documentation. |
| @@ -103,16 +102,17 @@ class NightlyBuild(object): |
| shutil.copyfile(changelogPath, linkPath) |
| def readMetadata(self): |
| """ |
| read the metadata file from a cloned repository |
| and parse id, version, basename and the compat section |
| out of the file |
| """ |
| + import buildtools.packagerGecko as packager |
| metadata = packager.readMetadata(self.tempdir) |
| self.extensionID = metadata.get("general", "id") |
| self.version = '%s.%s' % (metadata.get("general", "version"), self.revision) |
| self.basename = metadata.get("general", "basename") |
| self.compat = [] |
| for key, value in packager.KNOWN_APPS.iteritems(): |
| if metadata.has_option('compat', key): |
| minVersion, maxVersion = metadata.get('compat', key).split('/') |
| @@ -139,19 +139,18 @@ class NightlyBuild(object): |
| def readChromeMetadata(self): |
| """ |
| Read Chrome-specific metadata from manifest.json file. It will also |
| calculate extension ID from the private key. |
| """ |
| # Calculate extension ID from public key |
| # (see http://supercollider.dk/2010/01/calculating-chrome-extension-id-from-your-private-key-233) |
| - sys.path.append(self.tempdir) |
| - build = __import__('build') |
| - publicKey = build.getPublicKey(self.config.keyFile) |
| + import buildtools.packagerChrome as packager |
| + publicKey = packager.getPublicKey(self.config.keyFile) |
| hash = hashlib.sha256() |
| hash.update(publicKey) |
| self.extensionID = hash.hexdigest()[0:32] |
| self.extensionID = ''.join(map(lambda c: chr(97 + int(c, 16)), self.extensionID)) |
| # Now read manifest.json |
| manifestFile = open(os.path.join(self.tempdir, 'manifest.json'), 'rb') |
| manifest = json.load(manifestFile) |
| @@ -212,21 +211,20 @@ class NightlyBuild(object): |
| status = process.wait() |
| apkFile.close() |
| if status: |
| # clear broken output if any |
| # exception will be raised later |
| if os.path.exists(outputPath): |
| os.remove(outputPath) |
| elif self.config.type == 'chrome': |
| - buildCommand = ['python', os.path.join(self.tempdir, 'build.py'), '-k', self.config.keyFile, '-b', self.revision, outputPath] |
| - if self.config.experimental: |
| - buildCommand[-1:0] = ['--experimental'] |
| - subprocess.Popen(buildCommand, stdout=subprocess.PIPE).communicate() |
| + import buildtools.packagerChrome as packager |
| + packager.createBuild(self.tempdir, outFile=outputPath, buildNum=self.revision, keyFile=self.config.keyFile, experimentalAPI=self.config.experimental) |
| else: |
| + import buildtools.packagerGecko as packager |
| packager.createBuild(self.tempdir, outFile=outputPath, buildNum=self.revision, keyFile=self.config.keyFile) |
| if not os.path.exists(outputPath): |
| raise Exception("Build failed, output file hasn't been created") |
| linkPath = os.path.join(baseDir, '00latest%s' % self.config.packageSuffix) |
| if hasattr(os, 'symlink'): |
| if os.path.exists(linkPath): |