summaryrefslogtreecommitdiff
path: root/buildstream/plugins/sources
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-02-20 17:28:45 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-03-20 17:46:42 +0900
commit93e29955910527cde4b7895f78f72d1a7672d0bd (patch)
treec3fb3eda8255d988d54cdfd05c46d919e21733db /buildstream/plugins/sources
parent19cad981007d514cf15218b783ae05ed16cb511a (diff)
downloadbuildstream-93e29955910527cde4b7895f78f72d1a7672d0bd.tar.gz
Source plugins: Implement load_ref() in all source plugins
Diffstat (limited to 'buildstream/plugins/sources')
-rw-r--r--buildstream/plugins/sources/_downloadablefilesource.py4
-rw-r--r--buildstream/plugins/sources/bzr.py3
-rw-r--r--buildstream/plugins/sources/git.py6
-rw-r--r--buildstream/plugins/sources/local.py3
-rw-r--r--buildstream/plugins/sources/ostree.py8
-rw-r--r--buildstream/plugins/sources/patch.py3
6 files changed, 20 insertions, 7 deletions
diff --git a/buildstream/plugins/sources/_downloadablefilesource.py b/buildstream/plugins/sources/_downloadablefilesource.py
index d3b8d49bd..fd7c7fac5 100644
--- a/buildstream/plugins/sources/_downloadablefilesource.py
+++ b/buildstream/plugins/sources/_downloadablefilesource.py
@@ -36,6 +36,10 @@ class DownloadableFileSource(Source):
else:
return Consistency.RESOLVED
+ def load_ref(self, node):
+ self.ref = self.node_get_member(node, str, 'ref', '') or None
+ self.etag = self.node_get_member(node, str, 'etag', '') or None
+
def get_ref(self):
# Report `None` value if we dont have a ref
if self.ref is None:
diff --git a/buildstream/plugins/sources/bzr.py b/buildstream/plugins/sources/bzr.py
index 88349561c..93db3463c 100644
--- a/buildstream/plugins/sources/bzr.py
+++ b/buildstream/plugins/sources/bzr.py
@@ -84,6 +84,9 @@ class BzrSource(Source):
else:
return Consistency.RESOLVED
+ def load_ref(self, node):
+ self.ref = self.node_get_member(node, str, 'ref', '') or None
+
def get_ref(self):
return self.ref
diff --git a/buildstream/plugins/sources/git.py b/buildstream/plugins/sources/git.py
index 86e167e8e..3d10f69f6 100644
--- a/buildstream/plugins/sources/git.py
+++ b/buildstream/plugins/sources/git.py
@@ -258,9 +258,6 @@ class GitSource(Source):
checkout = self.node_get_member(submodule, bool, 'checkout')
self.submodule_checkout_overrides[path] = checkout
- if not (ref or self.tracking):
- raise SourceError("{}: Must specify either 'ref' or 'track' parameters".format(self))
-
def preflight(self):
# Check if git is installed, get the binary at the same time
self.host_git = utils.get_host_tool('git')
@@ -293,6 +290,9 @@ class GitSource(Source):
return Consistency.RESOLVED
return Consistency.INCONSISTENT
+ def load_ref(self, node):
+ self.mirror.ref = self.node_get_member(node, str, 'ref', '') or None
+
def get_ref(self):
return self.mirror.ref
diff --git a/buildstream/plugins/sources/local.py b/buildstream/plugins/sources/local.py
index 4f4a7b8e3..ebdd86fdf 100644
--- a/buildstream/plugins/sources/local.py
+++ b/buildstream/plugins/sources/local.py
@@ -76,6 +76,9 @@ class LocalSource(Source):
return Consistency.CACHED
# We dont have a ref, we're a local file...
+ def load_ref(self, node):
+ pass
+
def get_ref(self):
return None # pragma: nocover
diff --git a/buildstream/plugins/sources/ostree.py b/buildstream/plugins/sources/ostree.py
index d0b3c1807..43ca873ec 100644
--- a/buildstream/plugins/sources/ostree.py
+++ b/buildstream/plugins/sources/ostree.py
@@ -79,15 +79,15 @@ class OSTreeSource(Source):
# Our OSTree repo handle
self.repo = None
- if not (self.ref or self.tracking):
- raise SourceError("{}: Must specify either 'ref' or 'track' parameters".format(self))
-
def preflight(self):
- return
+ pass
def get_unique_key(self):
return [self.original_url, self.ref]
+ def load_ref(self, node):
+ self.ref = self.node_get_member(node, str, 'ref', '') or None
+
def get_ref(self):
return self.ref
diff --git a/buildstream/plugins/sources/patch.py b/buildstream/plugins/sources/patch.py
index a8a2da26c..cf9782a80 100644
--- a/buildstream/plugins/sources/patch.py
+++ b/buildstream/plugins/sources/patch.py
@@ -68,6 +68,9 @@ class PatchSource(Source):
def get_consistency(self):
return Consistency.CACHED
+ def load_ref(self, node):
+ pass
+
def get_ref(self):
return None # pragma: nocover