mirror of
https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git
synced 2024-11-11 09:24:21 +00:00
Tweak detection of installed update packages
Previously we were relying on `rpm -q` always outputting the right package last. We saw some test failures on recent kernel updates, e.g. https://openqa.fedoraproject.org/tests/658768 , which indicate this isn't always the case; there the 'right' package was second of three for kernel, third of three for kernel-core and first of three for kernel-modules. So we need to make it more robust. This uses an additional call: `rpm -q $pkg --last | head -1` to find the most recent package, if there are more than one; this should always be the right one, I hope. Note we cannot just add `--last` to the `rpm -q --qf...` call because the output when you do that is weird; you get the output you'd get if you just called `rpm -q --last` first, and *then* the query-formatted output afterwards (though with the modified order as expected). There doesn't seem to be any way to get only the latter. I also tweaked the log uploading so we always upload the working logs even when the test passes; it can't hurt anything and it is sometimes useful to have them. Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
parent
8e794a6c30
commit
0999921fe3
13
lib/utils.pm
13
lib/utils.pm
@ -944,22 +944,23 @@ sub advisory_check_nonmatching_packages {
|
||||
# versions installed after the update; I'm hoping the last line of output
|
||||
# for any given package is the most recent version, i.e. the one in the
|
||||
# update.
|
||||
script_run 'for pkg in $(cat /var/log/updatepkgnames.txt); do rpm -q $pkg && rpm -q $pkg --qf "%{SOURCERPM} %{EPOCH} %{NAME}-%{VERSION}-%{RELEASE}\n" | tail -1 >> /tmp/installedupdatepkgs.txt; done';
|
||||
script_run 'for pkg in $(cat /var/log/updatepkgnames.txt); do rpm -q $pkg && rpm -q $pkg --last | head -1 | cut -d" " -f1 | xargs rpm -q --qf "%{SOURCERPM} %{EPOCH} %{NAME}-%{VERSION}-%{RELEASE}\n" >> /tmp/installedupdatepkgs.txt; done';
|
||||
script_run 'sort -u -o /tmp/installedupdatepkgs.txt /tmp/installedupdatepkgs.txt';
|
||||
# for debugging, may as well always upload these, can't hurt anything
|
||||
upload_logs "/tmp/installedupdatepkgs.txt", failok=>1;
|
||||
upload_logs "/var/log/updatepkgs.txt", failok=>1;
|
||||
# if any line appears in installedupdatepkgs.txt but not updatepkgs.txt,
|
||||
# we have a problem.
|
||||
if (script_run 'comm -23 /tmp/installedupdatepkgs.txt /var/log/updatepkgs.txt > /var/log/installednotupdatedpkgs.txt') {
|
||||
# occasionally, for some reason, it's unhappy about sorting;
|
||||
# we shouldn't fail the test in this case, just upload the
|
||||
# files so we can see why...
|
||||
upload_logs "/tmp/installedupdatepkgs.txt", failok=>1;
|
||||
upload_logs "/var/log/updatepkgs.txt", failok=>1;
|
||||
# we shouldn't fail the test in this case, just make a note
|
||||
# of it so we can look why...
|
||||
diag "Installed vs. all update package comparison unexpectedly returned non-zero!";
|
||||
}
|
||||
# this exits 1 if the file is zero-length, 0 if it's longer
|
||||
# if it's 0, that's *BAD*: we want to upload the file and fail
|
||||
unless (script_run 'test -s /var/log/installednotupdatedpkgs.txt') {
|
||||
upload_logs "/var/log/installednotupdatedpkgs.txt", failok=>1;
|
||||
upload_logs "/var/log/updatepkgs.txt", failok=>1;
|
||||
my $message = "Package(s) from update not installed when it should have been! See installednotupdatedpkgs.txt";
|
||||
if ($args{fatal}) {
|
||||
set_var("_ACNMP_DONE", "1");
|
||||
|
Loading…
Reference in New Issue
Block a user