From be55833620361cf2316e53cf31fcf773ca867754 Mon Sep 17 00:00:00 2001 From: Chad Smith Date: Fri, 27 Mar 2026 18:43:08 -0600 Subject: [PATCH 1/3] tools: fix brpm script to use correct builddir in temp directory --- packages/brpm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/brpm b/packages/brpm index 7a1cf3d1d96..e1d0b318fef 100755 --- a/packages/brpm +++ b/packages/brpm @@ -30,6 +30,7 @@ if "avoid-pep8-E402-import-not-top-of-file": # Use the util functions from cloudinit sys.path.insert(0, find_root()) from cloudinit import subp, templater, util + from cloudinit import temp_utils # Subdirectories of the ~/rpmbuild dir @@ -83,7 +84,7 @@ def read_version_from_meson(): [ "meson", "setup", - "builddir", + builddir, "-Dinit_system=systemd", "-Ddisable_sshd_keygen=true", ] From 9cf9ab77d2b70867c314ba1d0095ba14d92ad172 Mon Sep 17 00:00:00 2001 From: Chad Smith Date: Fri, 27 Mar 2026 20:51:35 -0600 Subject: [PATCH 2/3] tests: retain skipUnlessJinjaGreaterThan 3.0.0 for rockylinux/9 support RockyLinux 9 has Jinja 2.11. Template-based unit tests break due to unsupported closure: +%}. Revert portion of 473fa335 to retain skip decorator avoiding unit test when Jinja is < 3.0.0 to support rockylinux developer rpm builds. --- packages/brpm | 3 +-- tests/unittests/helpers.py | 9 +++++++++ tests/unittests/test_render_template.py | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/brpm b/packages/brpm index e1d0b318fef..e24db2b7a92 100755 --- a/packages/brpm +++ b/packages/brpm @@ -29,8 +29,7 @@ def find_root(): if "avoid-pep8-E402-import-not-top-of-file": # Use the util functions from cloudinit sys.path.insert(0, find_root()) - from cloudinit import subp, templater, util - from cloudinit import temp_utils + from cloudinit import subp, templater, temp_utils, util # Subdirectories of the ~/rpmbuild dir diff --git a/tests/unittests/helpers.py b/tests/unittests/helpers.py index e4acf61b23a..63aeae955b1 100644 --- a/tests/unittests/helpers.py +++ b/tests/unittests/helpers.py @@ -283,6 +283,15 @@ def skipUnlessJsonSchema(): ) +def skipUnlessJinjaVersionGreaterThan(version=(0, 0, 0)): + import jinja2 + + return pytest.mark.skipif( + tuple(map(int, jinja2.__version__.split("."))) < version, + reason=f"jinj2 version is less than {version}", + ) + + @contextmanager def does_not_raise(): """Context manager to parametrize tests raising and not raising exceptions diff --git a/tests/unittests/test_render_template.py b/tests/unittests/test_render_template.py index 793786fa95d..7f8fc944429 100644 --- a/tests/unittests/test_render_template.py +++ b/tests/unittests/test_render_template.py @@ -6,6 +6,7 @@ from cloudinit import subp, templater, util from tests.helpers import cloud_init_project_dir +from tests.unittests.helpers import skipUnlessJinjaVersionGreaterThan # TODO(Look to align with tools.render-template or cloudinit.distos.OSFAMILIES) DISTRO_VARIANTS = [ @@ -203,6 +204,7 @@ class TestRenderSourcesList: ), ], ) + @skipUnlessJinjaVersionGreaterThan((3, 0, 0)) def test_render_sources_list_templates( self, tmpdir, template_path, expected ): From c432c72f4dba36b4262e0651c394ab7fa38c8d58 Mon Sep 17 00:00:00 2001 From: Chad Smith Date: Mon, 30 Mar 2026 11:27:00 -0600 Subject: [PATCH 3/3] chore: add read-dependencies, bddeb and brpm to ruff includes --- pyproject.toml | 1 + tools/read-dependencies | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b9e25e083c4..4657424c946 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -211,6 +211,7 @@ lint.ignore = [ "D403", # docstring: capitalized first line "E731", # Do not assign a `lambda` expression, use a `def` ] +extend-include = ["*read-dependencies", "*bddeb", "*brpm"] [tool.ruff.lint.pydocstyle] convention = "pep257" diff --git a/tools/read-dependencies b/tools/read-dependencies index f0e21124c63..bed826f3b79 100755 --- a/tools/read-dependencies +++ b/tools/read-dependencies @@ -140,8 +140,22 @@ CI_SYSTEM_BASE_PKGS = { "freebsd": [f"{FREEBSD_PKG_PREFIX}tox"], "redhat": ["python3-tox"], "centos": ["python3-tox"], - "ubuntu": ["make", "devscripts", "python3-dev", "libssl-dev", "tox", "sbuild"], - "debian": ["make", "devscripts", "python3-dev", "libssl-dev", "tox", "sbuild"], + "ubuntu": [ + "make", + "devscripts", + "python3-dev", + "libssl-dev", + "tox", + "sbuild", + ], + "debian": [ + "make", + "devscripts", + "python3-dev", + "libssl-dev", + "tox", + "sbuild", + ], } @@ -363,7 +377,7 @@ def pkg_install(pkg_list, distro, test_distro=False, dry_run=False): if test_distro: pkg_list = list(pkg_list) + CI_SYSTEM_BASE_PKGS["common"] if distro not in ("freebsd",): - pkg_list += CI_SYSTEM_BASE_PKGS["linux_common"] + pkg_list += CI_SYSTEM_BASE_PKGS["linux_common"] distro_base_pkgs = CI_SYSTEM_BASE_PKGS.get(distro, []) pkg_list += distro_base_pkgs print(