The previous fix was completely not right, so fix it a different way.

Resolves: rhbz#1249668

Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
Peter Jones 2015-08-03 15:08:50 -04:00
parent 7b98965227
commit ea2871d57a
7 changed files with 38 additions and 32 deletions

View File

@ -1,4 +1,4 @@
From 6656c53125c328613529a52b3dcdf479d49ec475 Mon Sep 17 00:00:00 2001 From b9f953dc0a2297fab25b968dce4f7320d022c3e1 Mon Sep 17 00:00:00 2001
From: Robert Marshall <rmarshall@redhat.com> From: Robert Marshall <rmarshall@redhat.com>
Date: Mon, 16 Mar 2015 14:14:19 -0400 Date: Mon, 16 Mar 2015 14:14:19 -0400
Subject: [PATCH 69/74] Use Distribution Package Sort for grub2-mkconfig Subject: [PATCH 69/74] Use Distribution Package Sort for grub2-mkconfig
@ -10,24 +10,14 @@ starting with the most recent. Added an option for rpm-based systems to
use the rpm-sort library to sort kernels instead. use the rpm-sort library to sort kernels instead.
Resolves rhbz#1124074 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 + .gitignore | 1 +
Makefile.util.def | 16 +++ Makefile.util.def | 16 +++
configure.ac | 29 +++++ configure.ac | 29 +++++
util/grub-mkconfig_lib.in | 8 +- util/grub-mkconfig_lib.in | 11 +-
util/grub-rpm-sort.8 | 12 ++ util/grub-rpm-sort.8 | 12 ++
util/grub-rpm-sort.c | 281 ++++++++++++++++++++++++++++++++++++++++++++++ util/grub-rpm-sort.c | 281 ++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 346 insertions(+), 1 deletion(-) 6 files changed, 349 insertions(+), 1 deletion(-)
create mode 100644 util/grub-rpm-sort.8 create mode 100644 util/grub-rpm-sort.8
create mode 100644 util/grub-rpm-sort.c create mode 100644 util/grub-rpm-sort.c
@ -71,7 +61,7 @@ index 591c5e5..f28d73d 100644
name = grub-mkconfig; name = grub-mkconfig;
common = util/grub-mkconfig.in; common = util/grub-mkconfig.in;
diff --git a/configure.ac b/configure.ac diff --git a/configure.ac b/configure.ac
index 357c94e..64791d1 100644 index 357c94e..4f26f6c 100644
--- a/configure.ac --- a/configure.ac
+++ b/configure.ac +++ b/configure.ac
@@ -65,6 +65,7 @@ grub_TRANSFORM([grub-mkrelpath]) @@ -65,6 +65,7 @@ grub_TRANSFORM([grub-mkrelpath])
@ -97,7 +87,7 @@ index 357c94e..64791d1 100644
+AC_ARG_ENABLE([rpm-sort], +AC_ARG_ENABLE([rpm-sort],
+ [AS_HELP_STRING([--enable-rpm-sort], + [AS_HELP_STRING([--enable-rpm-sort],
+ [enable native rpm sorting of kernels in grub (default=guessed)])]) + [enable native rpm sorting of kernels in grub (default=guessed)])])
+if test x"$enable_rpm-sort" = xno ; then +if test x"$enable_rpm_sort" = xno ; then
+ rpm_sort_excuse="explicitly disabled" + rpm_sort_excuse="explicitly disabled"
+fi +fi
+ +
@ -125,23 +115,33 @@ index 357c94e..64791d1 100644
if test x$host_kernel = xkfreebsd; then if test x$host_kernel = xkfreebsd; then
AC_CHECK_LIB([geom], [geom_gettree], [], AC_CHECK_LIB([geom], [geom_gettree], [],
diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
index 10fabee..954844d 100644 index 10fabee..9c410ea 100644
--- a/util/grub-mkconfig_lib.in --- a/util/grub-mkconfig_lib.in
+++ b/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in
@@ -213,6 +213,12 @@ version_sort () @@ -33,6 +33,9 @@ fi
if test "x$grub_mkrelpath" = x; then
grub_mkrelpath="${bindir}/@grub_mkrelpath@"
fi
+if test "x$grub_rpm_sort" = x; then
+ grub_rpm_sort="${sbindir}/@grub_rpm_sort@"
+fi
if which gettext >/dev/null 2>/dev/null; then
:
@@ -213,6 +216,12 @@ version_sort ()
esac esac
} }
+if [ "x$RPMLIB" = x ]; then +if [ "x$grub_rpm_sort" != x -a -x "$grub_rpm_sort" ]; then
+ kernel_sort=version_sort + kernel_sort="$grub_rpm_sort"
+else +else
+ kernel_sort="${sbindir}/grub-rpm-sort" + kernel_sort=version_sort
+fi +fi
+ +
version_test_numeric () version_test_numeric ()
{ {
version_test_numeric_a="$1" version_test_numeric_a="$1"
@@ -229,7 +235,7 @@ version_test_numeric () @@ -229,7 +238,7 @@ version_test_numeric ()
version_test_numeric_a="$version_test_numeric_b" version_test_numeric_a="$version_test_numeric_b"
version_test_numeric_b="$version_test_numeric_c" version_test_numeric_b="$version_test_numeric_c"
fi fi
@ -170,7 +170,7 @@ index 0000000..8ce2148
+.BR "info grub" +.BR "info grub"
diff --git a/util/grub-rpm-sort.c b/util/grub-rpm-sort.c diff --git a/util/grub-rpm-sort.c b/util/grub-rpm-sort.c
new file mode 100644 new file mode 100644
index 0000000..4bbba1f index 0000000..f33bd1e
--- /dev/null --- /dev/null
+++ b/util/grub-rpm-sort.c +++ b/util/grub-rpm-sort.c
@@ -0,0 +1,281 @@ @@ -0,0 +1,281 @@
@ -293,19 +293,19 @@ index 0000000..4bbba1f
+ vercmpflag = rpmvercmp ((lhs_name == NULL ? "" : lhs_name), + vercmpflag = rpmvercmp ((lhs_name == NULL ? "" : lhs_name),
+ (rhs_name == NULL ? "" : rhs_name)); + (rhs_name == NULL ? "" : rhs_name));
+ if (vercmpflag != 0) + if (vercmpflag != 0)
+ return -vercmpflag; + return vercmpflag;
+ +
+ /* Check version and return if unequal */ + /* Check version and return if unequal */
+ vercmpflag = rpmvercmp ((lhs_version == NULL ? "" : lhs_version), + vercmpflag = rpmvercmp ((lhs_version == NULL ? "" : lhs_version),
+ (rhs_version == NULL ? "" : rhs_version)); + (rhs_version == NULL ? "" : rhs_version));
+ if (vercmpflag != 0) + if (vercmpflag != 0)
+ return -vercmpflag; + return vercmpflag;
+ +
+ /* Check release and return the version compare value */ + /* Check release and return the version compare value */
+ vercmpflag = rpmvercmp ((lhs_release == NULL ? "" : lhs_release), + vercmpflag = rpmvercmp ((lhs_release == NULL ? "" : lhs_release),
+ (rhs_release == NULL ? "" : rhs_release)); + (rhs_release == NULL ? "" : rhs_release));
+ +
+ return -vercmpflag; + return vercmpflag;
+} +}
+ +
+static void +static void

View File

@ -1,4 +1,4 @@
From 9e6914a17245c7a9499c58b5b8c578526f201004 Mon Sep 17 00:00:00 2001 From 05a8c8724027ddf9cefc0a8be5e2046174f2c38d Mon Sep 17 00:00:00 2001
From: Robert Marshall <rmarshall@redhat.com> From: Robert Marshall <rmarshall@redhat.com>
Date: Thu, 25 Jun 2015 11:13:11 -0400 Date: Thu, 25 Jun 2015 11:13:11 -0400
Subject: [PATCH 70/74] Add friendly grub2 password config tool (#985962) Subject: [PATCH 70/74] Add friendly grub2 password config tool (#985962)
@ -65,7 +65,7 @@ index f28d73d..bc13d4a 100644
common = util/grub-mkconfig_lib.in; common = util/grub-mkconfig_lib.in;
installdir = noinst; installdir = noinst;
diff --git a/configure.ac b/configure.ac diff --git a/configure.ac b/configure.ac
index 64791d1..add5473 100644 index 4f26f6c..8545b9d 100644
--- a/configure.ac --- a/configure.ac
+++ b/configure.ac +++ b/configure.ac
@@ -65,6 +65,7 @@ grub_TRANSFORM([grub-mkrelpath]) @@ -65,6 +65,7 @@ grub_TRANSFORM([grub-mkrelpath])

View File

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

View File

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

View File

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

View File

@ -1,4 +1,4 @@
From 530c5e9d5b84fd87daed817fd11415486bcfd9a6 Mon Sep 17 00:00:00 2001 From e433d768dd3d11e93a53e7df8d6c0171b8316b1e Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com> From: Peter Jones <pjones@redhat.com>
Date: Wed, 22 Jul 2015 11:21:01 -0400 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 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 Name: grub2
Epoch: 1 Epoch: 1
Version: 2.02 Version: 2.02
Release: 0.19%{?dist} Release: 0.20%{?dist}
Summary: Bootloader with support for Linux, Multiboot and more Summary: Bootloader with support for Linux, Multiboot and more
Group: System Environment/Base Group: System Environment/Base
@ -140,6 +140,8 @@ Patch0073: 0073-Fix-race-in-EFI-validation.patch
Patch0074: 0074-Mark-po-exclude.pot-as-binary-so-git-won-t-try-to-di.patch Patch0074: 0074-Mark-po-exclude.pot-as-binary-so-git-won-t-try-to-di.patch
# And these are: # And these are:
# git checkout debuginfo # git checkout debuginfo
# git format-patch fedora-23.. # git format-patch fedora-23..
@ -594,6 +596,10 @@ fi
%{_datarootdir}/grub/themes/starfield %{_datarootdir}/grub/themes/starfield
%changelog %changelog
* Mon Aug 03 2015 Peter Jones <pjones@redhat.com> - 2.02-0.20
- The previous fix was completely not right, so fix it a different way.
Resolves: rhbz#1249668
* Fri Jul 31 2015 Peter Jones <pjones@redhat.com> - 2.02-0.19 * 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. - Fix grub2-mkconfig's sort to put kernels in the right order.
Related: rhbz#1124074 Related: rhbz#1124074