--- rpms/appletalk-kmod/sme7/appletalk-kmod.spec 2007/11/03 15:45:42 1.5 +++ rpms/appletalk-kmod/sme7/appletalk-kmod.spec 2010/06/01 16:33:44 1.26 @@ -1,16 +1,29 @@ -Source10: kmodtool2 -%define kmodtool bash %{SOURCE10} -%{!?kversion: %define kversion 2.6.9-55.0.12.EL} +# $Id: appletalk-kmod.spec,v 1.25 2010/04/21 16:05:43 slords Exp $ + +# Define the kmod package name here. +%define kmod_name appletalk + # hint: this can he overridden with "--define kversion foo" on the rpmbuild command line, e.g. # --define "kversion 2.6.16-1.2096_FC5" +%{!?kversion: %define kversion 2.6.9-89.0.20.EL} -%define kmod_name appletalk -%define kverrel %(%{kmodtool} verrel %{?kversion} 2>/dev/null) +Name: %{kmod_name}-kmod +Version: 1.0 +Release: 7%{?dist} +Group: System Environment/Kernel +License: GPL +Summary: %{kmod_name} kernel modules + +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +ExclusiveArch: i586 i686 x86_64 + +# Sources. +Source0: %{kmod_name}-%{version}-src.tgz +Source10: kmodtool-%{kmod_name} +# Define the variants for each architecture. %define upvar "" -%ifarch i586 i686 x86_64 -%define smpvar smp -%endif +%define smpvar smp %ifarch i686 %define hugememvar hugemem %define xenvar xenU @@ -19,26 +32,17 @@ Source10: kmodtool2 %define largesmpvar largesmp %define xenvar xenU %endif -%{!?kvariants: %define kvariants %{?upvar} %{?smpvar} %{?hugememvar} %{?largesmpvar} %{?xenvar}} -# hint: this can he overridden with "--define kvariant foo bar" on the rpmbuild command line, e.g. -# --define 'kvariant "" smp' - -Name: %{kmod_name}-kmod -Version: 1.0 -Release: 2.%(echo %{kverrel} | tr - _) -Summary: %{kmod_name} kernel modules - -Group: System Environment/Kernel -License: GPL -Source0: %{kmod_name}-%{version}-src.tgz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -ExclusiveArch: i586 i686 x86_64 + +# If kvariants isn't defined on the rpmbuild line, build all variants for this architecture. +%{!?kvariants: %define kvariants %{?upvar} %{?smpvar} %{?xenvar} %{?hugememvar} %{?largesmpvar}} + +# Magic hidden here. +%define kmodtool sh %{SOURCE10} +%{expand:%(%{kmodtool} rpmtemplate_kmp %{kmod_name} %{kversion} %{kvariants} 2>/dev/null)} %description %{summary}. -%{expand:%(%{kmodtool} rpmtemplate %{kmod_name} %{kverrel} %{kvariants} 2>/dev/null)} - %prep %setup -q -c for kvariant in %{kvariants} ; do @@ -50,20 +54,70 @@ for kvariant in %{kvariants} ; do done %build -rm -rf $RPM_BUILD_ROOT for kvariant in %{kvariants} ; do - ks=%{_usrsrc}/kernels/%{kverrel}${kvariant:+-$kvariant}-%{_target_cpu} - make -C $ks SUBDIRS=${PWD}/_kmod_build_$kvariant modules \ - CONFIG_ATALK=m CONFIG_PROC_FS=y CONFIG_SYSCTL=y - make -C $ks SUBDIRS=${PWD}/_kmod_build_$kvariant modules_install \ - INSTALL_MOD_PATH=$RPM_BUILD_ROOT modinst_dir='$(MODLIB)/updates/'%{kmod_name} +# ksrc=%{_usrsrc}/kernels/%{kversion}${kvariant:+-$kvariant}-%{_target_cpu} +# pushd _kmod_build_$kvariant +# make -C "${ksrc}" modules M=$PWD +# popd + ksrc=/lib/modules/"%{kversion}${kvariant:+$kvariant}"/build + cd _kmod_build_$kvariant + # make TOPDIR=${ksrc} modules %{?_smp_mflags} + make -C "${ksrc}" SUBDIRS=${PWD} CONFIG_ATALK=m CONFIG_PROC_FS=y CONFIG_SYSCTL=y modules %{?_smp_mflags} + cd .. done -chmod +x $RPM_BUILD_ROOT/lib/modules/*/updates/%{kmod_name}/*.ko + +%install +export INSTALL_MOD_PATH=$RPM_BUILD_ROOT +export INSTALL_MOD_DIR=extra/%{kmod_name} +for kvariant in %{kvariants} ; do +# ksrc=%{_usrsrc}/kernels/%{kversion}${kvariant:+-$kvariant}-%{_target_cpu} +# pushd _kmod_build_$kvariant +# make -C "${ksrc}" modules_install M=$PWD +# install -d ${INSTALL_MOD_PATH}/usr/lib/debug +# popd + ksrc=/lib/modules/"%{kversion}${kvariant:+$kvariant}"/build + cd _kmod_build_$kvariant + make -C ${ksrc} SUBDIRS=`pwd` INSTALL_MOD_PATH=$RPM_BUILD_ROOT modinst_dir='$(MODLIB)/extra/'%{kmod_name} modules_install + # make TOPDIR=${ksrc} INSTALL_MOD_PATH=$RPM_BUILD_ROOT INSTALL_MOD_DIR=extra/%{kmod_name}/ modules_install %{?_smp_mflags} + cd .. + + mkdir -p ${INSTALL_MOD_PATH}/usr/share/doc/kmod-%{kmod_name}/%{kversion}/ + find ${INSTALL_MOD_PATH}/lib/modules/"%{kversion}${kvariant:+$kvariant}"/ -type f -name \*.ko | sed "s,${INSTALL_MOD_PATH},," \ + > ${INSTALL_MOD_PATH}/usr/share/doc/kmod-%{kmod_name}/%{kversion}/"modules${kvariant:+-$kvariant}" +done + +# Strip the module(s). +find ${INSTALL_MOD_PATH} -type f -name \*.ko -exec strip --strip-debug \{\} \; + +# Override where module comes from. +mkdir -p ${INSTALL_MOD_PATH}/etc/depmod.d/ +find ${INSTALL_MOD_PATH}/lib/modules/ -type f -name \*.ko -printf '%f\n' \ + | sed 's,\.ko,,' | sort -u | xargs -ri echo "override {} * weak-updates/%{kmod_name}" \ + >> ${INSTALL_MOD_PATH}/etc/depmod.d/%{kmod_name}.conf %clean rm -rf $RPM_BUILD_ROOT %changelog +* Tue Jun 01 2010 Shad L. Lords 1.0-7.sme +- Make weak-updates default for pulling module [SME: 5982] +- Fix previous script to not error on uninstall [SME: 5448] + +* Wed Apr 21 2010 Shad L. Lords 1.0-6.sme +- Update scriptlets to not call rpm [SME: 5448] + +* Tue Oct 26 2009 Shad L. Lords 1.0-5.sme +- Make preuninstall script not fail on upgrade + +* Tue May 26 2009 Shad L. Lords 1.0-4.sme +- Initial build of the kABI-tracking version from 1.0. +- Modified spec and kmodtool(-appletalk) +- Note: weak-modules became available as of CentOS-4.7 +- Strip the module(s) added + +* Thu Feb 5 2009 Shad L. Lords +- Fix post scripts [SME: 4864] + * Mon May 7 2007 Shad L. Lords - Update to use kmodtool