OLD | NEW |
1 # coding: utf-8 | 1 # coding: utf-8 |
2 | 2 |
3 # This Source Code is subject to the terms of the Mozilla Public License | 3 # This Source Code is subject to the terms of the Mozilla Public License |
4 # version 2.0 (the "License"). You can obtain a copy of the License at | 4 # version 2.0 (the "License"). You can obtain a copy of the License at |
5 # http://mozilla.org/MPL/2.0/. | 5 # http://mozilla.org/MPL/2.0/. |
6 | 6 |
7 import os, re, subprocess, tarfile | 7 import os, re, subprocess, tarfile |
8 from StringIO import StringIO | 8 from StringIO import StringIO |
9 import buildtools.packager as packager | 9 import buildtools.packagerGecko as packagerBase |
10 import buildtools.packagerKMeleon as packagerKMeleon | 10 import buildtools.packagerKMeleon as packagerKMeleon |
11 | 11 |
12 def run(baseDir, downloadsRepo, buildtoolsRepo): | 12 def run(baseDir, downloadsRepo, buildtoolsRepo): |
13 baseExtDir = packagerKMeleon.getBaseExtensionDir(baseDir) | 13 baseExtDir = packagerKMeleon.getBaseExtensionDir(baseDir) |
14 | 14 |
15 # Read extension name, version and branch name | 15 # Read extension name, version and branch name |
16 locales = packager.readLocaleMetadata(baseExtDir, [packager.defaultLocale]) | 16 locales = packagerBase.readLocaleMetadata(baseExtDir, [packagerBase.defaultLoc
ale]) |
17 extensionName = locales[packager.defaultLocale]['name'] + ' for K-Meleon' | 17 extensionName = locales[packagerBase.defaultLocale]['name'] + ' for K-Meleon' |
18 | 18 |
19 metadata = packager.readMetadata(baseExtDir) | 19 metadata = packagerBase.readMetadata(baseExtDir) |
20 metadata.read(packager.getMetadataPath(baseDir)) | 20 metadata.read(packagerBase.getMetadataPath(baseDir)) |
21 branchName = metadata.get('general', 'branchname') | 21 branchName = metadata.get('general', 'branchname') |
22 version = metadata.get('general', 'version') | 22 version = metadata.get('general', 'version') |
23 | 23 |
24 # Tag our source repository | 24 # Tag our source repository |
25 subprocess.Popen(['hg', 'tag', '-R', baseDir, '-f', version]).communicate() | 25 subprocess.Popen(['hg', 'tag', '-R', baseDir, '-f', version]).communicate() |
26 | 26 |
27 # Create a release build | 27 # Create a release build |
28 buildPath = os.path.join(downloadsRepo, packager.getDefaultFileName(baseDir, m
etadata, version, 'zip')) | 28 buildPath = os.path.join(downloadsRepo, packagerBase.getDefaultFileName(baseDi
r, metadata, version, 'zip')) |
29 packagerKMeleon.createBuild(baseDir, outFile=buildPath, releaseBuild=True) | 29 packagerKMeleon.createBuild(baseDir, outFile=buildPath, releaseBuild=True) |
30 | 30 |
31 # Create source archive | 31 # Create source archive |
32 archivePath = os.path.splitext(buildPath)[0] + '-source.tgz' | 32 archivePath = os.path.splitext(buildPath)[0] + '-source.tgz' |
33 | 33 |
34 archiveHandle = open(archivePath, 'wb') | 34 archiveHandle = open(archivePath, 'wb') |
35 archive = tarfile.open(fileobj=archiveHandle, name=os.path.basename(archivePat
h), mode='w:gz') | 35 archive = tarfile.open(fileobj=archiveHandle, name=os.path.basename(archivePat
h), mode='w:gz') |
36 (data, dummy) = subprocess.Popen(['hg', 'archive', '-R', baseDir, '-t', 'tar',
'-X', os.path.join(baseDir, '.hgtags'), '-'], stdout=subprocess.PIPE).communica
te() | 36 (data, dummy) = subprocess.Popen(['hg', 'archive', '-R', baseDir, '-t', 'tar',
'-X', os.path.join(baseDir, '.hgtags'), '-'], stdout=subprocess.PIPE).communica
te() |
37 repoArchive = tarfile.open(fileobj=StringIO(data), mode='r:') | 37 repoArchive = tarfile.open(fileobj=StringIO(data), mode='r:') |
38 for fileInfo in repoArchive: | 38 for fileInfo in repoArchive: |
(...skipping 23 matching lines...) Expand all Loading... |
62 subprocess.Popen(['hg', 'commit', '-R', downloadsRepo, '-m', 'Releasing %s %s'
% (extensionName, version)]).communicate() | 62 subprocess.Popen(['hg', 'commit', '-R', downloadsRepo, '-m', 'Releasing %s %s'
% (extensionName, version)]).communicate() |
63 subprocess.Popen(['hg', 'tag', '-R', downloadsRepo, '-f', tagName]).communicat
e() | 63 subprocess.Popen(['hg', 'tag', '-R', downloadsRepo, '-f', tagName]).communicat
e() |
64 | 64 |
65 # Tag buildtools repository as well | 65 # Tag buildtools repository as well |
66 subprocess.Popen(['hg', 'tag', '-R', buildtoolsRepo, '-f', tagName]).communica
te() | 66 subprocess.Popen(['hg', 'tag', '-R', buildtoolsRepo, '-f', tagName]).communica
te() |
67 | 67 |
68 # Push all changes | 68 # Push all changes |
69 subprocess.Popen(['hg', 'push', '-R', baseDir]).communicate() | 69 subprocess.Popen(['hg', 'push', '-R', baseDir]).communicate() |
70 subprocess.Popen(['hg', 'push', '-R', downloadsRepo]).communicate() | 70 subprocess.Popen(['hg', 'push', '-R', downloadsRepo]).communicate() |
71 subprocess.Popen(['hg', 'push', '-R', buildtoolsRepo]).communicate() | 71 subprocess.Popen(['hg', 'push', '-R', buildtoolsRepo]).communicate() |
OLD | NEW |