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: Created Dec. 5, 2016, 8:38 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
Index: sitescripts/extensions/bin/createNightlies.py
===================================================================
--- a/sitescripts/extensions/bin/createNightlies.py
+++ b/sitescripts/extensions/bin/createNightlies.py
@@ -165,16 +165,24 @@ 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'):
+ # As far as WebExtensions are concerned, Gecko currently means only
+ # Firefox
+ self.compat.append({
+ 'id': packager.KNOWN_APPS['firefox'],
+ '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 +231,28 @@ 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'
elif self.config.type == 'android':
manifestPath = os.path.join(baseDir, 'updates.xml')
templateName = 'androidUpdateManifest'
+ elif self.config.type == 'gecko-webext':
+ manifestPath = os.path.join(baseDir, 'update.rdf')
+ templateName = 'geckoUpdateManifest'
Wladimir Palant 2016/12/05 08:42:03 Note: the builds currently won't use that update m
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
@@ -320,17 +331,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 +534,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 +561,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')):
Wladimir Palant 2016/12/05 08:42:03 Overindenting seems to be the most readable approa
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)

Powered by Google App Engine
This is Rietveld