From 4336f06475692871efa0f493854019e9b8188848 Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Wed, 13 Nov 2024 17:23:24 +0000 Subject: scripts/checklayer: check for SECURITY.md Add a check for a SECURITY.md file (or similar) to yocto-check-layer, as knowing where to report security issues is important. (From OE-Core rev: c7cb22ac4ceed60f88452e83c907a4c4f33660e4) Signed-off-by: Ross Burton Signed-off-by: Mathieu Dubois-Briand Signed-off-by: Richard Purdie --- scripts/lib/checklayer/__init__.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'scripts/lib/checklayer/__init__.py') diff --git a/scripts/lib/checklayer/__init__.py b/scripts/lib/checklayer/__init__.py index 62ecdfe390..86aadf39a6 100644 --- a/scripts/lib/checklayer/__init__.py +++ b/scripts/lib/checklayer/__init__.py @@ -452,3 +452,15 @@ def compare_signatures(old_sigs, curr_sigs): msg.extend([' ' + line for line in output.splitlines()]) msg.append('') return '\n'.join(msg) + + +def get_git_toplevel(directory): + """ + Try and find the top of the git repository that directory might be in. + Returns the top-level directory, or None. + """ + cmd = ["git", "-C", directory, "rev-parse", "--show-toplevel"] + try: + return subprocess.check_output(cmd, text=True).strip() + except: + return None -- cgit v1.2.3-54-g00ecf