From 4ef0a4e9ad021cb19440de273d18e345bce352b5 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Thu, 26 Sep 2024 20:16:05 +0200 Subject: [PATCH] CI: apkbuild_linting: fix missing output (MR 5633) pmbootstrap used to exit with 0 if "pmbootstrap lint" failed. This was the case in 2.3.x too, but I assumed this was a regression and fixed it recently in pmbootstrap MR 2398. It turns out that the CI code relied on this assumption, it captured the output of "pmbootstrap lint", and only after it is done it checks if the output wasn't empty and prints it in that case followed by exit 1. Now that pmbootstrap actually exits with 1, CI already fails at "common.run_pmbootstrap" and doesn't get to the part where it would be printed. I think "exit 1" on error is actually the right thing to do in pmbootstrap, so I'll leave that in. Adjust CI to just run "pmbootstrap lint", removing the additional output capture logic that isn't used anywhere besides here. This also has the advantage that we get the output "live", without buffering it completely first. --- .ci/lib/apkbuild_linting.py | 7 +------ .ci/lib/common.py | 7 ++----- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/.ci/lib/apkbuild_linting.py b/.ci/lib/apkbuild_linting.py index 144068b3a..5fa8c76c6 100755 --- a/.ci/lib/apkbuild_linting.py +++ b/.ci/lib/apkbuild_linting.py @@ -23,9 +23,4 @@ if __name__ == "__main__": print("No APKBUILDs to lint") sys.exit(0) - result = common.run_pmbootstrap(["-q", "lint"] + packages, output_return=True) - - if len(result) > 0: - print("Linting issues found:") - print(result) - sys.exit(1) + common.run_pmbootstrap(["-q", "lint"] + packages) diff --git a/.ci/lib/common.py b/.ci/lib/common.py index f3f0507a1..6c21aaab2 100755 --- a/.ci/lib/common.py +++ b/.ci/lib/common.py @@ -44,14 +44,11 @@ def commit_message_has_string(needle): return needle in run_git(["show", "-s", "--format=full", "HEAD"]) -def run_pmbootstrap(parameters, output_return=False): +def run_pmbootstrap(parameters): """ Run pmbootstrap with the pmaports dir as --aports """ cmd = ["pmbootstrap", "--aports", get_pmaports_dir()] + parameters - stdout = subprocess.PIPE if output_return else None - result = subprocess.run(cmd, stdout=stdout, universal_newlines=True) + result = subprocess.run(cmd, universal_newlines=True) result.check_returncode() - if output_return: - return result.stdout def get_upstream_branch():