1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-02 13:29:49 +00:00

lib/buildcfg: Share common clean/dirty layer function

The comments even say this was copy/paste code. Move to a
shared library function.

(From OE-Core rev: ac3de2f850a418673b87e1c454970cb099e191b0)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2022-06-09 11:27:14 +01:00
parent ba85bb6055
commit 5266670b2d
3 changed files with 16 additions and 35 deletions
+14 -1
View File
@@ -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"