mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-18 11:11:27 +00:00
scst.spec, scst-dkms.spec: Use version of running kernel if %{kdir} has not been set
This commit is contained in:
@@ -2,18 +2,8 @@
|
||||
# kversion: Kernel version as it appears under /lib/modules.
|
||||
# The algorithm for setting the variable kversion is as follows:
|
||||
# - If the variable kversion has been set, use its value.
|
||||
# - If an RPM with the name kernel-headers exists (RHEL / CentOS), use the
|
||||
# version number of the kernel that package is based on. This provides the
|
||||
# version number when building on a koji build server.
|
||||
# - Otherwise use the version number of the running kernel.
|
||||
%{!?kversion:%define kversion %{expand:%%(
|
||||
if rpm --quiet -q kernel-headers; then
|
||||
rpm -q --qf '%%%%{version}-%%%%{release}.%%%%{arch}\\n' \\
|
||||
kernel-headers | head -n1;
|
||||
else
|
||||
uname -r;
|
||||
fi
|
||||
)}}
|
||||
%{!?kversion:%define kversion %{expand:%%(uname -r)}}
|
||||
%{echo:kversion=%{kversion}
|
||||
}
|
||||
# kernel_rpm: Name of the kernel RPM if the kernel is available as an RPM.
|
||||
|
||||
12
scst.spec.in
12
scst.spec.in
@@ -3,22 +3,12 @@
|
||||
# The algorithm for setting the variable kversion is as follows:
|
||||
# - If the variable kversion has been set, use its value.
|
||||
# - If the variable kdir has been set, derive the kernel version from kdir.
|
||||
# - If an RPM with the name kernel-headers exists (RHEL / CentOS), use the
|
||||
# version number of the kernel that package is based on. This provides the
|
||||
# version number when building on a koji build server.
|
||||
# - Otherwise use the version number of the running kernel.
|
||||
%{!?kversion:
|
||||
%{?kdir:%define kversion %{expand:%%(
|
||||
make -sC "%{kdir}" kernelversion | grep -v ^make)}}
|
||||
%{!?kdir:
|
||||
%define kversion %{expand:%%(
|
||||
if rpm --quiet -q kernel-headers; then
|
||||
rpm -q --qf '%%%%{BUILDTIME} %%%%{version}-%%%%{release}.%%%%{arch}\\n' \\
|
||||
kernel-headers | sort | tail -n1 | { read a b; echo $b; };
|
||||
else
|
||||
uname -r;
|
||||
fi
|
||||
)}}}
|
||||
%define kversion %{expand:%%(uname -r)}}}
|
||||
%{echo:kversion=%{kversion}
|
||||
}
|
||||
# kernel_rpm: Name of the kernel RPM if the kernel is available as an RPM.
|
||||
|
||||
Reference in New Issue
Block a user