diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-06-09 11:27:14 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-06-11 10:30:57 +0100 |
commit | 5266670b2da48cccc9f042ca7afc7f86d7ff89ae (patch) | |
tree | 2cda867885b1e605275ff31e73c4197f5c129293 /meta/lib | |
parent | ba85bb605502a86fa83bd7a0f3d8ed644dc16a8c (diff) | |
download | poky-5266670b2da48cccc9f042ca7afc7f86d7ff89ae.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.
(From OE-Core rev: ac3de2f850a418673b87e1c454970cb099e191b0)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oe/buildcfg.py | 15 |
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): | |||
37 | except bb.process.ExecutionError: | 37 | except bb.process.ExecutionError: |
38 | rev = '<unknown>' | 38 | rev = '<unknown>' |
39 | return rev.strip() | 39 | return rev.strip() |
40 | 40 | ||
41 | def is_layer_modified(path): | ||
42 | try: | ||
43 | subprocess.check_output("""cd %s; export PSEUDO_UNLOAD=1; set -e; | ||
44 | git diff --quiet --no-ext-diff | ||
45 | git diff --quiet --no-ext-diff --cached""" % path, | ||
46 | shell=True, | ||
47 | stderr=subprocess.STDOUT) | ||
48 | return "" | ||
49 | except subprocess.CalledProcessError as ex: | ||
50 | # Silently treat errors as "modified", without checking for the | ||
51 | # (expected) return code 1 in a modified git repo. For example, we get | ||
52 | # output and a 129 return code when a layer isn't a git repo at all. | ||
53 | return " -- modified" | ||