Skip to content

Commit 03f14e6

Browse files
committed
Use StringDownload to transfer toolchains file and fix issues related to interpolation
1 parent 6f37f5b commit 03f14e6

File tree

2 files changed

+14
-17
lines changed

2 files changed

+14
-17
lines changed

buildbot/osuosl/master/config/builders.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3153,7 +3153,7 @@
31533153

31543154
## RISC-V RVA20 profile check-all 2-stage. The second stage is
31553155
# cross-compiled on the x86 host and then lit runs under a qemu-system image
3156-
# using the just-build artifacts.
3156+
# using the just-built artifacts.
31573157
{'name' : "clang-riscv-rva20-2stage",
31583158
'tags' : ["clang"],
31593159
'workernames' : ["rise-clang-riscv-rva20-2stage"],

zorg/buildbot/builders/ClangBuilder.py

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from buildbot.plugins import util
55
from buildbot.steps.shell import ShellCommand, SetProperty
66
from buildbot.steps.shell import WarningCountingShellCommand
7+
from buildbot.steps.transfer import StringDownload
78

89
import zorg.buildbot.builders.Util as builders_util
910

@@ -435,32 +436,28 @@ def _getClangCMakeBuildFactory(
435436
# Absolute paths to just built compilers.
436437
# Note: Backslash path separators do not work well with cmake and ninja.
437438
# Forward slash path separator works on Windows as well.
438-
stage1_cc = InterpolateToPosixPath(
439-
f"%(prop:builddir)s/{stage1_install}/bin/{cc}")
440-
stage1_cxx = InterpolateToPosixPath(
441-
f"%(prop:builddir)s/{stage1_install}/bin/{cxx}")
439+
stage1_cc = f"%(prop:builddir)s/{stage1_install}/bin/{cc}"
440+
stage1_cxx = f"%(prop:builddir)s/{stage1_install}/bin/{cxx}"
442441

443442
# If stage2_toolchain_options is set when we'll use a toolchain file
444443
# to specify the compiler being used (the just-built stage1) and add
445444
# any stage2_toolchain_options to it. Otherwise, just set
446445
# -DCMAKE_{C,CXX}_COMPILER.
447446
if stage2_toolchain_options is None:
448447
compiler_args = [
449-
f"-DCMAKE_C_COMPILER={stage1_cc}",
450-
f"-DCMAKE_CXX_COMPILER={stage1_cxx}"
448+
InterpolateToPosixPath(f"-DCMAKE_C_COMPILER={stage1_cc}"),
449+
InterpolateToPosixPath(f"-DCMAKE_CXX_COMPILER={stage1_cxx}"),
451450
]
452451
else:
453-
toolchain_file = InterpolateToPosixPath(
454-
f"%(prop:builddir)s/{stage2_build}/stage1-toolchain.cmake")
455-
with open(toolchain_file, 'w') as file:
456-
file.write(f"set(CMAKE_C_COMPILER {stage1_cc})\n")
457-
file.write(f"set(CMAKE_CXX_COMPILER {stage1_cxx})\n")
458-
for option in stage2_toolchain_options:
459-
file.write(f"{option}\n")
452+
toolchain_file = f"%(prop:builddir)s/{stage2_build}/stage1-toolchain.cmake"
453+
toolchain_file_contents = "\n".join([
454+
f"set(CMAKE_C_COMPILER {stage1_cc})",
455+
f"set(CMAKE_CXX_COMPILER {stage1_cxx})",
456+
] + stage2_toolchain_options)
457+
f.addStep(StringDownload(util.Interpolate(toolchain_file_contents),
458+
workerdest=InterpolateToPosixPath(toolchain_file)))
459+
compiler_args = [InterpolateToPosixPath(f"-DCMAKE_TOOLCHAIN_FILE={toolchain_file}")]
460460

461-
compiler_args = [
462-
"-DCMAKE_TOOLCHAIN_FILE={toolchain_file}"
463-
]
464461

465462
# If we have a separate stage2 cmake arg list, then ensure we re-apply
466463
# enable_projects and enable_runtimes if necessary.

0 commit comments

Comments
 (0)