OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
6 | 6 |
7 """ | 7 """ |
8 Buildbot steps for src tarball generation and debian package generation | 8 Buildbot steps for src tarball generation and debian package generation |
9 | 9 |
10 Package up the src of the dart repo and create a debian package. | 10 Package up the src of the dart repo and create a debian package. |
11 Archive tarball and debian package to google cloud storage. | 11 Archive tarball and debian package to google cloud storage. |
12 """ | 12 """ |
13 | 13 |
| 14 import os |
14 import re | 15 import re |
15 import sys | 16 import sys |
16 | 17 |
17 import bot | 18 import bot |
| 19 import bot_utils |
18 | 20 |
| 21 utils = bot_utils.GetUtils() |
| 22 |
| 23 HOST_OS = utils.GuessOS() |
19 SRC_BUILDER = r'src-tarball-linux' | 24 SRC_BUILDER = r'src-tarball-linux' |
20 | 25 |
21 def SrcConfig(name, is_buildbot): | 26 def SrcConfig(name, is_buildbot): |
22 """Returns info for the current buildbot based on the name of the builder. | 27 """Returns info for the current buildbot based on the name of the builder. |
23 | 28 |
24 Currently, since we only run this on linux, this is just: | 29 Currently, since we only run this on linux, this is just: |
25 - mode: always "release" | 30 - mode: always "release" |
26 - system: always "linux" | 31 - system: always "linux" |
27 """ | 32 """ |
28 src_pattern = re.match(SRC_BUILDER, name) | 33 src_pattern = re.match(SRC_BUILDER, name) |
29 if not src_pattern: | 34 if not src_pattern: |
30 return None | 35 return None |
31 | 36 |
32 return bot.BuildInfo('none', 'none', 'release', 'linux') | 37 return bot.BuildInfo('none', 'none', 'release', 'linux') |
33 | 38 |
34 def SrcSteps(build_info): | 39 def SrcSteps(build_info): |
| 40 # We always clobber the bot, to not leave old tarballs and packages |
| 41 # floating around the out dir. |
| 42 bot.Clobber(force=True) |
35 with bot.BuildStep('Create src tarball'): | 43 with bot.BuildStep('Create src tarball'): |
36 args = [sys.executable, './tools/create_tarball.py'] | 44 version = utils.GetVersion() |
| 45 builddir = os.path.join(bot_utils.DART_DIR, |
| 46 utils.GetBuildDir(HOST_OS, HOST_OS), |
| 47 'src_and_installation') |
| 48 if not os.path.exists(builddir): |
| 49 os.makedirs(builddir) |
| 50 tarfilename = 'dart-%s.tar.gz' % version |
| 51 tarfile = os.path.join(builddir, tarfilename) |
| 52 args = [sys.executable, './tools/create_tarball.py', '--tar_filename', |
| 53 tarfile] |
37 print 'Building src tarball' | 54 print 'Building src tarball' |
38 bot.RunProcess(args) | 55 bot.RunProcess(args) |
39 print 'Building Debian packages' | 56 print 'Building Debian packages' |
40 args = [sys.executable, './tools/create_debian_packages.py'] | 57 args = [sys.executable, './tools/create_debian_packages.py', |
| 58 '--tar_filename', tarfile, |
| 59 '--out_dir', builddir] |
41 bot.RunProcess(args) | 60 bot.RunProcess(args) |
42 | 61 |
43 if __name__ == '__main__': | 62 if __name__ == '__main__': |
44 # We pass in None for build_step to avoid building the sdk. | 63 # We pass in None for build_step to avoid building the sdk. |
45 bot.RunBot(SrcConfig, SrcSteps, build_step=None) | 64 bot.RunBot(SrcConfig, SrcSteps, build_step=None) |
OLD | NEW |