summaryrefslogtreecommitdiff
path: root/src/buildstream/_gitsourcebase.py
diff options
context:
space:
mode:
authorBenjamin Schubert <ben.c.schubert@gmail.com>2019-06-10 14:20:23 +0100
committerBenjamin Schubert <contact@benschubert.me>2019-06-25 21:08:50 +0100
commitb68b6d14564584df0da60f41483021568bd91b91 (patch)
tree523b568c450545d27a995b0b2354566697103eba /src/buildstream/_gitsourcebase.py
parente62347655a5445a621701b6e13c7abd813d954c9 (diff)
downloadbuildstream-b68b6d14564584df0da60f41483021568bd91b91.tar.gz
_yaml: Add 'as_bool()' and 'is_none()' to ScalarNode
- 'as_bool()' casts a ScalarNode into a boolean, understanding both 'True' and 'False' as truthy-falsy values, as per node_get(type=bool) behavior - 'is_none()' allwos checking whether the scalar node contains a 'None' value. Since 'None' cannot be used when working with booleans, we need to have a way of checking for 'None' when we actually need the information of whether the value is unset. - Adapt all call places to use the new API
Diffstat (limited to 'src/buildstream/_gitsourcebase.py')
-rw-r--r--src/buildstream/_gitsourcebase.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/buildstream/_gitsourcebase.py b/src/buildstream/_gitsourcebase.py
index eefa36b1d..61ecd36eb 100644
--- a/src/buildstream/_gitsourcebase.py
+++ b/src/buildstream/_gitsourcebase.py
@@ -388,7 +388,7 @@ class _GitSourceBase(Source):
self.node_validate(tag_node, ['tag', 'commit', 'annotated'])
tags = self._load_tags(node)
- self.track_tags = self.node_get_member(node, bool, 'track-tags', False)
+ self.track_tags = node.get_bool('track-tags', default=False)
self.original_url = node.get_str('url')
self.mirror = self.BST_MIRROR_CLASS(self, '', self.original_url, ref, tags=tags, primary=True)
@@ -405,7 +405,7 @@ class _GitSourceBase(Source):
raise SourceError("{}: Git sources require a ref and/or track".format(self),
reason="missing-track-and-ref")
- self.checkout_submodules = self.node_get_member(node, bool, 'checkout-submodules', True)
+ self.checkout_submodules = node.get_bool('checkout-submodules', default=True)
self.submodules = []
# Parse a dict of submodule overrides, stored in the submodule_overrides
@@ -423,7 +423,7 @@ class _GitSourceBase(Source):
self.submodule_overrides[path] = url
if 'checkout' in submodule:
- checkout = self.node_get_member(submodule, bool, 'checkout')
+ checkout = submodule.get_bool('checkout')
self.submodule_checkout_overrides[path] = checkout
self.mark_download_url(self.original_url)
@@ -667,7 +667,7 @@ class _GitSourceBase(Source):
for tag_node in tags_node:
tag = tag_node.get_str('tag')
commit_ref = tag_node.get_str('commit')
- annotated = self.node_get_member(tag_node, bool, 'annotated')
+ annotated = tag_node.get_bool('annotated')
tags.append((tag, commit_ref, annotated))
return tags