Skip to content

Commit

Permalink
Basic support for serving XML, not all attributes suppported
Browse files Browse the repository at this point in the history
  • Loading branch information
nthomas-mozilla committed Jul 9, 2012
1 parent 56a0917 commit bea9464
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "Firefox-13.0-build1",
"schema_version": 2,
"appVersion": "13.0",
"platforms": {
"WINNT_x86-msvc": {
"buildID": "20120601045813",
Expand Down
19 changes: 15 additions & 4 deletions auslib/AUS.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,21 @@ def createXML(self, updateQuery, release):
updateLine += ' detailsURL="%s"' % rel['detailsUrl']
updateLine += '>'
xml.append(updateLine)
for patch in sorted(rel['patches']):
xml.append(' <patch type="%s" URL="%s" hashFunction="%s" hashValue="%s" size="%s"/>' % \
(patch['type'], patch['URL'], patch['hashFunction'], patch['hashValue'], patch['size']))
xml.append(' </update>')

if rel['schema_version'] == 2:
updateLine=' <update type="%s" displayVersion="%s" appVersion="%s" platformVersion="%s" buildID="%s"' % \
(rel['type'], rel['displayVersion'], rel['appVersion'], rel['platformVersion'], rel['build'])
if rel['detailsUrl']:
updateLine += ' detailsURL="%s"' % rel['detailsUrl']
if rel['actions']:
updateLine += ' actions="%s"' % rel['actions']
updateLine += '>'
xml.append(updateLine)

for patch in sorted(rel['patches']):
xml.append(' <patch type="%s" URL="%s" hashFunction="%s" hashValue="%s" size="%s"/>' % \
(patch['type'], patch['URL'], patch['hashFunction'], patch['hashValue'], patch['size']))
xml.append(' </update>')
xml.append('</updates>')
# ensure valid xml by using the right entity for ampersand
payload = re.sub('&(?!amp;)','&amp;', '\n'.join(xml))
Expand Down
2 changes: 1 addition & 1 deletion AUS-server.py → balrog.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
options, args = parser.parse_args()

from auslib import log_format
from auslib.client.base import app, AUS
from auslib.web.base import app, AUS

log_level = logging.INFO
if options.verbose:
Expand Down
11 changes: 6 additions & 5 deletions test-rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ def populateDB(AUS, testdir):
# less accurate, but the best we can do.
version = data.get('appVersion', data.get('extv'))
if not version:
version = extv = data.get('platforms').values()[0].get('locales').values()[0]['extv']
if not extv:
raise Exception("Couldn't find extv for %s" % data['name'])
version = data.get('platforms').values()[0].get('locales').values()[0].get('extv')
if not version:
raise Exception("Couldn't find version for %s" % data['name'])
AUS.db.engine.execute("INSERT INTO releases VALUES ('%s', '%s', '%s','%s', 1)" %
(data['name'], product, version, json.dumps(data)))
# TODO - create a proper importer that walks the snippet store to find hashes ?
Expand Down Expand Up @@ -156,8 +156,9 @@ def isValidTestDir(d):
log_level = logging.INFO
if options.verbose:
log_level = logging.DEBUG

logging.basicConfig(level=log_level, format=log_format)
logging.basicConfig(level=log_level, format=log_format)
else:
logging.basicConfig(level=log_level, format="%(message)s")

if not options.testDirs:
for dirname in os.listdir('aus-data-snapshots'):
Expand Down

0 comments on commit bea9464

Please sign in to comment.