Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix kmodtool for packaging mainline Linux #14617

Merged
merged 1 commit into from
Mar 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions scripts/kmodtool
Original file line number Diff line number Diff line change
Expand Up @@ -333,36 +333,36 @@ print_customrpmtemplate ()
{
for kernel in ${1}
do
if [[ -e "${buildroot}/usr/src/kernels/${kernel}" ]] ; then
# this looks like a Fedora/RH kernel -- print a normal template (which includes the proper BR) and be happy :)
kernel_versions="${kernel_versions}${kernel}___${buildroot}%{_usrsrc}/kernels/${kernel} "
if [[ -e "${prefix}/lib/modules/${kernel}/build/Makefile" ]]; then
# likely a user-build-kernel with available buildfiles
# fixme: we should check if uname from Makefile is the same as ${kernel}

# parse kernel versions string and print template
local kernel_verrelarch=${kernel%%${kernels_known_variants}}
print_rpmtemplate_per_kmodpkg --redhat ${kernel} ${kernel##${kernel_verrelarch}}
kernel_versions="${kernel_versions}${kernel}___${prefix}/lib/modules/${kernel}/build/ "
print_rpmtemplate_per_kmodpkg --custom "${kernel}"

# create development package
if [[ -n "${devel}" ]]; then
# create devel package including common headers
print_rpmtemplate_kmoddevelpkg --redhat ${kernel} ${kernel##${kernel_verrelarch}}
print_rpmtemplate_kmoddevelpkg --custom "${kernel}"

# create devel package
print_rpmtemplate_per_kmoddevelpkg --redhat ${kernel} ${kernel##${kernel_verrelarch}}
print_rpmtemplate_per_kmoddevelpkg --custom "${kernel}"
fi
elif [[ -e "${prefix}/lib/modules/${kernel}/build/Makefile" ]]; then
# likely a user-build-kernel with available buildfiles
# fixme: we should check if uname from Makefile is the same as ${kernel}
elif [[ -e "${buildroot}/usr/src/kernels/${kernel}" ]]; then
# this looks like a Fedora/RH kernel -- print a normal template (which includes the proper BR) and be happy :)
kernel_versions="${kernel_versions}${kernel}___${buildroot}%{_usrsrc}/kernels/${kernel} "

kernel_versions="${kernel_versions}${kernel}___${prefix}/lib/modules/${kernel}/build/ "
print_rpmtemplate_per_kmodpkg --custom "${kernel}"
# parse kernel versions string and print template
local kernel_verrelarch=${kernel%%${kernels_known_variants}}
print_rpmtemplate_per_kmodpkg --redhat ${kernel} ${kernel##${kernel_verrelarch}}

# create development package
if [[ -n "${devel}" ]]; then
# create devel package including common headers
print_rpmtemplate_kmoddevelpkg --custom "${kernel}"
print_rpmtemplate_kmoddevelpkg --redhat ${kernel} ${kernel##${kernel_verrelarch}}

# create devel package
print_rpmtemplate_per_kmoddevelpkg --custom "${kernel}"
print_rpmtemplate_per_kmoddevelpkg --redhat ${kernel} ${kernel##${kernel_verrelarch}}
fi
else
error_out 2 "Don't know how to handle ${kernel} -- ${prefix}/lib/modules/${kernel}/build/Makefile not found"
Expand Down