commit:     ab0fb1519721067734702a3d4f2fa91c968eaa34
Author:     Jeroen Roovers <jer <AT> gentoo <DOT> org>
AuthorDate: Mon Dec  2 10:08:30 2019 +0000
Commit:     Jeroen Roovers <jer <AT> gentoo <DOT> org>
CommitDate: Mon Dec  2 10:14:32 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ab0fb151

nvidia-driver.eclass: Fix GPU vs version compatibility check

- In commit 245f417b539760ccf4939630f2c6b826ce34a556 I replaced
version_compare() with ver_test but failed to properly adjust the check
from the "is at least" return value to its ver_test equivalent. Invert
the test return value for clarity and check for a version mask less than
PV.
- Use lower case for local variable name.
- Fix a comment while there.

Fixes: https://bugs.gentoo.org/701734
Signed-off-by: Jeroen Roovers <jer <AT> gentoo.org>
Tested-by: Kobboi
Signed-off-by: Jeroen Roovers <jer <AT> gentoo.org>

 eclass/nvidia-driver.eclass | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/eclass/nvidia-driver.eclass b/eclass/nvidia-driver.eclass
index b71b7a769ae..8c108a9c338 100644
--- a/eclass/nvidia-driver.eclass
+++ b/eclass/nvidia-driver.eclass
@@ -175,12 +175,12 @@ nvidia-driver_get_mask() {
 
 # @FUNCTION: nvidia-driver_check_gpu
 # @DESCRIPTION:
-# Prints out a warning if the driver does not work w/ the installed video 
nvidia_gpu
+# Prints out a warning if the driver does not work with the installed GPU
 nvidia-driver_check_gpu() {
-       local NVIDIA_MASK="$(nvidia-driver_get_mask)"
+       local nvidia_mask="$(nvidia-driver_get_mask)"
 
-       if [ -n "${NVIDIA_MASK}" ]; then
-               if ! ver_test "${NVIDIA_MASK##*-}" -eq "${PV}" ; then
+       if [ -n "${nvidia_mask}" ]; then
+               if ver_test "${nvidia_mask##*-}" -lt "${PV}" ; then
                        ewarn "***** WARNING *****"
                        ewarn
                        ewarn "You are currently installing a version of 
nvidia-drivers that is"
@@ -190,9 +190,9 @@ nvidia-driver_check_gpu() {
                        ewarn
                        ewarn "Add the following mask entry to the local 
package.mask file:"
                        if [ -d "${ROOT}/etc/portage/package.mask" ]; then
-                               ewarn "echo \"${NVIDIA_MASK}\" > 
/etc/portage/package.mask/nvidia-drivers"
+                               ewarn "echo \"${nvidia_mask}\" > 
/etc/portage/package.mask/nvidia-drivers"
                        else
-                               ewarn "echo \"${NVIDIA_MASK}\" >> 
/etc/portage/package.mask"
+                               ewarn "echo \"${nvidia_mask}\" >> 
/etc/portage/package.mask"
                        fi
                        ewarn
                        ewarn "Failure to perform the steps above could result 
in a non-working"

Reply via email to