diff options
author | Jermain Horsman <jermain.horsman@nedap.com> | 2024-03-25 13:50:38 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-03-30 22:25:43 +0000 |
commit | 9b839a835cc0746c59f9d74ef0e66c79280f8f13 (patch) | |
tree | 65ae9b380e03c0fe0bc9e817cfd0f3cd8a7c2c8e /meta/lib/oe | |
parent | 861a703c1afc9b8fad0226dd5408eb200a0085c1 (diff) | |
download | poky-9b839a835cc0746c59f9d74ef0e66c79280f8f13.tar.gz |
bblayers/makesetup.py: Move git utility functions to oe.buildcfg module
This allows other classes to make use of these as well.
Includes a git describe and git toplevel function and functions
to get info for git remotes.
(From OE-Core rev: a04a084b6e513d15cb57ee103c6d6215ce1c75b9)
Signed-off-by: Jermain Horsman <jermain.horsman@nedap.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe')
-rw-r--r-- | meta/lib/oe/buildcfg.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/meta/lib/oe/buildcfg.py b/meta/lib/oe/buildcfg.py index b3fe510309..27b059b834 100644 --- a/meta/lib/oe/buildcfg.py +++ b/meta/lib/oe/buildcfg.py | |||
@@ -28,6 +28,35 @@ def get_metadata_git_revision(path): | |||
28 | rev = '<unknown>' | 28 | rev = '<unknown>' |
29 | return rev.strip() | 29 | return rev.strip() |
30 | 30 | ||
31 | def get_metadata_git_toplevel(path): | ||
32 | try: | ||
33 | toplevel, _ = bb.process.run('git rev-parse --show-toplevel', cwd=path) | ||
34 | except bb.process.ExecutionError: | ||
35 | return "" | ||
36 | return toplevel.strip() | ||
37 | |||
38 | def get_metadata_git_remotes(path): | ||
39 | try: | ||
40 | remotes_list, _ = bb.process.run('git remote', cwd=path) | ||
41 | remotes = remotes_list.split() | ||
42 | except bb.process.ExecutionError: | ||
43 | remotes = [] | ||
44 | return remotes | ||
45 | |||
46 | def get_metadata_git_remote_url(path, remote): | ||
47 | try: | ||
48 | uri, _ = bb.process.run('git remote get-url {remote}'.format(remote=remote), cwd=path) | ||
49 | except bb.process.ExecutionError: | ||
50 | return "" | ||
51 | return uri.strip() | ||
52 | |||
53 | def get_metadata_git_describe(path): | ||
54 | try: | ||
55 | describe, _ = bb.process.run('git describe --tags', cwd=path) | ||
56 | except bb.process.ExecutionError: | ||
57 | return "" | ||
58 | return describe.strip() | ||
59 | |||
31 | def is_layer_modified(path): | 60 | def is_layer_modified(path): |
32 | try: | 61 | try: |
33 | subprocess.check_output("""cd %s; export PSEUDO_UNLOAD=1; set -e; | 62 | subprocess.check_output("""cd %s; export PSEUDO_UNLOAD=1; set -e; |