#!/usr/bin/python """ Outputs AUS data in various file formats. """ import os from aus import Release, Update, Patch from database import DatabaseHandler """ Outputs AUS-style directory and update.xml tree """ class Xml: def run(self): db = DatabaseHandler("aus") for release in db.getAllReleases(): dir = os.path.join(release.getProduct(), release.getVersion(), release.getBuildId(), release.getBuildTarget(), release.getLocale(), release.getChannel()) if not os.path.exists(dir): os.makedirs(dir) update = release.getUpdate() if update != None: complete_patch = update.getCompletePatch() partial_patch = update.getPartialPatch() if complete_patch != None and partial_patch != None: f = open(os.path.join(dir, "update.xml"), 'w') print >>f,'' print >>f,' >f,'detailsUrl="%s"' % (update.getDetailsUrl()), if update.getLicenseUrl() != None: print >>f,'licenseUrl="%s"' % (update.getLicenseUrl()), f.write('>\n') print >>f,' ' % (partial_patch.getType(), partial_patch.getUrl(), partial_patch.getHashFunction(), partial_patch.getHashValue(), partial_patch.getSize()) print >>f,' ' % (complete_patch.getType(), complete_patch.getUrl(), complete_patch.getHashFunction(), complete_patch.getHashValue(), complete_patch.getSize()) print >>f,'' f.close()