Try to fix the 'matching update package' check for kernel

That clever-clever 'check the packages from the update were
installed' thing from yesterday breaks on kernel updates, as
they're installonly; after the update, the new version of the
package is installed, but the *old* version is too, and the way
I implemented the check, it treats that as a failure. Let's try
and handle this a somewhat-clever way (if this fails, I'm just
going to grep out lines with 'kernel' in them, as a *dumb* way).

Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2018-12-13 18:52:51 -08:00
parent 4629e5b740
commit b171c0a1c4

View file

@ -716,12 +716,17 @@ sub advisory_check_nonmatching_packages {
# unnecessarily in post_fail_hook
return if (get_var("_ACNMP_DONE"));
script_run 'touch /tmp/installedupdatepkgs.txt';
script_run 'for pkg in $(cat /var/log/updatepkgnames.txt); do rpm -q $pkg && rpm -q $pkg --qf "%{SOURCERPM} %{EPOCH} %{NAME}-%{VERSION}-%{RELEASE}\n" >> /tmp/installedupdatepkgs.txt; done';
# 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 /var/log/updatepkgs.txt. The 'tail -1' tries to handle the problem of
# installonly packages like the kernel, where we wind up with *multiple*
# 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 'sort -u -o /tmp/installedupdatepkgs.txt /tmp/installedupdatepkgs.txt';
# now, /tmp/installedupdatepkgs.txt is a sorted list of installed packages
# with the same name as packages from the update, in the same form as
# /var/log/updatepkgs.txt; so if any line appears in installedupdatepkgs.txt
# but not updatepkgs.txt, we have a problem.
# 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