summaryrefslogtreecommitdiff
path: root/buildstream/plugins/sources/patch.py
diff options
context:
space:
mode:
authorTiago Gomes <tiago.avv@gmail.com>2018-08-02 12:10:29 +0000
committerTiago Gomes <tiago.avv@gmail.com>2018-08-02 12:10:29 +0000
commit8656a65d21bd002b1fd490481e736f1748e8db86 (patch)
treea54839da778fc48c22fac07c4d64fa8dc7e3ed93 /buildstream/plugins/sources/patch.py
parent039d43e43431957a42193f12f06acb7b95c2eae4 (diff)
parent9f0c8fcfe348533987ec128b85356655edae77f4 (diff)
downloadbuildstream-Qinusty/490-artifact-cache-interactivity.tar.gz
Merge branch 'tiagogomes/issue-195' into 'master'Qinusty/490-artifact-cache-interactivity
Add validation for project paths See merge request BuildStream/buildstream!593
Diffstat (limited to 'buildstream/plugins/sources/patch.py')
-rw-r--r--buildstream/plugins/sources/patch.py13
1 files changed, 4 insertions, 9 deletions
diff --git a/buildstream/plugins/sources/patch.py b/buildstream/plugins/sources/patch.py
index 11b66b3ea..2fa002080 100644
--- a/buildstream/plugins/sources/patch.py
+++ b/buildstream/plugins/sources/patch.py
@@ -1,5 +1,6 @@
#
# Copyright Bloomberg Finance LP
+# Copyright (C) 2018 Codethink Limited
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -16,6 +17,7 @@
#
# Authors:
# Chandan Singh <csingh43@bloomberg.net>
+# Tiago Gomes <tiago.gomes@codethink.co.uk>
"""
patch - apply locally stored patches
@@ -52,19 +54,12 @@ class PatchSource(Source):
# pylint: disable=attribute-defined-outside-init
def configure(self, node):
- self.path = self.node_get_member(node, str, "path")
+ self.path = self.node_get_project_path(node, 'path',
+ check_is_file=True)
self.strip_level = self.node_get_member(node, int, "strip-level", 1)
self.fullpath = os.path.join(self.get_project_directory(), self.path)
def preflight(self):
- # Check if the configured file really exists
- if not os.path.exists(self.fullpath):
- raise SourceError("Specified path '{}' does not exist".format(self.path),
- reason="patch-no-exist")
- elif not os.path.isfile(self.fullpath):
- raise SourceError("Specified path '{}' must be a file".format(self.path),
- reason="patch-not-a-file")
-
# Check if patch is installed, get the binary at the same time
self.host_patch = utils.get_host_tool("patch")