From 5aaf78bf266c3736c2b4e4bf4147572895ce91c3 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Tue, 11 Jun 2024 00:28:34 -0700 Subject: [PATCH] Adjust COPR / tag package info generation for dnf5 properties dnf5 behaves differently from dnf < 5 in a couple of ways: like rpm it does not always add a newline to the query format, and it sends its status messages to stdout, not stderr. These commands account for this and produce identical output with dnf < 5 and dnf 5. Signed-off-by: Adam Williamson --- lib/utils.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/utils.pm b/lib/utils.pm index 06002df4..1e328bdc 100644 --- a/lib/utils.pm +++ b/lib/utils.pm @@ -576,12 +576,12 @@ sub setup_repos { # according to the 'configs' arg assert_script_run 'printf "[openqa-testtag]\nname=openqa-testtag\nbaseurl=' . get_var("UPDATE_OR_TAG_REPO") . '/\ncost=2000\nenabled=' . $args{configs} . '\ngpgcheck=0\npriority=1\n" > /etc/yum.repos.d/openqa-testtag.repo'; # write out the info files - assert_script_run 'dnf --disablerepo=* --enablerepo=openqa-testtag repoquery --qf "%{SOURCERPM} %{NAME} %{EPOCH} %{VERSION} %{RELEASE}" | sort -u > /mnt/updatepkgs.txt'; + assert_script_run 'dnf -q --disablerepo=* --enablerepo=openqa-testtag repoquery --qf "%{SOURCERPM} %{NAME} %{EPOCH} %{VERSION} %{RELEASE}\n" | sort -u | grep . > /mnt/updatepkgs.txt'; # the | xargs here is a wacky trick that converts newlines to - # spaces - unlike rpm, dnf always puts every package on a new + # spaces - unlike rpm, dnf < 5 always puts every package on a new # line, which we don't want here # https://unix.stackexchange.com/a/110759 - assert_script_run 'dnf --disablerepo=* --enablerepo=openqa-testtag repoquery --qf "%{NAME} " | xargs > /mnt/updatepkgnames.txt'; + assert_script_run 'dnf -q --disablerepo=* --enablerepo=openqa-testtag repoquery --qf "%{NAME} " | xargs > /mnt/updatepkgnames.txt'; } my @was = get_workarounds($args{version}); # bail if there are no workarounds: