X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=scripts%2Fkmodtool;h=852ade021d3c8a509deb929e6ca8872875e128f9;hb=abbfdca483897d4406889e3517e77baf07573ecb;hp=2170c4a908ae2b4b9d53a53cd07911c0371749b0;hpb=f3757573a677e8662e268f0bb8e5ffe750013088;p=zfs.git diff --git a/scripts/kmodtool b/scripts/kmodtool index 2170c4a..852ade0 100755 --- a/scripts/kmodtool +++ b/scripts/kmodtool @@ -37,6 +37,7 @@ kernel_versions_to_build_for= prefix= filterfile= target= +buildroot= error_out() { @@ -154,9 +155,6 @@ Provides: ${kmodname}-kmod = %{?epoch:%{epoch}:}%{version}-%{release} Requires: ${kmodname}-kmod-common >= %{?epoch:%{epoch}:}%{version} Requires(post): ${prefix}/sbin/depmod Requires(postun): ${prefix}/sbin/depmod -%{?KmodsRequires:Requires: %{KmodsRequires}-uname-r = ${kernel_uname_r}} -%{?KmodsBuildRequires:BuildRequires: %{KmodsBuildRequires}-uname-r = ${kernel_uname_r}} -%{?KmodsBuildRequires:BuildRequires: %{KmodsBuildRequires}} EOF if [[ ${obsolete_name} ]]; then @@ -169,6 +167,8 @@ EOF cat < /dev/null || : %postun -n kmod-${kmodname}-${kernel_uname_r} @@ -201,15 +201,38 @@ EOF print_rpmtemplate_kmoddevelpkg () { + if [[ "${1}" == "--custom" ]]; then + shift + local customkernel=true + elif [[ "${1}" == "--redhat" ]]; then + shift + local redhatkernel=true + fi + + local kernel_uname_r=${1} + cat <= %{?epoch:%{epoch}:}%{version}-%{release}" + fi + + if [[ ${obsolete_name} ]]; then + echo "Provides: kmod-${obsolete_name}-devel = ${obsolete_version}" + echo "Obsoletes: kmod-${obsolete_name}-devel < ${obsolete_version}" + fi + cat < objects for the newest kernel. + %files -n kmod-${kmodname}-devel %defattr(644,root,root,755) %{_usrsrc}/${kmodname}-%{version} @@ -238,22 +261,32 @@ print_rpmtemplate_per_kmoddevelpkg () local kernel_uname_r=${1} local kernel_variant="${2:+-${2}}" + # first part cat <= %{?epoch:%{epoch}:}%{version}-%{release} +%{?KmodsMetaRequires:Requires: %{?KmodsMetaRequires}} EOF - + if [[ ${obsolete_name} ]]; then echo "Provides: kmod-${obsolete_name}${kernel_variant} = ${obsolete_version}" echo "Obsoletes: kmod-${obsolete_name}${kernel_variant} < ${obsolete_version}" @@ -304,9 +338,9 @@ print_customrpmtemplate () { for kernel in ${1} do - if [[ -e "/usr/src/kernels/${kernel}" ]] ; then + 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}___%{_usrsrc}/kernels/${kernel} " + kernel_versions="${kernel_versions}${kernel}___${buildroot}%{_usrsrc}/kernels/${kernel} " # parse kernel versions string and print template local kernel_verrelarch=${kernel%%${kernels_known_variants}} @@ -314,6 +348,10 @@ print_customrpmtemplate () # create development package if [[ "${devel}" ]]; then + # create devel package including common headers + print_rpmtemplate_kmoddevelpkg --redhat ${kernel} ${kernel##${kernel_verrelarch}} + + # create devel package print_rpmtemplate_per_kmoddevelpkg --redhat ${kernel} ${kernel##${kernel_verrelarch}} fi elif [[ -e ${prefix}/lib/modules/"${kernel}"/build/Makefile ]] ; then @@ -325,6 +363,10 @@ print_customrpmtemplate () # create development package if [[ "${devel}" ]]; then + # create devel package including common headers + print_rpmtemplate_kmoddevelpkg --custom "${kernel}" + + # create devel package print_rpmtemplate_per_kmoddevelpkg --custom "${kernel}" fi else @@ -332,11 +374,6 @@ print_customrpmtemplate () fi done - # create common development package - if [[ "${devel}" ]]; then - print_rpmtemplate_kmoddevelpkg "${1}" - fi - # well, it's no header anymore, but who cares ;-) print_rpmtemplate_header } @@ -364,16 +401,14 @@ print_rpmtemplate () # create package print_rpmtemplate_per_kmodpkg ${kernel} ${kernel##${kernel_verrelarch}} - # create development package if [[ "${devel}" ]]; then + # create devel package including common headers + print_rpmtemplate_kmoddevelpkg ${kernel} ${kernel##${kernel_verrelarch}} + + # create devel package print_rpmtemplate_per_kmoddevelpkg ${kernel} ${kernel##${kernel_verrelarch}} fi done - - # create common development package - if [[ "${devel}" ]]; then - print_rpmtemplate_kmoddevelpkg "${1}" - fi } myprog_help () @@ -381,7 +416,6 @@ myprog_help () echo "Usage: $(basename ${0}) [OPTIONS]" echo $'\n'"Creates a template to be used during kmod building" echo $'\n'"Available options:" - # FIXME echo " --datadir -- look for our shared files in " echo " --filterfile -- filter the results with grep --file " echo " --for-kernels -- created templates only for these kernels" echo " --kmodname -- name of the kmod (required)" @@ -389,6 +423,7 @@ myprog_help () echo " --noakmod -- no akmod package" echo " --repo -- use buildsys-build--kerneldevpkgs" echo " --target -- target-arch (required)" + echo " --buildroot -- Build root (place to look for build files)" } while [ "${1}" ] ; do @@ -477,6 +512,11 @@ while [ "${1}" ] ; do shift build_kernels="current" ;; + --buildroot) + shift + buildroot="${1}" + shift + ;; --help) myprog_help exit 0