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
This commit is contained in:
Newbyte 2023-03-25 21:40:50 +01:00 committed by Oliver Smith
parent 9b4b663a38
commit 239aa4da8f
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -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)