def writeUpdateManifest(links): """ writes an update manifest for all extensions and Android apps """ extensions = {'gecko': [], 'android': [], 'safari': [], 'ie': []} for repo in Configuration.getRepositoryConfigurations(): if repo.type not in extensions or not links.has_section(repo.repositoryName): continue data = readMetadata(repo, links.get(repo.repositoryName, 'version')) data['updateURL'] = links.get(repo.repositoryName, 'downloadURL') if data['updateURL'].startswith(repo.downloadsURL): data['updateURL'] += "?update" extensions[repo.type].append(data) if len(extensions['android']) > 1: print >>sys.stderr, 'Warning: more than one Android app defined, update manifest only works for one' for repoType in extensions.iterkeys(): manifestPath = get_config().get('extensions', '%sUpdateManifestPath' % repoType) if repoType == 'ie': writeIEUpdateManifest(manifestPath, extensions[repoType]) else: # 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 # as a significant amount of users is on an old version. if repoType == 'android': newManifestPath = get_config().get("extensions", "androidNewUpdateManifestPath") writeAndroidUpdateManifest(newManifestPath, extensions[repoType]) template = get_template(get_config().get('extensions', '%sUpdateManifest' % repoType)) template.stream({'extensions': extensions[repoType]}).dump(manifestPath)
def main(download=False): """ main function for createNightlies.py """ nightlyConfig = ConfigParser.SafeConfigParser() nightlyConfigFile = get_config().get('extensions', 'nightliesData') if os.path.exists(nightlyConfigFile): nightlyConfig.read(nightlyConfigFile) # build all extensions specified in the configuration file # and generate changelogs and documentations for each: data = None for repo in Configuration.getRepositoryConfigurations(nightlyConfig): build = None try: build = NightlyBuild(repo) if download: build.download() elif build.hasChanges(): build.run() except Exception as ex: logging.error('The build for %s failed:', repo) logging.exception(ex) file = open(nightlyConfigFile, 'wb') nightlyConfig.write(file)
def getDownloadLinks(result): """ gets the download links for all extensions and puts them into the config object """ for repo in Configuration.getRepositoryConfigurations(): (downloadURL, version) = getDownloadLink(repo) if downloadURL == None: continue if not result.has_section(repo.repositoryName): result.add_section(repo.repositoryName) result.set(repo.repositoryName, "downloadURL", downloadURL) result.set(repo.repositoryName, "version", version) qrcode = getQRCode(downloadURL) if qrcode != None: result.set(repo.repositoryName, "qrcode", qrcode)
def writeUpdateManifest(links): """ writes an update manifest for all extensions and Android apps """ extensions = {'android': [], 'safari': [], 'ie': []} for repo in Configuration.getRepositoryConfigurations(): if repo.type not in extensions or not links.has_section( repo.repositoryName): continue data = readMetadata(repo, links.get(repo.repositoryName, 'version')) data['updateURL'] = links.get(repo.repositoryName, 'downloadURL') if data['updateURL'].startswith(repo.downloadsURL): data['updateURL'] += '?update' extensions[repo.type].append(data) if len(extensions['android']) > 1: print >> sys.stderr, 'Warning: more than one Android app defined, update manifest only works for one' for repoType in extensions.iterkeys(): manifestPath = get_config().get('extensions', '%sUpdateManifestPath' % repoType) if repoType == 'ie': writeIEUpdateManifest(manifestPath, extensions[repoType]) else: # 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 # as a significant amount of users is on an old version. if repoType == 'android': newManifestPath = get_config().get( 'extensions', 'androidNewUpdateManifestPath') writeAndroidUpdateManifest(newManifestPath, extensions[repoType]) path = get_config().get('extensions', '%sUpdateManifest' % repoType) template = get_template(path, autoescape=not path.endswith('.json')) template.stream({ 'extensions': extensions[repoType] }).dump(manifestPath)
def writeUpdateManifest(links): """ writes an update manifest for all Gecko extensions and Android apps """ extensions = {'gecko': [], 'android': []} for repo in Configuration.getRepositoryConfigurations(): if repo.type not in extensions or not links.has_section(repo.repositoryName): continue data = readMetadata(repo, links.get(repo.repositoryName, 'version')) data['updateURL'] = links.get(repo.repositoryName, 'downloadURL') if data['updateURL'].startswith(repo.downloadsURL): data['updateURL'] += "?update" extensions[repo.type].append(data) if len(extensions['android']) > 1: print >>sys.stderr, 'Warning: more than one Android app defined, update manifest only works for one' for repoType in extensions.iterkeys(): manifestPath = get_config().get('extensions', '%sUpdateManifestPath' % repoType) template = get_template(get_config().get('extensions', '%sUpdateManifest' % repoType)) template.stream({'extensions': extensions[repoType]}).dump(manifestPath)
def main(): """ main function for createNightlies.py """ setupStderr() nightlyConfig = ConfigParser.SafeConfigParser() nightlyConfigFile = get_config().get('extensions', 'nightliesData') if os.path.exists(nightlyConfigFile): nightlyConfig.read(nightlyConfigFile) # build all extensions specified in the configuration file # and generate changelogs and documentations for each: data = None for repo in Configuration.getRepositoryConfigurations(nightlyConfig): build = None try: build = NightlyBuild(repo) if build.hasChanges(): build.run() except Exception, ex: print >>sys.stderr, "The build for %s failed:" % repo traceback.print_exc()
def main(): """ main function for createNightlies.py """ nightlyConfig = ConfigParser.SafeConfigParser() nightlyConfigFile = get_config().get('extensions', 'nightliesData') if os.path.exists(nightlyConfigFile): nightlyConfig.read(nightlyConfigFile) # build all extensions specified in the configuration file # and generate changelogs and documentations for each: data = None for repo in Configuration.getRepositoryConfigurations(nightlyConfig): build = None try: build = NightlyBuild(repo) if build.hasChanges(): build.run() except Exception as ex: logging.error('The build for %s failed:', repo) logging.exception(ex) file = open(nightlyConfigFile, 'wb') nightlyConfig.write(file)
def writePadFile(links): for repo in Configuration.getRepositoryConfigurations(): if repo.pad and links.has_section(repo.repositoryName): PadFile.forRepository(repo, links.get(repo.repositoryName, 'version'), links.get(repo.repositoryName, 'downloadURL')).write()
def writePadFile(links): for repo in Configuration.getRepositoryConfigurations(): if repo.pad and links.has_section(repo.repositoryName): PadFile.forRepository( repo, links.get(repo.repositoryName, 'version'), links.get(repo.repositoryName, 'downloadURL')).write()