From a8f3a1e834a03d387e5227fe87415393b09fd5dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hozza?= Date: Mon, 29 Jul 2024 10:17:02 +0200 Subject: [PATCH] Test/dnf4.mark: make the test compatible with all dnf versions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Let's revert to using plain 'dnf', add an explicit newline in the query format and skip empty lines when processing the output. This makes the test case compatible with all DNF versions, even with dnf5 once this issue gets fixed. The previous approach didn't work on c9s / el9, because there is no '/usr/bin/dnf4 -> dnf-3' symlink. Also see: https://github.com/osbuild/osbuild/actions/runs/10136827918/job/28026181824 Co-authored-by: Michael Vogt Signed-off-by: Tomáš Hozza --- test/run/test_stages.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test/run/test_stages.py b/test/run/test_stages.py index ca224f07..476be949 100644 --- a/test/run/test_stages.py +++ b/test/run/test_stages.py @@ -537,15 +537,12 @@ class TestStages(test.TestBase): assert os.path.isdir(tree) # we're going to verify that packages in the tree are marked according to - # Explicitly use 'dnf4' for now, because 'dnf5' contains a breaking change - # in the repoquery --qf output, specifically it does not add a trailing newline. - # We can use plan 'dnf' again once https://github.com/rpm-software-management/dnf5/issues/709 is fixed. r = subprocess.run( [ - "dnf4", + "dnf", "--installroot", tree, "repoquery", "--installed", - "--qf", "%{name},%{reason}" + "--qf", "%{name},%{reason}\n" ], stdout=subprocess.PIPE, stderr=subprocess.PIPE, @@ -554,6 +551,12 @@ class TestStages(test.TestBase): ) for line in r.stdout.splitlines(): + # 'dnf5' contains a breaking change in the repoquery --qf output, specifically it does not add + # a trailing newline. For this reason, we add it explicitly in the query format above. This however + # means that there are empty lines in the output, if 'dnf' points to 'dnf4'. + # Upstream bug https://github.com/rpm-software-management/dnf5/issues/709 + if not line: + continue package, mark = line.strip().split(",") if package == "dnf":