summaryrefslogtreecommitdiff
path: root/buildstream/plugins/sources
diff options
context:
space:
mode:
authorWilliam Salmon <will.salmon@codethink.co.uk>2018-08-14 09:57:15 +0100
committerWilliam Salmon <will.salmon@codethink.co.uk>2018-08-17 10:48:01 +0100
commit9b6fac5ada7c2541da5666fa63160a7cea3dbe67 (patch)
tree5047089944b57d9c4b0ef620c42cf6a714c3a884 /buildstream/plugins/sources
parentc102b92fe4a3f1c71a77629a57a9838b83ee19b8 (diff)
downloadbuildstream-9b6fac5ada7c2541da5666fa63160a7cea3dbe67.tar.gz
Add Error to git and ostree sources configure
Raise a error at configure time if the track and ref properties are not present in the sources. This is to address https://gitlab.com/BuildStream/buildstream/issues/471 that documented unhelpful behaviour when tracking git sources. However the issue was also identified in ostree.
Diffstat (limited to 'buildstream/plugins/sources')
-rw-r--r--buildstream/plugins/sources/git.py7
-rw-r--r--buildstream/plugins/sources/ostree.py6
2 files changed, 13 insertions, 0 deletions
diff --git a/buildstream/plugins/sources/git.py b/buildstream/plugins/sources/git.py
index 855e766d2..b3bc9cac7 100644
--- a/buildstream/plugins/sources/git.py
+++ b/buildstream/plugins/sources/git.py
@@ -309,6 +309,13 @@ class GitSource(Source):
self.original_url = self.node_get_member(node, str, 'url')
self.mirror = GitMirror(self, '', self.original_url, ref)
self.tracking = self.node_get_member(node, str, 'track', None)
+
+ # At this point we now know if the source has a ref and/or a track.
+ # If it is missing both then we will be unable to track or build.
+ if self.mirror.ref is None and self.tracking is None:
+ 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.submodules = []
diff --git a/buildstream/plugins/sources/ostree.py b/buildstream/plugins/sources/ostree.py
index 6266731bf..526a91aa0 100644
--- a/buildstream/plugins/sources/ostree.py
+++ b/buildstream/plugins/sources/ostree.py
@@ -73,6 +73,12 @@ class OSTreeSource(Source):
self.mirror = os.path.join(self.get_mirror_directory(),
utils.url_directory_name(self.original_url))
+ # At this point we now know if the source has a ref and/or a track.
+ # If it is missing both then we will be unable to track or build.
+ if self.ref is None and self.tracking is None:
+ raise SourceError("{}: OSTree sources require a ref and/or track".format(self),
+ reason="missing-track-and-ref")
+
# (optional) Not all repos are signed. But if they are, get the gpg key
self.gpg_key_path = None
if self.node_get_member(node, str, 'gpg-key', None):