summaryrefslogtreecommitdiff
path: root/src/buildstream
diff options
context:
space:
mode:
authorbst-marge-bot <marge-bot@buildstream.build>2020-05-12 14:36:50 +0000
committerbst-marge-bot <marge-bot@buildstream.build>2020-05-12 14:36:50 +0000
commit011f591b79e3a4def535ac829c3d885707381133 (patch)
treec2e6b924e636d123c3b4901751e6866eaa8b2ccb /src/buildstream
parentd7d18c1a2e454c507afd9e1d3f1358639dd43871 (diff)
parentcd7132a4e8868b2e4bf507f17f6de795f832b094 (diff)
downloadbuildstream-011f591b79e3a4def535ac829c3d885707381133.tar.gz
Merge branch 'chandan/builddir-cachekey' into 'master'
buildelement: Ensure command-subdir is part of the cache key Closes #1295 See merge request BuildStream/buildstream!1920
Diffstat (limited to 'src/buildstream')
-rw-r--r--src/buildstream/buildelement.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/buildstream/buildelement.py b/src/buildstream/buildelement.py
index ce6bb3393..aa427064b 100644
--- a/src/buildstream/buildelement.py
+++ b/src/buildstream/buildelement.py
@@ -171,6 +171,8 @@ class BuildElement(Element):
# extend the configuration
node.validate_keys(_command_steps)
+ self._command_subdir = self.get_variable("command-subdir") # pylint: disable=attribute-defined-outside-init
+
for command_name in _legacy_command_steps:
self.__commands[command_name] = node.get_str_list(command_name, [])
@@ -183,6 +185,9 @@ class BuildElement(Element):
for command_name, command_list in self.__commands.items():
dictionary[command_name] = command_list
+ if self._command_subdir:
+ dictionary["command-subdir"] = self._command_subdir
+
# Specifying notparallel for a given element effects the
# cache key, while having the side effect of setting max-jobs to 1,
# which is normally automatically resolved and does not affect
@@ -201,9 +206,8 @@ class BuildElement(Element):
sandbox.mark_directory(install_root)
# Allow running all commands in a specified subdirectory
- command_subdir = self.get_variable("command-subdir")
- if command_subdir:
- command_dir = os.path.join(build_root, command_subdir)
+ if self._command_subdir:
+ command_dir = os.path.join(build_root, self._command_subdir)
else:
command_dir = build_root
sandbox.set_work_directory(command_dir)