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

Side by Side Diff: sitescripts/extensions/bin/updateUpdateManifests.py

Issue 6349778342379520: Issue 1048 - Fix Android update manifest format (Closed)
Patch Set: Created Sept. 18, 2014, 3:42 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # coding: utf-8 1 # coding: utf-8
2 2
3 # This file is part of the Adblock Plus web scripts, 3 # This file is part of the Adblock Plus web scripts,
4 # Copyright (C) 2006-2014 Eyeo GmbH 4 # Copyright (C) 2006-2014 Eyeo GmbH
5 # 5 #
6 # Adblock Plus is free software: you can redistribute it and/or modify 6 # Adblock Plus is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License version 3 as 7 # it under the terms of the GNU General Public License version 3 as
8 # published by the Free Software Foundation. 8 # published by the Free Software Foundation.
9 # 9 #
10 # Adblock Plus is distributed in the hope that it will be useful, 10 # Adblock Plus is distributed in the hope that it will be useful,
(...skipping 27 matching lines...) Expand all
38 reads extension ID and compatibility information from metadata file in the 38 reads extension ID and compatibility information from metadata file in the
39 extension's repository 39 extension's repository
40 """ 40 """
41 if repo.type == 'android': 41 if repo.type == 'android':
42 command = ['hg', '-R', repo.repository, 'id', '-r', version, '-n'] 42 command = ['hg', '-R', repo.repository, 'id', '-r', version, '-n']
43 result = subprocess.check_output(command) 43 result = subprocess.check_output(command)
44 revision = re.sub(r'\D', '', result) 44 revision = re.sub(r'\D', '', result)
45 45
46 return { 46 return {
47 'revision': revision, 47 'revision': revision,
48 'version': version,
48 'minSdkVersion': get_min_sdk_version(repo, version), 49 'minSdkVersion': get_min_sdk_version(repo, version),
49 } 50 }
50 elif repo.type == 'safari': 51 elif repo.type == 'safari':
51 metadata = repo.readMetadata(version) 52 metadata = repo.readMetadata(version)
52 return { 53 return {
53 'certificateID': getSafariCertificateID(repo.keyFile), 54 'certificateID': getSafariCertificateID(repo.keyFile),
54 'version': version, 55 'version': version,
55 'shortVersion': version, 56 'shortVersion': version,
56 'basename': metadata.get('general', 'basename'), 57 'basename': metadata.get('general', 'basename'),
57 } 58 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 manifestPath = get_config().get('extensions', '%sUpdateManifestPath' % repoT ype) 98 manifestPath = get_config().get('extensions', '%sUpdateManifestPath' % repoT ype)
98 if repoType == 'ie': 99 if repoType == 'ie':
99 writeIEUpdateManifest(manifestPath, extensions[repoType]) 100 writeIEUpdateManifest(manifestPath, extensions[repoType])
100 else: 101 else:
101 # ABP for Android used to have its own update manifest format. We need to 102 # ABP for Android used to have its own update manifest format. We need to
102 # generate both that and the new one in the libadblockplus format as long 103 # generate both that and the new one in the libadblockplus format as long
103 # as a significant amount of users is on an old version. 104 # as a significant amount of users is on an old version.
104 if repoType == 'android': 105 if repoType == 'android':
105 newManifestPath = get_config().get("extensions", 106 newManifestPath = get_config().get("extensions",
106 "androidNewUpdateManifestPath") 107 "androidNewUpdateManifestPath")
107 writeLibabpUpdateManifest(newManifestPath, extensions[repoType]) 108 data = extensions[repoType][0]
109 updates = {
110 'adblockplusandroid': {
Wladimir Palant 2014/09/18 18:49:40 This shouldn't be hardcoded. Please add a basename
Felix Dahlke 2014/09/19 02:25:52 Done.
111 'version': data['version'],
112 'url': data['updateURL']
113 }
114 }
115 writeLibabpUpdateManifest(newManifestPath, updates)
116 del data['version']
Wladimir Palant 2014/09/18 18:49:40 This shouldn't be necessary, the template will ign
Felix Dahlke 2014/09/19 02:25:52 Done.
108 template = get_template(get_config().get('extensions', '%sUpdateManifest' % repoType)) 117 template = get_template(get_config().get('extensions', '%sUpdateManifest' % repoType))
109 template.stream({'extensions': extensions[repoType]}).dump(manifestPath) 118 template.stream({'extensions': extensions[repoType]}).dump(manifestPath)
110 119
111 def updateUpdateManifests(): 120 def updateUpdateManifests():
112 """ 121 """
113 updates all update manifests with the current versions 122 updates all update manifests with the current versions
114 """ 123 """
115 124
116 parser = SafeConfigParser() 125 parser = SafeConfigParser()
117 getDownloadLinks(parser) 126 getDownloadLinks(parser)
118 writeUpdateManifest(parser) 127 writeUpdateManifest(parser)
119 128
120 if __name__ == "__main__": 129 if __name__ == "__main__":
121 updateUpdateManifests() 130 updateUpdateManifests()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld