|
|
eaaa62 |
From: Jiri Benc <jbenc@redhat.com>
|
|
|
eaaa62 |
Subject: Build correctly with z-stream kernels
|
|
|
eaaa62 |
|
|
|
eaaa62 |
In brew, there's usually a newer kernel installed than the one used for
|
|
|
eaaa62 |
installation. Handle this situation correctly by allowing the spec file to
|
|
|
eaaa62 |
define kernel_version to be used in rpm dependencies, while building against
|
|
|
eaaa62 |
a compatible newer (z-stream) kernel.
|
|
|
eaaa62 |
|
|
|
eaaa62 |
Signed-off-by: Jiri Benc <jbenc@redhat.com>
|
|
|
eaaa62 |
|
|
|
eaaa62 |
---
|
|
|
eaaa62 |
kmodtool | 31 ++++++++++++++++++++++++++++---
|
|
|
eaaa62 |
macros | 2 +-
|
|
|
eaaa62 |
2 files changed, 29 insertions(+), 4 deletions(-)
|
|
|
eaaa62 |
|
|
|
eaaa62 |
--- a/kmodtool
|
|
|
eaaa62 |
+++ b/kmodtool
|
|
|
eaaa62 |
@@ -9,6 +9,7 @@
|
|
|
eaaa62 |
# Copyright (c) 2003-2010 Ville Skyttä <ville.skytta@iki.fi>,
|
|
|
eaaa62 |
# Thorsten Leemhuis <fedora@leemhuis.info>
|
|
|
eaaa62 |
# Jon Masters <jcm@redhat.com>
|
|
|
eaaa62 |
+# Copyright (c) 2012-2013 Jiri Benc <jbenc@redhat.com>
|
|
|
eaaa62 |
#
|
|
|
eaaa62 |
# Permission is hereby granted, free of charge, to any person obtaining
|
|
|
eaaa62 |
# a copy of this software and associated documentation files (the
|
|
|
eaaa62 |
@@ -49,9 +50,25 @@ kver=
|
|
|
eaaa62 |
verrel=
|
|
|
eaaa62 |
variant=
|
|
|
eaaa62 |
|
|
|
eaaa62 |
+get_kernel_release ()
|
|
|
eaaa62 |
+{
|
|
|
eaaa62 |
+ if [[ -z $1 ]]; then
|
|
|
eaaa62 |
+ uname -r
|
|
|
eaaa62 |
+ return
|
|
|
eaaa62 |
+ fi
|
|
|
eaaa62 |
+ local arch=$(arch)
|
|
|
eaaa62 |
+ local verrel=${1%.$arch}
|
|
|
eaaa62 |
+ local verprefix=${verrel%.*}
|
|
|
eaaa62 |
+ local versuffix=${verrel#$verprefix}
|
|
|
eaaa62 |
+ verrel=$(ls -Ud /usr/src/kernels/$verprefix*$versuffix.$arch | sort -V | tail -n 1)
|
|
|
eaaa62 |
+ verrel=${verrel##*/}
|
|
|
eaaa62 |
+ [[ -z $verrel ]] && verrel=$1.$arch
|
|
|
eaaa62 |
+ echo "$verrel"
|
|
|
eaaa62 |
+}
|
|
|
eaaa62 |
+
|
|
|
eaaa62 |
get_verrel ()
|
|
|
eaaa62 |
{
|
|
|
eaaa62 |
- verrel=${1:-$(uname -r)}
|
|
|
eaaa62 |
+ verrel=$(get_kernel_release "$1")
|
|
|
eaaa62 |
verrel=${verrel/%.$knownvariants/}
|
|
|
eaaa62 |
}
|
|
|
eaaa62 |
|
|
|
eaaa62 |
@@ -61,10 +78,16 @@ print_verrel ()
|
|
|
eaaa62 |
echo "${verrel}"
|
|
|
eaaa62 |
}
|
|
|
eaaa62 |
|
|
|
eaaa62 |
+get_verrel_for_deps ()
|
|
|
eaaa62 |
+{
|
|
|
eaaa62 |
+ verrel_dep=${1:-$(uname -r)}
|
|
|
eaaa62 |
+ verrel_dep=${verrel_dep/%.$knownvariants/}
|
|
|
eaaa62 |
+}
|
|
|
eaaa62 |
+
|
|
|
eaaa62 |
get_variant ()
|
|
|
eaaa62 |
{
|
|
|
eaaa62 |
get_verrel $@
|
|
|
eaaa62 |
- variant=${1:-$(uname -r)}
|
|
|
eaaa62 |
+ variant=$(get_kernel_release "$1")
|
|
|
eaaa62 |
variant=${variant/#$verrel?(.)/}
|
|
|
eaaa62 |
variant=${variant:-'""'}
|
|
|
eaaa62 |
}
|
|
|
eaaa62 |
@@ -129,7 +152,7 @@ get_rpmtemplate ()
|
|
|
eaaa62 |
echo "%global _use_internal_dependency_generator 0"
|
|
|
eaaa62 |
|
|
|
eaaa62 |
cat <
|
|
|
eaaa62 |
-Provides: kernel-modules >= ${verrel}${dotvariant}
|
|
|
eaaa62 |
+Provides: kernel-modules >= ${verrel_dep}${dotvariant}
|
|
|
eaaa62 |
Provides: ${kmod_name}-kmod = %{?epoch:%{epoch}:}%{version}-%{release}
|
|
|
eaaa62 |
Requires(post): /sbin/depmod
|
|
|
eaaa62 |
Requires(postun): /sbin/depmod
|
|
|
eaaa62 |
@@ -206,6 +229,8 @@ print_rpmtemplate ()
|
|
|
eaaa62 |
shift
|
|
|
eaaa62 |
kver="${1}"
|
|
|
eaaa62 |
get_verrel "${1}"
|
|
|
eaaa62 |
+ get_verrel_for_deps "${1}"
|
|
|
eaaa62 |
+ [[ -z $kver ]] && kver=$verrel
|
|
|
eaaa62 |
shift
|
|
|
eaaa62 |
if [ -z "${kmod_name}" ] ; then
|
|
|
eaaa62 |
echo "Please provide the kmodule-name as first parameter." >&2
|
|
|
eaaa62 |
--- a/macros
|
|
|
eaaa62 |
+++ b/macros
|
|
|
eaaa62 |
@@ -218,7 +218,7 @@ package or when debugging this package.\
|
|
|
eaaa62 |
then \
|
|
|
eaaa62 |
nobuildreqs="yes" \
|
|
|
eaaa62 |
fi \
|
|
|
eaaa62 |
- override_filelist="$filelist" override_preamble="$preamble" nobuildreqs="$nobuildreqs" kmod_version=%kmod_version kmod_release=%kmod_release %{kmodtool} rpmtemplate %{-n*}%{!-n:%name} %{kverrel} $flavors_to_build 2>/dev/null \
|
|
|
eaaa62 |
+ override_filelist="$filelist" override_preamble="$preamble" nobuildreqs="$nobuildreqs" kmod_version=%kmod_version kmod_release=%kmod_release %{kmodtool} rpmtemplate %{-n*}%{!-n:%name} %{kernel_version} $flavors_to_build 2>/dev/null \
|
|
|
eaaa62 |
)}
|
|
|
eaaa62 |
|
|
|
eaaa62 |
#==============================================================================
|