comparison master.cfg @ 60:c8350f7d9834

new class to allow environment to be set using $HOME/buildbot-worker-env
author John W. Eaton <jwe@octave.org>
date Fri, 22 Mar 2024 07:06:14 -0400
parents d26ca1d27a39
children 10c1848313c6
comparison
equal deleted inserted replaced
59:d26ca1d27a39 60:c8350f7d9834
261 from buildbot.steps.shell import ShellCommand 261 from buildbot.steps.shell import ShellCommand
262 from buildbot.steps.shell import Configure 262 from buildbot.steps.shell import Configure
263 from buildbot.steps.shell import Compile 263 from buildbot.steps.shell import Compile
264 from buildbot.steps.shell import Test 264 from buildbot.steps.shell import Test
265 265
266 ## A class that allows the worker to use environment variables
267 ## from a file in ShellCommand steps. We use this instead of
268 ## ShellCommand in all rules for the Octave buildbot.
269
270 class EnvShellCommand (ShellCommand):
271 def __init__ (self, command = '', **kwargs):
272 kwargs['command'] = [
273 'bash', '-c', 'if [ -f "$HOME/buildbot-worker-env" ]; then source "$HOME/buildbot-worker-env"; fi; %s' % command
274 ]
275 ShellCommand.__init__ (self, **kwargs)
276
266 ## Steps we may use in more than one build factory. 277 ## Steps we may use in more than one build factory.
267 278
268 def build_cmd_list (cmd, nice = 0, opts = []): 279 def build_cmd_list (cmd, nice = 0, opts = []):
269 cmd_list = [] 280 cmd_list = []
270 281
294 haltOnFailure = True, 305 haltOnFailure = True,
295 workdir = "src") 306 workdir = "src")
296 307
297 def mk_octave_bootstrap_step (nice = 0): 308 def mk_octave_bootstrap_step (nice = 0):
298 boot_cmd = build_cmd_list ("./bootstrap", nice = nice) 309 boot_cmd = build_cmd_list ("./bootstrap", nice = nice)
299 return ShellCommand (command = boot_cmd, workdir = "src", env = build_env, 310 return EnvShellCommand (command = boot_cmd, workdir = "src", env = build_env,
300 description = "bootstrap") 311 description = "bootstrap")
301 312
302 sh_rm_build_dir = ShellCommand (command = ["rm", "-rf", "build"], workdir = ".", 313 sh_rm_build_dir = EnvShellCommand (command = ["rm", "-rf", "build"], workdir = ".",
303 env = build_env, description = "clean build dir") 314 env = build_env, description = "clean build dir")
304 315
305 sh_mk_build_dir = ShellCommand (command = ["mkdir", "build"], 316 sh_mk_build_dir = EnvShellCommand (command = ["mkdir", "build"],
306 description = "create build dir") 317 description = "create build dir")
307 318
308 def mk_octave_configure_step (nice = 0, opts = []): 319 def mk_octave_configure_step (nice = 0, opts = []):
309 conf_cmd = build_cmd_list ("../src/configure", nice = nice, opts = opts) 320 conf_cmd = build_cmd_list ("../src/configure", nice = nice, opts = opts)
310 return Configure (command = conf_cmd, workdir = "build", env = build_env) 321 return Configure (command = conf_cmd, workdir = "build", env = build_env)
311 322
648 workdir = "src") 659 workdir = "src")
649 660
650 661
651 def mk_mxe_octave_bootstrap_step (nice = 0): 662 def mk_mxe_octave_bootstrap_step (nice = 0):
652 boot_cmd = build_cmd_list ("./bootstrap", nice = nice) 663 boot_cmd = build_cmd_list ("./bootstrap", nice = nice)
653 return ShellCommand (command = boot_cmd, workdir = "src", env = build_env, 664 return EnvShellCommand (command = boot_cmd, workdir = "src", env = build_env,
654 description = "bootstrap") 665 description = "bootstrap")
655 666
656 667
657 def mk_mxe_octave_configure_step (nice = 0, branch = "default", opts = []): 668 def mk_mxe_octave_configure_step (nice = 0, branch = "default", opts = []):
658 conf_cmd = build_cmd_list (["./configure", 669 conf_cmd = build_cmd_list (["./configure",
659 "--with-pkg-dir=../../mxe-pkg-src", 670 "--with-pkg-dir=../../mxe-pkg-src",
663 return Configure (command = conf_cmd, workdir = "src", env = build_env) 674 return Configure (command = conf_cmd, workdir = "src", env = build_env)
664 675
665 676
666 def mk_mxe_octave_clean_step (nice = 0): 677 def mk_mxe_octave_clean_step (nice = 0):
667 boot_cmd = build_cmd_list (["make", "clean"], nice = nice) 678 boot_cmd = build_cmd_list (["make", "clean"], nice = nice)
668 return ShellCommand (command = boot_cmd, workdir = "src", env = build_env, 679 return EnvShellCommand (command = boot_cmd, workdir = "src", env = build_env,
669 description = "clean") 680 description = "clean")
670 681
671 682
672 ## Timeout is large for these steps because mxe-octave currently only 683 ## Timeout is large for these steps because mxe-octave currently only
673 ## prints a status update for each package, not detailed output from 684 ## prints a status update for each package, not detailed output from
674 ## make. The way the dependencies currently work, making 685 ## make. The way the dependencies currently work, making