summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-06-09 11:27:14 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-06-11 10:29:42 +0100
commitac3de2f850a418673b87e1c454970cb099e191b0 (patch)
treebead0ddea1558fcda67c089302b4fdf2416ad378 /meta/lib
parent439cdf8a1e52fd2c4dc81dc40ce7e6af282ce7ac (diff)
downloadopenembedded-core-contrib-ac3de2f850a418673b87e1c454970cb099e191b0.tar.gz
lib/buildcfg: Share common clean/dirty layer function
The comments even say this was copy/paste code. Move to a shared library function. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oe/buildcfg.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/meta/lib/oe/buildcfg.py b/meta/lib/oe/buildcfg.py
index a749fc5303..a7549f1e22 100644
--- a/meta/lib/oe/buildcfg.py
+++ b/meta/lib/oe/buildcfg.py
@@ -37,4 +37,17 @@ def get_metadata_git_revision(path, d):
except bb.process.ExecutionError:
rev = '<unknown>'
return rev.strip()
-
+
+def is_layer_modified(path):
+ try:
+ subprocess.check_output("""cd %s; export PSEUDO_UNLOAD=1; set -e;
+ git diff --quiet --no-ext-diff
+ git diff --quiet --no-ext-diff --cached""" % path,
+ shell=True,
+ stderr=subprocess.STDOUT)
+ return ""
+ except subprocess.CalledProcessError as ex:
+ # Silently treat errors as "modified", without checking for the
+ # (expected) return code 1 in a modified git repo. For example, we get
+ # output and a 129 return code when a layer isn't a git repo at all.
+ return " -- modified"