Skip to content

Commit bd30608

Browse files
authored
Add a new 'hint' argument for LLVMBuildFactory factory class. (#223)
This parameter is used to apply suffixes to the step names when factory is used as a nested factory for another one. The suffix will be added to the step name separated by dash symbol. As example for 'stageX' hint the following step names will be generated for the factory's steps: cmake-cofigure => cmake-configure-stageX build => build-<target>-stageX
1 parent 7e930b2 commit bd30608

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

zorg/buildbot/process/factory.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,24 @@ class LLVMBuildFactory(BuildFactory):
2323
2424
enable_runtimes is a list of enabled runtimes. If None,
2525
it gets discovered based on the depends_on_projects list.
26+
27+
hint : string, optional
28+
Use this hint to apply suffixes to the step names when factory is used as a nested factory for another one.
29+
The suffix will be added to the step name separated by dash symbol.
30+
31+
As example, passing of 'stageX' with 'hint' will force generating of the following step names:
32+
cmake-cofigure => cmake-configure-stageX
33+
build => build-stageX
34+
install => install-stageX
35+
& etc.
2636
"""
2737

28-
def __init__(self, steps=None, depends_on_projects=None, **kwargs):
38+
def __init__(self, steps=None, depends_on_projects=None, hint=None, **kwargs):
2939
# Cannot use "super" here as BuildFactory is an old style class.
3040
BuildFactory.__init__(self, steps)
3141

42+
self.hint = hint
43+
3244
# Handle the dependencies.
3345
if depends_on_projects is None:
3446
# llvm project is always included.
@@ -141,12 +153,16 @@ def pathRelativeTo(path, basePath):
141153

142154
return rel_path
143155

144-
156+
def makeStepName(self, name):
157+
assert name, "The step name agrument cannot be empty."
158+
return f"{name}-{self.hint}" if self.hint else name
159+
145160
def addGetSourcecodeSteps(self, **kwargs):
146161
# Checkout the monorepo.
147162
# Documentation: http://docs.buildbot.net/current/manual/configuration/buildsteps.html#git
148163
self.addStep(steps.Git(
149-
name='Checkout the source code',
164+
name=self.makeStepName('checkout'),
165+
description='Checkout the source code',
150166
repourl=self.repourl_prefix + "llvm-project.git",
151167
progress=True,
152168
workdir=util.Interpolate(self.monorepo_dir),
@@ -176,7 +192,7 @@ def addGetSourcecodeForProject(self, project, name=None, src_dir=None, **kwargs)
176192
kwargs.pop('workdir', None)
177193

178194
self.addStep(steps.Git(
179-
name=name,
195+
name=self.makeStepName(name),
180196
repourl=_repourl,
181197
progress=True,
182198
workdir=util.Interpolate(src_dir),

0 commit comments

Comments
 (0)