OLD | NEW |
1 # This Source Code Form is subject to the terms of the Mozilla Public | 1 # This Source Code Form is subject to the terms of the Mozilla Public |
2 # License, v. 2.0. If a copy of the MPL was not distributed with this | 2 # License, v. 2.0. If a copy of the MPL was not distributed with this |
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. | 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
4 | 4 |
5 import os | 5 import os |
6 import re | 6 import re |
7 import codecs | 7 import codecs |
8 import subprocess | 8 import subprocess |
9 import tarfile | 9 import tarfile |
10 import json | 10 import json |
(...skipping 28 matching lines...) Expand all Loading... |
39 fileinfo.name = re.sub(r'^[^/]+/', prefix, fileinfo.name
) | 39 fileinfo.name = re.sub(r'^[^/]+/', prefix, fileinfo.name
) |
40 archive.addfile(fileinfo, filedata) | 40 archive.addfile(fileinfo, filedata) |
41 finally: | 41 finally: |
42 process.stdout.close() | 42 process.stdout.close() |
43 process.wait() | 43 process.wait() |
44 | 44 |
45 | 45 |
46 def run(baseDir, type, version, keyFiles, downloadsRepo): | 46 def run(baseDir, type, version, keyFiles, downloadsRepo): |
47 if type == 'gecko': | 47 if type == 'gecko': |
48 import buildtools.packagerGecko as packager | 48 import buildtools.packagerGecko as packager |
| 49 elif type == 'safari': |
| 50 import buildtools.packagerSafari as packager |
| 51 elif type == 'edge': |
| 52 import buildtools.packagerEdge as packager |
49 elif type == 'chrome': | 53 elif type == 'chrome': |
50 import buildtools.packagerChrome as packager | 54 import buildtools.packagerChrome as packager |
51 | 55 |
52 # Replace version number in metadata file "manually", ConfigParser will mess | 56 # Replace version number in metadata file "manually", ConfigParser will mess |
53 # up the order of lines. | 57 # up the order of lines. |
54 metadata = packager.readMetadata(baseDir, type) | 58 metadata = packager.readMetadata(baseDir, type) |
55 with open(metadata.option_source('general', 'version'), 'r+b') as file: | 59 with open(metadata.option_source('general', 'version'), 'r+b') as file: |
56 rawMetadata = file.read() | 60 rawMetadata = file.read() |
57 rawMetadata = re.sub( | 61 rawMetadata = re.sub( |
58 r'^(\s*version\s*=\s*).*', r'\g<1>%s' % version, | 62 r'^(\s*version\s*=\s*).*', r'\g<1>%s' % version, |
(...skipping 21 matching lines...) Expand all Loading... |
80 | 84 |
81 # Create a release build | 85 # Create a release build |
82 downloads = [] | 86 downloads = [] |
83 if type == 'gecko': | 87 if type == 'gecko': |
84 keyFile = keyFiles[0] if keyFiles else None | 88 keyFile = keyFiles[0] if keyFiles else None |
85 metadata = packager.readMetadata(baseDir, type) | 89 metadata = packager.readMetadata(baseDir, type) |
86 buildPath = os.path.join(downloadsRepo, packager.getDefaultFileName(meta
data, version, 'xpi')) | 90 buildPath = os.path.join(downloadsRepo, packager.getDefaultFileName(meta
data, version, 'xpi')) |
87 packager.createBuild(baseDir, type=type, outFile=buildPath, releaseBuild
=True, keyFile=keyFile) | 91 packager.createBuild(baseDir, type=type, outFile=buildPath, releaseBuild
=True, keyFile=keyFile) |
88 downloads.append(buildPath) | 92 downloads.append(buildPath) |
89 elif type == 'chrome': | 93 elif type == 'chrome': |
90 # We actually have to create three different builds: signed and unsigned | 94 # Create both signed and unsigned Chrome builds (the latter for Chrome W
eb Store). |
91 # Chrome builds (the latter for Chrome Web Store), and a signed Safari b
uild. | |
92 metadata = packager.readMetadata(baseDir, type) | 95 metadata = packager.readMetadata(baseDir, type) |
93 buildPath = os.path.join(downloadsRepo, packager.getDefaultFileName(meta
data, version, 'crx')) | 96 buildPath = os.path.join(downloadsRepo, packager.getDefaultFileName(meta
data, version, 'crx')) |
94 packager.createBuild(baseDir, type=type, outFile=buildPath, releaseBuild
=True, keyFile=keyFiles[0]) | 97 packager.createBuild(baseDir, type=type, outFile=buildPath, releaseBuild
=True, keyFile=keyFiles[0]) |
95 downloads.append(buildPath) | 98 downloads.append(buildPath) |
96 | 99 |
97 buildPathUnsigned = os.path.join(baseDir, packager.getDefaultFileName(me
tadata, version, 'zip')) | 100 buildPathUnsigned = os.path.join(baseDir, packager.getDefaultFileName(me
tadata, version, 'zip')) |
98 packager.createBuild(baseDir, type=type, outFile=buildPathUnsigned, rele
aseBuild=True, keyFile=None) | 101 packager.createBuild(baseDir, type=type, outFile=buildPathUnsigned, rele
aseBuild=True, keyFile=None) |
| 102 elif type == 'safari': |
| 103 metadata = packager.readMetadata(baseDir, type) |
| 104 buildPath = os.path.join(downloadsRepo, packager.getDefaultFileName(meta
data, version, 'safariextz')) |
| 105 packager.createBuild(baseDir, type='safari', outFile=buildPath, releaseB
uild=True, keyFile=keyFiles[0]) |
| 106 downloads.append(buildPath) |
| 107 elif type == 'edge': |
| 108 # We only offer the Edge extension for use through the Windows Store |
| 109 metadata = packager.readMetadata(baseDir, type) |
| 110 buildPath = os.path.join(downloadsRepo, packager.getDefaultFileName(meta
data, version, 'zip')) |
| 111 packager.createBuild(baseDir, type=type, outFile=buildPathUnsigned, rele
aseBuild=True, keyFile=None) |
99 | 112 |
100 import buildtools.packagerSafari as packagerSafari | |
101 metadataSafari = packagerSafari.readMetadata(baseDir, 'safari') | |
102 buildPathSafari = os.path.join(downloadsRepo, packagerSafari.getDefaultF
ileName(metadataSafari, version, 'safariextz')) | |
103 packagerSafari.createBuild(baseDir, type='safari', outFile=buildPathSafa
ri, releaseBuild=True, keyFile=keyFiles[1]) | |
104 downloads.append(buildPathSafari) | |
105 | 113 |
106 # Create source archive | 114 # Create source archive |
107 archivePath = os.path.splitext(buildPath)[0] + '-source.tgz' | 115 archivePath = os.path.splitext(buildPath)[0] + '-source.tgz' |
108 create_sourcearchive(baseDir, archivePath) | 116 create_sourcearchive(baseDir, archivePath) |
109 downloads.append(archivePath) | 117 downloads.append(archivePath) |
110 | 118 |
111 # Now add the downloads and commit | 119 # Now add the downloads and commit |
112 subprocess.check_call(['hg', 'add', '-R', downloadsRepo] + downloads) | 120 subprocess.check_call(['hg', 'add', '-R', downloadsRepo] + downloads) |
113 subprocess.check_call(['hg', 'commit', '-R', downloadsRepo, '-m', 'Releasing
%s %s' % (extensionName, version)]) | 121 subprocess.check_call(['hg', 'commit', '-R', downloadsRepo, '-m', 'Releasing
%s %s' % (extensionName, version)]) |
114 | 122 |
115 # Push all changes | 123 # Push all changes |
116 subprocess.check_call(['hg', 'push', '-R', baseDir]) | 124 subprocess.check_call(['hg', 'push', '-R', baseDir]) |
117 subprocess.check_call(['hg', 'push', '-R', downloadsRepo]) | 125 subprocess.check_call(['hg', 'push', '-R', downloadsRepo]) |
OLD | NEW |