Skip to content

Commit

Permalink
Test/dnf4.mark: make the test compatible with all dnf versions
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Tomáš Hozza <[email protected]>
  • Loading branch information
thozza and mvo5 committed Jul 29, 2024
1 parent 4edbe22 commit a8f3a1e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions test/run/test_stages.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,15 +537,12 @@ def test_dnf4_mark(self):
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,
Expand All @@ -554,6 +551,12 @@ def test_dnf4_mark(self):
)

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":
Expand Down

0 comments on commit a8f3a1e

Please sign in to comment.