Reverse rpmvercmp return value

RPM sort was returning kernels sorted from oldest to newest
instead of newest to oldest. Flipped the sign on the return
value to switch the order.

Related: rhbz#1124074

Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
Robert Marshall 2015-07-30 15:42:48 -04:00 committed by Peter Jones
parent 8facaba7e5
commit 7b98965227
7 changed files with 25 additions and 11 deletions

View File

@ -1,4 +1,4 @@
From e00237f383d6c5cce444e3ac4c8991573b8a518c Mon Sep 17 00:00:00 2001
From 6656c53125c328613529a52b3dcdf479d49ec475 Mon Sep 17 00:00:00 2001
From: Robert Marshall <rmarshall@redhat.com>
Date: Mon, 16 Mar 2015 14:14:19 -0400
Subject: [PATCH 69/74] Use Distribution Package Sort for grub2-mkconfig
@ -10,6 +10,16 @@ starting with the most recent. Added an option for rpm-based systems to
use the rpm-sort library to sort kernels instead.
Resolves rhbz#1124074
And then later we discovered that was wrong and did:
Reverse rpmvercmp return value (#1229329)
RPM sort was returning kernels sorted from oldest to newest
instead of newest to oldest. Flipped the sign on the return
value to switch the order.
Resolves: rhbz#1229329
---
.gitignore | 1 +
Makefile.util.def | 16 +++
@ -160,7 +170,7 @@ index 0000000..8ce2148
+.BR "info grub"
diff --git a/util/grub-rpm-sort.c b/util/grub-rpm-sort.c
new file mode 100644
index 0000000..f33bd1e
index 0000000..4bbba1f
--- /dev/null
+++ b/util/grub-rpm-sort.c
@@ -0,0 +1,281 @@
@ -283,19 +293,19 @@ index 0000000..f33bd1e
+ vercmpflag = rpmvercmp ((lhs_name == NULL ? "" : lhs_name),
+ (rhs_name == NULL ? "" : rhs_name));
+ if (vercmpflag != 0)
+ return vercmpflag;
+ return -vercmpflag;
+
+ /* Check version and return if unequal */
+ vercmpflag = rpmvercmp ((lhs_version == NULL ? "" : lhs_version),
+ (rhs_version == NULL ? "" : rhs_version));
+ if (vercmpflag != 0)
+ return vercmpflag;
+ return -vercmpflag;
+
+ /* Check release and return the version compare value */
+ vercmpflag = rpmvercmp ((lhs_release == NULL ? "" : lhs_release),
+ (rhs_release == NULL ? "" : rhs_release));
+
+ return vercmpflag;
+ return -vercmpflag;
+}
+
+static void

View File

@ -1,4 +1,4 @@
From d41ecd85b4a086643bc17d6bd96d9cf644017199 Mon Sep 17 00:00:00 2001
From 9e6914a17245c7a9499c58b5b8c578526f201004 Mon Sep 17 00:00:00 2001
From: Robert Marshall <rmarshall@redhat.com>
Date: Thu, 25 Jun 2015 11:13:11 -0400
Subject: [PATCH 70/74] Add friendly grub2 password config tool (#985962)

View File

@ -1,4 +1,4 @@
From 0bc88ef1f983924c9fdc82c5f3a55213ec71ea4c Mon Sep 17 00:00:00 2001
From 77d0a87d5c1d1864f9a8409cde6fbd29d11bd996 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Tue, 7 Jul 2015 12:00:26 -0400
Subject: [PATCH 71/74] Make "exit" take a return code.

View File

@ -1,4 +1,4 @@
From de4b00b23dcbe9218650565cb55b15866cb51868 Mon Sep 17 00:00:00 2001
From 9466b1c5194e6c7d388349fa2691e288b4523bc3 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Tue, 7 Jul 2015 12:04:28 -0400
Subject: [PATCH 72/74] Add some __unused__ where gcc 5.x is more picky about

View File

@ -1,4 +1,4 @@
From 2636009baa0bed56168f41f97e2396afdb183a0d Mon Sep 17 00:00:00 2001
From 6afbd577549250cdd954dfc12f03a6a4e7d3b906 Mon Sep 17 00:00:00 2001
From: Matthew Garrett <mjg59@coreos.com>
Date: Tue, 14 Jul 2015 16:58:51 -0700
Subject: [PATCH 73/74] Fix race in EFI validation

View File

@ -1,4 +1,4 @@
From 98d1d5afe30a77125a153c09e73e9dc71b5ef8da Mon Sep 17 00:00:00 2001
From 530c5e9d5b84fd87daed817fd11415486bcfd9a6 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Wed, 22 Jul 2015 11:21:01 -0400
Subject: [PATCH 74/74] Mark po/exclude.pot as binary so git won't try to diff

View File

@ -45,7 +45,7 @@
Name: grub2
Epoch: 1
Version: 2.02
Release: 0.18%{?dist}
Release: 0.19%{?dist}
Summary: Bootloader with support for Linux, Multiboot and more
Group: System Environment/Base
@ -594,6 +594,10 @@ fi
%{_datarootdir}/grub/themes/starfield
%changelog
* Fri Jul 31 2015 Peter Jones <pjones@redhat.com> - 2.02-0.19
- Fix grub2-mkconfig's sort to put kernels in the right order.
Related: rhbz#1124074
* Thu Jul 30 2015 Peter Jones <pjones@redhat.com> - 2.02-0.18
- Fix a build failure on aarch64