Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: sitescripts/extensions/bin/createNightlies.py

Issue 29366797: Issue 4697 - Add support for WebExtension-based Firefox development builds (Closed) Base URL: https://hg.adblockplus.org/sitescripts
Patch Set: Updated tests and update manifest generation Created Dec. 5, 2016, 11:21 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « .sitescripts.example ('k') | sitescripts/extensions/bin/updateUpdateManifests.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sitescripts/extensions/bin/createNightlies.py
===================================================================
--- a/sitescripts/extensions/bin/createNightlies.py
+++ b/sitescripts/extensions/bin/createNightlies.py
@@ -165,16 +165,22 @@ class NightlyBuild(object):
self.buildNum)
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('/')
self.compat.append({'id': value, 'minVersion': minVersion, 'maxVersion': maxVersion})
+ if metadata.has_option('compat', 'gecko'):
+ self.compat.append({
+ 'id': 'gecko',
+ 'minVersion': metadata.get('compat', 'gecko')
+ })
+
def readAndroidMetadata(self):
"""
Read Android-specific metadata from AndroidManifest.xml file.
"""
manifestFile = open(os.path.join(self.tempdir, 'AndroidManifest.xml'), 'r')
manifest = parseXml(manifestFile)
manifestFile.close()
@@ -223,25 +229,31 @@ class NightlyBuild(object):
self.version = packager.getBuildVersion(self.tempdir, metadata, False,
self.buildNum)
self.shortVersion = metadata.get('general', 'version')
self.basename = metadata.get('general', 'basename')
self.updatedFromGallery = False
def writeUpdateManifest(self):
"""
- Writes update.rdf file for the current build
+ Writes update manifest for the current build
"""
baseDir = os.path.join(self.config.nightliesDirectory, self.basename)
if self.config.type == 'safari':
manifestPath = os.path.join(baseDir, 'updates.plist')
templateName = 'safariUpdateManifest'
+ autoescape = True
elif self.config.type == 'android':
manifestPath = os.path.join(baseDir, 'updates.xml')
templateName = 'androidUpdateManifest'
+ autoescape = True
+ elif self.config.type == 'gecko-webext':
+ manifestPath = os.path.join(baseDir, 'updates.json')
+ templateName = 'geckoUpdateManifest'
+ autoescape = False
else:
return
if not os.path.exists(baseDir):
os.makedirs(baseDir)
# ABP for Android used to have its own update manifest format. We need to
# generate both that and the new one in the libadblockplus format as long
@@ -249,17 +261,18 @@ class NightlyBuild(object):
if self.config.type == 'android':
newManifestPath = os.path.join(baseDir, 'update.json')
writeAndroidUpdateManifest(newManifestPath, [{
'basename': self.basename,
'version': self.version,
'updateURL': self.updateURL
}])
- template = get_template(get_config().get('extensions', templateName))
+ template = get_template(get_config().get('extensions', templateName),
+ autoescape=autoescape)
template.stream({'extensions': [self]}).dump(manifestPath)
def writeIEUpdateManifest(self, versions):
"""
Writes update.json file for the latest IE build
"""
if len(versions) == 0:
return
@@ -320,17 +333,17 @@ class NightlyBuild(object):
else:
env = os.environ
spiderMonkeyBinary = self.config.spiderMonkeyBinary
if spiderMonkeyBinary:
env = dict(env, SPIDERMONKEY_BINARY=spiderMonkeyBinary)
command = [os.path.join(self.tempdir, 'build.py'),
'-t', self.config.type, 'build', '-b', self.buildNum]
- if self.config.type != 'gecko':
+ if self.config.type not in {'gecko', 'gecko-webext'}:
command.extend(['-k', self.config.keyFile])
command.append(self.path)
subprocess.check_call(command, env=env)
if not os.path.exists(self.path):
raise Exception("Build failed, output file hasn't been created")
linkPath = os.path.join(baseDir, '00latest%s' % self.config.packageSuffix)
@@ -523,18 +536,20 @@ class NightlyBuild(object):
# get meta data from the repository
if self.config.type == 'android':
self.readAndroidMetadata()
elif self.config.type == 'chrome':
self.readChromeMetadata()
elif self.config.type == 'safari':
self.readSafariMetadata()
+ elif self.config.type in {'gecko', 'gecko-webext'}:
+ self.readGeckoMetadata()
else:
- self.readGeckoMetadata()
+ raise Exception('Unknown build type {}' % self.config.type)
# create development build
self.build()
# write out changelog
self.writeChangelog(self.getChanges())
# write update manifest
@@ -548,17 +563,19 @@ class NightlyBuild(object):
self.writeIEUpdateManifest(versions)
# update index page
self.updateIndex(versions)
# update nightlies config
self.config.latestRevision = self.revision
- if self.config.type == 'gecko' and self.config.galleryID and get_config().has_option('extensions', 'amo_key'):
+ if (self.config.type in {'gecko', 'gecko-webext'} and
+ self.config.galleryID and
+ get_config().has_option('extensions', 'amo_key')):
self.uploadToMozillaAddons()
elif self.config.type == 'chrome' and self.config.clientID and self.config.clientSecret and self.config.refreshToken:
self.uploadToChromeWebStore()
finally:
# clean up
if self.tempdir:
shutil.rmtree(self.tempdir, ignore_errors=True)
« no previous file with comments | « .sitescripts.example ('k') | sitescripts/extensions/bin/updateUpdateManifests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld