1
0
forked from pool/kernel-source
kernel-source/kernel-source.spec.in

241 lines
6.9 KiB
RPMSpec
Raw Normal View History

#
# spec file for package kernel-source@VARIANT@ (Version @RPMVERSION@)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
# icecream 0
# FIXME: this check will go before the next release ...
%define using_buildservice 0%{?opensuse_bs}
%if %using_buildservice
# Strip off the build number ("y") from the "x.y" release number
%define source_rel %(release=%release; echo ${release%.*})
%else
# We don't have build numbers internally
%define source_rel %release
%endif
# macro to add the source timestamp to package descriptions
%define source_timestamp %(sed '1s/^/Source timestamp: /' %_sourcedir/source-timestamp || :)
%define srcversion @SRCVERSION@
%define patchversion @PATCHVERSION@
%define variant @VARIANT@%{nil}
%define release_major %(rel="%source_rel" ; echo "${rel##[^0-9]*.}")
%define kernelrelease %patchversion-%release_major
%define src_install_dir usr/src/linux-%kernelrelease%variant
%define obj_install_dir /%src_install_dir-obj
%define rpm_install_dir %buildroot%real_install_dir
%define tolerate_unknown_new_config_options @TOLERATE_UNKNOWN_NEW_CONFIG_OPTIONS@
Name: kernel-source@VARIANT@
Summary: The Linux Kernel Sources
Version: @RPMVERSION@
%if %using_buildservice
Release: @RELEASE_PREFIX@<RELEASE>
%else
Release: @RELEASE_PREFIX@0
%endif
License: GPL
Group: Development/Sources
AutoReqProv: off
BuildRequires: coreutils sed
BuildRequires: fdupes
Requires(post): coreutils sed
Provides: linux
Provides: %name = %version-%source_rel
Source0: http://www.kernel.org/pub/linux/kernel/v2.6/linux-%srcversion.tar.bz2
Source2: source-post.sh
Source3: %name.rpmlintrc
Source8: devel-pre.sh
Source9: devel-post.sh
Source10: preun.sh
Source11: postun.sh
Source12: pre.sh
Source13: post.sh
Source14: series.conf
Source16: guards
Source21: config.conf
Source23: supported.conf
Source30: config-subst
Source33: check-for-config-changes
Source34: check-supported-list
Source37: README.SUSE
Source38: README.KSYMS
Source40: source-timestamp
Source41: built-in-where
Source44: find-provides
Source45: module-renames
Source46: modversions
Source47: extract-modaliases
Source48: macros.kernel-source
Source49: kernel-module-subpackage
Source50: symsets.pl
Source51: mkspec
Source52: kernel-source%variant.changes
Source53: kernel-source.spec.in
Source54: kernel-binary.spec.in
Source55: kernel-syms.spec.in
Source56: config.sh
Source57: compute-PATCHVERSION.sh
Source58: old-packages.conf
Source59: arch-symbols
Source60: package-descriptions
Source100: config.tar.bz2
Source101: patches.arch.tar.bz2
Source102: patches.drivers.tar.bz2
Source103: patches.fixes.tar.bz2
Source104: patches.rpmify.tar.bz2
Source105: patches.suse.tar.bz2
Source107: patches.xen.tar.bz2
Source108: patches.addon.tar.bz2
Source109: patches.kernel.org.tar.bz2
Source110: patches.apparmor.tar.bz2
Source111: patches.rt.tar.bz2
Source112: patches.trace.tar.bz2
Source113: patches.kabi.tar.bz2
Source120: kabi.tar.bz2
BuildRoot: %_tmppath/%name-%version-build
BuildArchitectures: noarch
Prefix: /usr/src
# Build with bash instead of sh as the shell: this turns on bash
# extensions like <(...).
%define _buildshell /bin/bash
%define my_builddir %_builddir/%{name}-%{version}
%(chmod +x %_sourcedir/{guards,config-subst,check-for-config-changes,symsets.pl,mkspec,compute-PATCHVERSION.sh,arch-symbols})
%define symbols %(set -- $([ -e %_sourcedir/extra-symbols ] && cat %_sourcedir/extra-symbols) ; echo $*)
%define variant_symbols %(case %name in (*-rt) echo "RT" ;; esac)
%define do_vanilla "%variant" == ""
%description
Linux kernel sources with many fixes and improvements.
%source_timestamp
%package vanilla
Summary: Vanilla Linux kernel sources with minor build fixes.
Group: Development/Sources
AutoReqProv: off
%description vanilla
Vanilla Linux kernel sources with minor build fixes.
%source_timestamp
%prep
if ! [ -e %_sourcedir/linux-%srcversion.tar.bz2 ]; then
echo "Please get a copy of linux-%srcversion.tar.bz2 from" \
"ftp://ftp.kernel.org/pub/linux/kernel/v2.6/."
fi
echo "Symbol(s): %symbols"
# Unpack all sources and patches
%setup -q -c -T -a 100 -a 101 -a 102 -a 103 -a 104 -a 105 -a 107 -a 108 -a 109 -a 110 -a 111 -a 112 -a 113
%build
# Release number without the EXTRAVERSION
RELEASE=%source_rel
while [ "$RELEASE" != "${RELEASE#[^0-9]*.}" ]; do
RELEASE=${RELEASE#[^0-9]*.}
done
mkdir -p $RPM_BUILD_ROOT/usr/src
cd $RPM_BUILD_ROOT/usr/src
ln -sf linux%variant linux%variant # dummy symlink
# Unpack the vanilla kernel sources
bzip2 -cd %_sourcedir/linux-%srcversion.tar.bz2 \
| tar xf -
mv linux-%srcversion linux-%kernelrelease%variant
%if %do_vanilla
cp -al linux-%kernelrelease%variant linux-%kernelrelease-vanilla
cd linux-%kernelrelease-vanilla
%_sourcedir/guards %variant_symbols %symbols < %_sourcedir/series.conf |
egrep kernel.org\|rpmify > .patches
for patch in $(< .patches); do
if ! patch -s -F0 -E -p1 --no-backup-if-mismatch \
-i %_builddir/%name-%version/$patch; then
echo "*** Patch $patch failed ***"
exit 1
fi
done
rm -f .patches $(find . -name ".gitignore")
cd ..
%endif
cd linux-%kernelrelease%variant
%_sourcedir/guards %variant_symbols %symbols < %_sourcedir/series.conf \
> .patches
for patch in $(< .patches); do
if ! patch -s -F0 -E -p1 --no-backup-if-mismatch \
-i %_builddir/%name-%version/$patch; then
echo "*** Patch $patch failed ***"
exit 1
fi
done
rm -f .patches $(find . -name ".gitignore")
if [ -f %_sourcedir/localversion ] ; then
cat %_sourcedir/localversion > localversion
fi
# Hardlink duplicate files automatically (from package fdupes).
%fdupes $RPM_BUILD_ROOT
%install
# Install the documentation and example Kernel Module Package.
DOC=$RPM_BUILD_ROOT/usr/share/doc/packages/%name
mkdir -p $DOC
cp %_sourcedir/README.SUSE $DOC
ln -s /usr/share/doc/packages/%name/README.SUSE %buildroot/%src_install_dir/
install -m 755 -d $RPM_BUILD_ROOT/etc/rpm
install -m 644 %_sourcedir/macros.kernel-source $RPM_BUILD_ROOT/etc/rpm/
install -m 755 -d $RPM_BUILD_ROOT/usr/lib/rpm
install -m 644 %_sourcedir/kernel-module-subpackage \
$RPM_BUILD_ROOT/usr/lib/rpm/
for script in post; do
sed -e "s:@KERNELRELEASE@:%kernelrelease:g" \
-e "s:@SRCVARIANT@:%variant:g" \
%_sourcedir/source-$script.sh > %name-$script.sh
done
%post -f %name-post.sh
%files
%defattr(-, root, root)
%ghost /usr/src/linux%variant
/usr/share/doc/packages/%name
/etc/rpm/macros.kernel-source
/usr/lib/rpm/kernel-module-subpackage
/%src_install_dir
%if %do_vanilla
%files vanilla
%defattr(-, root, root)
/usr/src/linux-%kernelrelease-vanilla
%endif
%changelog