1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2025-11-29 20:36:00 +00:00

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 <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2025-06-10 13:10:56 +02:00
parent 1714c77620
commit 3fd367938b

View File

@ -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