aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2017-12-05 17:51:37 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-12-10 22:41:42 +0000
commitddda57ab1dee989dce8754350471807c916a6f47 (patch)
tree4a220856832ad432228c11a9a3b76001b11eb899
parent33bf6e05af0a68da32f0484460b1de5f7f4eea98 (diff)
downloadopenembedded-core-contrib-ddda57ab1dee989dce8754350471807c916a6f47.tar.gz
classes/sanity: check we don't have an ancient GNU patch
We depend on the host GNU patch, but patch < 2.7 can't handle git-style patches. This results in patches that fail to apply, or worse apply incorrectly. Signed-off-by: Ross Burton <ross.burton@intel.com>
-rw-r--r--meta/classes/sanity.bbclass17
1 files changed, 17 insertions, 0 deletions
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index 1410af2901..d0f507e0c5 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -456,6 +456,22 @@ def check_sanity_validmachine(sanity_data):
return messages
+# Patch before 2.7 can't handle all the features in git-style diffs. Some
+# patches may incorrectly apply, and others won't apply at all.
+def check_patch_version(sanity_data):
+ from distutils.version import LooseVersion
+ import re, subprocess
+
+ try:
+ result = subprocess.check_output(["patch", "--version"], stderr=subprocess.STDOUT, universal_newlines=True)
+ version = re.search(r"[0-9.]+", result.splitlines()[0]).group()
+ if LooseVersion(version) < LooseVersion("2.7"):
+ return "Your version of patch is older than 2.7 and has bugs which will break builds. Please install a newer version of patch.\n"
+ else:
+ return None
+ except subprocess.CalledProcessError as e:
+ return "Unable to execute patch --version, exit code %d:\n%s\n" % (e.returncode, e.output)
+
# Unpatched versions of make 3.82 are known to be broken. See GNU Savannah Bug 30612.
# Use a modified reproducer from http://savannah.gnu.org/bugs/?30612 to validate.
def check_make_version(sanity_data):
@@ -596,6 +612,7 @@ def check_sanity_version_change(status, d):
import stat
status.addresult(check_make_version(d))
+ status.addresult(check_patch_version(d))
status.addresult(check_tar_version(d))
status.addresult(check_git_version(d))
status.addresult(check_perl_modules(d))