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

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

Issue 29589674: Issue 5942 - don't create Gecko update manifests (Closed)
Patch Set: Removing further unused code Created Oct. 26, 2017, 10:35 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
OLDNEW
1 # This file is part of the Adblock Plus web scripts, 1 # This file is part of the Adblock Plus web scripts,
2 # Copyright (C) 2006-present eyeo GmbH 2 # Copyright (C) 2006-present eyeo GmbH
3 # 3 #
4 # Adblock Plus is free software: you can redistribute it and/or modify 4 # Adblock Plus is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as 5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation. 6 # published by the Free Software Foundation.
7 # 7 #
8 # Adblock Plus is distributed in the hope that it will be useful, 8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details. 11 # GNU General Public License for more details.
12 # 12 #
13 # You should have received a copy of the GNU General Public License 13 # You should have received a copy of the GNU General Public License
14 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 14 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
15 15
16 """ 16 """
17 Generate update manifests 17 Generate update manifests
18 ========================= 18 =========================
19 19
20 This script generates update manifests for all extensions and apps 20 This script generates update manifests for all extensions and apps
21 """ 21 """
22 22
23 import os 23 import os
24 import re 24 import re
25 import sys 25 import sys
26 import subprocess 26 import subprocess
27 import xml.dom.minidom as dom 27 import xml.dom.minidom as dom
28 from ConfigParser import SafeConfigParser 28 from ConfigParser import SafeConfigParser
29 29
30 from buildtools.packagerGecko import KNOWN_APPS
31 from buildtools.packagerSafari import get_developer_identifier 30 from buildtools.packagerSafari import get_developer_identifier
32 from buildtools.xarfile import read_certificates_and_key 31 from buildtools.xarfile import read_certificates_and_key
33 32
34 from sitescripts.utils import get_config, get_template 33 from sitescripts.utils import get_config, get_template
35 from sitescripts.extensions.utils import ( 34 from sitescripts.extensions.utils import (
36 Configuration, getDownloadLinks, 35 Configuration, getDownloadLinks,
37 writeIEUpdateManifest, writeAndroidUpdateManifest) 36 writeIEUpdateManifest, writeAndroidUpdateManifest)
38 37
39 38
40 def get_min_sdk_version(repo, version): 39 def get_min_sdk_version(repo, version):
(...skipping 23 matching lines...) Expand all
64 metadata = repo.readMetadata(version) 63 metadata = repo.readMetadata(version)
65 certs = read_certificates_and_key(repo.keyFile)[0] 64 certs = read_certificates_and_key(repo.keyFile)[0]
66 65
67 return { 66 return {
68 'certificateID': get_developer_identifier(certs), 67 'certificateID': get_developer_identifier(certs),
69 'version': version, 68 'version': version,
70 'shortVersion': version, 69 'shortVersion': version,
71 'basename': metadata.get('general', 'basename'), 70 'basename': metadata.get('general', 'basename'),
72 'updatedFromGallery': True 71 'updatedFromGallery': True
73 } 72 }
74 elif repo.type == 'gecko':
75 metadata = repo.readMetadata(version)
76 result = {
77 'extensionID': metadata.get('general', 'id'),
78 'version': version,
79 'compat': []
80 }
81 for key, value in KNOWN_APPS.iteritems():
82 if metadata.has_option('compat', key):
83 minVersion, maxVersion = metadata.get('compat', key).split('/')
84 result['compat'].append({'id': value, 'minVersion': minVersion, 'maxVersion': maxVersion})
85 return result
86 elif repo.type == 'ie': 73 elif repo.type == 'ie':
87 return { 74 return {
88 'version': version, 75 'version': version,
89 'basename': os.path.basename(repo.repository) 76 'basename': os.path.basename(repo.repository)
90 } 77 }
91 else: 78 else:
92 raise Exception('unknown repository type %r' % repo.type) 79 raise Exception('unknown repository type %r' % repo.type)
93 80
94 81
95 def writeUpdateManifest(links): 82 def writeUpdateManifest(links):
96 """ 83 """
97 writes an update manifest for all extensions and Android apps 84 writes an update manifest for all extensions and Android apps
98 """ 85 """
99 86
100 extensions = {'gecko': [], 'android': [], 'safari': [], 'ie': []} 87 extensions = {'android': [], 'safari': [], 'ie': []}
101 for repo in Configuration.getRepositoryConfigurations(): 88 for repo in Configuration.getRepositoryConfigurations():
102 if repo.type not in extensions or not links.has_section(repo.repositoryN ame): 89 if repo.type not in extensions or not links.has_section(repo.repositoryN ame):
103 continue 90 continue
104 data = readMetadata(repo, links.get(repo.repositoryName, 'version')) 91 data = readMetadata(repo, links.get(repo.repositoryName, 'version'))
105 data['updateURL'] = links.get(repo.repositoryName, 'downloadURL') 92 data['updateURL'] = links.get(repo.repositoryName, 'downloadURL')
106 if data['updateURL'].startswith(repo.downloadsURL): 93 if data['updateURL'].startswith(repo.downloadsURL):
107 data['updateURL'] += '?update' 94 data['updateURL'] += '?update'
108 extensions[repo.type].append(data) 95 extensions[repo.type].append(data)
109 96
110 if len(extensions['android']) > 1: 97 if len(extensions['android']) > 1:
(...skipping 21 matching lines...) Expand all
132 updates all update manifests with the current versions 119 updates all update manifests with the current versions
133 """ 120 """
134 121
135 parser = SafeConfigParser() 122 parser = SafeConfigParser()
136 getDownloadLinks(parser) 123 getDownloadLinks(parser)
137 writeUpdateManifest(parser) 124 writeUpdateManifest(parser)
138 125
139 126
140 if __name__ == '__main__': 127 if __name__ == '__main__':
141 updateUpdateManifests() 128 updateUpdateManifests()
OLDNEW

Powered by Google App Engine
This is Rietveld