From 2bfb1417f7e931cdd2381129e86ccbba785b4bc4 Mon Sep 17 00:00:00 2001 From: Dolphin von Chips Date: Wed, 29 Jul 2020 21:18:34 +0500 Subject: [PATCH] CI: check if packages in _pmb_recommends exist (MR 1467) --- .gitlab-ci/testcases/test_aports.py | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/.gitlab-ci/testcases/test_aports.py b/.gitlab-ci/testcases/test_aports.py index 04414a400..deb1e59bc 100644 --- a/.gitlab-ci/testcases/test_aports.py +++ b/.gitlab-ci/testcases/test_aports.py @@ -10,6 +10,8 @@ import os import add_pmbootstrap_to_import_path import pmb.parse import pmb.parse._apkbuild +import pmb.parse.apkindex +import pmb.helpers.repo @pytest.fixture @@ -172,3 +174,32 @@ def test_aports_device_kernel(args): " multiple kernels in depends (see" " ): " + path) + + +def test_aports_ui(args): + """ + Raise an error if package in _pmb_recommends is not found + """ + for arch in pmb.config.build_device_architectures: + for path in glob.iglob(args.aports + "/main/postmarketos-ui-*/APKBUILD"): + apkbuild = pmb.parse.apkbuild(args, path) + # Skip if arch isn't enabled + if not pmb.helpers.package.check_arch(args, apkbuild["pkgname"], arch): + continue + + for package in apkbuild["_pmb_recommends"]: + depend = pmb.helpers.package.get(args, package, + arch, must_exist=False) + if depend is None or not pmb.helpers.package.check_arch(args, package, arch): + raise RuntimeError(f"{path}: package '{package}' from" + f" _pmb_recommends not found for arch '{arch}'") + + # Check packages from "_pmb_recommends" of -extras subpackage if one exists + if f"{apkbuild['pkgname']}-extras" in apkbuild["subpackages"]: + apkbuild = apkbuild["subpackages"][f"{apkbuild['pkgname']}-extras"] + for package in apkbuild["_pmb_recommends"]: + depend = pmb.helpers.package.get(args, package, + arch, must_exist=False) + if depend is None or not pmb.helpers.package.check_arch(args, package, arch): + raise RuntimeError(f"{path}: package '{package}' from _pmb_recommends " + f"of -extras subpackage is not found for arch '{arch}'")