# HG changeset patch # User John W. Eaton # Date 1711105574 14400 # Node ID c8350f7d98347295eb0e6489eea887a67eecdcef # Parent d26ca1d27a3916c899e3a246cd1f872ff8fce420 new class to allow environment to be set using $HOME/buildbot-worker-env diff -r d26ca1d27a39 -r c8350f7d9834 master.cfg --- a/master.cfg Thu Dec 28 13:56:48 2023 -0500 +++ b/master.cfg Fri Mar 22 07:06:14 2024 -0400 @@ -263,6 +263,17 @@ from buildbot.steps.shell import Compile from buildbot.steps.shell import Test +## A class that allows the worker to use environment variables +## from a file in ShellCommand steps. We use this instead of +## ShellCommand in all rules for the Octave buildbot. + +class EnvShellCommand (ShellCommand): + def __init__ (self, command = '', **kwargs): + kwargs['command'] = [ + 'bash', '-c', 'if [ -f "$HOME/buildbot-worker-env" ]; then source "$HOME/buildbot-worker-env"; fi; %s' % command + ] + ShellCommand.__init__ (self, **kwargs) + ## Steps we may use in more than one build factory. def build_cmd_list (cmd, nice = 0, opts = []): @@ -296,14 +307,14 @@ def mk_octave_bootstrap_step (nice = 0): boot_cmd = build_cmd_list ("./bootstrap", nice = nice) - return ShellCommand (command = boot_cmd, workdir = "src", env = build_env, - description = "bootstrap") + return EnvShellCommand (command = boot_cmd, workdir = "src", env = build_env, + description = "bootstrap") -sh_rm_build_dir = ShellCommand (command = ["rm", "-rf", "build"], workdir = ".", - env = build_env, description = "clean build dir") +sh_rm_build_dir = EnvShellCommand (command = ["rm", "-rf", "build"], workdir = ".", + env = build_env, description = "clean build dir") -sh_mk_build_dir = ShellCommand (command = ["mkdir", "build"], - description = "create build dir") +sh_mk_build_dir = EnvShellCommand (command = ["mkdir", "build"], + description = "create build dir") def mk_octave_configure_step (nice = 0, opts = []): conf_cmd = build_cmd_list ("../src/configure", nice = nice, opts = opts) @@ -650,8 +661,8 @@ def mk_mxe_octave_bootstrap_step (nice = 0): boot_cmd = build_cmd_list ("./bootstrap", nice = nice) - return ShellCommand (command = boot_cmd, workdir = "src", env = build_env, - description = "bootstrap") + return EnvShellCommand (command = boot_cmd, workdir = "src", env = build_env, + description = "bootstrap") def mk_mxe_octave_configure_step (nice = 0, branch = "default", opts = []): @@ -665,8 +676,8 @@ def mk_mxe_octave_clean_step (nice = 0): boot_cmd = build_cmd_list (["make", "clean"], nice = nice) - return ShellCommand (command = boot_cmd, workdir = "src", env = build_env, - description = "clean") + return EnvShellCommand (command = boot_cmd, workdir = "src", env = build_env, + description = "clean") ## Timeout is large for these steps because mxe-octave currently only