templates: Reinstate unused version comparison functions w/ warning
PATCH 1/1 templates: Reinstate unused version comparison functions w/ warning
Revert "templates: Remove unused version comparison functions" and add a warning to the functions that they are deprecated.
Removing the functions directly caused a lot of upgrade issues w/ custom user scripts that called the functions. In Debian and Ubuntu, grub-mkconfig is invoked as a post-installation script and would fail, causing upgrades to fail halfway through and putting the package manager into an inconsistent state.
This reverts commit a79c567f6b5820a8795c273a9eaabd06a1f92b29.
--- util/grub-mkconfig_lib.in | 54 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+)
util/grub-mkconfig_lib.in +54 -0
@@ -244,6 +244,60 @@ grub_move_to_front () done } +version_test_numeric () +{ + grub_warn "version_test_numeric() is deprecated. Use version_sort() instead." + version_test_numeric_a="$1" + version_test_numeric_cmp="$2" + version_test_numeric_b="$3" + if [ "$version_test_numeric_a" = "$version_test_numeric_b" ] ; then + case "$version_test_numeric_cmp" in + ge|eq|le) return 0 ;; + gt|lt) return 1 ;; + esac + fi + if [ "$version_test_numeric_cmp" = "lt" ] ; then + version_test_numeric_c="$version_test_numeric_a" + version_test_numeric_a="$version_test_numeric_b" + version_test_numeric_b="$version_test_numeric_c" + fi + if (echo "$version_test_numeric_a" ; echo "$version_test_numeric_b") | version_sort | head -n 1 | grep -qx "$version_test_numeric_b" ; then + return 0 + else + return 1 + fi +} + +version_test_gt () +{ + grub_warn "version_test_gt() is deprecated. Use version_sort() instead." + version_test_gt_a="`echo "$1" | sed -e "s/[^-]*-//"`" + version_test_gt_b="`echo "$2" | sed -e "s/[^-]*-//"`" + version_test_gt_cmp=gt + if [ "x$version_test_gt_b" = "x" ] ; then + return 0 + fi + case "$version_test_gt_a:$version_test_gt_b" in + *.old:*.old) ;; + *.old:*) version_test_gt_a="`echo "$version_test_gt_a" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=gt ;; + *:*.old) version_test_gt_b="`echo "$version_test_gt_b" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=ge ;; + esac + version_test_numeric "$version_test_gt_a" "$version_test_gt_cmp" "$version_test_gt_b" + return "$?" +} + +version_find_latest () +{ + grub_warn "version_find_latest() is deprecated. Use version_sort() instead." + version_find_latest_a="" + for i in "$@" ; do + if version_test_gt "$i" "$version_find_latest_a" ; then + version_find_latest_a="$i" + fi + done + echo "$version_find_latest_a" +} + # One layer of quotation is eaten by "" and the second by sed; so this turns # ' into \'. grub_quote () {
Signature · 7 lines
2.40.1 _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
Quoted 8 lines · Julian Andres Klode
Revert "templates: Remove unused version comparison functions" and add a warning to the functions that they are deprecated.
Removing the functions directly caused a lot of upgrade issues w/ custom user scripts that called the functions. In Debian and Ubuntu, grub-mkconfig is invoked as a post-installation script and would fail, causing upgrades to fail halfway through and putting the package manager into an inconsistent state.
FWIW, we get one bug per 2 weeks basically, for an interim Ubuntu release which generally does not receive much usage, that is a high number.
The proposal is to pick this for 2.12 and directly after the release remove it again. Then users will have time to fix their scripts without systems breaking immediately.
Signature · 7 lines
debian developer - deb.li/jak | jak-linux.org - free software dev ubuntu core developer i speak de, en _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
Quoted 10 lines · Julian Andres Klode
Quoted 8 lines · Julian Andres Klode
Revert "templates: Remove unused version comparison functions" and add a warning to the functions that they are deprecated.
Removing the functions directly caused a lot of upgrade issues w/ custom user scripts that called the functions. In Debian and Ubuntu, grub-mkconfig is invoked as a post-installation script and would fail, causing upgrades to fail halfway through and putting the package manager into an inconsistent state.
Quoted 7 lines
FWIW, we get one bug per 2 weeks basically, for an interim Ubuntu release which generally does not receive much usage, that is a high number.
The proposal is to pick this for 2.12 and directly after the release remove it again. Then users will have time to fix their scripts without systems breaking immediately.
I will add these two paragraphs to the commit message.
Otherwise Reviewed-by: Daniel Kiper <[email protected]>...
Daniel
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Quoted 10 lines · Julian Andres Klode
Quoted 8 lines · Julian Andres Klode
Revert "templates: Remove unused version comparison functions" and add a warning to the functions that they are deprecated.
Removing the functions directly caused a lot of upgrade issues w/ custom user scripts that called the functions. In Debian and Ubuntu, grub-mkconfig is invoked as a post-installation script and would fail, causing upgrades to fail halfway through and putting the package manager into an inconsistent state.
Quoted 7 lines
FWIW, we get one bug per 2 weeks basically, for an interim Ubuntu release which generally does not receive much usage, that is a high number.
The proposal is to pick this for 2.12 and directly after the release remove it again. Then users will have time to fix their scripts without systems breaking immediately.
I only removed those because they were now unused internally, without expecting this impact for external users. The gradual deprecation plan seems better indeed.
Thanks,
Mathieu
Signature · 9 lines
Mathieu Desnoyers EfficiOS Inc. https://www.efficios.com _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel