OLD | NEW |
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-2012 Eyeo GmbH | 4 # Copyright (C) 2006-2012 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 for change in result.split('\0\0'): | 80 for change in result.split('\0\0'): |
81 if change: | 81 if change: |
82 date, author, revision, description = change.split('\0') | 82 date, author, revision, description = change.split('\0') |
83 yield {'date': date, 'author': author, 'revision': revision, 'descriptio
n': description} | 83 yield {'date': date, 'author': author, 'revision': revision, 'descriptio
n': description} |
84 | 84 |
85 def copyRepository(self): | 85 def copyRepository(self): |
86 ''' | 86 ''' |
87 Create a repository copy in a temporary directory | 87 Create a repository copy in a temporary directory |
88 ''' | 88 ''' |
89 self.tempdir = tempfile.mkdtemp(prefix=self.config.repositoryName) | 89 self.tempdir = tempfile.mkdtemp(prefix=self.config.repositoryName) |
90 command = ['hg', 'archive', '-R', self.config.repository, '-r', 'default', s
elf.tempdir] | 90 command = ['hg', 'archive', '-S', '-R', self.config.repository, '-r', 'defau
lt', self.tempdir] |
91 subprocess.Popen(command).communicate() | 91 subprocess.Popen(command).communicate() |
92 | 92 |
93 def writeChangelog(self, changes): | 93 def writeChangelog(self, changes): |
94 """ | 94 """ |
95 write the changelog file into the cloned repository | 95 write the changelog file into the cloned repository |
96 """ | 96 """ |
97 baseDir = os.path.join(self.config.nightliesDirectory, self.basename) | 97 baseDir = os.path.join(self.config.nightliesDirectory, self.basename) |
98 if not os.path.exists(baseDir): | 98 if not os.path.exists(baseDir): |
99 os.makedirs(baseDir) | 99 os.makedirs(baseDir) |
100 changelogFile = "%s-%s.changelog.xhtml" % (self.basename, self.version) | 100 changelogFile = "%s-%s.changelog.xhtml" % (self.basename, self.version) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 while self.version.count('.') < 2: | 142 while self.version.count('.') < 2: |
143 self.version += '.0' | 143 self.version += '.0' |
144 self.version = '%s.%s' % (self.version, self.revision) | 144 self.version = '%s.%s' % (self.version, self.revision) |
145 | 145 |
146 usesSdk = manifest.getElementsByTagName('uses-sdk')[0] | 146 usesSdk = manifest.getElementsByTagName('uses-sdk')[0] |
147 self.minSdkVersion = usesSdk.attributes["android:minSdkVersion"].value | 147 self.minSdkVersion = usesSdk.attributes["android:minSdkVersion"].value |
148 self.basename = os.path.basename(self.config.repository) | 148 self.basename = os.path.basename(self.config.repository) |
149 | 149 |
150 def readChromeMetadata(self): | 150 def readChromeMetadata(self): |
151 """ | 151 """ |
152 Read Chrome-specific metadata from manifest.json file. It will also | 152 Read Chrome-specific metadata from metadata file. This will also |
153 calculate extension ID from the private key. | 153 calculate extension ID from the private key. |
154 """ | 154 """ |
155 | 155 |
156 # Calculate extension ID from public key | 156 # Calculate extension ID from public key |
157 # (see http://supercollider.dk/2010/01/calculating-chrome-extension-id-from-
your-private-key-233) | 157 # (see http://supercollider.dk/2010/01/calculating-chrome-extension-id-from-
your-private-key-233) |
158 import buildtools.packagerChrome as packager | 158 import buildtools.packagerChrome as packager |
159 publicKey = packager.getPublicKey(self.config.keyFile) | 159 publicKey = packager.getPublicKey(self.config.keyFile) |
160 hash = hashlib.sha256() | 160 hash = hashlib.sha256() |
161 hash.update(publicKey) | 161 hash.update(publicKey) |
162 self.extensionID = hash.hexdigest()[0:32] | 162 self.extensionID = hash.hexdigest()[0:32] |
163 self.extensionID = ''.join(map(lambda c: chr(97 + int(c, 16)), self.extensio
nID)) | 163 self.extensionID = ''.join(map(lambda c: chr(97 + int(c, 16)), self.extensio
nID)) |
164 | 164 |
165 # Now read manifest.json | 165 # Now read metadata file |
166 manifestFile = open(os.path.join(self.tempdir, 'manifest.json'), 'rb') | 166 metadata = packager.readMetadata(self.tempdir) |
167 manifest = json.load(manifestFile) | 167 self.version = metadata.get("general", "version") |
168 manifestFile.close() | |
169 | |
170 self.version = manifest['version'] | |
171 while self.version.count('.') < 2: | 168 while self.version.count('.') < 2: |
172 self.version += '.0' | 169 self.version += '.0' |
173 self.version = '%s.%s' % (self.version, self.revision) | 170 self.version = '%s.%s' % (self.version, self.revision) |
174 self.basename = os.path.basename(self.config.repository) | 171 self.basename = metadata.get("general", "basename") |
175 if self.config.experimental: | 172 if self.config.experimental: |
176 self.basename += '-experimental' | 173 self.basename += '-experimental' |
177 | 174 |
178 self.compat = [] | 175 self.compat = [] |
179 if 'minimum_chrome_version' in manifest: | 176 if metadata.has_section('compat') and metadata.has_option('compat', 'chrome'
): |
180 self.compat.append({'id': 'chrome', 'minVersion': manifest['minimum_chrome
_version']}) | 177 self.compat.append({'id': 'chrome', 'minVersion': metadata.get('compat', '
chrome')}) |
181 | 178 |
182 def writeUpdateManifest(self): | 179 def writeUpdateManifest(self): |
183 """ | 180 """ |
184 Writes update.rdf file for the current build | 181 Writes update.rdf file for the current build |
185 """ | 182 """ |
186 baseDir = os.path.join(self.config.nightliesDirectory, self.basename) | 183 baseDir = os.path.join(self.config.nightliesDirectory, self.basename) |
187 if not os.path.exists(baseDir): | 184 if not os.path.exists(baseDir): |
188 os.makedirs(baseDir) | 185 os.makedirs(baseDir) |
189 if self.config.type == 'chrome': | 186 if self.config.type == 'chrome': |
190 manifestPath = os.path.join(baseDir, "updates.xml") | 187 manifestPath = os.path.join(baseDir, "updates.xml") |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 link['changelog'] = changelogFile | 290 link['changelog'] = changelogFile |
294 links.append(link) | 291 links.append(link) |
295 template = get_template(get_config().get('extensions', 'nightlyIndexPage')) | 292 template = get_template(get_config().get('extensions', 'nightlyIndexPage')) |
296 template.stream({'config': self.config, 'links': links}).dump(outputPath) | 293 template.stream({'config': self.config, 'links': links}).dump(outputPath) |
297 | 294 |
298 def updateDocs(self): | 295 def updateDocs(self): |
299 if not self.config.type == 'gecko': | 296 if not self.config.type == 'gecko': |
300 return | 297 return |
301 | 298 |
302 docsdir = tempfile.mkdtemp(prefix='jsdoc') | 299 docsdir = tempfile.mkdtemp(prefix='jsdoc') |
303 command = ['hg', 'archive', '-R', get_config().get('extensions', 'jsdocRepos
itory'), '-r', 'default', docsdir] | 300 command = ['hg', 'archive', '-S', '-R', get_config().get('extensions', 'jsdo
cRepository'), '-r', 'default', docsdir] |
304 subprocess.Popen(command).communicate() | 301 subprocess.Popen(command).communicate() |
305 | 302 |
306 try: | 303 try: |
307 outputPath = os.path.join(self.config.docsDirectory, self.basename) | 304 outputPath = os.path.join(self.config.docsDirectory, self.basename) |
308 command = ['perl', os.path.join(docsdir, 'jsrun.pl'), | 305 command = ['perl', os.path.join(docsdir, 'jsrun.pl'), |
309 '-t=' + os.path.join(docsdir, 'templates', 'jsdoc'), | 306 '-t=' + os.path.join(docsdir, 'templates', 'jsdoc'), |
310 '-d=' + outputPath, | 307 '-d=' + outputPath, |
311 '-a', | 308 '-a', |
312 '-p', | 309 '-p', |
313 '-x=js', | 310 '-x=js', |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 except Exception, ex: | 387 except Exception, ex: |
391 print >>sys.stderr, "The build for %s failed:" % repo | 388 print >>sys.stderr, "The build for %s failed:" % repo |
392 traceback.print_exc() | 389 traceback.print_exc() |
393 | 390 |
394 file = open(nightlyConfigFile, 'wb') | 391 file = open(nightlyConfigFile, 'wb') |
395 nightlyConfig.write(file) | 392 nightlyConfig.write(file) |
396 | 393 |
397 | 394 |
398 if __name__ == '__main__': | 395 if __name__ == '__main__': |
399 main() | 396 main() |
OLD | NEW |