diff options
author | Tristan Maat <tristan.maat@codethink.co.uk> | 2018-03-12 13:09:08 +0100 |
---|---|---|
committer | Tristan Maat <tristan.maat@codethink.co.uk> | 2018-03-27 14:32:54 +0100 |
commit | 6d5a7217cbc3f88a3355b62025cdf0ba079348b7 (patch) | |
tree | e4fc15282069080617b119dcd6ec9de02aa53b17 /buildstream/_workspaces.py | |
parent | f761140f18a7d54caf6e6dba8a722b9ff1f4430e (diff) | |
download | buildstream-6d5a7217cbc3f88a3355b62025cdf0ba079348b7.tar.gz |
Record last successful workspace build key
Diffstat (limited to 'buildstream/_workspaces.py')
-rw-r--r-- | buildstream/_workspaces.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/buildstream/_workspaces.py b/buildstream/_workspaces.py index 9c3933bbd..36b2c9e74 100644 --- a/buildstream/_workspaces.py +++ b/buildstream/_workspaces.py @@ -40,9 +40,11 @@ BST_WORKSPACE_FORMAT_VERSION = 1 # Args: # path (str): The path that should host this workspace # project (Project): The project this workspace is part of +# last_successful (str): The key of the last successful build of this workspace # class Workspace(): - def __init__(self, path, project): + def __init__(self, path, project, last_successful=None): + self.last_successful = last_successful self.path = path self._element = None @@ -52,8 +54,12 @@ class Workspace(): @classmethod def from_yaml_node(cls, node, project): path = _yaml.node_get(node, str, 'path') + last_successful = _yaml.node_get(node, str, 'last_successful', default_value='') - return cls(path, project) + if last_successful == '': + last_successful = None + + return cls(path, project, last_successful) # _to_dict() # @@ -63,7 +69,7 @@ class Workspace(): # (dict) A dict representation of the workspace # def _to_dict(self): - to_return = ['path'] + to_return = ['path', 'last_successful'] return {key: val for key, val in self.__dict__.items() if key in to_return and val is not None} |