Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(633)

Side by Side Diff: tools/bots/linux_distribution_support.py

Issue 2903603002: Fix some issues with buildbot recipe change. (Closed)
Patch Set: Fix promote script Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/bots/bot_utils.py ('k') | tools/deps/dartium.deps/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 os
15 import re 15 import re
16 import sys 16 import sys
17 17
18 import bot 18 import bot
19 import bot_utils 19 import bot_utils
20 20
21 utils = bot_utils.GetUtils() 21 utils = bot_utils.GetUtils()
22 22
23 HOST_OS = utils.GuessOS() 23 HOST_OS = utils.GuessOS()
24 SRC_BUILDER = r'linux-distribution-support-(debian_wheezy|ubuntu_precise)' 24 SRC_BUILDER = r'debianpackage-linux'
25 25
26 def SrcConfig(name, is_buildbot): 26 def SrcConfig(name, is_buildbot):
27 """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.
28 28
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 return bot.BuildInfo('none', 'none', 'release', 'linux', 36 return bot.BuildInfo('none', 'none', 'release', 'linux')
37 builder_tag=src_pattern.group(1))
38 37
39 def ArchiveArtifacts(tarfile, builddir, channel, linux_system): 38 def ArchiveArtifacts(tarfile, builddir, channel):
40 namer = bot_utils.GCSNamer(channel=channel) 39 namer = bot_utils.GCSNamer(channel=channel)
41 gsutil = bot_utils.GSUtil() 40 gsutil = bot_utils.GSUtil()
42 revision = utils.GetArchiveVersion() 41 revision = utils.GetArchiveVersion()
43 # Archive the src tar to the src dir 42 # Archive the src tar to the src dir
44 remote_tarfile = '/'.join([namer.src_directory(revision), 43 remote_tarfile = '/'.join([namer.src_directory(revision),
45 os.path.basename(tarfile)]) 44 os.path.basename(tarfile)])
46 gsutil.upload(tarfile, remote_tarfile, public=True) 45 gsutil.upload(tarfile, remote_tarfile, public=True)
47 # Archive all files except the tar file to the linux packages dir 46 # Archive all files except the tar file to the linux packages dir
48 for entry in os.listdir(builddir): 47 for entry in os.listdir(builddir):
49 full_path = os.path.join(builddir, entry) 48 full_path = os.path.join(builddir, entry)
50 # We expect a flat structure, not subdirectories 49 # We expect a flat structure, not subdirectories
51 assert(os.path.isfile(full_path)) 50 assert(os.path.isfile(full_path))
52 if full_path != tarfile: 51 if full_path != tarfile:
53 package_dir = namer.linux_packages_directory(revision, linux_system) 52 package_dir = namer.linux_packages_directory(revision)
54 remote_file = '/'.join([package_dir, 53 remote_file = '/'.join([package_dir,
55 os.path.basename(entry)]) 54 os.path.basename(entry)])
56 gsutil.upload(full_path, remote_file, public=True) 55 gsutil.upload(full_path, remote_file, public=True)
57 56
58 def InstallFromDep(builddir): 57 def InstallFromDep(builddir):
59 for entry in os.listdir(builddir): 58 for entry in os.listdir(builddir):
60 if entry.endswith("_amd64.deb"): 59 if entry.endswith("_amd64.deb"):
61 path = os.path.join(builddir, entry) 60 path = os.path.join(builddir, entry)
62 Run(['sudo', 'dpkg', '-i', path]) 61 Run(['sudo', 'dpkg', '-i', path])
63 62
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 builddir = os.path.join(bot_utils.DART_DIR, 100 builddir = os.path.join(bot_utils.DART_DIR,
102 utils.GetBuildDir(HOST_OS), 101 utils.GetBuildDir(HOST_OS),
103 'src_and_installation') 102 'src_and_installation')
104 103
105 if not os.path.exists(builddir): 104 if not os.path.exists(builddir):
106 os.makedirs(builddir) 105 os.makedirs(builddir)
107 tarfilename = 'dart-%s.tar.gz' % version 106 tarfilename = 'dart-%s.tar.gz' % version
108 tarfile = os.path.join(builddir, tarfilename) 107 tarfile = os.path.join(builddir, tarfilename)
109 108
110 with bot.BuildStep('Validating linux system'): 109 with bot.BuildStep('Validating linux system'):
111 print 'Validating that we are on %s' % build_info.builder_tag 110 print 'Validating that we are on debian jessie'
112 args = ['cat', '/etc/os-release'] 111 args = ['cat', '/etc/os-release']
113 (stdout, stderr, exitcode) = bot_utils.run(args) 112 (stdout, stderr, exitcode) = bot_utils.run(args)
114 if exitcode != 0: 113 if exitcode != 0:
115 print "Could not find linux system, exiting" 114 print "Could not find linux system, exiting"
116 sys.exit(1) 115 sys.exit(1)
117 116 if not "jessie" in stdout:
118 if build_info.builder_tag == "debian_wheezy": 117 print "Trying to build debian bits but not on debian Jessie"
119 if not "jessie" in stdout: 118 print "You can't fix this, please contact whesse@"
120 print "Trying to build debian bits on a non debian system" 119 sys.exit(1)
121 print "You can't fix this, please contact whesse@"
122 sys.exit(1)
123 if build_info.builder_tag == "ubuntu_precise":
124 if not "precise" in stdout:
125 print "Trying to build ubuntu bits on a non ubuntu system"
126 print "You can't fix this, please contact whesse@"
127 sys.exit(1)
128 120
129 with bot.BuildStep('Create src tarball'): 121 with bot.BuildStep('Create src tarball'):
130 print 'Building src tarball' 122 print 'Building src tarball'
131 Run([sys.executable, './tools/create_tarball.py', 123 Run([sys.executable, './tools/create_tarball.py',
132 '--tar_filename', tarfile]) 124 '--tar_filename', tarfile])
133 125
134 print 'Building Debian packages' 126 print 'Building Debian packages'
135 Run([sys.executable, './tools/create_debian_packages.py', 127 Run([sys.executable, './tools/create_debian_packages.py',
136 '--tar_filename', tarfile, 128 '--tar_filename', tarfile,
137 '--out_dir', builddir]) 129 '--out_dir', builddir])
138 130
139 with bot.BuildStep('Sanity check installation'): 131 with bot.BuildStep('Sanity check installation'):
140 if os.path.exists('/usr/bin/dart'): 132 if os.path.exists('/usr/bin/dart'):
141 print "Dart already installed, removing" 133 print "Dart already installed, removing"
142 UninstallDart() 134 UninstallDart()
143 TestInstallation(assume_installed=False) 135 TestInstallation(assume_installed=False)
144 136
145 InstallFromDep(builddir) 137 InstallFromDep(builddir)
146 TestInstallation(assume_installed=True) 138 TestInstallation(assume_installed=True)
147 139
148 # We build the runtime target to get everything we need to test the 140 # We build the runtime target to get everything we need to test the
149 # standalone target. 141 # standalone target.
150 Run([sys.executable, './tools/build.py', '-mrelease', '-ax64', 'runtime']) 142 Run([sys.executable, './tools/build.py', '-mrelease', '-ax64', 'runtime'])
151 # Copy in the installed binary to avoid poluting /usr/bin (and having to 143 # Copy in the installed binary to avoid poluting /usr/bin (and having to
152 # run as root) 144 # run as root)
153 Run(['cp', '/usr/bin/dart', 'out/ReleaseX64/dart']) 145 Run(['cp', '/usr/bin/dart', 'out/ReleaseX64/dart'])
154 146
155 # We currently can't run the testing script on wheezy since the checked in 147 # We currently can't run the testing script on wheezy since the checked in
156 # binary is built on precise, see issue 18742 148 # binary is built on precise, see issue 18742
157 if (build_info.builder_tag == 'ubuntu_precise'): 149 # TODO(18742): Run './tools/test.py' '-mrelease' 'standalone'
158 Run([sys.executable, './tools/test.py', '-ax64',
159 '--mode=release', 'standalone'])
160 150
161 # Sanity check dart2js and the analyzer against a hello world program 151 # Sanity check dart2js and the analyzer against a hello world program
162 with utils.TempDir() as temp_dir: 152 with utils.TempDir() as temp_dir:
163 test_file = CreateDartTestFile(temp_dir) 153 test_file = CreateDartTestFile(temp_dir)
164 Run(['/usr/lib/dart/bin/dart2js', test_file]) 154 Run(['/usr/lib/dart/bin/dart2js', test_file])
165 Run(['/usr/lib/dart/bin/dartanalyzer', test_file]) 155 Run(['/usr/lib/dart/bin/dartanalyzer', test_file])
166 Run(['/usr/lib/dart/bin/dart', test_file]) 156 Run(['/usr/lib/dart/bin/dart', test_file])
167 157
168 # Sanity check that pub can start up and print the version 158 # Sanity check that pub can start up and print the version
169 Run(['/usr/lib/dart/bin/pub', '--version']) 159 Run(['/usr/lib/dart/bin/pub', '--version'])
170 160
171 UninstallDart() 161 UninstallDart()
172 TestInstallation(assume_installed=False) 162 TestInstallation(assume_installed=False)
173 163
174 with bot.BuildStep('Upload artifacts'): 164 with bot.BuildStep('Upload artifacts'):
175 bot_name, _ = bot.GetBotName() 165 bot_name, _ = bot.GetBotName()
176 channel = bot_utils.GetChannelFromName(bot_name) 166 channel = bot_utils.GetChannelFromName(bot_name)
177 if channel != bot_utils.Channel.BLEEDING_EDGE: 167 if channel != bot_utils.Channel.BLEEDING_EDGE:
178 ArchiveArtifacts(tarfile, builddir, channel, build_info.builder_tag) 168 ArchiveArtifacts(tarfile, builddir, channel)
179 else: 169 else:
180 print 'Not uploading artifacts on bleeding edge' 170 print 'Not uploading artifacts on bleeding edge'
181 171
182 if __name__ == '__main__': 172 if __name__ == '__main__':
183 # We pass in None for build_step to avoid building the sdk. 173 # We pass in None for build_step to avoid building the sdk.
184 bot.RunBot(SrcConfig, SrcSteps, build_step=None) 174 bot.RunBot(SrcConfig, SrcSteps, build_step=None)
OLDNEW
« no previous file with comments | « tools/bots/bot_utils.py ('k') | tools/deps/dartium.deps/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698