From 4d1d8e342f02c16e8a5fec9f2a46cf0518db2af2 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 18 Sep 2024 11:48:16 +0200 Subject: [PATCH] gen-depsolve-dnf4: adjust mockdata() for new `exclude:` prefix This commit follows https://github.com/osbuild/images/pull/938 and adjust the way excludes are represented. --- src/otk_external_osbuild/command/gen_depsolve_dnf4.py | 4 ++-- test/test_gen_depsolve_dnf4.py | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/otk_external_osbuild/command/gen_depsolve_dnf4.py b/src/otk_external_osbuild/command/gen_depsolve_dnf4.py index 5ae734f1..1aa6d0eb 100644 --- a/src/otk_external_osbuild/command/gen_depsolve_dnf4.py +++ b/src/otk_external_osbuild/command/gen_depsolve_dnf4.py @@ -34,7 +34,7 @@ def mockdata(packages): "release": "0", "arch": "noarch", } - for p in packages + for p in packages["include"] + [f"exclude:{p}" for p in packages["exclude"]] ] @@ -42,7 +42,7 @@ def root(input_stream: TextIO) -> None: data = json.loads(input_stream.read()) tree = data["tree"] if "OTK_UNDER_TEST" in os.environ: - packages = mockdata(tree["packages"]["include"]) + packages = mockdata(tree["packages"]) sys.stdout.write(json.dumps(transform(packages))) return diff --git a/test/test_gen_depsolve_dnf4.py b/test/test_gen_depsolve_dnf4.py index b421747f..1bea6e88 100644 --- a/test/test_gen_depsolve_dnf4.py +++ b/test/test_gen_depsolve_dnf4.py @@ -42,6 +42,14 @@ def test_gen_depsolve_dnf4_under_test_mock_data(monkeypatch, capsys): "release": "0", "arch": "noarch", "epoch": "", + }, { + "arch": "noarch", + "checksum": "sha256:93941c24b2276b2050d001b61bab64c58a8df5242bf491fa888f061cca12b51a", + "epoch": "", + "name": "exclude:not-pkg2", + "release": "0", + "remote_location": "https://example.com/repo/packages/exclude:not-pkg2", + "version": "0", }, ], },