From 3fd367938b61b9a30d9c1828d3c10b1b4dec2398 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Tue, 10 Jun 2025 13:10:56 +0200 Subject: [PATCH] Make updatepkgs and updatepkgnames more precise for side tags The way side tags work, every package in the distro is in the side tag repo, so updatepkgs and updatepkgnames end up huge. To fix this, we'll use a koji query for all packages that are actually in the side tag to generate updatepkgnames.txt, and then use that to filter the dnf command to generate updatepkgs.txt. Signed-off-by: Adam Williamson --- lib/utils.pm | 43 ++++++++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/lib/utils.pm b/lib/utils.pm index 67d4825b..252ae144 100644 --- a/lib/utils.pm +++ b/lib/utils.pm @@ -580,16 +580,37 @@ 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 - # -q avoids most progress spew into the output. grep -v testtag - # avoids some more. grep . filters empty lines, which we get - # with dnf < 5 since this queryformat template ends with \n for - # dnf >= 5 - assert_script_run 'dnf -q --disablerepo=* --enablerepo=openqa-testtag repoquery --qf "%{SOURCERPM} %{NAME} %{EPOCH} %{VERSION} %{RELEASE}\n" --arch=' . $arch . ',noarch | sort -u | grep -v testtag | grep . > /mnt/updatepkgs.txt'; - # the | xargs here is a wacky trick that converts newlines to - # 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 -q --disablerepo=* --enablerepo=openqa-testtag repoquery --qf "%{NAME} " | xargs > /mnt/updatepkgnames.txt'; + if ($copr) { + # -q avoids most progress spew into the output. grep -v testtag + # avoids some more. grep . filters empty lines, which we get + # with dnf < 5 since this queryformat template ends with \n for + # dnf >= 5 + assert_script_run 'dnf -q --disablerepo=* --enablerepo=openqa-testtag repoquery --qf "%{SOURCERPM} %{NAME} %{EPOCH} %{VERSION} %{RELEASE}\n" --arch=' . $arch . ',noarch | sort -u | grep -v testtag | grep . > /mnt/updatepkgs.txt'; + # the | xargs here is a wacky trick that converts newlines to + # 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 -q --disablerepo=* --enablerepo=openqa-testtag repoquery --qf "%{NAME} " | xargs > /mnt/updatepkgnames.txt'; + } + else { + # for side tags we use koji because the repo has *every* package + # on CANNED, we need to enter the toolbox + if (get_var("CANNED")) { + type_string "toolbox -y enter\n"; + # this is simply to wait till we're in the toolbox + assert_script_run "true", 180; + } + assert_script_run 'dnf -y install koji', 300; + assert_script_run 'koji list-tagged ' . $tag . ' --latest | tail -n+3 | cut -d\' \' -f1 | rev | cut -d\'-\' -f3- | rev > /mnt/updatepkgnames.txt'; + # exit the toolbox on CANNED + if (get_var("CANNED")) { + type_string "exit\n"; + wait_serial "# "; + } + upload_logs '/mnt/updatepkgnames.txt'; + # now *only* query those packages via dnf to generate updatepkgs + assert_script_run 'dnf -q --disablerepo=* --enablerepo=openqa-testtag repoquery `tr "\n" " " < /mnt/updatepkgnames.txt` --qf "%{SOURCERPM} %{NAME} %{EPOCH} %{VERSION} %{RELEASE}\n" --arch=' . $arch . ',noarch | sort -u | grep -v testtag | grep . > /mnt/updatepkgs.txt'; + } } my @was = get_workarounds($args{version}); # bail if there are no workarounds: @@ -1268,7 +1289,7 @@ sub advisory_check_nonmatching_packages { $timeout *= 2 if ($pkgs > 4800); my $wrapper = $args{wrapper}; $rpmcmd = "$wrapper rpm" if ($wrapper); - $timeout *= 2 if ($wrapper); + $timeout *= 3 if ($wrapper); # this creates /tmp/installedupdatepkgs.txt as a sorted list of installed # packages with the same name as packages from the update, in the same form # as /mnt/updatepkgs.txt. The '--last | head -1' tries to handle the