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

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

Issue 6282067956465664: Issue 399 - Added support for Safari to updateDownloadLinks (Closed)
Patch Set: Created April 30, 2014, 11:43 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/extensions/bin/createNightlies.py ('k') | sitescripts/extensions/utils.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sitescripts/extensions/bin/updateDownloadLinks.py
===================================================================
--- a/sitescripts/extensions/bin/updateDownloadLinks.py
+++ b/sitescripts/extensions/bin/updateDownloadLinks.py
@@ -28,7 +28,7 @@
from ConfigParser import SafeConfigParser
from StringIO import StringIO
from sitescripts.utils import get_config, get_template
-from sitescripts.extensions.utils import compareVersions, Configuration
+from sitescripts.extensions.utils import compareVersions, Configuration, getSafariCertificateID
from buildtools.packagerGecko import KNOWN_APPS
def urlencode(value):
@@ -106,7 +106,12 @@
highestURL = None
highestVersion = None
- prefix = os.path.basename(repo.repository) + '-'
+
+ if repo.type == 'android':
+ prefix = os.path.basename(repo.repository)
+ else:
+ prefix = readRawMetadata(repo).get('general', 'basename')
+ prefix += '-'
suffix = repo.packageSuffix
# go through the downloads repository looking for downloads matching this extension
@@ -170,6 +175,21 @@
if qrcode != None:
result.set(repo.repositoryName, "qrcode", qrcode)
+def readRawMetadata(repo, version='tip'):
+ files = subprocess.check_output(['hg', '-R', repo.repository, 'locate', '-r', version]).splitlines()
+ if 'metadata.%s' % repo.type in files:
+ command = ['hg', '-R', repo.repository, 'cat', '-r', version, os.path.join(repo.repository, 'metadata.%s' % repo.type)]
+ result = subprocess.check_output(command)
+ else:
+ # Fall back to platform-independent metadata file for now
+ command = ['hg', '-R', repo.repository, 'cat', '-r', version, os.path.join(repo.repository, 'metadata')]
+ result = subprocess.check_output(command)
Wladimir Palant 2014/04/30 11:50:57 Nit: You only copied that code but |result = subpr
Sebastian Noack 2014/04/30 12:21:45 Even better, just generating the manifest filename
+
+ parser = SafeConfigParser()
+ parser.readfp(StringIO(result))
+
+ return parser
+
def readMetadata(repo, version):
"""
reads extension ID and compatibility information from metadata file in the
@@ -189,27 +209,24 @@
'revision': revision,
'minSdkVersion': usesSdk.attributes["android:minSdkVersion"].value,
}
+ elif repo.type == 'safari':
+ metadata = readRawMetadata(repo, version)
+ return {
+ 'certificateID': getSafariCertificateID(repo.keyFile),
+ 'version': version,
+ 'shortVersion': version,
+ 'basename': metadata.get('general', 'basename'),
+ }
else:
Wladimir Palant 2014/04/30 11:50:57 Nit: Please check |repo.type == 'gecko'| explicitl
Sebastian Noack 2014/04/30 12:21:45 Done.
- files = subprocess.check_output(['hg', '-R', repo.repository, 'locate', '-r', version]).splitlines()
- if 'metadata.%s' % repo.type in files:
- command = ['hg', '-R', repo.repository, 'cat', '-r', version, os.path.join(repo.repository, 'metadata.%s' % repo.type)]
- result = subprocess.check_output(command)
- else:
- # Fall back to platform-independent metadata file for now
- command = ['hg', '-R', repo.repository, 'cat', '-r', version, os.path.join(repo.repository, 'metadata')]
- result = subprocess.check_output(command)
-
- parser = SafeConfigParser()
- parser.readfp(StringIO(result))
-
+ metadata = readRawMetadata(repo, version)
result = {
- 'extensionID': parser.get('general', 'id'),
+ 'extensionID': metadata.get('general', 'id'),
'version': version,
'compat': []
}
for key, value in KNOWN_APPS.iteritems():
- if parser.has_option('compat', key):
- minVersion, maxVersion = parser.get('compat', key).split('/')
+ if metadata.has_option('compat', key):
+ minVersion, maxVersion = metadata.get('compat', key).split('/')
result['compat'].append({'id': value, 'minVersion': minVersion, 'maxVersion': maxVersion})
return result
@@ -218,7 +235,7 @@
writes an update manifest for all Gecko extensions and Android apps
"""
- extensions = {'gecko': [], 'android': []}
+ extensions = {'gecko': [], 'android': [], 'safari': []}
for repo in Configuration.getRepositoryConfigurations():
if repo.type not in extensions or not links.has_section(repo.repositoryName):
continue
« no previous file with comments | « sitescripts/extensions/bin/createNightlies.py ('k') | sitescripts/extensions/utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld