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

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

Issue 6291923287408640: Issue 1093 - Separate update manifest generation (Closed)
Patch Set: Created July 22, 2014, 8:03 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
Index: sitescripts/extensions/bin/updateUpdateManifests.py
===================================================================
new file mode 100644
--- /dev/null
+++ b/sitescripts/extensions/bin/updateUpdateManifests.py
@@ -0,0 +1,64 @@
+# coding: utf-8
+
+# This file is part of the Adblock Plus web scripts,
+# Copyright (C) 2006-2014 Eyeo GmbH
+#
+# Adblock Plus is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3 as
+# published by the Free Software Foundation.
+#
+# Adblock Plus is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
+
+"""
+Update update manifests
Wladimir Palant 2014/07/22 11:24:26 Generate update manifests?
Felix Dahlke 2014/07/22 12:01:11 Done.
+=======================
+
+ This script generates update manifests for all extensions and apps
+"""
+
+from ConfigParser import SafeConfigParser
+from sitescripts.extensions.utils import (Configuration, getDownloadLinks,
+ readMetadata)
+from sitescripts.utils import get_config, get_template
+
+def writeUpdateManifest(links):
Felix Dahlke 2014/07/22 08:11:11 This hasn't been changed, just moved. Since I kep
Wladimir Palant 2014/07/22 11:24:26 Quite a few more actually: elemhidehelper, abpcust
Felix Dahlke 2014/07/22 12:01:11 It doesn't look to me like we're generating update
Wladimir Palant 2014/07/22 18:41:22 We do, see https://adblockplus.org/update.rdf. Ext
+ """
+ writes an update manifest for all extensions and Android apps
+ """
+
+ extensions = {'gecko': [], 'android': [], 'safari': []}
+ 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))
+ print extensions[repoType]
Wladimir Palant 2014/07/22 11:24:26 Debug code?
Felix Dahlke 2014/07/22 12:01:11 Ouch, done.
+ template.stream({'extensions': extensions[repoType]}).dump(manifestPath)
+
+def updateUpdateManifests():
+ """
+ updates all update manifests with the current versions
+ """
+
+ parser = SafeConfigParser()
+ getDownloadLinks(parser)
+ writeUpdateManifest(parser)
+
+if __name__ == "__main__":
+ updateUpdateManifests()

Powered by Google App Engine
This is Rietveld