Skip to content

Commit

Permalink
autoinstall: do not fail on modules skipped due to BUILD_EXCLUSIVE_*
Browse files Browse the repository at this point in the history
Closes #302
  • Loading branch information
anbe42 authored and evelikov committed Apr 3, 2023
1 parent cac9132 commit 0f499c9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
2 changes: 2 additions & 0 deletions dkms.8.in
Expand Up @@ -659,6 +659,8 @@ If the kernel being built for does not match against this regular expression (or
does not the satisfy the constraints of any other
.B BUILD_EXCLUSIVE_*
directive), the dkms build will error out with exit code 77.
Note that dkms autoinstall will ignore this type of error condition and simply
skip the respective modules.
For example, if you set it as ="^2\.4.*", your module would not be built for 2.6
or later kernels.
.TP
Expand Down
13 changes: 11 additions & 2 deletions dkms.in
Expand Up @@ -2199,6 +2199,7 @@ autoinstall() {
local -a next_install=()
local -a known_modules=()
local -a installed_modules=()
local -a skipped_modules=()
local -a failed_modules=()
local -A build_depends=()
local -A latest=()
Expand Down Expand Up @@ -2260,11 +2261,15 @@ autoinstall() {
for mv in "${to_install[@]}"; do
IFS=/ read m v <<< "$mv"
if [[ -z "${build_depends[$m]}" ]]; then
if (module="$m" module_version="$v" kernelver="$kernelver" arch="$arch" install_module); then
(module="$m" module_version="$v" kernelver="$kernelver" arch="$arch" install_module)
status=$?
if [ "$status" = 0 ]; then
installed_modules[${#installed_modules[@]}]="$m"
install_count=$(($install_count +1))
elif [ "$status" = 77 ]; then
skipped_modules[${#skipped_modules[@]}]="$m"
else
failed_modules[${#failed_modules[@]}]="$m($?)"
failed_modules[${#failed_modules[@]}]="$m($status)"
fi
else
next_install[${#next_install[@]}]="$mv"
Expand All @@ -2287,6 +2292,10 @@ autoinstall() {
echo "dkms autoinstall on $kernelver/$arch succeeded for ${installed_modules[@]}"
fi

if [[ "${#skipped_modules[@]}" > 0 ]]; then
echo "dkms autoinstall on $kernelver/$arch was skipped for ${skipped_modules[@]}"
fi

if [[ "${#failed_modules[@]}" > 0 ]]; then
echo "dkms autoinstall on $kernelver/$arch failed for ${failed_modules[@]}"
fi
Expand Down
8 changes: 3 additions & 5 deletions run_test.sh
Expand Up @@ -1399,13 +1399,11 @@ run_status_with_expected_output 'dkms_build_exclusive_test' << EOF
dkms_build_exclusive_test/1.0: added
EOF

echo "Running dkms autoinstall (1 x skip) (THIS SHOULD NOT FAIL!)"
run_with_expected_error 11 dkms autoinstall -k "${KERNEL_VER}" << EOF
dkms autoinstall on ${KERNEL_VER}/${KERNEL_ARCH} failed for dkms_build_exclusive_test(77)
echo "Running dkms autoinstall (1 x skip)"
run_with_expected_output dkms autoinstall -k "${KERNEL_VER}" << EOF
dkms autoinstall on ${KERNEL_VER}/${KERNEL_ARCH} was skipped for dkms_build_exclusive_test
Error! The /var/lib/dkms/dkms_build_exclusive_test/1.0/${KERNEL_VER}/${KERNEL_ARCH}/dkms.conf for module dkms_build_exclusive_test includes a BUILD_EXCLUSIVE directive which does not match this kernel/arch.
This indicates that it should not be built.
Error! One or more modules failed to install during autoinstall.
Refer to previous errors for more information.
EOF
run_status_with_expected_output 'dkms_build_exclusive_test' << EOF
dkms_build_exclusive_test/1.0: added
Expand Down

0 comments on commit 0f499c9

Please sign in to comment.