def writeUpdateManifest(self): """ Writes update.rdf file 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' 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 # as a significant amount of users is on an old version. if self.config.type == 'android': newManifestPath = os.path.join(baseDir, 'update.json') writeAndroidUpdateManifest(newManifestPath, [{ 'basename': self.basename, 'version': self.version, 'updateURL': self.updateURL }]) template = get_template(get_config().get('extensions', templateName)) template.stream({'extensions': [self]}).dump(manifestPath)
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 writeUpdateManifest(self): """ 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' autoescape = True elif self.config.type == 'android': manifestPath = os.path.join(baseDir, 'updates.xml') templateName = 'androidUpdateManifest' autoescape = True 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 # as a significant amount of users is on an old version. if self.config.type == 'android': newManifestPath = os.path.join(baseDir, 'update.json') writeAndroidUpdateManifest(newManifestPath, [{ 'basename': self.basename, 'version': self.version, 'updateURL': self.updateURL, }]) template = get_template(get_config().get('extensions', templateName), autoescape=autoescape) template.stream({'extensions': [self]}).dump(manifestPath)
def writeUpdateManifest(self): """ Writes update.rdf file for the current build """ baseDir = os.path.join(self.config.nightliesDirectory, self.basename) if not os.path.exists(baseDir): os.makedirs(baseDir) if self.config.type == 'chrome' or self.config.type == 'opera': manifestPath = os.path.join(baseDir, "updates.xml") templateName = 'chromeUpdateManifest' elif 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' # 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. newManifestPath = os.path.join(baseDir, "update.json") writeAndroidUpdateManifest(newManifestPath, [{ 'basename': self.basename, 'version': self.version, 'updateURL': self.updateURL }]) else: manifestPath = os.path.join(baseDir, "update.rdf") templateName = 'geckoUpdateManifest' template = get_template(get_config().get('extensions', templateName)) template.stream({'extensions': [self]}).dump(manifestPath)
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)