File kernel-syms.spec of Package kernel-source

#
# spec file for package kernel-syms (Version 2.6.27.56)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild

Url:            http://www.kernel.org/
%if 0%{?opensuse_bs}
# 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

Name:           kernel-syms
Summary:        Kernel Symbol Versions (modversions)
Version:        2.6.27.56
Release:        0.<RELEASE1>
License:        GPL v2 only
Group:          Development/Sources
AutoReqProv:    off
BuildRequires:  coreutils
%if ! 0%{?opensuse_bs}
BuildRequires:  kernel-dummy
%endif
ExclusiveArch:  %ix86 ppc ppc64 s390 s390x ia64 x86_64
%ifarch %ix86
BuildRequires:  kernel-debug kernel-default kernel-ec2 kernel-pae kernel-trace kernel-vmi kernel-xen
%else
%ifarch ppc
BuildRequires:  kernel-default kernel-kdump kernel-ppc64 kernel-ps3
%else
%ifarch ppc64
BuildRequires:  kernel-debug kernel-default kernel-kdump kernel-ppc64
%else
%ifarch s390
BuildRequires:  kernel-s390
%else
%ifarch s390x
BuildRequires:  kernel-default
%else
%ifarch ia64
BuildRequires:  kernel-debug kernel-default kernel-trace
%else
%ifarch x86_64
BuildRequires:  kernel-debug kernel-default kernel-ec2 kernel-trace kernel-xen
%endif
%endif
%endif
%endif
%endif
%endif
%endif
# the packages above do require other things, but none of those are needed during package build
#!BuildIgnore: irqbalance xen
#!BuildIgnore: perl-Bootloader mkinitrd
#!BuildIgnore: module-init-tools_fix_bnc480524
Requires:       linux
Requires:       kernel-source = 2.6.27.56-%source_rel
Source11:       arch-symbols
Source12:       guards
Source21:       config.conf
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Prefix:         /usr/src

%(chmod +x %_sourcedir/{arch-symbols,guards})

%define symbols %(set -- $(%_sourcedir/arch-symbols %_target_cpu) $([ -e %_sourcedir/extra-symbols ] && cat %_sourcedir/extra-symbols) ; echo $*)

%description
Kernel symbols, such as functions and variables, have version
information attached to them. This package contains the symbol versions
for the standard kernels.

This package is needed for compiling kernel module packages with proper
package dependencies.



Authors:
--------
    Linus Torvalds <torvalds@transmeta.com>
    
    see /usr/src/linux/CREDITS for more details.

Source Timestamp: 2010-12-01 16:57:58 +0100
GIT Revision: 1b5f62cf35ce9157f69781339df846ab7661e31d
GIT Branch: SLE11_BRANCH

%prep

echo "Architecture symbol(s):" %symbols

%install
rm -rf $RPM_BUILD_ROOT
mkdir $RPM_BUILD_ROOT

set -- %symbols
case kernel-syms in
(*-rt)
    set -- RT "$@"
    ;;
esac
%_sourcedir/guards "$@" < %_sourcedir/series.conf > %_builddir/kernel-syms.patches
for config in $(%_sourcedir/guards %symbols < %_sourcedir/config.conf) ; do
    arch="${config%%/*}"
    flavor="${config#*/}"

    rpm -q --quiet kernel-$flavor || continue

    # Don't add the build infrastructure for kernels that are based
    # on a different set of patches.
    set -- kernel-$flavor $flavor $(case $flavor in (rt|rt_*) echo RT ;; esac)
    %_sourcedir/guards $* %symbols < %_sourcedir/series.conf \
	> %_builddir/kernel-$flavor.patches
    diff -q %_builddir/{kernel-syms,kernel-$flavor}.patches || continue

    # Make sure that all the kernel-$flavor version-release match the
    # kernel-syms version-release.
    set -- %version-%release $(rpm -q --qf '%%{VERSION}-%%{RELEASE}' kernel-$flavor)
%if 0%{?opensuse_bs}
    set -- ${1%.*} ${2%.*}
%endif
    if [ "$1" != "$2" ]; then
	echo "version-release of %name-$1 and kernel-$flavor-$2 do not match" >&2
	exit 1
    fi

    shopt -s nullglob
    for symvers in /usr/src/linux-*-obj/$arch/$flavor/Module.symvers; do
	cp -p --parents $symvers $RPM_BUILD_ROOT/
	for file in /lib/modules/*-$flavor/modules.alias; do
	    cp -p $file $(dirname $RPM_BUILD_ROOT$symvers)
	done
    done
    for symsets in /boot/symsets-*-$flavor.tar.gz; do
	cp -p --parents $symsets $RPM_BUILD_ROOT/
    done
    for file in /lib/modules/*-$flavor/build; do
	cp -pd --parents $file $RPM_BUILD_ROOT/
    done
done

%files
%defattr(-, root, root)
/usr/src/linux-*-obj
/boot/symsets-*-*.tar.gz
/lib/modules/*/build

%changelog
openSUSE Build Service is sponsored by