From 239aa4da8f7d900943f648bc6cc4c9a504528e7b Mon Sep 17 00:00:00 2001 From: Newbyte Date: Sat, 25 Mar 2023 21:40:50 +0100 Subject: [PATCH] CI: Support not having "pmbootstrap" in $PATH (MR 3977) Not everyone's setup includes "pmbootstrap" as a command in $PATH. Currently, in such setups, $ pmbootstrap ci kconfig (and potentially other testcases) in the pmaports repository do not work as they expect the "pmbootstrap" command to exist. Resolve this by checking whether PMBOOTSTRAP_CMD is set and use that as command for invoking pmbootstrap. If it isn't set (because you're using an old pmbootstrap version or invoking a script directly for some reason), fall back to the old behaviour as to not break compatibility. Depends on pmbootstrap patch that sets PMBOOTSTRAP_CMD to argv[0]: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/patches/39995 --- .ci/testcases/add_pmbootstrap_to_import_path/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.ci/testcases/add_pmbootstrap_to_import_path/__init__.py b/.ci/testcases/add_pmbootstrap_to_import_path/__init__.py index 7b2b152a3..a8cc13279 100755 --- a/.ci/testcases/add_pmbootstrap_to_import_path/__init__.py +++ b/.ci/testcases/add_pmbootstrap_to_import_path/__init__.py @@ -15,8 +15,10 @@ def path_pmbootstrap(): code from there. returns: pmbootstrap installation folder """ - # Find 'pmbootstrap' executable - bin = shutil.which("pmbootstrap") + # This variable is set by pmbootstrap 1.52 and later + # If it's undefined, try to find 'pmbootstrap' in path + bin = os.environ.get("PMBOOTSTRAP_CMD") or shutil.which("pmbootstrap") + if not bin: print("ERROR: 'pmbootstrap' not found in $PATH") sys.exit(1)