From 7ab40a4336816a57fec005a175df1159a3d5ff04 Mon Sep 17 00:00:00 2001 From: Clayton Craft Date: Mon, 14 Apr 2025 18:36:12 -0700 Subject: [PATCH] pmb.lint: Don't try to lint apkbuild paths that are empty This fixes an issue where pmb lint tries to lint an apkbuild using a repo path that the apkbuild doesn't exist in. For example, it fixes this: ``` [22:13:26] (native) linting postmarketos-ui-cosmic with apkbuild-lint [22:13:26] *** apkbuild-lint output *** Error: File APKBUILD does not exist [22:13:26] *** apkbuild-lint output *** [22:13:26] ERROR: Linter failed! Traceback (most recent call last): File "/builds/postmarketOS/pmaports/.ci/lib/apkbuild_linting.py", line 26, in common.run_pmbootstrap(["-q", "lint"] + packages) File "/builds/postmarketOS/pmaports/.ci/lib/common.py", line 52, in run_pmbootstrap subprocess.run(cmd, universal_newlines=True, check=True) File "/usr/lib/python3.12/subprocess.py", line 571, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['pmbootstrap', '--aports', '/builds/postmarketOS/pmaports', '-q', 'lint', 'postmarketos-ui-cosmic']' returned non-zero exit status 2. ``` Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2584 --- pmb/helpers/lint.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pmb/helpers/lint.py b/pmb/helpers/lint.py index 505e91a4..0770c00f 100644 --- a/pmb/helpers/lint.py +++ b/pmb/helpers/lint.py @@ -95,6 +95,9 @@ def check(pkgnames: Sequence[str]) -> None: # For each pkgrepo run the linter on the relevant packages has_failed = False for pkgrepo, apkbuild_paths in apkbuilds.items(): + # FIXME: somehow invalid paths get into this list + if not apkbuild_paths: + continue if pmb.chroot.user( ["apkbuild-lint", *apkbuild_paths], check=False,