add rpmlint policy to avoid odd warnings

This commit is contained in:
Mikhail Novosyolov 2022-10-17 13:47:53 +03:00
parent c500bf870b
commit 745d2896f9
4 changed files with 79 additions and 4 deletions

View file

@ -0,0 +1,2 @@
# kernel modules are put here and then symlinked to from /lib/modules by alternatives(8)
addFilter("W: arch-dependent-file-in-usr-share /usr/share/auto-krokodil/kmods/.*")

View file

@ -3,7 +3,7 @@ Name: auto-krokodil
Group: System/Kernel and hardware
License: GPLv3
Url: https://abf.io/import/auto-krokodil
Version: 0.21
Version: 0.22
Release: 1
BuildArch: noarch
%ifarch %{ix86} %{x86_64}
@ -16,6 +16,7 @@ Source10: krokodil-rpm-provides.php
Source11: krokodilnvidia.attr
# rpm macros
Source12: macros.krokodil
Source13: auto-krokodil-rpmlint.conf
# Test data, to run tests:
# - build and install auto-krokodil-rpm-generators from this spec
@ -74,6 +75,8 @@ Generators of RPM provides for proprietary Nvidia drivers
Summary: RPM macros for packaging of binary kernel modules for Nvidia drivers
Requires: coreutils
Requires: gawk
# pull rpmlint policy when installing BuildRequires
Requires: (%{name}-rpmlint if rpmlint)
%description rpm-macros
RPM macros for packaging of binary kernel modules for Nvidia drivers
@ -83,6 +86,18 @@ RPM macros for packaging of binary kernel modules for Nvidia drivers
#----------------------------------------
%package rpmlint
Summary: rpmlint policy for krokodil-packaged kernel modules
Requires: rpmlint
%description rpmlint
rpmlint policy for krokodil-packaged kernel modules
%files rpmlint
%{_datadir}/rpmlint/config.d/auto-krokodil-rpmlint.conf
#----------------------------------------
%package legacy-converter
Summary: Convert JSON from newer Nvidia driver to an older one
Requires: /usr/bin/php
@ -137,6 +152,9 @@ ln -s kroko-cli %{buildroot}%{_bindir}/%{name}-cli
%install_macro krokodil %{SOURCE12}
mkdir -p %{buildroot}%{_datadir}/rpmlint/config.d
install -m0644 %{SOURCE13} %{buildroot}%{_datadir}/rpmlint/config.d
%check
bash -x %{SOURCE24}

48
kroko-gui.sh Executable file
View file

@ -0,0 +1,48 @@
#!/bin/bash
set -e
set -a
if test -f kroko-cli.sh
then
SOURCING=1 . kroko-cli.sh
else
SOURCING=1 . kroko-cli
fi
COMMON_ZENITY_ARGS="--window-icon=geany --title=kroko-gui"
_zenity(){
zenity $COMMON_ZENITY_ARGS "$@"
}
# if use _zenity() here, PID is incorrect (probably subshell's PID is taken)
zenity $COMMON_ZENITY_ARGS --progress --pulsate --text=$"Selecting the best NVIDIA driver…" &
zenity_pid=$!
if o="$(_cli_get_gpus)"
then
:
else
rc=$?
kill $zenity_pid
case $rc in
$EXIT_ENOGPU )
_zenity --error --text=$"No NVIDIA GPUs found""!"
exit $EXIT_ENOGPU
;;
$EXIT_ENODRIVER )
_zenity --error --text=$"No suitable drivers found""!"
exit $EXIT_ENODRIVER
;;
$EXIT_ENOCOMMONDRIVER )
_zenity --error --text=$"This computer has multiple NVIDIA GPUs".$"A driver which would work with all of them has not been found".
exit $EXIT_ENOCOMMONDRIVER
;;
* )
_zenity --error --text=$"An unknown error occured".$"Something went wrong""!".
exit $EXIT_ENOCOMMONDRIVER
;;
esac
fi
#echo "$o" | _select_best_driver

View file

@ -90,14 +90,21 @@ update-alternatives --remove \\
if [ -d /lib/modules/%{-p*} ]; then %{_sbindir}/depmod -a %{-p*} || : ; fi
}
# "Requires" in kernel package
# Dependencies in kernel package
# Dependencies are soft ("Recommends" insted of "Requires") to do not
# fail if an Nvidia kernel module cannot be installed for one
# of the installed kernels which is not the newest one
%kroko_req_modules_in_kernel(j:n:p:) \
%{expand: \
Requires: (kmod-nvidia%{-j*}-kabi(%{-p*}) if nvidia%{-j*}) \
Recommends: (kmod-nvidia%{-j*}-kabi(%{-p*}) if nvidia%{-j*}) \
%{nil} \
}
# "Requires" in nvidiaXXX package
# Dependencies in nvidiaXXX package
# "Requires", not "Recommends" here despite "Recommends" above
# to have strong dependencies at least here and avoid accidently
# and silently leaving users without Nvidia kernel modules
# (force installing a binary module for at least the latest kernel)
%kroko_req_modules_in_nvidia(k:f:j:n:) \
%{expand: \
# e.g.: (kmod-nvdia-5.10-generic(390.13) if kernel-5.10-generic)