Chromium Code Reviews| 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. |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 29 Currently, since we only run this on linux, this is just: | 29 Currently, since we only run this on linux, this is just: |
| 30 - mode: always "release" | 30 - mode: always "release" |
| 31 - system: always "linux" | 31 - system: always "linux" |
| 32 """ | 32 """ |
| 33 src_pattern = re.match(SRC_BUILDER, name) | 33 src_pattern = re.match(SRC_BUILDER, name) |
| 34 if not src_pattern: | 34 if not src_pattern: |
| 35 return None | 35 return None |
| 36 | 36 |
| 37 return bot.BuildInfo('none', 'none', 'release', 'linux') | 37 return bot.BuildInfo('none', 'none', 'release', 'linux') |
| 38 | 38 |
| 39 def ArchiveArtifacts(tarfile, builddir, channel): | |
| 40 namer = bot_utils.GCSNamer(channel=channel) | |
| 41 gsutil = bot_utils.GSUtil() | |
| 42 revision = utils.GetSVNRevision() | |
| 43 # Archive the src tar to the src dir | |
| 44 remote_tarfile = '/'.join([namer.src_directory(revision), | |
| 45 os.path.basename(tarfile)]) | |
| 46 gsutil.upload(tarfile, remote_tarfile, public=True) | |
| 47 # Archive all files except the tar file to the linux packages dir | |
| 48 for entry in os.listdir(builddir): | |
| 49 full_path = os.path.join(builddir, entry) | |
| 50 # We expect a flat structure, not subdirectories | |
| 51 assert(os.path.isfile(full_path)) | |
| 52 if full_path != tarfile: | |
| 53 remote_file = '/'.join([namer.linux_packages_directory(revision), | |
| 54 os.path.basename(entry)]) | |
| 55 gsutil.upload(full_path, remote_file, public=True) | |
| 56 | |
| 39 def SrcSteps(build_info): | 57 def SrcSteps(build_info): |
| 40 # We always clobber the bot, to not leave old tarballs and packages | 58 # We always clobber the bot, to not leave old tarballs and packages |
| 41 # floating around the out dir. | 59 # floating around the out dir. |
| 42 bot.Clobber(force=True) | 60 bot.Clobber(force=True) |
| 61 version = utils.GetVersion() | |
|
ricow1
2014/03/17 15:20:24
this block is just moved out of the with
| |
| 62 builddir = os.path.join(bot_utils.DART_DIR, | |
| 63 utils.GetBuildDir(HOST_OS, HOST_OS), | |
| 64 'src_and_installation') | |
| 65 if not os.path.exists(builddir): | |
| 66 os.makedirs(builddir) | |
| 67 tarfilename = 'dart-%s.tar.gz' % version | |
| 68 tarfile = os.path.join(builddir, tarfilename) | |
| 69 | |
| 43 with bot.BuildStep('Create src tarball'): | 70 with bot.BuildStep('Create src tarball'): |
| 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', | 71 args = [sys.executable, './tools/create_tarball.py', '--tar_filename', |
| 53 tarfile] | 72 tarfile] |
| 54 print 'Building src tarball' | 73 print 'Building src tarball' |
| 55 bot.RunProcess(args) | 74 bot.RunProcess(args) |
| 56 print 'Building Debian packages' | 75 print 'Building Debian packages' |
| 57 args = [sys.executable, './tools/create_debian_packages.py', | 76 args = [sys.executable, './tools/create_debian_packages.py', |
| 58 '--tar_filename', tarfile, | 77 '--tar_filename', tarfile, |
| 59 '--out_dir', builddir] | 78 '--out_dir', builddir] |
| 60 bot.RunProcess(args) | 79 bot.RunProcess(args) |
| 80 | |
| 81 with bot.BuildStep('Upload artifacts'): | |
| 82 bot_name, _ = bot.GetBotName() | |
| 83 channel = bot_utils.GetChannelFromName(bot_name) | |
| 84 if channel != bot_utils.Channel.BLEEDING_EDGE: | |
| 85 ArchiveArtifacts(tarfile, builddir, channel) | |
| 61 | 86 |
| 62 if __name__ == '__main__': | 87 if __name__ == '__main__': |
| 63 # We pass in None for build_step to avoid building the sdk. | 88 # We pass in None for build_step to avoid building the sdk. |
| 64 bot.RunBot(SrcConfig, SrcSteps, build_step=None) | 89 bot.RunBot(SrcConfig, SrcSteps, build_step=None) |
| OLD | NEW |