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

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

Issue 29760638: Issue 6611 - don't keep unsigned .xpi files (Closed)
Patch Set: Created April 24, 2018, 1:15 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
« .sitescripts.example ('K') | « .sitescripts.example ('k') | 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 # 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
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 310
311 for suffix in ['-x86.msi', '-x64.msi', '-gpo-x86.msi', '-gpo-x64.msi']: 311 for suffix in ['-x86.msi', '-x64.msi', '-gpo-x86.msi', '-gpo-x64.msi']:
312 linkPath = os.path.join(baseDir, '00latest%s' % suffix) 312 linkPath = os.path.join(baseDir, '00latest%s' % suffix)
313 outputPath = os.path.join(baseDir, self.basename + '-' + version + s uffix) 313 outputPath = os.path.join(baseDir, self.basename + '-' + version + s uffix)
314 self.symlink_or_copy(outputPath, linkPath) 314 self.symlink_or_copy(outputPath, linkPath)
315 315
316 def build(self): 316 def build(self):
317 """ 317 """
318 run the build command in the tempdir 318 run the build command in the tempdir
319 """ 319 """
320 baseDir = os.path.join(self.config.nightliesDirectory, self.basename) 320 if self.config.type not in self.downloadable_repos:
321 baseDir = os.path.join(self.config.nightliesDirectory,
322 self.basename)
323 else:
324 baseDir = self.tempdir
325
321 if not os.path.exists(baseDir): 326 if not os.path.exists(baseDir):
322 os.makedirs(baseDir) 327 os.makedirs(baseDir)
323 outputFile = '%s-%s%s' % (self.basename, self.version, self.config.packa geSuffix) 328 outputFile = '%s-%s%s' % (self.basename, self.version, self.config.packa geSuffix)
324 self.path = os.path.join(baseDir, outputFile) 329 self.path = os.path.join(baseDir, outputFile)
325 self.updateURL = urlparse.urljoin(self.config.nightliesURL, self.basenam e + '/' + outputFile + '?update') 330 self.updateURL = urlparse.urljoin(self.config.nightliesURL, self.basenam e + '/' + outputFile + '?update')
326 331
327 if self.config.type == 'android': 332 if self.config.type == 'android':
328 apkFile = open(self.path, 'wb') 333 apkFile = open(self.path, 'wb')
329 334
330 try: 335 try:
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 config.get('extensions', 'amo_secret'), 513 config.get('extensions', 'amo_secret'),
509 upload_url, 514 upload_url,
510 'PUT', 515 'PUT',
511 data, 516 data,
512 [('Content-Type', content_type)], 517 [('Content-Type', content_type)],
513 ) 518 )
514 519
515 try: 520 try:
516 urllib2.urlopen(request).close() 521 urllib2.urlopen(request).close()
517 except urllib2.HTTPError as e: 522 except urllib2.HTTPError as e:
523 shutil.copyfile(
524 self.path,
525 os.path.join(get_config().get('extensions', 'root'),
526 'failed.' + self.config.packageSuffix),
527 )
518 try: 528 try:
519 logging.error(e.read()) 529 logging.error(e.read())
520 finally: 530 finally:
521 e.close() 531 e.close()
522 raise 532 raise
523 533
524 self.add_to_downloads_lockfile( 534 self.add_to_downloads_lockfile(
525 self.config.type, 535 self.config.type,
526 { 536 {
527 'buildtype': 'devbuild', 537 'buildtype': 'devbuild',
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 get_config().has_option('extensions', 'amo_key')): 820 get_config().has_option('extensions', 'amo_key')):
811 self.uploadToMozillaAddons() 821 self.uploadToMozillaAddons()
812 elif self.config.type == 'chrome' and self.config.clientID and self. config.clientSecret and self.config.refreshToken: 822 elif self.config.type == 'chrome' and self.config.clientID and self. config.clientSecret and self.config.refreshToken:
813 self.uploadToChromeWebStore() 823 self.uploadToChromeWebStore()
814 elif self.config.type == 'edge' and self.config.clientID and self.co nfig.clientSecret and self.config.refreshToken and self.config.tenantID: 824 elif self.config.type == 'edge' and self.config.clientID and self.co nfig.clientSecret and self.config.refreshToken and self.config.tenantID:
815 self.upload_to_windows_store() 825 self.upload_to_windows_store()
816 826
817 finally: 827 finally:
818 # clean up 828 # clean up
819 if self.tempdir: 829 if self.tempdir:
820 shutil.rmtree(self.tempdir, ignore_errors=True) 830 shutil.rmtree(self.tempdir, ignore_errors=True)
tlucas 2018/04/24 13:31:48 The proposed change relies on this line to remove
821 831
822 def download(self): 832 def download(self):
823 download_info = self.read_downloads_lockfile() 833 download_info = self.read_downloads_lockfile()
824 downloads = self.downloadable_repos.intersection(download_info.keys()) 834 downloads = self.downloadable_repos.intersection(download_info.keys())
825 835
826 if self.config.type in downloads: 836 if self.config.type in downloads:
827 try: 837 try:
828 self.copyRepository() 838 self.copyRepository()
829 self.readGeckoMetadata() 839 self.readGeckoMetadata()
830 840
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 896
887 file = open(nightlyConfigFile, 'wb') 897 file = open(nightlyConfigFile, 'wb')
888 nightlyConfig.write(file) 898 nightlyConfig.write(file)
889 899
890 900
891 if __name__ == '__main__': 901 if __name__ == '__main__':
892 parser = argparse.ArgumentParser() 902 parser = argparse.ArgumentParser()
893 parser.add_argument('--download', action='store_true', default=False) 903 parser.add_argument('--download', action='store_true', default=False)
894 args = parser.parse_args() 904 args = parser.parse_args()
895 main(args.download) 905 main(args.download)
OLDNEW
« .sitescripts.example ('K') | « .sitescripts.example ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld