Hello community,

here is the log from the commit of package kernel-source.3332 for 
openSUSE:13.1:Update checked in at 2014-12-21 12:45:41
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:13.1:Update/kernel-source.3332 (Old)
 and      /work/SRC/openSUSE:13.1:Update/.kernel-source.3332.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "kernel-source.3332"

Changes:
--------
New Changes file:

--- /dev/null   2014-12-10 22:29:50.188034256 +0100
+++ /work/SRC/openSUSE:13.1:Update/.kernel-source.3332.new/kernel-cubox.changes 
2014-12-21 12:44:20.000000000 +0100
@@ -0,0 +1,31066 @@
+-------------------------------------------------------------------
+Wed Dec 17 18:56:55 CET 2014 - [email protected]
+
+- netlink: Only check file credentials for implicit destinations
+  (bsc#875051, CVE-2014-0181).
+- net: Use netlink_ns_capable to verify the permisions of netlink
+  messages (bsc#875051, CVE-2014-0181).
+- net: Add variants of capable for use on netlink messages
+  (bsc#875051, CVE-2014-0181).
+- net: Add variants of capable for use on on sockets (bsc#875051,
+  CVE-2014-0181).
+- net: add a permission check in sock_diag_put_filterinfo
+  (bsc#875051, CVE-2014-0181).
+- netlink: Rename netlink_capable netlink_allowed (bsc#875051,
+  CVE-2014-0181).
+- commit 8210f77
+
+-------------------------------------------------------------------
+Wed Dec 17 15:54:00 CET 2014 - [email protected]
+
+- Refresh patches.fixes/rtc-cmos-add-an-alarm-disable-quirk.patch.
+- Refresh patches.xen/xen-x86-EFI.
+- commit ab47385
+
+-------------------------------------------------------------------
+Wed Dec 17 13:37:37 CET 2014 - [email protected]
+
+- Refresh patches.xen/xen-x86-EFI.
+- commit 87190d7
+
+-------------------------------------------------------------------
+Wed Dec 17 13:07:22 CET 2014 - [email protected]
+
+- x86-64, espfix: Don't leak bits 31:16 of %esp returning to
+  16-bit stack (bsc#907818,CVE-2014-9090).
+- x86, espfix: Make espfix64 a Kconfig option, fix UML
+  (bsc#907818,CVE-2014-9090).
+- x86, espfix: Make it possible to disable 16-bit support
+  (bsc#907818,CVE-2014-9090).
+- x86/tls: Validate TLS entries to protect espfix
+  (bsc#909077,CVE-2014-8133).
+- x86_64/entry/xen: Do not invoke espfix64 on Xen
+  (bsc#907818,CVE-2014-9090).
+- x86_64, traps: Fix the espfix64 #DF fixup and rewrite it in C
+  (bsc#907818,CVE-2014-9090).
+- x86_64, traps: Rework bad_iret (bsc#909077,CVE-2014-8133).
+- x86_64, traps: Stop using IST for #SS (bsc#907818,
+  CVE-2014-9090, CVE-2014-9322).
+- Update config files.
+- Refresh patches.arch/x86_64-unwind-annotations.
+- Refresh patches.fixes/rtc-cmos-add-an-alarm-disable-quirk.patch.
+- Refresh patches.xen/xen3-patch-2.6.31.
+- commit eeb66c4
+
+-------------------------------------------------------------------
+Tue Dec 16 14:23:39 CET 2014 - [email protected]
+
+- parport: parport_pc, do not remove parent devices early
+  (bnc#856659).
+- commit 3f46c18
+
+-------------------------------------------------------------------
+Thu Dec 11 14:52:09 CET 2014 - [email protected]
+
+- x86_32, entry: Store badsys error code in %eax (bnc#883724,
+  CVE-2014-4508).
+- Refresh other Xen patches.
+- commit 9dc2a2a
+
+-------------------------------------------------------------------
+Sun Dec  7 05:19:57 CET 2014 - [email protected]
+
+- net: sctp: fix remote memory pressure from excessive queueing
+  (bnc#902351 CVE-2014-3688).
+- commit 7cdad6e
+
+-------------------------------------------------------------------
+Fri Dec  5 11:52:00 CET 2014 - [email protected]
+
+- KEYS: Fix stale key registration at error path (bnc#908163).
+- commit f780b60
+
+-------------------------------------------------------------------
+Fri Dec  5 01:33:56 CET 2014 - [email protected]
+
+- net: sctp: fix panic on duplicate ASCONF chunks (bnc#902349
+  CVE-2014-3687).
+- commit 1ccfd9b
+
+-------------------------------------------------------------------
+Mon Dec  1 16:30:27 CET 2014 - [email protected]
+
+- fs: Add a missing permission check to do_umount (CVE-2014-7975
+  bnc#900392).
+- commit b34d885
+
+-------------------------------------------------------------------
+Mon Nov 17 14:46:13 CET 2014 - [email protected]
+
+- ttusb-dec: buffer overflow in ioctl (bnc#905744).
+- commit 1d8fada
+
+-------------------------------------------------------------------
+Sat Nov 15 01:35:11 CET 2014 - [email protected]
+
+- net: sctp: fix skb_over_panic when receiving malformed ASCONF
+  chunks (bnc#902346 CVE-2014-3673).
+- commit a066b91
+
+-------------------------------------------------------------------
+Thu Nov 13 19:17:02 CET 2014 - [email protected]
+
+- HID: picolcd: sanity check report size in raw_event() callback
+  (bsc#896392, CVE-2014-3186).
+- commit 8278361
+
+-------------------------------------------------------------------
+Thu Nov 13 15:43:28 CET 2014 - [email protected]
+
+- net: sctp: fix NULL pointer dereference in af->from_addr_param
+  on (bnc#905100, CVE-2014-7841).
+- commit d1eef7a
+
+-------------------------------------------------------------------
+Thu Nov 13 14:11:06 CET 2014 - [email protected]
+
+- lz4: add overrun checks to lz4_uncompress_unknownoutputsize()
+  (bnc#883949,CVE-2014-4611).
+- lz4: fix another possible overrun (bnc#883949,CVE-2014-4611).
+- commit 8c939fa
+
+-------------------------------------------------------------------
+Thu Nov 13 12:37:06 CET 2014 - [email protected]
+
+- lzo: check for length overrun in variable length encoding
+  (bnc#889348,CVE-2014-4608).
+- commit 7d2426f
+
+-------------------------------------------------------------------
+Thu Nov 13 12:16:12 CET 2014 - [email protected]
+
+- mac80211: fix fragmentation code, particularly for encryption
+  (bnc#904700,CVE-2014-8709).
+- commit 980252a
+
+-------------------------------------------------------------------
+Thu Nov 13 12:06:14 CET 2014 - [email protected]
+
+- USB: whiteheat: Added bounds checking for bulk command response
+  (CVE-2014-3185,bnc#896391).
+- commit e41eed3
+
+-------------------------------------------------------------------
+Wed Nov 12 20:43:05 CET 2014 - [email protected]
+
+- HID: fix a couple of off-by-ones (bsc#896390, CVE-2014-3184).
+- commit 96ebcbe
+
+-------------------------------------------------------------------
+Tue Nov 11 20:55:08 CET 2014 - [email protected]
+
+- HID: logitech-dj: prevent false errors to be shown (bsc#896385,
+  CVE-2014-3182).
+- HID: logitech: perform bounds checking on device_id early enough
+  (bsc#896385, CVE-2014-3182).
+- commit 72245c3
+
+-------------------------------------------------------------------
+Tue Nov 11 20:52:39 CET 2014 - [email protected]
+
+- Move patches to where they belong in series.conf
+- commit 8a403f9
+
+-------------------------------------------------------------------
+Tue Nov 11 17:41:11 CET 2014 - [email protected]
+
+- HID: magicmouse: sanity check report size in raw_event()
+  callback (bsc#896382, CVE-2014-3181).
+- commit 2ab1e40
+
+-------------------------------------------------------------------
+Mon Nov 10 12:47:13 CET 2014 - [email protected]
+
+- tracing/syscalls: Ignore numbers outside NR_syscalls' range
+  (bsc#904013, CVE-2014-7826).
+- commit 99ef942
+
+-------------------------------------------------------------------
+Mon Nov 10 11:25:01 CET 2014 - [email protected]
+
+- xfs: fix directory hash ordering bug.
+- commit 410d910
+
+-------------------------------------------------------------------
+Fri Nov  7 17:56:20 CET 2014 - [email protected]
+
+- ipv6: fix leaking uninitialized port number of offender sockaddr
++++ 30869 more lines (skipped)
++++ between /dev/null
++++ and 
/work/SRC/openSUSE:13.1:Update/.kernel-source.3332.new/kernel-cubox.changes
New Changes file:

kernel-debug.changes: same change
New Changes file:

kernel-default.changes: same change
New Changes file:

kernel-desktop.changes: same change
New Changes file:

kernel-docs.changes: same change
New Changes file:

kernel-ec2.changes: same change
New Changes file:

kernel-exynos.changes: same change
New Changes file:

kernel-lpae.changes: same change
New Changes file:

kernel-obs-build.changes: same change
New Changes file:

kernel-obs-qa.changes: same change
New Changes file:

kernel-pae.changes: same change
New Changes file:

kernel-source.changes: same change
New Changes file:

kernel-syms.changes: same change
New Changes file:

kernel-trace.changes: same change
New Changes file:

kernel-vanilla.changes: same change
New Changes file:

kernel-xen.changes: same change

New:
----
  README.KSYMS
  README.SUSE
  _constraints
  apply-patches
  arch-symbols
  check-for-config-changes
  compute-PATCHVERSION.sh
  config-options.changes.txt
  config.addon.tar.bz2
  config.conf
  config.sh
  config.tar.bz2
  configtool.pl
  constraints.in
  devel-post.sh
  devel-pre.sh
  find-provides
  group-source-files.pl
  guards
  host-memcpy-hack.h
  kabi.pl
  kabi.tar.bz2
  kernel-binary.spec.in
  kernel-cert-subpackage
  kernel-cubox.changes
  kernel-cubox.spec
  kernel-debug.changes
  kernel-debug.spec
  kernel-default.changes
  kernel-default.spec
  kernel-desktop.changes
  kernel-desktop.spec
  kernel-docs.changes
  kernel-docs.spec
  kernel-docs.spec.in
  kernel-ec2.changes
  kernel-ec2.spec
  kernel-exynos.changes
  kernel-exynos.spec
  kernel-lpae.changes
  kernel-lpae.spec
  kernel-module-subpackage
  kernel-obs-build.changes
  kernel-obs-build.spec
  kernel-obs-build.spec.in
  kernel-obs-qa.changes
  kernel-obs-qa.spec
  kernel-obs-qa.spec.in
  kernel-pae.changes
  kernel-pae.spec
  kernel-source.changes
  kernel-source.rpmlintrc
  kernel-source.spec
  kernel-source.spec.in
  kernel-spec-macros
  kernel-syms.changes
  kernel-syms.spec
  kernel-syms.spec.in
  kernel-trace.changes
  kernel-trace.spec
  kernel-vanilla.changes
  kernel-vanilla.spec
  kernel-xen.changes
  kernel-xen.spec
  linux-3.11.tar.bz2
  log.sh
  macros.kernel-source
  minmem
  mkspec
  modversions
  needed_space_in_mb
  old-flavors
  package-descriptions
  patches.addon.tar.bz2
  patches.apparmor.tar.bz2
  patches.arch.tar.bz2
  patches.drivers.tar.bz2
  patches.fixes.tar.bz2
  patches.kabi.tar.bz2
  patches.kernel.org.tar.bz2
  patches.rpmify.tar.bz2
  patches.rt.tar.bz2
  patches.suse.tar.bz2
  patches.trace.tar.bz2
  patches.xen.tar.bz2
  post.sh
  postun.sh
  pre.sh
  preun.sh
  series.conf
  source-post.sh
  source-timestamp
  split-modules
  supported.conf
  sysctl.tar.bz2
  try-disable-staging-driver

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ kernel-cubox.spec ++++++
++++ 1080 lines (skipped)

kernel-debug.spec: same change
kernel-default.spec: same change
kernel-desktop.spec: same change
++++++ kernel-docs.spec ++++++
#
# spec file for package kernel-docs
#
# Copyright (c) 2014 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/
#


%define patchversion 3.11.10
%define variant %{nil}

%include %_sourcedir/kernel-spec-macros

Name:           kernel-docs
Summary:        Kernel Documentation
License:        GPL-2.0
Group:          Documentation/Man
Version:        3.11.10
%if 0%{?is_kotd}
Release:        <RELEASE>.g8210f77
%else
Release:        0
%endif
BuildRequires:  docbook-toys
BuildRequires:  docbook-utils
BuildRequires:  ghostscript_any
BuildRequires:  kernel-source%variant
BuildRequires:  libjpeg-devel
BuildRequires:  texlive
BuildRequires:  transfig
BuildRequires:  xmlto
BuildRequires:  xorg-x11-devel
Url:            http://www.kernel.org/
Provides:       %name = %version-%source_rel
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Source:         kernel-spec-macros

%description
These are the PDF documents and man pages (section 9) built from
the current kernel sources.


%source_timestamp
%prep
cp -av /etc/texmf/web2c/texmf.cnf .
cat << EOF >> texmf.cnf
main_memory.pdfjadetex = 2500000
hash_extra.pdfjadetex = 70000
max_strings.pdfjadetex = 120000
save_size.pdfjadetex = 10000
EOF
%setup -T -c

%build
# use texmf.cnf from local source
export TEXMFCNF=$RPM_BUILD_DIR
export LANG=en_US
make -C /usr/src/linux%variant O=$PWD -k -i mandocs %{?jobs:-j%jobs}
make -C /usr/src/linux%variant O=$PWD -k -i pdfdocs %{?jobs:-j%jobs}

%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT/%{_mandir}/man9
# filter out obscure device drivers - they clutter up the rpm and don't add any 
real value
find Documentation/DocBook/ -name '*.9.gz' | 
egrep -v 
'man/(sis[69]|rio|fsl|struct_rio|RIO|mpc85|set_rx_mode|mdio_(read|write)|mii_ioctl|mca_|z8530|nand|sppp|piix|(read|write)_zs)'
 |  
while read i ; do
        cp $i $RPM_BUILD_ROOT/%{_mandir}/man9
done
install -d $RPM_BUILD_ROOT/usr/share/doc/kernel
cp -a Documentation/DocBook/*.pdf $RPM_BUILD_ROOT/usr/share/doc/kernel || true
if [ -d Documentation/kdb ] ; then
    for i in Documentation/kdb/*.m* ; do
        k=`basename $i`
        k=${k/man/9}
        k=${k/mm/9}
        cp $i $RPM_BUILD_ROOT/%{_mandir}/man9/$k
    done
fi

ln -s /usr/share/man/man9/request_threaded_irq.9.gz 
$RPM_BUILD_ROOT/usr/share/man/man9/request_irq.9.gz

cp -a 
/usr/src/linux%variant/{COPYING,CREDITS,MAINTAINERS,README,REPORTING-BUGS} .

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc COPYING CREDITS MAINTAINERS README REPORTING-BUGS
%{_mandir}/man9/*
%docdir /usr/share/doc/kernel
/usr/share/doc/kernel

%changelog
++++++ kernel-ec2.spec ++++++
++++ 1086 lines (skipped)

kernel-exynos.spec: same change
kernel-lpae.spec: same change
++++++ kernel-obs-build.spec ++++++
#
# spec file for package kernel-obs-build
#
# Copyright (c) 2014 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/
#
# needsrootforbuild


#!BuildIgnore: post-build-checks

%define patchversion 3.11.10
%define variant %{nil}

%include %_sourcedir/kernel-spec-macros

Name:           kernel-obs-build
BuildRequires:  coreutils
BuildRequires:  device-mapper
BuildRequires:  util-linux

BuildRequires:  kernel-default
%ifarch %ix86 x86_64
BuildRequires:  kernel-xen
%endif
ExclusiveArch:  %ix86 aarch64 armv6hl armv7hl ia64 ppc ppc64 s390x x86_64
%if 0%{?suse_version} < 1320
# For SLE 11 
BuildRequires:  mkinitrd
BuildRequires:  perl-Bootloader
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%else
BuildRequires:  dracut
%endif
Summary:        package kernel and initrd for OBS VM builds
License:        GPL-2.0
Group:          SLES
Version:        3.11.10
%if 0%{?is_kotd}
Release:        <RELEASE>.g8210f77
%else
Release:        0
%endif

%description
This package is repackaging already compiled kernels to make them usable
inside of Open Build Service (OBS) VM builds. An initrd with some basic
kernel modules is generated as well, but further kernel modules can be 
loaded during build when installing the kernel package.

%prep

%build
mkdir -p /usr/lib/dracut/modules.d/80obs
cat > /usr/lib/dracut/modules.d/80obs/module-setup.sh <<EOF
#!/bin/bash

# called by dracut
check() {
    return 0
}

# called by dracut
installkernel() {
    hostonly='' instmods obs
}

# called by dracut
install() {
    inst_hook pre-udev 10 "\$moddir"/setup_obs.sh
}
EOF
chmod a+rx /usr/lib/dracut/modules.d/80obs/module-setup.sh
cat > /usr/lib/dracut/modules.d/80obs/setup_obs.sh <<EOF
#!/bin/sh
info "Loading kernel modules for OBS"
info "  Loop..."
modprobe loop max_loop=64 lbs=0 || modprobe loop max_loop=64
info "  binfmt misc..."
modprobe binfmt_misc
EOF
chmod a+rx /usr/lib/dracut/modules.d/80obs/setup_obs.sh

# a longer list to have them also available for qemu cross builds where x86_64 
kernel runs in eg. arm env.
# this list of modules where available on build workers of build.opensuse.org, 
so we stay compatible.
export KERNEL_MODULES="loop dm-mod dm-snapshot binfmt-misc fuse kqemu squashfs 
ext2 ext3 ext4 reiserfs nf_conntrack_ipv6 binfmt_misc virtio_pci virtio_blk fat 
vfat nls_cp437 nls_iso8859-1 ibmvscsi ibmvscsic"
ROOT=""
[ -e "/dev/vda" ] && ROOT="-d /dev/vda"
[ -e /dev/hda1 ] && ROOT="-d /dev/hda1" # for xen builds
%define kernel_name vmlinu?
%ifarch s390 s390x
%define kernel_name image
%endif

%if 0%{?suse_version} < 1320
# For SLE 11 
/sbin/mkinitrd $ROOT \
               -m "$KERNEL_MODULES" \
               -k /boot/%{kernel_name}-*-default -M /boot/System.map-*-default 
-i /tmp/initrd.kvm -B
%ifarch %ix86 x86_64
/sbin/mkinitrd $ROOT \
               -m "$KERNEL_MODULES" \
               -k /boot/vmlinuz-xen -M /boot/System.map-*-xen -i /tmp/initrd.xen
%endif
%else
dracut --host-only --drivers="$KERNEL_MODULES" --force /tmp/initrd.kvm `echo 
/boot/%{kernel_name}-*-default | sed -n -e 's,[^-]*-\(.*-default\),\1,p'`
%ifarch %ix86 x86_64
dracut --host-only --drivers="$KERNEL_MODULES" --force /tmp/initrd.xen `echo 
/boot/%{kernel_name}-*-xen | sed -n -e 's,[^-]*-\(.*-xen\),\1,p'`
%endif
%endif


#cleanup
rm -rf /usr/lib/dracut/modules.d/80obs

%install
install -d -m 0755 $RPM_BUILD_ROOT
cp -v /boot/%{kernel_name}-*-default $RPM_BUILD_ROOT/.build.kernel.kvm
cp -v /tmp/initrd.kvm $RPM_BUILD_ROOT/.build.initrd.kvm
%ifarch %ix86 x86_64
cp -v /boot/%{kernel_name}-*-xen $RPM_BUILD_ROOT/.build.kernel.xen
cp -v /tmp/initrd.xen $RPM_BUILD_ROOT/.build.initrd.xen
%endif

%files
%defattr(-,root,root)
/.build.kernel.*
/.build.initrd.*

%changelog
++++++ kernel-obs-qa.spec ++++++
#
# spec file for package kernel-obs-qa
#
# Copyright (c) 2014 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/
#
# needsrootforbuild


%define patchversion 3.11.10
%define variant %{nil}

%include %_sourcedir/kernel-spec-macros

Name:           kernel-obs-qa
BuildRequires:  kernel-default
# kernel-obs-build must be also configured as VMinstall, but is required
# here as well to avoid that qa and build package build parallel
BuildRequires:  kernel-obs-build
BuildRequires:  modutils
%ifarch %ix86 x86_64
BuildRequires:  kernel-xen
%endif
ExclusiveArch:  %ix86 aarch64 armv6hl armv7hl ia64 ppc ppc64 s390x x86_64
%if 0%{?suse_version} < 1200
# for SLE 11
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%endif
Summary:        Basic QA tests for the kernel
License:        GPL-2.0
Group:          SLES
Version:        3.11.10
%if 0%{?is_kotd}
Release:        <RELEASE>.g8210f77
%else
Release:        0
%endif

%description
This package is using the kernel compiled within Open Build Service(OBS)
projects and runs basic tests.

%prep

%build

%check
# More tests are comming, currently the main test is the existens of
# this spec file. It does trigger a build within OBS VM which is using
# the kernel of the same project.

# test suites should be packaged in other packages, but build required
# and called here.

if ! /sbin/modprobe loop; then
  echo "ERROR: Unable to load the kernel loop module."
  echo "Usually the wrong kernel is running, this is atm"
  cat /proc/version
  echo "Installed kernel modules are:"
  rpm -q kernel-@FLAVOR@
  exit 1
fi


%install
mkdir -p %{buildroot}/usr/share/%name
touch %{buildroot}/usr/share/%name/logfile

%files
%defattr(-,root,root)
/usr/share/%name

%changelog
++++++ kernel-pae.spec ++++++
++++ 1106 lines (skipped)

++++++ kernel-source.spec ++++++
#
# spec file for package kernel-source
#
# Copyright (c) 2014 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/
#
# icecream 0


%define srcversion 3.11
%define patchversion 3.11.10
%define variant %{nil}
%define vanilla_only 0

%include %_sourcedir/kernel-spec-macros

%define src_install_dir usr/src/linux-%kernelrelease%variant

Name:           kernel-source
Summary:        The Linux Kernel Sources
License:        GPL-2.0
Group:          Development/Sources
Version:        3.11.10
%if 0%{?is_kotd}
Release:        <RELEASE>.g8210f77
%else
Release:        0
%endif
Url:            http://www.kernel.org/
AutoReqProv:    off
BuildRequires:  coreutils
BuildRequires:  fdupes
BuildRequires:  sed
Requires(post): coreutils sed
Provides:       %name = %version-%source_rel
Provides:       linux
Provides:       multiversion(kernel)
Source0:        
http://www.kernel.org/pub/linux/kernel/v3.x/linux-%srcversion.tar.bz2
Source2:        source-post.sh
Source3:        kernel-source.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
Source17:       apply-patches
Source21:       config.conf
Source23:       supported.conf
Source33:       check-for-config-changes
Source35:       group-source-files.pl
Source37:       README.SUSE
Source38:       README.KSYMS
Source39:       config-options.changes.txt
Source40:       source-timestamp
Source44:       find-provides
Source45:       split-modules
Source46:       modversions
Source48:       macros.kernel-source
Source49:       kernel-module-subpackage
Source50:       kabi.pl
Source51:       mkspec
Source52:       kernel-source%variant.changes
Source53:       kernel-source.spec.in
Source54:       kernel-binary.spec.in
Source55:       kernel-syms.spec.in
Source56:       kernel-docs.spec.in
Source57:       kernel-cert-subpackage
Source58:       constraints.in
Source60:       config.sh
Source61:       compute-PATCHVERSION.sh
Source62:       old-flavors
Source63:       arch-symbols
Source64:       package-descriptions
Source65:       kernel-spec-macros
Source66:       configtool.pl
Source67:       log.sh
Source68:       host-memcpy-hack.h
Source69:       try-disable-staging-driver
Source70:       kernel-obs-build.spec.in
Source71:       kernel-obs-qa.spec.in
Source100:      config.tar.bz2
Source101:      config.addon.tar.bz2
Source102:      patches.arch.tar.bz2
Source103:      patches.drivers.tar.bz2
Source104:      patches.fixes.tar.bz2
Source105:      patches.rpmify.tar.bz2
Source106:      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
Source121:      sysctl.tar.bz2
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
Prefix:         /usr/src
# Source is only complete with devel files.
Requires:       kernel-devel%variant = %version-%release

%(chmod +x 
%_sourcedir/{guards,apply-patches,check-for-config-changes,group-source-files.pl,find-provides,split-modules,modversions,kabi.pl,mkspec,compute-PATCHVERSION.sh,arch-symbols,configtool.pl,log.sh,try-disable-staging-driver})

%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 -n kernel-devel%variant
Summary:        Development files needed for building kernel modules
Group:          Development/Sources
AutoReqProv:    off
Provides:       kernel-devel%variant = %version-%source_rel
Provides:       multiversion(kernel)

%description -n kernel-devel%variant
Kernel-level headers and Makefiles required for development of
external kernel modules.


%source_timestamp
%package vanilla
Summary:        Vanilla Linux kernel sources with minor build fixes.
Group:          Development/Sources
AutoReqProv:    off
Provides:       %name-vanilla = %version-%source_rel
Provides:       multiversion(kernel)

%description vanilla
Vanilla Linux kernel sources with minor build fixes.


%source_timestamp
%prep

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 106 -a 107 -a 108 
-a 109 -a 110 -a 111 -a 112 -a 113 -a 120 -a 121

%build
mkdir -p $RPM_BUILD_ROOT/usr/src
cd $RPM_BUILD_ROOT/usr/src

# Unpack the vanilla kernel sources
tar -xf %{S:0}
if test "%srcversion" != "%kernelrelease%variant"; then
        mv linux-%srcversion linux-%kernelrelease%variant
fi

%if %do_vanilla
%if %vanilla_only
        mv \
%else
        cp -al \
%endif
        linux-%kernelrelease%variant linux-%kernelrelease-vanilla
cd linux-%kernelrelease-vanilla
%_sourcedir/apply-patches --vanilla %_sourcedir/series.conf %my_builddir 
%symbols
rm -f $(find . -name ".gitignore")
cd ..
%endif

%if ! %vanilla_only
ln -sf linux%variant linux%variant  # dummy symlink

cd linux-%kernelrelease%variant
%_sourcedir/apply-patches %_sourcedir/series.conf %my_builddir %symbols
rm -f $(find . -name ".gitignore")

if [ -f %_sourcedir/localversion ] ; then
    cat %_sourcedir/localversion > localversion
fi
%endif

# Hardlink duplicate files automatically (from package fdupes).
%fdupes $RPM_BUILD_ROOT

%install
%if ! %vanilla_only
# Install the documentation and example Kernel Module Package.
DOC=$RPM_BUILD_ROOT/usr/share/doc/packages/%name
mkdir -p $DOC
cp %_sourcedir/README.SUSE %_sourcedir/config-options.changes.txt $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,cert}-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

pushd "%buildroot"
perl "%_sourcedir/group-source-files.pl" \
        -D "$OLDPWD/devel.files" -N "$OLDPWD/nondevel.files" \
        -L "%src_install_dir"
popd

# kernel-source and kernel-$flavor-devel are built independently, but the
# shipped sources (/usr/src/linux/) need to be older than generated files
# (/usr/src/linux-obj). We rely on the git commit timestamp to not point into
# the future and be thus lower than the timestamps of files built from the
# source (bnc#669669).
ts="$(head -n1 %_sourcedir/source-timestamp)"
find %buildroot/usr/src/linux* ! -type l | xargs touch -d "$ts"

%post -f %name-post.sh

%post -n kernel-devel%variant -f %name-post.sh

%files -f nondevel.files
%defattr(-, root, root)

%files -n kernel-devel%variant -f devel.files
%defattr(-,root,root)
%ghost /usr/src/linux%variant
/usr/share/doc/packages/%name
/etc/rpm/macros.kernel-source
/usr/lib/rpm/kernel-*-subpackage
%endif

%if %do_vanilla

%files vanilla
%defattr(-, root, root)
/usr/src/linux-%kernelrelease-vanilla
%endif

%changelog
++++++ kernel-syms.spec ++++++
#
# spec file for package kernel-syms
#
# Copyright (c) 2014 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/
#


%define variant %{nil}

%include %_sourcedir/kernel-spec-macros

Name:           kernel-syms
Summary:        Kernel Symbol Versions (modversions)
License:        GPL-2.0
Group:          Development/Sources
Version:        3.11.10
%if %using_buildservice
%if 0%{?is_kotd}
Release:        <RELEASE>.g8210f77
%else
Release:        0
%endif
%else
%define kernel_source_release %(LC_ALL=C rpm -q kernel-devel%variant-%version 
--qf "%{RELEASE}" | grep -v 'not installed' || echo 0)
Release:        %kernel_source_release
%endif
Url:            http://www.kernel.org/
AutoReqProv:    off
BuildRequires:  coreutils
%ifarch armv7hl
Requires:       kernel-cubox-devel = %version-%source_rel
%endif
%ifarch aarch64 armv6hl armv7hl %ix86 ia64 ppc ppc64 s390x x86_64
Requires:       kernel-default-devel = %version-%source_rel
%endif
%ifarch %ix86 x86_64
Requires:       kernel-desktop-devel = %version-%source_rel
%endif
%ifarch armv7hl
Requires:       kernel-exynos-devel = %version-%source_rel
%endif
%ifarch armv7hl
Requires:       kernel-lpae-devel = %version-%source_rel
%endif
%ifarch %ix86
Requires:       kernel-pae-devel = %version-%source_rel
%endif
%ifarch %ix86 x86_64
Requires:       kernel-xen-devel = %version-%source_rel
%endif
Provides:       %name = %version-%source_rel
Provides:       multiversion(kernel)
Source:         README.KSYMS
Requires:       kernel-devel%variant = %version-%source_rel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
ExclusiveArch:  %ix86 aarch64 armv6hl armv7hl ia64 ppc ppc64 s390x x86_64
Prefix:         /usr/src

%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.


%source_timestamp
%prep

%install
install -m 644 -D %{SOURCE0} %buildroot/%_docdir/%name/README.SUSE

%files
%defattr(-, root, root)
%dir %_docdir/%name
%_docdir/%name/README.SUSE

%changelog
++++++ kernel-trace.spec ++++++
++++ 1080 lines (skipped)

kernel-vanilla.spec: same change
kernel-xen.spec: same change
++++++ README.KSYMS ++++++
This file is a place holder for the kernel-syms{,-rt} package. It is used
to group build dependencies for all kernel flavors.

The KMP build process will build KMPs against all installed kernel flavors
automatically. If you don't need to build against other flavors than the
ones you've already installed - it is safe to uninstall this package.
++++++ README.SUSE ++++++
WORKING WITH THE SUSE 2.6.x and 3.x KERNEL SOURCES

Andreas Gruenbacher <[email protected]>, SUSE Labs, 2003, 2004, 2005, 2006
Michal Marek <[email protected]>, SUSE Labs, 2010


This document gives an overview of how SUSE Linux kernels are
created, and describes tasks like building individual kernels
and creating external kernel modules.

A companion HOWTO that describes how to build driver update disks (among
other things) is available at:

    
http://developer.novell.com/wiki/index.php/Creating_a_Driver_Update_Disk_%28DUD%29


TABLE OF CONTENTS

  Overview
  Compiling your own kernel
  Building additional (external) modules
  Supported vs. unsupported modules
  Patch selection mechanism
  Where to find configuration files
  How to configure the kernel sources
  Module load paths


OVERVIEW

The kernels for SUSE are generated from the vanilla Linux kernel sources
found at http://ftp.kernel.org, on top of which a number of patches are
applied. The resulting kernel source tree is configured and built,
resulting in a binary kernel.

The add-on patches and configuration files are maintained in
a GIT repository at

    http://gitorious.org/opensuse/kernel-source
    
A script (scripts/tar-up.sh) packs up the files in the repository in a
form suitable for rpmbuild. When building the RPM packages, the
following binary packages get created:

  *  kernel-source

     The kernel source tree, generated by unpacking the vanilla kernel
     sources and applying the patches. The kernel sources are used by
     a number of other packages. They can also be used for compiling
     additional kernel modules.

  *  kernel-devel

     A subset of the kernel-source package that is needed to build
     external modules.

  *  kernel-$FLAVOR

     A number of binary kernels (for example, kernel-default for
     uniprocessor machines, kernel-smp for smp machines, etc.). These
     packages are all generated from the same kernel sources, and
     differ in the kernel configurations used.

  *  kernel-$FLAVOR-base

     A subset of kernel-$FLAVOR, for use in paravirtualized quests that
     only require a few device and filesystem drivers.

  *  kernel-$FLAVOR-devel

     The files used for generating kernel module packages for use with
     kernel-$FLAVOR.

  *  kernel-syms

     A meta package that pulls in the relevant kernel-$FLAVOR-devel
     packages for a given architecture.


The repository contains the configuration files (.config) for all SUSE
kernel flavors. All configuration files are included in the dependencies
of the kernel-syms package (see WHERE TO FIND CONFIGURATION FILES below).


In the installed system, the kernel-source package installs files in the
following directories:


  *  /usr/src/linux-$VERSION-$RELEASE/

     The kernel sources.

  *  /usr/src/linux

     A symbolic link to /usr/src/linux-$VERSION-$RELEASE.

  *  /usr/share/doc/packages/kernel-source/

     This document.


The kernel-$FLAVOR-devel packages install the following files:

  *  /usr/src/linux-$VERSION-$RELEASE-obj/$ARCH/$FLAVOR/

     Kernel build object files for one kernel flavor. These
     files are used for compiling additional kernel modules.

  *  /usr/src/linux-obj/$ARCH/$FLAVOR

     A symbolic link to /usr/src/linux-$VERSION-$RELEASE-obj/$ARCH/$FLAVOR.


COMPILING YOUR OWN KERNEL

The kernel sources are found in the kernel-source package. The
recommended way to produce a binary kernel is:

  (1)  Install kernel-source. Change to the /usr/src/linux directory.

  (2)  Create a build directory for use in configuring and building
       the kernel. Using /usr/src/linux directly requires root priviledges
       and will cause problems if you need to build kernel modules for
       other installed kernels.

  (3)  Configure the kernel (for example, ``make -C /usr/src/linux
       O=$(pwd) oldconfig'' or ``make -C /usr/src/linux O=$(pwd) cloneconfig'',
       see HOW TO CONFIGURE THE KERNEL SOURCES).

  (4)  Build the kernel and all its modules (``make'').

  (5)  Make sure that /etc/modprobe.d/unsupported-modules contains

           allow_unsupported_modules 1

       otherwise modprobe will refuse to load any modules.

  (6)  Install the kernel and the modules (``make modules_install'',
       followed by ``make install''). This will automatically create
       an initrd for the new kernel as well (see ``mkinitrd -h'').

  (7)  Add the kernel to the boot manager. When using lilo, run ``lilo''
       to update the boot map.

Instead of building binary kernels by hand, you can also build
one of the kernel-$FLAVOR packages using RPM.


BUILDING ADDITIONAL (EXTERNAL) MODULES

A single binary kernel module generally only works for a specific
version of the kernel source tree, for a specific architecture and
configuration. This means that for each binary kernel that SUSE ships, a
custom module must be built. This requirement is to some extent relaxed
by the modversion mechanism: modversions attach a checksum to each
symbol (function or variable) exported to modules by the kernel. This
allows to use kernel modules that have been built for a kernel with a
different version or release number in many cases, as long as none of
the symbols the module uses have changed between the two kernel
versions.

When releasing maintenance or security update kernels for a specific
product, we carefully try to keep the kernel ABI stable.  Despite this,
we sometimes have no choice but to break binary compatibility. In this
case, those kernel modules must be rebuilt.

Additional kernel modules for one of the SUSE kernel flavors can be
built in three different ways:

  (1) by configuring the kernel sources in a separate build directory
      (see HOW TO CONFIGURE THE KERNEL SOURCES), or

  (2) by using one of the standard configurations in
      /usr/src/linux-obj/$ARCH/$FLAVOR, or

  (3) by creating a Kernel Module Package (KMP) as described in the
      Kernel Module Packages Manual, http://www.suse.de/~agruen/KMPM/.


The first method involves the following steps:

  (1)  Install the kernel-source package.

  (2)  Configure the kernel, see HOW TO CONFIGURE THE KERNEL SOURCES.

  (3)  Create files required for compiling external modules:
       ``make scripts'' and ``make prepare''.

  (4)  Compile the module(s) by changing into the module source directory
       and typing ``make -C $(your_build_dir) M=$(pwd)''.

  (5)  Install the module(s) by typing
       ``make -C $(your_build_dir) M=$(pwd) modules_install''.


The second method involves the following steps:

  (1)  Install the kernel-devel package.

  (2)  Install the kernel-$FLAVOR-devel package. This is necessary for
       symbol version information (CONFIG_MODVERSIONS).

  (3)  Compile the module(s) by changing into the module source directory
       and typing ``make -C /usr/src/linux-obj/$ARCH/$FLAVOR M=$(pwd)''.
       Substitute $ARCH and $FLAVOR with the architecture and flavor
       for which to build the module(s).

       If the installed kernel sources match the running kernel, you
       can build modules for the running kernel by using the path
       /lib/modules/$(uname -r)/build as the -C option in the above
       command. (build is a symlink to /usr/src/linux-obj/$ARCH/$FLAVOR).

  (4)  Install the module(s) with
       ``make -C /usr/src/linux-obj/$ARCH/$FLAVOR M=$(pwd) modules_install''.


Whenever building modules, please use the kernel build infrastructure as
much as possible, and do not try to circumvent it. The
Documentation/kbuild directory in the kernel sources documents kbuild
makefiles.


SUPPORTED VS. UNSUPPORTED MODULES

As an extension to the mainline kernel, modules can be tagged as
supported (directly by SUSE, or indirectly by a third party) or
unsupported. Modules which are known to be flakey or for which SUSE does
not have the necessary expertise are marked as unsupported.  Modules for
which SUSE has third-party support agreements are marked as externally
supported. Modules for which SUSE provides direct support are marked as
supported.

The support status of a module can be queried with the modinfo tool.
Modinfo will report one of the following:

  - direct support by SUSE: "supported: yes"
  - third-party support: "supported: external"
  - unsupported modules: no supported tag.

At runtime, the setting of the" unsupported" kernel command line
parameter and /proc/sys/kernel/unsupported determines whether
unsupported modules can be loaded or not, and whether or not loading an
unsupported module causes a warning in the system log:

  0 = only allow supported modules,
  1 = warn when loading unsupported modules,
  2 = don't warn.

Irrespective of this setting, loading an externally supported or unsupported
module both set a kernel taint flag. The taint flags are included in
Oopses. The taint status of the kernel can be inspected in
/proc/sys/kernel/tainted: Bits 0 to 4 have the following meanings:

  bit  0 = a module with a GPL-incompatible license was loaded (tainted & 1),
  bit  1 = module load was enforced (tainted & 2),
  bit  2 = an SMP-unsafe module was loaded (tainted & 4),
  bit  3 = (reserved),
  bit  4 = an unsupported module was loaded (tainted & 16),
  bit  5 = a module with third-party support was loaded (tainted & 32).
  bit 10 = a machine check exception has occurred (taint & 1024; x86_64 only
           so far).

The corresponding codes for the taint flags in Oopses are (x = unknown):

  - "Pxxx" if bit 0 set or else
    "Gxxx" if bit 0 unset,
  
  - "xFxx" if bit 1 set or else
    "x xx" if bit 1 unset,
  
  - "xxSx" if set or else
    "xx x" if bit 2 unset,
  
  - "xxxU" if bit 4 set or else
    "xxxX" if bit 5 set or else
    "xxx ".

By default, external modules will not have the supported flag (that is,
they wil be marked as unsupported). For building externally supported
modules, please get in touch with Kurt Garloff <[email protected]>.


PATCH SELECTION MECHANISM

The SUSE kernels consist of the vanilla kernel sources on top of which a
number of patches is applied. The file series.conf determines which
patches are applied and which are excluded. A script named "guards"
converts series.conf into a plain list of patch files to be applied.
Guards decides which patches to include and exclude based on a list of
symbols. From the kernel-source.src.rpm package, a fully patched
kernel source tree can be generated from vanilla sources + patches like
this:

    # Install the package:

      $ rpm -i kernel-source.src.rpm

    # Unpack the patches and the kernel sources:
    
      $ cd /usr/src/packages/SOURCES
      $ for f in patches.*.tar.bz2; do          \
          tar -xjf "$f" || break;               \
        done
      $ tar -xjf linux-2.6.5.tar.bz2

    # Apply the patches

      $ for p in $(./guards < series.conf); do
          patch -d linux-2.6.5 -p1 < $p || break
        done

The configuration script config.conf which is similar to series.conf is
used for configuration file selection. See the section WHERE TO FIND
CONFIGURATION FILES.

The file format of series.conf and config.conf should be obvious from
the comments in series.conf, and from the guards(1) manual page. (The
guards(1) manual page can be generated by running pod2man on the guards
script.)


WHERE TO FIND CONFIGURATION FILES

Kernel configuration files are stored in the kernel GIT repository. When
packing up the repository, they end up in config.tar.bz2.

The kernel-$FLAVOR packages are based on config/$ARCH/$FLAVOR.
(kernel-default is based on config/$ARCH/default, for example). The
kernel-$FLAVOR packages install their configuration files as
/boot/config-$VER_STR (for example, /boot/config-2.6.5-99-default). The
config is also packaged in the kernel-$FLAVOR-devel package as
/usr/src/linux-obj/$ARCH/$FLAVOR/.config.

In addition, the running kernel exposes a gzip compressed version of its
configuration file as /proc/config.gz. The kernel sources can be
configured based on /proc/config.gz with ``make cloneconfig''.


HOW TO CONFIGURE THE KERNEL SOURCES

Before a binary kernel is built or an additional loadable module
for an existing kernel is created, the kernel must be configured.

In order for a loadable module to work with an existing kernel, it must
be created with a configuration that is identical to the kernel's
configuration, or at least very close to that. Each configuration is
contained in a single file. The kernel-syms package installs
configurations for all standard SUSE kernel variants, so for building
only external kernel modules it is not necessary to configure the kernel
sources.

Configuring the kernel sources for a specific configuration is
straightfoward:

  - Locate the configuration file you want to use. (See WHERE TO FIND
    CONFIGURATION FILES above).

  - Copy the configuration to the file .config in your build directory.

  - Run the following commands in sequence to apply the configuration,
    generate version information files, etc.:

        make -C /usr/src/linux O=$PWD clean
        make -C /usr/src/linux O=$PWD oldconfig

    Alternatively to ``make oldconfig'', you can also use ``make
    menuconfig'' for a text menu oriented user interface. If the kernel
    sources do not match the configuration file exactly, ``make
    oldconfig'' will prompt for settings that are undefined. Once this
    step is completed, a Makefile will have been created that eliminates
    the need to specify the locations of the kernel source and the build
    directory.

    For configuring the kernel to match the running kernel, there is a
    shortcut ``make cloneconfig'' that expands the file /proc/config.gz
    into .config, and then runs ``make oldconfig''.

HOW TO ADD CUSTOM PATCHES

Typically patches are added to the appropriate patches.* directory (e.g.
patches.fixes) and to series.conf. When the kernel-source package is
exported from the git repository, the patch will be automatically added
to the appropriate patch tarball.

If your goal is to create a kernel with only a few additional patches
and you don't want to be bothered with using the git repository, there
is an easier way.

The kernel-source SRPM ships with two empty archives that can be be
filled and automatically expanded when building the kernel. You can use
these to add your own patches and config options without disturbing the
rest of the kernel package. This is useful if you are using the openSUSE
Build Service and link to the main kernel-source project instead of
creating your own branch. The advantage to this is that your project
will automatically receive all the changes that go into the main project
without any further effort.

To add a patch using this mechanism, just add it to the
patches.addon.tar.bz2 archive and add an entry to the series.conf file.
The archive will be expanded automatically with the other kernel patches
when the source tree is constructed.

Some patches may add new Kconfig options. The config.addon.tar.bz2
archive contains the same hierarchy as config.tar.bz2, but is under
config.addon. You can add your new config options to files named after
their config/ counterparts.

For example, the file used to configure the i386 default kernel is named
config/i386/default. To add config options to that kernel, you would
create a new file called config.addon/i386/default with the options as
formatted in a normal Linux kernel .config file. This is important
because the kernel build is non-interactive and will fail if it
encounters new config options without entries in the config file.

MODULE LOAD PATHS

Modules that belong to a specific kernel release are installed in
/lib/modules/2.6.5-99-smp and similar. Note that this path contains the
kernel package release number. Modules from KMPs must be installed
below /lib/modules/2.6.5-99-smp/updates/ and similar: modules below
updates/ have priority over other modules.

When KMPs contain modules that are compatible between multiple installed
kernels, symlinks are used to make those modules available to those
compatible kernels like this:

  /lib/modules/2.6.16-100-smp/weak-updates/foo.ko ->
      /lib/modules/2.6.16-99-smp/updates/foo.ko

Modules in the weak-updates directory have lower priority than modules
in /lib/modules/2.6.16-100-smp/updates/, and higher priority than other
modules in /lib/modules/2.6.16-100-smp.


REFERENCES

General

  Documentation in the kernel source tree.

  Linux Documentation Project, http://www.tldp.org/

  Linux Weekly News, http://lwn.net

  Rusty's Remarkably Unreliable Guides (Kernel Hacking
    and Kernel Locking guides),
    http://www.netfilter.org/unreliable-guides/

  Kernel newbies, http://www.kernelnewbies.org/


Loadable Kernel Modules

  Peter Jay Salzman and Ori Pomerantz: Linux Kernel Module
    Programming Guide, Version 2.4, April 2003,
    http://www.tldp.org/guides.html


Kernel Module Packages

    Andreas Gruenbacher: Kernel Module Packages Manual.
    Versions for CODE9 (SLES9, SUSE LINUX 10.0) and CODE10
    (SUSE Linux 10.1, SLES10),
    http://www.suse.de/~agruen/KMPM/
++++++ _constraints ++++++
<constraints>
  <hardware>
    <disk>
      <size unit="G">7</size>
    </disk>
  </hardware>

  <overwrite>
    <conditions>
      <arch>i586</arch>      <!-- applies only for either i586 or x86_64 
packages -->
      <arch>x86_64</arch>
<package>kernel-cubox</package>
<package>kernel-debug</package>
<package>kernel-default</package>
<package>kernel-desktop</package>
<package>kernel-ec2</package>
<package>kernel-exynos</package>
<package>kernel-lpae</package>
<package>kernel-pae</package>
<package>kernel-trace</package>
<package>kernel-vanilla</package>
<package>kernel-xen</package>
    </conditions>
    <hardware>
      <processors>8</processors>
      <disk>
        <size unit="G">14</size>
      </disk>
    </hardware>
  </overwrite>

  <overwrite>
    <conditions>
      <arch>i586</arch>
      <arch>x86_64</arch>
      <package>kernel-obs-qa</package>
    </conditions>
    <sandbox>kvm</sandbox>
  </overwrite>

  <overwrite>
    <conditions>
      <arch>i586</arch>
      <arch>x86_64</arch>
      <package>kernel-obs-qa-xen</package>
    </conditions>
    <sandbox>xen</sandbox>
  </overwrite>
</constraints>

++++++ apply-patches ++++++
#!/bin/sh
#
# Given a series.conf file and a directory with patches, applies them to the
# current directory.
# Used by kernel-source.spec.in and kernel-binary.spec.in

USAGE="$0 [--vanilla] <series.conf> <patchdir> [symbol ...]"

set -e
set -o pipefail
vanilla=false
if test "$1" == "--vanilla"; then
        vanilla=true
        shift
fi
if test $# -lt 2; then
        echo "$USAGE" >&2
        exit 1
fi
DIR="${0%/*}"
SERIES_CONF=$1
PATCH_DIR=$2
shift 2

trap 'rm -f "$series"' EXIT
series=$(mktemp)
# support for patches in patches.addon/series
cp "$SERIES_CONF" "$series"
if ! $vanilla && test -e "$PATCH_DIR/patches.addon/series"; then
        # make it user-friendly and automatically prepend "patches.addon/"
        # if there is no "/"
        sed -r 's|^([[:space:]]*)([^#[:space:]][^/]*)$|\1patches.addon/\2|' \
                "$PATCH_DIR/patches.addon/series" >>"$series"
fi

(
        echo "trap 'echo \"*** patch \$_ failed ***\"' ERR"
        echo "set -ex"
        "$DIR"/guards "$@" <"$series" | \
        if $vanilla; then
                egrep '^patches\.(kernel\.org|rpmify)/'
        else
                cat
        fi |\
        sed "s|^|patch -s -F0 -E -p1 --no-backup-if-mismatch -i $PATCH_DIR/|"
) | sh

++++++ arch-symbols ++++++
#!/bin/sh

#############################################################################
# Copyright (c) 2003-2005,2009 Novell, Inc.
# All Rights Reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, contact Novell, Inc.
#
# To contact Novell about this file by physical or electronic mail,
# you may find current contact information at www.novell.com
#############################################################################

# With --list, list all known architectures, otherwise print the generic
# name for this architecture (or the one specified on command line).

if [ "$1" = "--list" ]; then
    # List all known architectures
    echo i386 mips{,64} sparc{,64} ppc{,64} s390{,x} ia64 x86_64 alpha parisc 
armv6hl armv7hl arm64
    exit 0
fi

if [ -n "$1" ]; then
    ARCH="$1"
else
    ARCH="`arch`"
fi
case "$ARCH" in
    # from rpm --eval '%ix86'
    i?86 | pentium3 | pentium4 | athlon | geode)
        echo i386
        ;;
    aarch64)
        echo arm64
        ;;
    *)
        echo "$ARCH"
        ;;
esac
++++++ check-for-config-changes ++++++
#! /bin/bash

# lines 4 contains a timestamp...
differences="$(
    diff -bU0 <(sed -e '/^# .* is not set$/p' -e '/^$\|^#/d' "$1" | sort) \
              <(sed -e '/^# .* is not set$/p' -e '/^$\|^#/d' "$2" | sort) \
    | grep '^[-+][^-+]'
)" || true
if [ -n "$differences" ]; then
    echo
    echo "Changes after running \`make oldconfig':"
    echo "$differences"
    echo
    if echo "$differences" | grep -q '^+' ; then
        exit 1
    fi
fi
++++++ compute-PATCHVERSION.sh ++++++
#! /bin/bash

export LANG=POSIX

path=(.)
while test $# -gt 0; do
        case "$1" in
        --patches)
                path[${#path[@]}]=$2
                shift 2
                ;;
        *)
                echo "Usage $0 [--patches <dir>]" >&2
                exit 1
        esac
done
if test "${path[*]}" = "."; then
        path=(. ..)
fi


source $(dirname $0)/config.sh
parse_srcversion()
{
        local IFS=.
        set -- ${SRCVERSION%%-*}
        VERSION=$1
        PATCHLEVEL=${2:-0}
        SUBLEVEL=${3:-0}
        EXTRAVERSION=${SRCVERSION#${SRCVERSION%%-*}}
}
parse_srcversion

EXTRA_SYMBOLS=$(set -- $([ -e $(dirname $0)/extra-symbols ] && cat $(dirname 
$0)/extra-symbols) ; echo $*)

series=$(mktemp)
tmp_files="$series"
trap 'rm -rf $tmp_files' EXIT
warned=false
while read patch; do
        dir=${patch%/*}
        for p in "${path[@]}"; do
                if test -d "$p/$dir"; then
                        echo "$p/$patch"
                        continue 2
                fi
        done
        for p in "${path[@]}"; do
                if test -e "$p/$dir.tar.bz2"; then
                        echo "unpacking $p/$dir.tar.bz2" >&2
                        if ! $warned; then
                                echo "pass --patches <directory with unpacked 
tarballs> to avoid this" >&2
                                warned=true
                        fi
                        tmp_files="$tmp_files $dir"
                        tar -xjf "$p/$dir.tar.bz2"
                        echo "$patch"
                        continue 2
                fi
        done
        echo "Can't find $patch" >&2
        exit 1
done >"$series" < <($(dirname $0)/guards $EXTRA_SYMBOLS <series.conf)

# Parse all the changes to KERNELRELEASE out of all patches and
# convert them to shell code that can be evaluated. Evaluate it.
eval "$(
    <"$series" xargs awk '
    /^--- |^\+\+\+ / \
        { M = match($2, /^[^\/]+\/Makefile( \t|$)/) }
    M && /^+(VERSION|PATCHLEVEL|SUBLEVEL|EXTRAVERSION)/ \
        { print }
    ' \
    | sed -e 's,^+,,' -e 's, *= *\(.*\),="\1",'
)"

echo "$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION"
++++++ config-options.changes.txt ++++++
++++ 1485 lines (skipped)

++++++ config.conf ++++++
# Kernel configuration file selection.
# See the arch-symbols script for a list of symbols defined.
# -syms excludes a flavor from the kernel-syms package (vanilla is excluded
# automatically).

#
# IMPORTANT: the subdirectory names map to cpuarch
#            kernel-binary and kernel-source rely on this
#

+i386           i386/default
+i386           i386/desktop
+i386           i386/pae
+i386 -syms     i386/debug
+i386           i386/xen
+i386 -syms     i386/ec2
+i386           i386/vanilla
+i386 -syms     i386/trace

+ia64           ia64/default
+ia64 -syms     ia64/debug
+ia64           ia64/vanilla
+ia64 -syms     ia64/trace

+x86_64         x86_64/default
+x86_64         x86_64/desktop
+x86_64         x86_64/xen
+x86_64 -syms   x86_64/ec2
+x86_64 -syms   x86_64/debug
+x86_64         x86_64/vanilla
+x86_64 -syms   x86_64/trace

+ppc            ppc/default
+ppc            ppc/vanilla
+ppc64          ppc64/default
+ppc64 -syms    ppc64/trace
+ppc64 -syms    ppc64/debug
+ppc64          ppc64/vanilla

# ARM architectures
+armv6hl        armv6hl/default
+armv7hl        armv7hl/default
+armv7hl        armv7hl/lpae
+armv7hl        armv7hl/cubox
+armv7hl        armv7hl/exynos
+arm64          arm64/default

+s390x          s390x/default
+s390x -syms    s390x/trace
+s390x          s390x/vanilla
++++++ config.sh ++++++
# The version of the main tarball to use
SRCVERSION=3.11
# variant of the kernel-source package, either empty or "-rt"
VARIANT=
# buildservice projects to build the kernel against
OBS_PROJECT=openSUSE:13.1:Update
++++++ configtool.pl ++++++
#!/usr/bin/perl
#
# Merge two kernel configs, eliminating duplicated assignments.
# TODO:
#   support for #include-style directives in config files, to make the
#   kernel configs more maintainable

use strict;
use warnings;

# ( { source => <file> name => ... value => ...}, { comment => ...}, ... )
my @lines;
# references into the @lines array
my %variables;

sub store_var {
        my ($file, $line, $name, $value) = @_;

        if (exists($variables{$name})) {
                if ($variables{$name}->{source} eq $file) {
                        print STDERR "$file:$line: warning: $name redefined\n";
                }
        } else {
                my $new = {};
                push(@lines, $new);
                $variables{$name} = $new;
        }
        $variables{$name}->{source} = $file;
        $variables{$name}->{name} = $name;
        $variables{$name}->{value} = $value;
}

sub store_comment {
        my ($comment) = @_;

        push(@lines, { comment => $comment });
}

while (<>) {
        chomp;
        if (/^CONFIG_(\w+)=(.*)/) {
                store_var($ARGV, $., $1, $2);
        } elsif (/^# CONFIG_(\w+) is not set/) {
                store_var($ARGV, $., $1, 'n');
        } elsif (/^$|^#/) {
                store_comment($_);
        } else {
                print STDERR "$ARGV:$.: warning: ignoring unknown line\n";
        }
}

for my $line (@lines) {
        if (exists($line->{comment})) {
                print "$line->{comment}\n";
        } elsif ($line->{value} eq 'n') {
                print "# CONFIG_$line->{name} is not set\n";
        } else {
                print "CONFIG_$line->{name}=$line->{value}\n";
        }
}
++++++ constraints.in ++++++
<constraints>
  <hardware>
    <disk>
      <size unit="G">7</size>
    </disk>
  </hardware>

  <overwrite>
    <conditions>
      <arch>i586</arch>      <!-- applies only for either i586 or x86_64 
packages -->
      <arch>x86_64</arch>
@BINARY_PACKAGES_XML@
    </conditions>
    <hardware>
      <processors>8</processors>
      <disk>
        <size unit="G">14</size>
      </disk>
    </hardware>
  </overwrite>

  <overwrite>
    <conditions>
      <arch>i586</arch>
      <arch>x86_64</arch>
      <package>kernel-obs-qa</package>
    </conditions>
    <sandbox>kvm</sandbox>
  </overwrite>

  <overwrite>
    <conditions>
      <arch>i586</arch>
      <arch>x86_64</arch>
      <package>kernel-obs-qa-xen</package>
    </conditions>
    <sandbox>xen</sandbox>
  </overwrite>
</constraints>

++++++ devel-post.sh ++++++
relink() {
    if [ -h "$2" ]; then
        local old=$(readlink "$2")
        [ "$old" = "$1" ] && return 0
        echo "Changing symlink $2 from $old to $1"
    elif [ -e "$2" ]; then
        echo "Replacing file $2 with symlink to $1"
    fi
    rm -f "$2" \
    && ln -s "$1" "$2"
}

release="@KERNELRELEASE@@SRCVARIANT@-obj"
arch_flavor="@CPU_ARCH_FLAVOR@"

relink ../../linux-$release/"$arch_flavor" /usr/src/linux-obj/"$arch_flavor"
++++++ devel-pre.sh ++++++
# handle update from an older kernel-source with linux-obj as symlink
if [ -h /usr/src/linux-obj ]; then
    rm -vf /usr/src/linux-obj
fi
++++++ find-provides ++++++
#! /bin/bash

trap 'rm -f "$filelist"' EXIT
filelist=$(mktemp -t ${0##*/}.XXXXXXXXXX)
grep -v '/kernel/drivers/staging/.*\.ko$' >"$filelist"
shopt -s nullglob

# pretend that /boot/vmlinux-* is in the -base package and not in -devel
if grep -q '/boot/System\.map\>' "$filelist"; then
        prefix=$(sed -rn 's:(.*)/boot/System\.map\>.*:\1:p; T; q' "$filelist")
        for f in "$prefix"/boot/vmlinux*; do
                echo "$f" >>"$filelist"
        done
else
        perl -ni -e 'next if /\/boot\/vmlinux/ && !/\.debug$/; print' 
"$filelist"
fi

/usr/lib/rpm/find-provides "$@" <"$filelist"
++++++ group-source-files.pl ++++++
#!/usr/bin/perl

use Getopt::Long;
use strict;

&main();
sub main
{
        my($dev_output, $ndev_output, $loc) = ("-", "-", ".");
        &Getopt::Long::Configure(qw(bundling));
        &GetOptions(
                "D=s" => \$dev_output,
                "N=s" => \$ndev_output,
                "L=s" => \$loc,
        );

        my($dev, $ndev) = &scan($loc);
        &output($dev, $ndev, $dev_output, $ndev_output);
}

sub scan
{
        my $loc = shift @_;
        my(@dev, @ndev);

        foreach $_ (`find "$loc"`)
        {
                chomp $_;
                if (-d $_ && !-l $_) {
                        # Generate directory list later.
                        next;
                }
                my $is_devel =
                        m{^\Q$loc\E.*/Kconfig} ||
                        m{^\Q$loc\E.*/Kbuild} ||
                        m{^\Q$loc\E.*/Makefile} ||
                        m{^\Q$loc\E/arch/[^/]+/boot/dts/include/dt-bindings\b} 
||
                        m{^\Q$loc\E/arch/[^/]+/include\b} ||
                        m{^\Q$loc\E/arch/arm/[^/]+/include/mach\b} ||
                        m{^\Q$loc\E/arch/arm/[^/]+/include/plat\b} ||
                        m{^\Q$loc\E/include/[^/]+\b} ||
                        m{^\Q$loc\E/scripts\b};
                if (substr($_, 0, 1) ne "/") {
                        # We cannot use an absolute path during find,
                        # but rpm wants one later.
                        $_ = "/$_";
                }
                $is_devel ? push(@dev, $_) : push(@ndev, $_);
        }

        push(@dev, &calc_dirs("/$loc", \@dev));
        push(@ndev, &calc_dirs("/$loc", \@ndev));
        return (\@dev, \@ndev);
}

sub calc_dirs
{
        my($base, $files) = @_;
        my %dirs;

        foreach my $file (@$files) {
                my $path = $file;
                do {
                        $path =~ s{/[^/]+$}{};
                        $dirs{$path} = 1;
                } while ($path ne $base);
                # This loop also makes sure that $base itself is included.
        }

        return map { "\%dir $_" } keys %dirs;
}

sub output
{
        my($dev, $ndev, $dev_out, $ndev_out) = @_;
        local *FH;

        open(FH, "> $dev_out") || warn "Error writing to $dev_out: $!";
        print FH join("\n", @$dev), "\n";
        close FH;

        open(FH, "> $ndev_out") || warn "Error writing to $ndev_out: $!";
        print FH join("\n", @$ndev), "\n";
        close FH;
}
++++++ guards ++++++
#!/usr/bin/perl -w
#############################################################################
# Copyright (c) 2003-2007,2009 Novell, Inc.
# All Rights Reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, contact Novell, Inc.
#
# To contact Novell about this file by physical or electronic mail,
# you may find current contact information at www.novell.com
#############################################################################
#
# Guards:
#
# +xxx   include if xxx is defined
# -xxx   exclude if xxx is defined
# +!xxx  include if xxx is not defined
# -!xxx  exclude if xxx is not defined
#

use FileHandle;
use Getopt::Long;
use strict;

# Prototypes
sub files_in($$);
sub parse($$);
sub help();

sub slashme($) {
    my ($dir) = @_;
    $dir =~ s#([^/])$#$&/#; # append a slash if necessary
    if ($dir eq './') {
        return '';
    } else {
        return $dir;
    }
}

# Generate a list of files in a directory
#
sub files_in($$) {
    my ($dir, $path) = @_;
    my $dh = new FileHandle;
    my (@files, $file);


    opendir $dh, length("$dir$path") ? "$dir$path" : '.'
        or die "$dir$path: $!\n";
    while ($file = readdir($dh)) {
        next if $file =~ /^(\.|\.\.|\.#.*|CVS|.*~)$/;
        if (-d "$dir$path$file") {
                @files = (@files, files_in($dir, "$path$file/"));
        } else {
                #print "[$path$file]\n";
                push @files, "$path$file";
        }
    }
    closedir $dh;
    return @files;
}

# Parse a configuration file
# Callback called with ($patch, @guards) arguments
#
sub parse($$) {
    my ($fh, $callback) = @_;

    my $line = "";

    while (<$fh>) {
        chomp;
        s/(^|\s+)#.*//;
        if (s/\\$/ /) {
                $line .= $_;
                next;
        }
        $line .= $_;
        my @guards = ();
        foreach my $token (split /[\s\t\n]+/, $line) {
            next if $token eq "";
            if ($token =~ /^[-+]/) {
                push @guards, $token;
            } else {
                #print "[" . join(",", @guards) . "] $token\n";
                &$callback($token, @guards);
            }
        }
        $line = "";
    }
}

# Command line options
#
my ($dir, $config, $default, $check, $list, $invert_match, $with_guards) =
   (  '',     '-',        1,      0,     0,             0,            0);
my @path;

# Help text
#
sub help() {
    print "$0 - select from a list of files guarded by conditions\n";
    print "SYNOPSIS: $0 [--prefix=dir] [--path=dir1:dir2:...]\n" .
        "       [--default=0|1] [--check|--list] [--invert-match]\n" .
        "       [--with-guards] [--config=file] symbol ...\n\n" .
        "       (Default values: --path='" . join(':', @path) . "', " .
                "--default=$default)\n";
    exit 0;
}

# Parse command line options
#
Getopt::Long::Configure ("bundling");
eval {
    unless (GetOptions (
        'd|prefix=s' => \$dir,
        'c|config=s' => \$config,
        'C|check' => \$check,
        'l|list' => \$list,
        'w|with-guards' => \$with_guards,
        'p|path=s' => \@path,
        'D|default=i' => \$default,
        'v|invert-match' => \$invert_match,
        'h|help' => sub { help(); exit 0; })) {
        help();
        exit 1;
    }
};
if ($@) {
    print "$@";
    help();
    exit 1;
}

@path = ('.')
    unless (@path);
@path = split(/:/, join(':', @path));

my $fh = ($config eq '-') ? \*STDIN : new FileHandle($config)
    or die "$config: $!\n";

$dir = slashme($dir);

if ($check) {
    # Check for duplicate files, or for files that are not referenced by
    # the specification.

    my $problems = 0;
    my @files;

    foreach (@path) {
        @files = (@files, files_in($dir, slashme($_)));
    }
    my %files = map { $_ => 0 } @files;

    parse($fh, sub {
        my ($patch, @guards) = @_;
        if (exists $files{$patch}) {
            $files{$patch}++;
        } else {
            print "Not found: $dir$patch\n";
            $problems++;
        }});

    $fh->close();

    my ($file, $ref);
    while (($file, $ref) = each %files) {
        next if $ref == 1;

        if ($ref == 0) {
            if ($config eq '-') {
                print "Unused: $file\n";
            } else {
                print "Not in $config: $file\n";
            }
            $problems++;
        }
        if ($ref > 1) {
            print "Warning: multiple uses";
            print " in $config" if $config ne '-';
            print ": $file\n";
            # This is not an error if the entries are mutually exclusive...
        }
    }
    exit $problems ? 1 : 0;

} elsif ($list) {
    parse($fh, sub {
        my ($patch, @guards) = @_;
        print join(' ', @guards), ' '
                if (@guards && $with_guards);
        print "$dir$patch\n";
        });
} else {
    # Generate a list of patches to apply.

    my %symbols = map { $_ => 1 } @ARGV;

    parse($fh, sub {
        my ($patch, @guards) = @_;

        my $selected;
        if (@guards) {
            # If the first guard is -xxx, the patch is included by default;
            # if it is +xxx, the patch is excluded by default.
            $selected = ($guards[0] =~ /^-/);

            foreach (@guards) {
                /^([-+])(!?)(.*)?/
                    or die "Bad guard '$_'\n";

                # Check if the guard matches
                if (($2 eq '!' && !exists $symbols{$3}) ||
                    ($2 eq ''  && ( $3 eq '' || exists $symbols{$3}))) {
                    # Include or exclude
                    $selected = ($1 eq '+');
                }
            }
        } else {
            # If there are no guards, use the specified default result.
            $selected = $default;
        }

        print "$dir$patch\n"
            if $selected ^ $invert_match;
        });

    $fh->close();

    exit 0;
}

__END__

=head1 NAME

guards - select from a list of files guarded by conditions

=head1 SYNOPSIS

F<guards> [--prefix=F<dir>] [--path=F<dir1:dir2:...>] [--default=<0|1>]
          [--check|--list] [--invert-match] [--with-guards] [--config=<file>]
          I<symbol> ...

=head1 DESCRIPTION

The script reads a configuration file that may contain so-called guards, file
names, and comments, and writes those file names that satisfy all guards to
standard output. The script takes a list of symbols as its arguments. Each line
in the configuration file is processed separately. Lines may start with a
number of guards. The following guards are defined:

=over

+I<xxx> Include the file(s) on this line if the symbol I<xxx> is defined.

-I<xxx> Exclude the file(s) on this line if the symbol I<xxx> is defined.

+!I<xxx> Include the file(s) on this line if the symbol I<xxx> is not defined.

-!I<xxx> Exclude the file(s) on this line if the symbol I<xxx> is not defined.

- Exclude this file. Used to avoid spurious I<--check> messages.

=back

The guards are processed left to right. The last guard that matches determines
if the file is included. If no guard is specified, the I<--default>
setting determines if the file is included.

If no configuration file is specified, the script reads from standard input.

The I<--check> option is used to compare the specification file against the
file system. If files are referenced in the specification that do not exist, or
if files are not enlisted in the specification file warnings are printed. The
I<--path> option can be used to specify which directory or directories to scan.
Multiple directories are separated by a colon (C<:>) character. The
I<--prefix> option specifies the location of the files.

Use I<--list> to list all files independent of any rules. Use I<--invert-match>
to list only the excluded patches. Use I<--with-guards> to also include all
inclusion and exclusion rules.

=head1 AUTHOR

Andreas Gruenbacher <[email protected]>, SUSE Labs
++++++ host-memcpy-hack.h ++++++
#ifdef __x86_64__
/* 
 * Force the linker to use the older memcpy variant, so that the user programs
 * work on older systems
 */
__asm__(".symver memcpy,memcpy@GLIBC_2.2.5");
#endif
++++++ kabi.pl ++++++
#!/usr/bin/perl
use strict;
use warnings;

use Getopt::Long;
use Data::Dumper;

# ( { sym => regexp, mod => regexp, fail => 0/1 }, ... )
my @rules;
my ($opt_verbose, $opt_rules);

sub load_rules {
        my $file = shift;
        my $errors = 0;

        xopen(my $fh, '<', $file);
        while (<$fh>) {
                chomp;
                s/#.*//;
                next if /^\s*$/;
                my ($pattern, $verdict) = split(/\s+/);
                my $new = {};
                if (uc($verdict) eq "PASS") {
                        $new->{fail} = 0;
                } elsif (uc($verdict) eq "FAIL") {
                        $new->{fail} = 1;
                } else {
                        print STDERR "$file:$.: invalid verdict \"$verdict\", 
must be either PASS or FAIL.\n";
                        $errors++;
                        next;
                }
                # simple glob -> regexp conversion
                $pattern =~ s/\*/.*/g;
                $pattern =~ s/\?/./g;
                $pattern =~ s/.*/^$&\$/;
                if ($pattern =~ /\/|^vmlinux$/) {
                        $new->{mod} = $pattern;
                } else {
                        $new->{sym} = $pattern;
                }
                push(@rules, $new);
        }
        if ($errors && !@rules) {
                print STDERR "error: only garbage found in $file.\n";
                exit 1;
        }
        close($fh);
}

sub load_symvers {
        my $file = shift;
        my %res;
        my $errors = 0;

        xopen(my $fh, '<', $file);
        while (<$fh>) {
                my @l = split(/\s+/);
                if (@l < 3) {
                        print STDERR "$file:$.: unknown line\n";
                        $errors++;
                        next;
                }
                my $new = { crc => $l[0], mod => $l[2] };
                $res{$l[1]} = $new;
        }
        if (!%res) {
                print STDERR "error: no symvers found in $file.\n";
                exit 1;
        }
        close($fh);
        return %res;
}

my $kabi_errors = 0;
sub kabi_change {
        my ($sym, $mod, $oldcrc, $newcrc) = @_;
        my $fail = 1;

        for my $rule (@rules) {
                if ($rule->{mod} && $mod =~ $rule->{mod} ||
                    $rule->{sym} && $sym =~ $rule->{sym}) {
                        $fail = $rule->{fail};
                        last;
                }
        }
        return unless $fail or $opt_verbose;
        print STDERR "KABI: symbol $sym($mod) ";
        if ($newcrc) {
                print STDERR "changed crc from $oldcrc to $newcrc"
        } else {
                print STDERR "lost";
        }
        if ($fail) {
                $kabi_errors++;
                print STDERR "\n";
        } else {
                print STDERR " (tolerated)\n";
        }
}

sub xopen {
        open($_[0], $_[1], @_[2..$#_]) or die "$_[2]: $!\n";
}

my $res = GetOptions(
        'verbose|v' => \$opt_verbose,
        'rules|r=s' => \$opt_rules,
);
if (!$res || @ARGV != 2) {
        print STDERR "Usage: $0 [--rules <rules file>] Module.symvers.old 
Module.symvers\n";
        exit 1;
}
if (defined($opt_rules)) {
        load_rules($opt_rules);
}
my %old = load_symvers($ARGV[0]);
my %new = load_symvers($ARGV[1]);

for my $sym (sort keys(%old)) {
        if (!$new{$sym}) {
                kabi_change($sym, $old{$sym}->{mod}, $old{$sym}->{crc}, 0);
        } elsif ($old{$sym}->{crc} ne $new{$sym}->{crc}) {
                kabi_change($sym, $new{$sym}->{mod}, $old{$sym}->{crc},
                        $new{$sym}->{crc});
        }
}
if ($kabi_errors) {
        print STDERR "KABI: aborting due to kabi changes.\n";
        exit 1;
}
exit 0;
++++++ kernel-binary.spec.in ++++++
++++ 955 lines (skipped)

++++++ kernel-cert-subpackage ++++++
%package -n %{-n*}-ueficert
Summary: UEFI Secure Boot Certificate For Package %{-n*}-kmp
Group: System/Kernel
%description -n %{-n*}-ueficert
This package contains the UEFI Secure Boot certificate used to sign
modules in the %{-n*}-kmp packages.

# The scriptlets are reused in kernel-binary.spec.in by a sed script that
# stops at the next line that starts with a percent sign
%post -n %{-n*}-ueficert
if ! command -v mokutil >/dev/null; then
        exit 0
fi
# XXX: Only call mokutil if UEFI and shim are used
for cert in @CERTS@; do
        if ! mokutil --import "$cert" --root-pw; then
                echo "Failed to import $cert"
        fi
done
exit 0

%preun -n %{-n*}-ueficert
if ! command -v mokutil >/dev/null; then
        exit 0
fi
for cert in @CERTS@; do
        ln "$cert" "$cert.delete"
done
exit 0

%postun -n %{-n*}-ueficert
if ! command -v mokutil >/dev/null; then
        exit 0
fi
for cert in @CERTS@; do
        if ! test -e "$cert"; then
                if ! mokutil --delete "$cert.delete" --root-pw; then
                        echo "Failed to delete $cert"
                fi
        fi
        rm "$cert.delete"
done
exit 0

%files -n %{-n*}-ueficert
%defattr(-, root, root)
%dir /etc/uefi
/etc/uefi/certs
++++++ kernel-docs.spec.in ++++++
#
# spec file for package kernel-docs@VARIANT@
#
# Copyright (c) @YEAR@ 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/
#


%define patchversion @PATCHVERSION@
%define variant @VARIANT@%{nil}

%include %_sourcedir/kernel-spec-macros

Name:           kernel-docs@VARIANT@
Summary:        Kernel Documentation
License:        GPL-2.0
Group:          Documentation/Man
Version:        @RPMVERSION@
%if 0%{?is_kotd}
Release:        <RELEASE>.g@COMMIT@
%else
Release:        @RELEASE@
%endif
BuildRequires:  docbook-toys
BuildRequires:  docbook-utils
BuildRequires:  ghostscript_any
BuildRequires:  kernel-source%variant
BuildRequires:  libjpeg-devel
BuildRequires:  texlive
BuildRequires:  transfig
BuildRequires:  xmlto
BuildRequires:  xorg-x11-devel
Url:            http://www.kernel.org/
Provides:       %name = %version-%source_rel
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Source:         kernel-spec-macros

%description
These are the PDF documents and man pages (section 9) built from
the current kernel sources.


%source_timestamp
%prep
cp -av /etc/texmf/web2c/texmf.cnf .
cat << EOF >> texmf.cnf
main_memory.pdfjadetex = 2500000
hash_extra.pdfjadetex = 70000
max_strings.pdfjadetex = 120000
save_size.pdfjadetex = 10000
EOF
%setup -T -c

%build
# use texmf.cnf from local source
export TEXMFCNF=$RPM_BUILD_DIR
export LANG=en_US
make -C /usr/src/linux%variant O=$PWD -k -i mandocs %{?jobs:-j%jobs}
make -C /usr/src/linux%variant O=$PWD -k -i pdfdocs %{?jobs:-j%jobs}

%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT/%{_mandir}/man9
# filter out obscure device drivers - they clutter up the rpm and don't add any 
real value
find Documentation/DocBook/ -name '*.9.gz' | 
egrep -v 
'man/(sis[69]|rio|fsl|struct_rio|RIO|mpc85|set_rx_mode|mdio_(read|write)|mii_ioctl|mca_|z8530|nand|sppp|piix|(read|write)_zs)'
 |  
while read i ; do
        cp $i $RPM_BUILD_ROOT/%{_mandir}/man9
done
install -d $RPM_BUILD_ROOT/usr/share/doc/kernel
cp -a Documentation/DocBook/*.pdf $RPM_BUILD_ROOT/usr/share/doc/kernel || true
if [ -d Documentation/kdb ] ; then
    for i in Documentation/kdb/*.m* ; do
        k=`basename $i`
        k=${k/man/9}
        k=${k/mm/9}
        cp $i $RPM_BUILD_ROOT/%{_mandir}/man9/$k
    done
fi

ln -s /usr/share/man/man9/request_threaded_irq.9.gz 
$RPM_BUILD_ROOT/usr/share/man/man9/request_irq.9.gz

cp -a 
/usr/src/linux%variant/{COPYING,CREDITS,MAINTAINERS,README,REPORTING-BUGS} .

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc COPYING CREDITS MAINTAINERS README REPORTING-BUGS
%{_mandir}/man9/*
%docdir /usr/share/doc/kernel
/usr/share/doc/kernel

%changelog
++++++ kernel-module-subpackage ++++++
%package -n %{-n*}-kmp-%1
%define _this_kmp_version %{-v*}_k%(echo %2 | sed -r 'y/-/_/; 
s/^(2\.6\.[0-9]+)_/\\1.0_/; # use 2.6.x.0 for mainline kernels')
Version: %_this_kmp_version
Release: %{-r*}
%(
for spec in {%_sourcedir,%_specdir}/%name.spec /dev/null; do
    [ -e $spec ] && break
done
awk '
BEGIN           { tags["summary"] = "Summary: %summary"
                  tags["group"] = "Group: %group" }
/^%%/           { in_pkg_header = \
                  ($0 ~ /^%%package[ \t]+KMP[ \t]*$/ ||
                   $0 ~ /^%%package[ \t]+-n[ \t]*%name-KMP[ \t]*$/)
                  next }
in_pkg_header && /^(Summary|Group):[ \t]*/ \
                { tag = tolower($1) ; sub(/:$/, "", tag)
                  tags[tag] = $0 }
END             { print tags["summary"]
                  print tags["group"] }
' $spec
)
Provides: %{-n*}-kmp = %_this_kmp_version
Provides: %{-n*}-kmp = %{-v*}
Provides: multiversion(kernel)
Requires: coreutils grep
%{-c:Requires: %{-n*}-ueficert}
Enhances: kernel-%1
%ifarch %ix86
%if %1 == "default"
Obsoletes: %{-n*}-vmi
%endif
%endif
AutoReqProv: on
%{-p:%{expand:%(cd %_sourcedir; cat %{-p*})}}
%description -n %{-n*}-kmp-%1
%(
for spec in {%_sourcedir,%_specdir}/%name.spec /dev/null; do
    [ -e $spec ] && break
done
awk '
/^%%/           { in_desc = \
                  ($0 ~ /^%%description[ \t]+KMP[ \t]*$/ ||
                   $0 ~ /^%%description[ \t]+-n[ \t]*%name-KMP[ \t]*$/)
                  next }
in_desc         { print; good = 1 }
END             { exit(! good) }
' $spec || \
awk '
/^%%/           { in_desc = \
                  ($0 ~ /^%%description[ \t]*$/ ||
                   $0 ~ /^%%description[ \t]+-n[ \t]*%name[ \t]*$/)
                  next }
in_desc         { print; good = 1 }
END             { exit(! good) }
' $spec
)
%post -n %{-n*}-kmp-%1
nvr=%{-n*}-kmp-%1-%_this_kmp_version-%{-r*}
wm2=/usr/lib/module-init-tools/weak-modules2
if [ -x $wm2 ]; then
    %{-b:KMP_NEEDS_MKINITRD=1} /bin/bash -${-/e/} $wm2 --add-kmp $nvr
fi
%preun -n %{-n*}-kmp-%1
nvr=%{-n*}-kmp-%1-%_this_kmp_version-%{-r*}
rpm -ql $nvr | sed -n '/\.ko$/p' > /var/run/rpm-$nvr-modules
%postun -n %{-n*}-kmp-%1
nvr=%{-n*}-kmp-%1-%_this_kmp_version-%{-r*}
modules=( $(cat /var/run/rpm-$nvr-modules) )
rm -f /var/run/rpm-$nvr-modules
if [ ${#modules[*]} = 0 ]; then
    echo "WARNING: $nvr does not contain any kernel modules" >&2
    exit 0
fi
wm2=/usr/lib/module-init-tools/weak-modules2
if [ -x $wm2 ]; then
    printf '%s\n' "${modules[@]}" | /bin/bash -${-/e/} $wm2 --remove-kmp $nvr
fi
%files -n %{-n*}-kmp-%1
%{-f:%{expand:%(cd %_sourcedir; cat %{-f*})}}
%{!-f:%defattr (-,root,root)}
%{!-f:/lib/modules/%2-%1}
++++++ kernel-obs-build.spec.in ++++++
#
# spec file for package kernel-obs-build
#
# Copyright (c) @YEAR@ 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/
#
# needsrootforbuild


#!BuildIgnore: post-build-checks

%define patchversion @PATCHVERSION@
%define variant @VARIANT@%{nil}

%include %_sourcedir/kernel-spec-macros

Name:           kernel-obs-build
BuildRequires:  coreutils
BuildRequires:  device-mapper
BuildRequires:  util-linux

BuildRequires:  kernel-default
%ifarch %ix86 x86_64
BuildRequires:  kernel-xen
%endif
ExclusiveArch:  @ARCHS@
%if 0%{?suse_version} < 1320
# For SLE 11 
BuildRequires:  mkinitrd
BuildRequires:  perl-Bootloader
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%else
BuildRequires:  dracut
%endif
Summary:        package kernel and initrd for OBS VM builds
License:        GPL-2.0
Group:          SLES
Version:        @RPMVERSION@
%if 0%{?is_kotd}
Release:        <RELEASE>.g@COMMIT@
%else
Release:        @RELEASE@
%endif

%description
This package is repackaging already compiled kernels to make them usable
inside of Open Build Service (OBS) VM builds. An initrd with some basic
kernel modules is generated as well, but further kernel modules can be 
loaded during build when installing the kernel package.

%prep

%build
mkdir -p /usr/lib/dracut/modules.d/80obs
cat > /usr/lib/dracut/modules.d/80obs/module-setup.sh <<EOF
#!/bin/bash

# called by dracut
check() {
    return 0
}

# called by dracut
installkernel() {
    hostonly='' instmods obs
}

# called by dracut
install() {
    inst_hook pre-udev 10 "\$moddir"/setup_obs.sh
}
EOF
chmod a+rx /usr/lib/dracut/modules.d/80obs/module-setup.sh
cat > /usr/lib/dracut/modules.d/80obs/setup_obs.sh <<EOF
#!/bin/sh
info "Loading kernel modules for OBS"
info "  Loop..."
modprobe loop max_loop=64 lbs=0 || modprobe loop max_loop=64
info "  binfmt misc..."
modprobe binfmt_misc
EOF
chmod a+rx /usr/lib/dracut/modules.d/80obs/setup_obs.sh

# a longer list to have them also available for qemu cross builds where x86_64 
kernel runs in eg. arm env.
# this list of modules where available on build workers of build.opensuse.org, 
so we stay compatible.
export KERNEL_MODULES="loop dm-mod dm-snapshot binfmt-misc fuse kqemu squashfs 
ext2 ext3 ext4 reiserfs nf_conntrack_ipv6 binfmt_misc virtio_pci virtio_blk fat 
vfat nls_cp437 nls_iso8859-1 ibmvscsi ibmvscsic"
ROOT=""
[ -e "/dev/vda" ] && ROOT="-d /dev/vda"
[ -e /dev/hda1 ] && ROOT="-d /dev/hda1" # for xen builds
%define kernel_name vmlinu?
%ifarch s390 s390x
%define kernel_name image
%endif

%if 0%{?suse_version} < 1320
# For SLE 11 
/sbin/mkinitrd $ROOT \
               -m "$KERNEL_MODULES" \
               -k /boot/%{kernel_name}-*-default -M /boot/System.map-*-default 
-i /tmp/initrd.kvm -B
%ifarch %ix86 x86_64
/sbin/mkinitrd $ROOT \
               -m "$KERNEL_MODULES" \
               -k /boot/vmlinuz-xen -M /boot/System.map-*-xen -i /tmp/initrd.xen
%endif
%else
dracut --host-only --drivers="$KERNEL_MODULES" --force /tmp/initrd.kvm `echo 
/boot/%{kernel_name}-*-default | sed -n -e 's,[^-]*-\(.*-default\),\1,p'`
%ifarch %ix86 x86_64
dracut --host-only --drivers="$KERNEL_MODULES" --force /tmp/initrd.xen `echo 
/boot/%{kernel_name}-*-xen | sed -n -e 's,[^-]*-\(.*-xen\),\1,p'`
%endif
%endif


#cleanup
rm -rf /usr/lib/dracut/modules.d/80obs

%install
install -d -m 0755 $RPM_BUILD_ROOT
cp -v /boot/%{kernel_name}-*-default $RPM_BUILD_ROOT/.build.kernel.kvm
cp -v /tmp/initrd.kvm $RPM_BUILD_ROOT/.build.initrd.kvm
%ifarch %ix86 x86_64
cp -v /boot/%{kernel_name}-*-xen $RPM_BUILD_ROOT/.build.kernel.xen
cp -v /tmp/initrd.xen $RPM_BUILD_ROOT/.build.initrd.xen
%endif

%files
%defattr(-,root,root)
/.build.kernel.*
/.build.initrd.*

%changelog
++++++ kernel-obs-qa.spec.in ++++++
#
# spec file for package kernel-obs-qa
#
# Copyright (c) @YEAR@ 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/
#
# needsrootforbuild


%define patchversion @PATCHVERSION@
%define variant @VARIANT@%{nil}

%include %_sourcedir/kernel-spec-macros

Name:           kernel-obs-qa
BuildRequires:  kernel-default
# kernel-obs-build must be also configured as VMinstall, but is required
# here as well to avoid that qa and build package build parallel
BuildRequires:  kernel-obs-build
BuildRequires:  modutils
%ifarch %ix86 x86_64
BuildRequires:  kernel-xen
%endif
ExclusiveArch:  @ARCHS@
%if 0%{?suse_version} < 1200
# for SLE 11
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%endif
Summary:        Basic QA tests for the kernel
License:        GPL-2.0
Group:          SLES
Version:        @RPMVERSION@
%if 0%{?is_kotd}
Release:        <RELEASE>.g@COMMIT@
%else
Release:        @RELEASE@
%endif

%description
This package is using the kernel compiled within Open Build Service(OBS)
projects and runs basic tests.

%prep

%build

%check
# More tests are comming, currently the main test is the existens of
# this spec file. It does trigger a build within OBS VM which is using
# the kernel of the same project.

# test suites should be packaged in other packages, but build required
# and called here.

if ! /sbin/modprobe loop; then
  echo "ERROR: Unable to load the kernel loop module."
  echo "Usually the wrong kernel is running, this is atm"
  cat /proc/version
  echo "Installed kernel modules are:"
  rpm -q kernel-@FLAVOR@
  exit 1
fi


%install
mkdir -p %{buildroot}/usr/share/%name
touch %{buildroot}/usr/share/%name/logfile

%files
%defattr(-,root,root)
/usr/share/%name

%changelog
++++++ kernel-source.rpmlintrc ++++++
# These zero-length files are correct:
addFilter("zero-length /usr/src/linux-3\..*obj/.*include/config.*h")
# vdsos are special
addFilter("shared-lib-without-dependency-information 
/lib/modules/3\..*/vdso/.*")
addFilter("missing-PT_GNU_STACK-section /lib/modules/3\..*/vdso/")
# This is a stale symlink until the kernel-source package is installed:
addFilter("dangling-symlink /lib/modules/3\..*/source")
# These hidden files are fine:
addFilter ("hidden-file-or-dir /usr/src/linux-3\..*-obj/.*/.config")
addFilter ("hidden-file-or-dir 
/usr/src/linux-3\..*-obj/.*/.kernel-binary.spec.buildenv")
++++++ kernel-source.spec.in ++++++
#
# spec file for package kernel-source@VARIANT@
#
# Copyright (c) @YEAR@ 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/
#
# icecream 0


%define srcversion @SRCVERSION@
%define patchversion @PATCHVERSION@
%define variant @VARIANT@%{nil}
%define vanilla_only @VANILLA_ONLY@

%include %_sourcedir/kernel-spec-macros

%define src_install_dir usr/src/linux-%kernelrelease%variant

Name:           kernel-source@VARIANT@
Summary:        The Linux Kernel Sources
License:        GPL-2.0
Group:          Development/Sources
Version:        @RPMVERSION@
%if 0%{?is_kotd}
Release:        <RELEASE>.g@COMMIT@
%else
Release:        @RELEASE@
%endif
Url:            http://www.kernel.org/
AutoReqProv:    off
BuildRequires:  coreutils
BuildRequires:  fdupes
BuildRequires:  sed
Requires(post): coreutils sed
Provides:       %name = %version-%source_rel
Provides:       linux
Provides:       multiversion(kernel)
Source0:        @TARBALL_URL@linux-%srcversion.tar.bz2
Source2:        source-post.sh
Source3:        kernel-source.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
Source17:       apply-patches
Source21:       config.conf
Source23:       supported.conf
Source33:       check-for-config-changes
Source35:       group-source-files.pl
Source37:       README.SUSE
Source38:       README.KSYMS
Source39:       config-options.changes.txt
Source40:       source-timestamp
Source44:       find-provides
Source45:       split-modules
Source46:       modversions
Source48:       macros.kernel-source
Source49:       kernel-module-subpackage
Source50:       kabi.pl
Source51:       mkspec
Source52:       kernel-source%variant.changes
Source53:       kernel-source.spec.in
Source54:       kernel-binary.spec.in
Source55:       kernel-syms.spec.in
Source56:       kernel-docs.spec.in
Source57:       kernel-cert-subpackage
Source58:       constraints.in
Source60:       config.sh
Source61:       compute-PATCHVERSION.sh
Source62:       old-flavors
Source63:       arch-symbols
Source64:       package-descriptions
Source65:       kernel-spec-macros
Source66:       configtool.pl
Source67:       log.sh
Source68:       host-memcpy-hack.h
Source69:       try-disable-staging-driver
Source70:       kernel-obs-build.spec.in
Source71:       kernel-obs-qa.spec.in
Source100:      config.tar.bz2
Source101:      config.addon.tar.bz2
Source102:      patches.arch.tar.bz2
Source103:      patches.drivers.tar.bz2
Source104:      patches.fixes.tar.bz2
Source105:      patches.rpmify.tar.bz2
Source106:      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
Source121:      sysctl.tar.bz2
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
Prefix:         /usr/src
# Source is only complete with devel files.
Requires:       kernel-devel%variant = %version-%release

%(chmod +x %_sourcedir/{@SCRIPTS@})

%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 -n kernel-devel%variant
Summary:        Development files needed for building kernel modules
Group:          Development/Sources
AutoReqProv:    off
Provides:       kernel-devel%variant = %version-%source_rel
Provides:       multiversion(kernel)

%description -n kernel-devel%variant
Kernel-level headers and Makefiles required for development of
external kernel modules.


%source_timestamp
%package vanilla
Summary:        Vanilla Linux kernel sources with minor build fixes.
Group:          Development/Sources
AutoReqProv:    off
Provides:       %name-vanilla = %version-%source_rel
Provides:       multiversion(kernel)

%description vanilla
Vanilla Linux kernel sources with minor build fixes.


%source_timestamp
%prep

echo "Symbol(s): %symbols"

# Unpack all sources and patches
%setup -q -c -T @UNPACK_PATCHES@

%build
mkdir -p $RPM_BUILD_ROOT/usr/src
cd $RPM_BUILD_ROOT/usr/src

# Unpack the vanilla kernel sources
tar -xf %{S:0}
if test "%srcversion" != "%kernelrelease%variant"; then
        mv linux-%srcversion linux-%kernelrelease%variant
fi

%if %do_vanilla
%if %vanilla_only
        mv \
%else
        cp -al \
%endif
        linux-%kernelrelease%variant linux-%kernelrelease-vanilla
cd linux-%kernelrelease-vanilla
%_sourcedir/apply-patches --vanilla %_sourcedir/series.conf %my_builddir 
%symbols
rm -f $(find . -name ".gitignore")
cd ..
%endif

%if ! %vanilla_only
ln -sf linux%variant linux%variant  # dummy symlink

cd linux-%kernelrelease%variant
%_sourcedir/apply-patches %_sourcedir/series.conf %my_builddir %symbols
rm -f $(find . -name ".gitignore")

if [ -f %_sourcedir/localversion ] ; then
    cat %_sourcedir/localversion > localversion
fi
%endif

# Hardlink duplicate files automatically (from package fdupes).
%fdupes $RPM_BUILD_ROOT

%install
%if ! %vanilla_only
# Install the documentation and example Kernel Module Package.
DOC=$RPM_BUILD_ROOT/usr/share/doc/packages/%name
mkdir -p $DOC
cp %_sourcedir/README.SUSE %_sourcedir/config-options.changes.txt $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,cert}-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

pushd "%buildroot"
perl "%_sourcedir/group-source-files.pl" \
        -D "$OLDPWD/devel.files" -N "$OLDPWD/nondevel.files" \
        -L "%src_install_dir"
popd

# kernel-source and kernel-$flavor-devel are built independently, but the
# shipped sources (/usr/src/linux/) need to be older than generated files
# (/usr/src/linux-obj). We rely on the git commit timestamp to not point into
# the future and be thus lower than the timestamps of files built from the
# source (bnc#669669).
ts="$(head -n1 %_sourcedir/source-timestamp)"
find %buildroot/usr/src/linux* ! -type l | xargs touch -d "$ts"

%post -f %name-post.sh

%post -n kernel-devel%variant -f %name-post.sh

%files -f nondevel.files
%defattr(-, root, root)

%files -n kernel-devel%variant -f devel.files
%defattr(-,root,root)
%ghost /usr/src/linux%variant
/usr/share/doc/packages/%name
/etc/rpm/macros.kernel-source
/usr/lib/rpm/kernel-*-subpackage
%endif

%if %do_vanilla

%files vanilla
%defattr(-, root, root)
/usr/src/linux-%kernelrelease-vanilla
%endif

%changelog
++++++ kernel-spec-macros ++++++
# This file is included by all the kernel-*.spec files

# Build with bash instead of sh as the shell: this turns on bash
# extensions like <(...).
%define _buildshell /bin/bash

%define using_buildservice      0%{?opensuse_bs}

# source_rel is the package release string, without the rebuild counter
# generated by the build service. If the release string has a non-digit
# suffix, we keep that suffix and strip the rightmost digit component.
# This is used in KOTD builds: 2.1.g1234567 -> 2.g1234567
%define source_rel %release
%if %using_buildservice
%define source_rel %(echo %release | sed -r 
's/\\.[0-9]+($|\\.[^.]*[^.0-9][^.]*$)/\\1/')
%endif

# how the kernel release string (uname -r) should look like
%define kernelrelease %patchversion-%source_rel

%define my_builddir %_builddir/%{name}-%{version}

# macro to add the source timestamp to package descriptions
%define source_timestamp %(sed '1s/^/Source Timestamp: /' 
%_sourcedir/source-timestamp || :)

# vim: ft=spec
++++++ kernel-syms.spec.in ++++++
#
# spec file for package kernel-syms@VARIANT@
#
# Copyright (c) @YEAR@ 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/
#


%define variant @VARIANT@%{nil}

%include %_sourcedir/kernel-spec-macros

Name:           kernel-syms@VARIANT@
Summary:        Kernel Symbol Versions (modversions)
License:        GPL-2.0
Group:          Development/Sources
Version:        @RPMVERSION@
%if %using_buildservice
%if 0%{?is_kotd}
Release:        <RELEASE>.g@COMMIT@
%else
Release:        @RELEASE@
%endif
%else
%define kernel_source_release %(LC_ALL=C rpm -q kernel-devel%variant-%version 
--qf "%{RELEASE}" | grep -v 'not installed' || echo 0)
Release:        %kernel_source_release
%endif
Url:            http://www.kernel.org/
AutoReqProv:    off
BuildRequires:  coreutils
@REQUIRES@
Provides:       %name = %version-%source_rel
Provides:       multiversion(kernel)
Source:         README.KSYMS
Requires:       kernel-devel%variant = %version-%source_rel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
ExclusiveArch:  @ARCHS@
Prefix:         /usr/src

%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.


%source_timestamp
%prep

%install
install -m 644 -D %{SOURCE0} %buildroot/%_docdir/%name/README.SUSE

%files
%defattr(-, root, root)
%dir %_docdir/%name
%_docdir/%name/README.SUSE

%changelog
++++++ log.sh ++++++
#! /bin/sh

# log.sh - Automate insertion of patches into a kernel rpm tree managed
# with series.conf
#
# Usage example:
#
# osc branch openSUSE:11.3/kernel-source
# osc co home:philipsb:branches:openSUSE:11.3:Update:Test/kernel-source
# mv ~/linux-2.6/driver-fix-for-something.patch .
# echo -e "\tpatches.drivers/driver-fix-for-something.patch" >> series.conf
# ./log.sh
# osc commit

#############################################################################
# Copyright (c) 2004-2006,2008-2010 Novell, Inc.
# All Rights Reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, contact Novell, Inc.
#
# To contact Novell about this file by physical or electronic mail,
# you may find current contact information at www.novell.com
#############################################################################

# Construct a changes entry and commit log from a patch.

CHANGES=kernel-source.changes

trap 'rm -rf "$tmpdir"' EXIT
tmpdir=$(mktemp -d /tmp/${0##*/}.XXXXXX)
message=$tmpdir/message

log_entry() {
    local entry=$1

    echo "$entry" \
    | fmt --width 65 \
    | sed -e '1s/^/- /' -e '2,$s/^/  /' \
    >> $message
}


patch_meta() {
    local patch=$1

    subject=$(formail -c -x Subject < "$patch" \
             | sed -e 's, *\[[#/ A-Za-z0-9-]*\],,')
    subject=${subject## }
    subject=${subject%.}

    set -- $(formail -c -x References -x Reference < "$patch")
    references="$*"
}

patch_log_entry() {
    local patch=$1 subject references old_subj old_ref old_patch="$tmpdir/old"

    git show "HEAD:$patch" >"$old_patch" 2>/dev/null
    patch_meta "$old_patch"
    old_subj="$subject"
    old_ref="$references"

    patch_meta "$patch"

    local msg
    if test -z "$subject" -o "$subject" != "$old_subj"; then
        msg="$subject${references:+ ($references)}" 
    elif test "$references" != "$old_ref"; then
        if test -n "$references"; then
            msg="Update references ($references)"
        fi
    else
        msg="Refresh"
    fi

    log_entry "$patch: $msg${msg:+.}"
}

find_patches() {
       osc diff series.conf \
       | sed -n "s/^+\s*\(patches.*\)/\1/p"
}

for file in  "$@" $(find_patches); do
    dirname=$(dirname $file)
    basename=$(basename $file)
    archive=$dirname.tar.bz2

    if [ ! -f $basename ]; then
        echo "ERROR: $basename added to series.conf but doesn't exist in $PWD"
        exit 1
    fi

    if [ ! -d $dirname ]; then
        tar xvf $archive
    fi
    
    mv $basename $dirname
    rm $archive
    tar cfj $archive $dirname

    files[${#files[@]}]=$file
done 

if [ ${#files[@]} -eq 0 ]; then
    echo "No modified files" >&2
    exit 1
fi

for file in "${files[@]}"; do
    if [ "${file:0:1}" = - ]; then
        log_entry "${file:1}: Delete."
    else
        case "$file" in
            config/*)
                if [ -z "$configs_updated" ]; then
                    log_entry "Update config files."
                    configs_updated=1
                fi
                ;;
                
            patches.*)
                patch_log_entry "$file"
                ;;

            kabi/*/symvers-* | kabi/*/symtypes-* | kabi/*/symsets-* )
                if [ -z "$symvers_updated" ]; then
                    log_entry "Update reference module symbol versions."
                    symvers_updated=1
                fi
                ;;

            series.conf)
                # don't log changes in there
                ;;

            *)
                log_entry "$file: "
                ;;
        esac
    fi
done

if [ ! -s $message ]; then
    echo "- " >> $message
fi

if osc vc $CHANGES $message; then
    entry=$(sed -ne '1,2d' -e '/^--*$/!p' -e '/^--*$/q' $CHANGES)
    entry=${entry##$'\n'}
    entry=${entry%%$'\n'}
fi

for c in *.changes; do
    [ $c = $CHANGES ] && continue
    cp $CHANGES $c
done
++++++ macros.kernel-source ++++++
# A few cross-distro definitions:
%kernel_module_package_release 1
%kernel_module_package_buildreqs modutils kernel-syms

# Defines %flavors_to_build and %kernel_source() as a side effect.
%_kernel_module_package(n:v:r:t:f:Xp:bc:) \
%{expand:%( \
        subpkg=%{-t*}%{!-t:/usr/lib/rpm/kernel-module-subpackage} \
        echo "%%define _suse_kernel_module_subpackage(n:v:r:f:p:bc) 
%%{expand:%%(cd %_sourcedir; cat $subpkg; echo %%%%nil)}" \
        flavors_to_build= \
        flavors="%*" \
        for flavor in $(ls /usr/src/linux-obj/%_target_cpu 2>/dev/null); do \
            case " $flavors " in \
            (*" $flavor "*) \
                [ -n "%{-X}" ] && continue ;; \
            (*) \
                [ -z "%{-X}" -a -n "$flavors" ] && continue ;; \
            esac \
            krel=$(make -s -C /usr/src/linux-obj/%_target_cpu/$flavor 
kernelrelease) \
            kver=${krel%%-*} \
            flavors_to_build="$flavors_to_build $flavor" \
            echo "%%_suse_kernel_module_subpackage -n %{-n*}%{!-n:%name} -v 
%{-v*}%{!-v:%version} -r %{-r*}%{!-r:%release} %{-p} %{-b} %{-c:-c} $flavor 
$kver" \
        done \
        echo "%%global flavors_to_build${flavors_to_build:-%%nil}" \
        echo "%%{expand:%%(test -z '%flavors_to_build' && echo 
%%%%internal_kmp_error)}" \
        echo "%%global kernel_source() /usr/src/linux-obj/%_target_cpu/%%%%{1}" 
\
        echo "%%global kernel_module_package_moddir() updates" \
        \
        echo "%package -n %{-n*}%{!-n:%name}-kmp-_dummy_" \
        echo "Version: %version" \
        echo "Summary: %summary" \
        echo "Group: %group" \
        echo "%description -n %{-n*}%{!-n:%name}-kmp-_dummy_" \
        %{-c:
                for fmt in DER PEM; do h=$(openssl x509 -inform $fmt 
-fingerprint -noout -in %{-c*}); if test -n "$h"; then break; fi; done \
                cert=/etc/uefi/certs/$(echo "$h" | sed -rn 's/^SHA1 
Fingerprint=//; T; s/://g; s/(.{8}).*/\\1/p').crt
                : The -n expanstion in kernel-cert-subpackage only works if
                : -n is actually passed to the macro. Fix this here, so that
                : we do not have to modify the modsign-repackage script
                sed "s|@CERTS@|$cert|g; s|%%{-n.}|%{-n*}%{!-n:%name}|g" 
/usr/lib/rpm/kernel-cert-subpackage \
                echo "%%global __spec_build_pre %%__spec_build_pre mkdir -p 
%%buildroot/etc/uefi/certs; openssl x509 -in %{-c*} -inform $fmt -out 
%%buildroot/$cert -outform DER" } \
        )}

# kernel_module_package: simply pass on all options and arguments.
%kernel_module_package(n:v:r:t:f:xp:bc:) \
        %{expand:%%_kernel_module_package %{-x:-X} %{-n} %{-v} %{-r} %{-t} 
%{-f} %{-p} %*}

# suse_kernel_module_package: invert the meaning of the -x flag. (You are not
# supposed to understand why a simple %{-x:}%{!-x:-x} won't work.)
%suse_kernel_module_package(n:v:r:s:f:xp:bc:) \
        %{expand:%%_kernel_module_package %{-x: }%{!-x:-X} %{-n} %{-v} %{-r} 
%{-s:-t %{-s*}} %{-f} %{-p} %*}
++++++ minmem ++++++
1048576
++++++ mkspec ++++++
#!/usr/bin/perl

use strict;
use warnings;

use File::Copy;
use Getopt::Long;

my $dir = ".";
my $rpmrelease = 0;
my $patches="";

GetOptions(
        "patches=s" => \$patches,
        "release=s" => \$rpmrelease
) or die "Usage: $0 [--release <release>] [--patches <dir>]\n";

# flavor -> [supported archs]
my %flavor_archs = parse_config_conf();
# subset to include in kernel-syms
my %syms_flavor_archs = parse_config_conf("syms");

# template name -> template body
my %templates = read_spec_templates();

# config.sh variables
my %vars = parse_config_sh();
my ($srcversion, $variant, $vanilla_only) =
        ($vars{'SRCVERSION'}, $vars{'VARIANT'}, $vars{'VANILLA_ONLY'});
$vanilla_only ||= "0";

# package name -> [summary, description]
my %binary_descriptions = parse_descriptions();

# arch -> flavor -> [obsoleted packages]
my %obsolete_packages = parse_old_flavors();

$patches="--patches $patches" if $patches;
my $patchversion = `$dir/compute-PATCHVERSION.sh $patches`;
chomp $patchversion;
my $rpmversion = $patchversion;
# stuff the -rcX tag into the rpm version if possible;
$rpmversion =~ s/\.0-rc/.rc/;
$rpmversion =~ s/-rc\d+//;
$rpmversion =~ s/-/./g;

$rpmrelease =~ s/-/./g;

my $sources = join("\n", $templates{source} =~ /^Source\d+:[^\n]*/msg);
# Find all SourceN: foo.tar.(bz2|xz) lines and generate the NoSource:
# lines and the %setup line
my @tarballs = ($sources =~ /^Source(\d+):[^\n]*\.tar\.(?:bz2|xz)/msg);
my $nosource = $sources;
$nosource =~ s/^Source(\d+):.*?$/NoSource:       $1/mg;

# Source0 (the linux tarball) is unpacked manually
@tarballs = grep { $_ > 0 } @tarballs;
my $unpack_patches = join(" ", map { "-a $_" } @tarballs);
# List of scripts to automatically chmod +x before build
my $scripts = join(",", grep { is_script($_) }
                        ($sources =~ /\nSource\d+:\s*([^\s]*)/mg));

my $tarball_url;
if ($srcversion =~ /^(\d+)(?:\.\d+)*(-rc\d+)?$/) {
        $tarball_url = "http://www.kernel.org/pub/linux/kernel/v$1.x/";;
        $tarball_url .= "testing/" if $2;
} else {
        # kernel.org has no tarballs for  linux-next or vanilla snapshots
        $tarball_url = "";
}

my $commit = get_commit();

my %macros = (
        VARIANT => $variant,
        VANILLA_ONLY => $vanilla_only,
        SRCVERSION => $srcversion,
        PATCHVERSION => $patchversion,
        RPMVERSION => $rpmversion,
        TARBALL_URL => $tarball_url,
        RELEASE => $rpmrelease,
        COMMIT => $commit,
        SOURCES => $sources,
        NOSOURCE => $nosource,
        UNPACK_PATCHES => $unpack_patches,
        SCRIPTS => $scripts,
        YEAR => (localtime time)[5] + 1900,
);

# binary spec files
for my $flavor (sort keys(%flavor_archs)) {
        my ($summary, $description);
        if (!exists($binary_descriptions{"kernel-$flavor"})) {
                print STDERR "warning: no description for kernel-$flavor 
found\n";
                $summary = "The Linux Kernel";
                $description = "The Linux Kernel.";
        } else {
                $summary = $binary_descriptions{"kernel-$flavor"}->[0];
                $description = $binary_descriptions{"kernel-$flavor"}->[1];
        }

        do_spec('binary', "kernel-$flavor.spec", %macros,
                FLAVOR => $flavor,
                SUMMARY => $summary,
                DESCRIPTION => $description,
                ARCHS => join(" ", arch2rpm(@{$flavor_archs{$flavor}})),
                PROVIDES_OBSOLETES =>
                        provides_obsoletes($flavor, @{$flavor_archs{$flavor}}),
                PROVIDES_OBSOLETES_BASE =>
                        provides_obsoletes("$flavor-base", 
@{$flavor_archs{$flavor}}),
        );
}
# kernel-source.spec
do_spec('source', "kernel-source$variant.spec", %macros);

# kernel-docs.spec
do_spec('docs', "kernel-docs$variant.spec", %macros);

# kernel-syms.spec
{
        my $requires = "";
        my %all_archs;
        my $all_archs;
        for my $flavor (sort keys(%syms_flavor_archs)) {
                next if $flavor eq "vanilla";
                my @archs = arch2rpm(@{$syms_flavor_archs{$flavor}});
                $all_archs{$_} = 1 for @archs;
                $requires .= "%ifarch @archs\n";
                $requires .= "Requires:       kernel-$flavor-devel = 
\%version-\%source_rel\n";
                $requires .= "%endif\n";
        }
        chomp $requires;
        $all_archs = join(" ", sort(keys(%all_archs)));
        if (keys(%all_archs)) {
                do_spec('syms', "kernel-syms$variant.spec", %macros,
                        REQUIRES => $requires,
                        ARCHS => $all_archs);
        }
        # kernel-obs-*.spec
        if (!$variant) {
                do_spec('obs-build', "kernel-obs-build.spec", %macros,
                        ARCHS => $all_archs); 
                do_spec('obs-qa', "kernel-obs-qa.spec", %macros,
                        ARCHS => $all_archs);
        }
}

copy_changes();

# _constraints
{
        my @packages = map { "<package>kernel-$_</package>" } sort 
keys(%flavor_archs);
        my $packages = join("\n", @packages);
        do_spec('constraints', "_constraints",
                BINARY_PACKAGES_XML => $packages);
}

exit 0;



sub parse_config_conf {
        my @symbols = @_;
        my $symbols = join(' ', @symbols);
        my %res;

        for my $arch (split(/\s+/, `$dir/arch-symbols --list`)) {
                my @flavors = `$dir/guards $arch $symbols < $dir/config.conf`;
                next if @flavors == 0;
                chomp @flavors;
                @flavors = map { s/.*\///; $_ } @flavors;
                for my $flavor (@flavors) {
                        $res{$flavor} ||= [];
                        push(@{$res{$flavor}}, $arch);
                }
        }
        for my $flavor (keys(%res)) {
                $res{$flavor} = [sort @{$res{$flavor}}];
        }
        return %res;
}

sub read_spec_templates {
        my %res;

        for my $template (qw(binary source syms docs obs-build obs-qa)) {
                xopen(my $fh, '<', "$dir/kernel-$template.spec.in");
                local $/ = undef;
                $res{$template} = <$fh>;
                close($fh);
        }
        {
                xopen(my $fh, '<', "$dir/constraints.in");
                local $/ = undef;
                $res{constraints} = <$fh>;
                close($fh);
        }
        return %res;
}

# return a hash of config.sh variables
sub parse_config_sh {
        my %res;

        xopen(my $fh, '<', "$dir/config.sh");
        while (<$fh>) {
                chomp;
                if (/^\s*([A-Z_]+)=(.*)/) {
                        $res{$1} = $2;
                }
        }
        close($fh);
        return %res;
}

sub parse_descriptions {
        my %res;
        my $current;
        my $blank = "";
        # 0 - expect summary, 1 - eating blank lines, 2 - reading description
        my $state = 0;

        xopen(my $fh, '<', "$dir/package-descriptions");
        while (<$fh>) {
                next if /^\s*#/;

                if (/^==+\s+([^\s]+)\s+==+\s*$/) {
                        my $package = $1;
                        if ($current) {
                                chomp $current->[1];
                        }
                        $current = ["", ""];
                        $res{$package} = $current;
                        $state = 0;
                        next;
                }
                if (/^$/) {
                        if ($state == 2) {
                                $blank .= $_;
                        }
                        next;
                }
                # non-blank line and not === package ===
                if ($state == 0) {
                        chomp;
                        $current->[0] = $_;
                        $state = 1;
                } elsif ($state == 1) {
                        $current->[1] = $_;
                        $blank = "";
                        $state = 2;
                } else {
                        $current->[1] .= $blank;
                        $blank = "";
                        $current->[1] .= $_;
                }
        }
        if ($current) {
                chomp $current->[1];
        }
        close($fh);
        return %res;
}

sub parse_old_flavors{
        my %res;


        xopen(my $fh, '<', "$dir/old-flavors");
        while (<$fh>) {
                chomp;
                next if /^\s*(#|$)/;
                if (!m:^\s*(\w+)/([\w-]+)\s+([\w-]+)\s+([\w.-]+)\s*$:) {
                        print STDERR "$dir/old-flavors:$.: expected arch/flavor 
<old flavor> <old version>\n";
                        next;
                }
                my ($arch, $flavor, $old_flavor, $old_version) = ($1, $2, $3, 
$4);
                $res{$arch} ||= {};
                $res{$arch}{$flavor} ||= [];
                push(@{$res{$arch}{$flavor}},
                        ["kernel-$old_flavor", $old_version]);
        }
        close($fh);
        return %res;
}

sub is_script {
        my $script = shift;

        return undef if $script =~ /\.(tar\.(gz|bz2)|in|conf)$/;
        return undef if $script =~ /^README/;
        return 1 if $script =~ /\.pl$/;
        open(my $fh, '<', $script) or return undef;
        sysread($fh, my $shebang, 2);
        close($fh);
        return 1 if $shebang eq "#!";
        return undef;
}

sub arch2rpm {
        if (wantarray) {
                return map { _arch2rpm($_) } @_;
        }
        return _arch2rpm($_[0]);
}
sub _arch2rpm {
        my $arch = shift;
        return "\%ix86" if $arch eq "i386";
        return "aarch64" if $arch eq "arm64";
        return $arch;
}

sub provides_obsoletes {
        my $flavor = shift;
        my @archs = @_;
        my $res = "";

        for my $arch (@archs) {
                my @packs = @{$obsolete_packages{$arch}{$flavor} || []};
                next if (!@packs);
                my $rpmarch = arch2rpm($arch);
                chomp $rpmarch;
                $res .= "\%ifarch $rpmarch\n";
                for my $pack (@packs) {
                        my $name = $pack->[0];
                        my $version = $pack->[1];
                        $res .= "Provides:       $name = $version\n";
                        $res .= "Obsoletes:      $name <= $version\n";
                }
                $res .= "\%endif\n";
        }
        chomp $res;
        return $res;
}

sub get_commit {
        my ($commit, $fh);

        if (!open($fh, '<', "source-timestamp")) {
                print STDERR "warning: source-timestamp: $!\n";
                print STDERR "warning: Cannot determine commit id\n";
                return "0000000";
        }
        while (<$fh>) {
                if (/^GIT Revision: ([0-9a-f]{7})/) {
                        $commit = $1;
                }
        }
        close($fh);
        if (!$commit) {
                print STDERR "warning: Commit id missing in source-timestamp 
file\n";
                return "0000000";
        }
        return $commit;
}

sub do_spec {
        my $template = shift;
        my $specfile = shift;
        my %macros = @_;

        my $text = $templates{$template};
        my $prev_text;
        do {
                $prev_text = $text;
                for my $m (keys %macros) {
                        $text =~ s/\@$m\@/$macros{$m}/g;
                }
        } while ($prev_text ne $text);
        print "$specfile\n";
        xopen(my $fh, '>', "$dir/$specfile");
        print $fh $text;
        close($fh);
}

sub copy_changes {

        opendir(my $dh, $dir) or die "$dir: $!\n";

        while (my $name = readdir $dh) {
                next unless $name =~ /\.spec$/;
                next if $name eq "kernel-source$variant.spec";

                $name =~ s/\.spec$/.changes/;
                copy("$dir/kernel-source$variant.changes", "$dir/$name");
        }
        closedir($dh);
}

sub xopen {
        open($_[0], $_[1], $_[2]) or die "$_[2]: $!\n";
}

++++++ modversions ++++++
#! /usr/bin/perl -w

use File::Basename;
use File::Path;
use File::Find;
use Getopt::Long;
use strict;

my %symbol_type_name = (
    n => 'normal', t => 'typedef', e => 'enum', s => 'struct', u => 'union',
    E => 'enum constant'
);

my %definitions;
my %override;
my %override_locally;
my %locally_unknown;
my %locally_defined;

sub expand_types($);
sub expand_types($) {
    my ($definition) = @_;
    local ($_, $1, $2);

    my @defn = split ' ', $definition;
    for (@defn[1..$#defn]) {
        if (/^(.)#(.*)/) {
            #print "<<$defn[0] : $_>>\n";
            next if exists $locally_defined{$_};
            $locally_defined{$_} = 1;

            if ($locally_unknown{$_}) {
                print "override " if $override_locally{$_};
                print "$_ $symbol_type_name{$1} $2 { UNKNOWN } \n";
            } else {
                if (!exists $definitions{$_}) {
                    die "Missing definition of $symbol_type_name{$1} $2\n";
                }
                expand_types("$_ $definitions{$_}");
            }
        }
    }
    print "override " if $override_locally{$defn[0]};
    print "$definition\n";
}

sub pack_dump($$) {
    my ($dir, $ext) = @_;
    my @files;

    $ext = ".symtypes" unless defined $ext;
    $dir =~ s/\/+$//;

    find(sub ($) { /\Q$ext\E$/ && push @files, $File::Find::name}, $dir);
    map { s/^\Q$dir\E\/(.*)\Q$ext\E$/$1/ } @files;

    foreach my $file (sort @files) {
        print "/* $file.o */\n";

        local *FD;
        open FD, "< $dir/$file$ext"
            or die "$dir/$file$ext: $!\n";
        while (<FD>) {
            chomp;

            my $override = "";
            if (s/^override //) {
                $override = $&;
            }

            if (/^(\S)#(\S+)\s*(.*)/) {
                my $sym = "$1#$2";
                my $definition = $3;

                if (/^$sym\s+$symbol_type_name{$1}\s+$2\s+{\s+UNKNOWN\s+}\s*$/) 
{
                    $_ = $override . substr($sym, 0, 1) . "##" . substr($sym, 
2);
                } else {
                    if (exists $definitions{$sym} && $definitions{$sym} eq 
$definition) {
                        if (($override ne "") == (exists $override{$sym})) {
                            next;
                        }
                        $_ = "$override$sym";
                    } else {
                        $definitions{$sym} = $definition;
                        if ($override eq "") {
                            delete $override{$sym};
                        } else {
                            $override{$sym} = 1;
                            $_ = "$override$_";
                        }
                    }
                }
            } elsif ($override) {
                    $_ = "$override$_";
            }
            print "$_\n";
        }
        close FD;
        print "\n";
    }
}

sub unpack_dump($$) {
    my ($dir, $ext) = @_;

    $ext = ".symref" unless defined $ext;

    while (<STDIN>) {
        next if /^$/;
        chomp;

        if (/^\/\* (.*)\.o \*\//) {
            close STDOUT;
            mkpath(dirname("$dir/$1$ext"));
            open STDOUT, "> $dir/$1$ext"
                or die "$dir/$1$ext: $!\n";
            %locally_defined = ();
            %locally_unknown = ();
            %override_locally = %override;
            next;
        }

        my $override = /^override\s/;
        s/^override\s//;

        if (/^([^ ])#(#?)([^ ]+) *(.*)$/) {
            my $sym = "$1#$3";

            if ($4 ne "") {
                if (/\s+{\s+UNKNOWN\s+}\s*$/) {
                    $locally_unknown{$sym} = 1;
                    $override_locally{$sym} = $override;
                } else {
                    $definitions{$sym} = $4;
                    $locally_unknown{$sym} = 0;
                    $override{$sym} = $override;
                    $override_locally{$sym} = $override;
                }
            } else {
                $locally_unknown{$sym} = ($2 ne "");
                $override_locally{$sym} = $override;
            }
            next;
        } elsif (/^([^# ]*)/) {
                $override_locally{$1} = $override;
        }
        expand_types($_);
    }
}

my ($pack, $unpack, $ext);
GetOptions("pack" => \$pack, "unpack" => \$unpack, "ext:s" => \$ext)
    && ($pack || $unpack) && @ARGV == 1
    or die "USAGE:\t$0 [--ext extension] --pack {dir} > file\n" .
                 "\t$0 [--ext extension] --unpack {dir} < file\n";

pack_dump($ARGV[0], $ext) if $pack;
unpack_dump($ARGV[0], $ext) if $unpack;
++++++ needed_space_in_mb ++++++
6144
++++++ old-flavors ++++++
# List of obsolete kernel flavors
# <arch>/<new flavor>   <old flavor>    <upper bound of shipped versions>

# SLES 9
ia64/default    sn2             2.6.6

ppc/ppc64       pmac64          2.6.6
ppc/ppc64       pseries64       2.6.6

# SLES 10
i386/default    smp             2.6.17
i386/pae        bigsmp          2.6.17
i386/xen        xenpae          2.6.17

x86_64/default  smp             2.6.17

ppc/ppc64       iseries64       2.6.17
ppc/ppc64       kdump           2.6.17

# SLES 11 GA only
# FIXME: more architectures had kdump in SLES 10
ppc64/debug     kdump           2.6.28
ppc64/default   kdump           2.6.28
ppc64/ppc64     kdump           2.6.28
ppc64/trace     kdump           2.6.28

# SLES 11 GA only / 11.4
i386/pae        vmi             2.6.38
i386/pae-base   vmi-base        2.6.38



++++++ package-descriptions ++++++
# Descriptions of the binary kernel packages. The format is
#
# === <package name> ===
# Summary (single line)
#
# Long description (multiple
# lines)
#
# Descriptions of the -base and -extra subpackages are derived from the
# main descriptions.

=== kernel-debug ===
A Debug Version of the Kernel

This kernel has several debug facilities enabled that hurt performance.
Only use this kernel when investigating problems.

=== kernel-default ===
The Standard Kernel

The standard kernel for both uniprocessor and multiprocessor systems.

=== kernel-desktop ===
Kernel optimized for the desktop

This kernel is optimized for the desktop. It is configured for lower latency
and has many of the features that aren't usually used on desktop machines
disabled.

%ifarch %ix86
This kernel supports up to 64GB of main memory. It requires Physical
Addressing Extensions (PAE), which were introduced with the Pentium Pro
processor.

PAE is not only more physical address space but also important for the
"no execute" feature which disables execution of code that is marked as
non-executable. Therefore, the PAE kernel should be used on any systems
that support it, regardless of the amount of main memory.
%endif

=== kernel-kdump ===
kernel for kdump

This kernel is intended for kdump. It can not be booted with a normal
bootloader, the kexec tool has to be used to load it. Once the system
crashes, the loaded kernel will be started to grab debug info from the
crashed kernel.

=== kernel-net ===
Minimal kernel with disk and net support

This kernel carries only networking and disk drivers to fit into the
standard Sun OpenBoot download buffer, and is intended for the
initial install and rescue mode only.

=== kernel-pae ===
Kernel with PAE Support

This kernel supports up to 64GB of main memory. It requires Physical
Addressing Extensions (PAE), which were introduced with the Pentium Pro
processor.

PAE is not only more physical address space but also important for the
"no execute" feature which disables execution of code that is marked as
non-executable. Therefore, the PAE kernel should be used on any systems
that support it, regardless of the amount of main memory.

=== kernel-ppc64 ===
Kernel for ppc64 Systems

This package contains the kernel for:

IBM pSeries 64bit machines IBM iSeries 64bit machines Apple G5 machines
Sony Playstation 3

The boot file is /boot/vmlinux.

The home page of the ppc64 project is http://www.penguinppc.org/

=== kernel-ps3 ===
kernel for ps3 bootloader

This package contains the kernel for the PS3 bootloader. PS3 systems
only have 4MB of flash memory for the bootloader, so this kernel needs
to be as small as possible and is _not_ meant to be installed in the
final system.

=== kernel-s390 ===
The Standard Kernel

The standard kernel.

=== kernel-trace ===
The Standard Kernel with Tracing Features

This kernel has different tracing features enabled (e.g. utrace, ftrace).

=== kernel-vanilla ===
The Standard Kernel - without any SUSE patches

The standard kernel - without any SUSE patches

=== kernel-xen ===
The Xen Kernel

The Linux kernel for Xen paravirtualization.

This kernel can be used both as the domain0 ("xen0") and as an
unprivileged ("xenU") kernel.

=== kernel-ec2 ===
The Amazon EC2 Xen Kernel

The Linux kernel for Xen paravirtualization.

This kernel can only be used both as an unprivileged ("xenU")
kernel (for Amazon EC2).

=== kernel-vmi ===
VMI-enabled kernel

The Linux Kernel designed to run on top of a virtual machine
interface layer (VMI).

=== kernel-lpae ===
Kernel for LPAE enabled systems

The kernel for all 32-bit ARM platforms that support LPAE. This includes all
Cortex A15 based SoCs, like the Exynos5, OMAP5 or Calxeda ECX-2000.

=== kernel-cubox ===
Kernel for SolidRun Cubox

The standard kernel for Marvell Dove SoC, as found in
the SolidRun Cubox.

=== kernel-exynos ===
Kernel for Samsung's Exynos SoC

The standard kernel for Samsung's Exynos 4 & 5 SoC, as found in the Origen 
board.

=== kernel-versatile ===
Kernel for Versatile SoC

The standard kernel for Versatile SoC, or for emulation with QEMU.
++++++ post.sh ++++++
# Flag to trigger /etc/init.d/purge-kernels on next reboot (fate#312018)
touch /boot/do_purge_kernels

# It must be possible to install different kernel.rpm packages in parallel.
# But in this post install script, the /boot/vmlinux symlink is replaced.
# On powerpc, the different kernels are for different board/firmware types
# They are not compatible.
wrong_boardtype() {
    echo "This kernel-@FLAVOR@.@[email protected] is for $1, it will not boot 
on this system."
    echo "The /boot/vmlinux symlink will not be created or updated."
    exit 0
}
if [ -f /proc/cpuinfo ]; then
    case "@FLAVOR@-@RPM_TARGET_CPU@" in
        
vanilla-ppc64|default-ppc64|ps3-ppc64|ppc64-ppc64|kdump-ppc64|ps3-ppc|ppc64-ppc|kdump-ppc)
                if [ -d /proc/iSeries -o ! -d /proc/ppc64 ]; then
                        wrong_boardtype "OpenFirmware based 64bit machines"
                fi
        ;;
        vanilla-ppc|default-ppc)
                if [ -d /proc/ppc64 -o -d /proc/iSeries ]; then
                        wrong_boardtype "32bit systems"
                fi
        ;;
        *)
        ;;
    esac
fi

suffix=
case @FLAVOR@ in
    kdump|ps3|xen*|ec2|vanilla)
        suffix=-@FLAVOR@
        ;;
esac
for x in /boot/@IMAGE@ /boot/initrd; do
    rm -f $x$suffix
    ln -s ${x##*/}-@KERNELRELEASE@-@FLAVOR@ $x$suffix
done

# Add symlinks of compatible modules to /lib/modules/$krel/weak-updates/, 
# run depmod and mkinitrd
wm2=/usr/lib/module-init-tools/weak-modules2
if [ -x $wm2 ]; then
    if [ @BASE_PACKAGE@ = 1 ]; then
        /bin/bash -${-/e/} $wm2 --add-kernel @KERNELRELEASE@-@FLAVOR@
    else
        nvr=@SUBPACKAGE@-@RPM_VERSION_RELEASE@
        rpm -ql $nvr | /bin/bash -${-/e/} $wm2 --add-kernel-modules 
@KERNELRELEASE@-@FLAVOR@
    fi
else
    echo "$wm does not exist, please run depmod and mkinitrd manually" >&2
fi

message_install_bl () {
        echo "You may need to setup and install the boot loader using the"
        echo "available bootloader for your platform (e.g. grub, lilo, zipl, 
...)."
}

run_bootloader () {
    if [ -f /etc/sysconfig/bootloader ] &&
            [ -f /boot/grub/menu.lst -o \
              -f /etc/lilo.conf      -o \
              -f /etc/elilo.conf     -o \
              -f /etc/zipl.conf ]
    then
        return 0
    else
        return 1
    fi
}

# exit out early for Moblin as we don't want to touch the bootloader menu
if [ -f /etc/SuSE-moblin-release ] ; then
    exit 0
fi

if [ -f /etc/fstab -a ! -e /.buildenv ] ; then
    # only run the bootloader if the usual bootloader configuration
    # files are there -- this is different on every architecture
    initrd=initrd-@KERNELRELEASE@-@FLAVOR@
    if [ -e /boot/$initrd -o ! -e /lib/modules/@KERNELRELEASE@-@FLAVOR@ ] && \
       run_bootloader ; then
       [ -e /boot/$initrd ] || initrd=
        if [ -x /usr/lib/bootloader/bootloader_entry ]; then
            /usr/lib/bootloader/bootloader_entry \
                add \
                @FLAVOR@ \
                @KERNELRELEASE@-@FLAVOR@ \
                @IMAGE@-@KERNELRELEASE@-@FLAVOR@ \
                $initrd
        else
            message_install_bl
        fi
    fi
else
    message_install_bl
fi

# vim: set sts=4 sw=4 ts=8 noet:
++++++ postun.sh ++++++
# If a kernel package is removed before the next reboot, we assume that the
# multiversion variable in /etc/zypp/zypp.conf is not configured and we delete
# the flag again (fate#312018)
rm -f /boot/do_purge_kernels

wm2=/usr/lib/module-init-tools/weak-modules2
nvr=@SUBPACKAGE@-@RPM_VERSION_RELEASE@

if [ -e /boot/System.map-@KERNELRELEASE@-@FLAVOR@ ]; then
    # the same package was reinstalled or just rebuilt, otherwise the files
    # would have been deleted by now
    # do not remove anything in this case (bnc#533766)
    rm -f /var/run/rpm-$nvr-modules
    exit 0
fi

if [ @BASE_PACKAGE@ = 0 ]; then
    if [ -x $wm2 ]; then
        /bin/bash -${-/e/} $wm2 --remove-kernel-modules 
@KERNELRELEASE@-@FLAVOR@ < /var/run/rpm-$nvr-modules
    fi
    rm -f /var/run/rpm-$nvr-modules
    exit 0
fi
# Remove symlinks from /lib/modules/$krel/weak-updates/.
if [ -x $wm2 ]; then
    /bin/bash -${-/e/} $wm2 --remove-kernel @KERNELRELEASE@-@FLAVOR@
fi

# exit out early for Moblin as we don't want to touch the bootloader menu
if [ -f /etc/SuSE-moblin-release ] ; then
    exit 0
fi

# remove fstab check once perl-Bootloader can cope with it
if [ -f /etc/fstab ]; then
        if [ -x /usr/lib/bootloader/bootloader_entry ]; then
            /usr/lib/bootloader/bootloader_entry \
                remove \
                @FLAVOR@ \
                @KERNELRELEASE@-@FLAVOR@ \
                @IMAGE@-@KERNELRELEASE@-@FLAVOR@ \
                initrd-@KERNELRELEASE@-@FLAVOR@
        fi
fi
++++++ pre.sh ++++++
# see bug #259303
# this script runs when the kernel gets updated with YaST
# YaST calls rpm always with -U
# -U replaces all packages with the new one
# rpm removes the files from the old packages after the postinstall script ran
# this will double the required space below /boot
# remove the files from the old packages to make room for the new initrd
# rpm may complain about low disk space if /boot/vmlinux does not fit
if [ @BASE_PACKAGE@ = 1 -a "$YAST_IS_RUNNING" != "" ]; then
        mydf="$( POSIXLY_CORRECT=1 df -P /boot/ | awk '/^(\/|-[[:blank:]])/{ 
print $4}' )"
        if test "$mydf" != "" ; then
                echo "Free diskspace below /boot: $mydf blocks"
                # echo "512 byte blocks: $(( 2 * 1024 * 20 ))"
                if test "$mydf" -lt  "40960" ; then
                        echo "make room for new kernel '@FLAVOR@' because there 
are less than 20MB available."
                        # disabled because it breaks patch rpms
                        #rm -fv /boot/@IMAGE@-*-@FLAVOR@
                        rm -fv /boot/initrd-*-@FLAVOR@
                fi
        fi
fi
++++++ preun.sh ++++++
if [ @BASE_PACKAGE@ = 0 ]; then
    nvr=@SUBPACKAGE@-@RPM_VERSION_RELEASE@
    rpm -ql $nvr | grep '\.ko$' > /var/run/rpm-$nvr-modules
fi
++++++ series.conf ++++++
++++ 1019 lines (skipped)

++++++ source-post.sh ++++++
relink() {
    if [ -h "$2" ]; then
        local old=$(readlink "$2")
        [ "$old" = "$1" ] && return 0
        echo "Changing symlink $2 from $old to $1"
    elif [ -e "$2" ]; then
        echo "Replacing file $2 with symlink to $1"
    fi
    rm -f "$2" \
    && ln -s "$1" "$2"
}

relink linux-@KERNELRELEASE@@SRCVARIANT@ /usr/src/linux@SRCVARIANT@
++++++ source-timestamp ++++++
2014-12-17 18:57:03 +0100
GIT Revision: 8210f77d2c2948f453bd0bb26f872f517d68cc91
GIT Branch: openSUSE-13.1
++++++ split-modules ++++++
#!/bin/bash
# 
# given a Module.base and modules.dep, generate list
# of base / supported / unsupported modules

set -e
export LC_COLLATE=C

usage()
{
        echo "Usage: ${0##*/} -b Module.base [-d dir] [-i] [-e] [-o outdir]"
        echo "  -i    Ignore supported.conf errors"
        echo "  -e    Create the -extra filelist (otherwise, treat all modules 
as supported)"
}

options=$(getopt -o b:d:o:ie -- "$@")
if test $? -ne 0; then
        usage >&2
        exit 1
fi
eval set -- "$options"
opt_base=
opt_out=.
opt_dir=.
opt_ignore_errors=false
opt_extra=false
while test $# -gt 0; do
        opt=$1
        shift
        case "$opt" in
        -b | -d | -o)
                arg=$1
                shift
        esac
        case "$opt" in
        -b)
                opt_base=$arg ;;
        -d)
                opt_dir=$arg ;;
        -o)
                opt_out=$arg ;;
        -i)
                opt_ignore_errors=true ;;
        -e)
                opt_extra=true ;;
        --)
                break ;;
        *)
                echo "Unknown option $opt" >&2
                exit 1
        esac
done
if test -z "$opt_base"; then
        usage >&2
        exit 1
fi

trap 'rm -rf "$tmp"' EXIT
tmp=$(mktemp -d)
mkdir "$tmp/empty"

find "$opt_dir" -type f -name '*.ko' -printf '/%P\n' | \
        awk -F/ '{ n=$NF; gsub(/-/, "_", n); sub(/\.ko$/, "", n); print n " " 
$0; }' | \
        sort >"$tmp/all"

err=false
while read mod path; do
        if $opt_extra; then
                support=$(/sbin/modinfo -F supported "$opt_dir/$path")
        else
                support=yes
        fi
        case "$support" in
        yes | external)
                echo "$mod"
                ;;
        no)
                ;;
        "")
                echo "warning: ${path#/lib/modules/*/kernel/} not listed in 
supported.conf" >&2
                ;;
        *)
                echo "error: invalid support flag for $mod: $support" >&2
                err=true
                ;;
        esac
done <"$tmp/all" | sort -u >"$tmp/supp"
if $err; then
        exit 1
fi

modules_dep=$(find "$opt_dir" -type f -name modules.dep)
if test -z "$modules_dep"; then
        echo "Cannot find modules.dep in $opt_dir" >&2
        exit 1
fi
(
        echo '%:
        @echo $@
ifdef EXPLAIN
        @for dep in $^; do echo "$$dep needed by $@"; done >> $(EXPLAIN)
endif
'
        sed -r 's:[^ ]*/([^/]*)\.ko\>:\1:g; y/-/_/' "$modules_dep"
) >"$tmp/dep"

add_dependent_modules()
{
        xargs -r make EXPLAIN=$1 -rRs -C "$tmp/empty" -f "$tmp/dep" | sort -u
}

# base
sed 'y/-/_/' <"$opt_base" | add_dependent_modules >"$tmp/base"
join -j 1 -o 2.2 "$tmp/base" "$tmp/all" >"$opt_out/base-modules"

# main
add_dependent_modules "$tmp/supp-explain" <"$tmp/supp" >"$tmp/supp-all"
if ! cmp -s "$tmp/supp" "$tmp/supp-all"; then
        echo "The following unsupported modules are used by supported modules:" 
>&2
        join -j1 -a2 <(sort "$tmp/supp-explain") \
                 <(join -v2 "$tmp/supp" "$tmp/supp-all") >&2
        echo "Please fix supported.conf." >&2
        if ! $opt_ignore_errors; then
                exit 1
        fi
fi
join -j 1 -o 2.2 "$tmp/supp-all" "$tmp/all" >"$opt_out/main-modules"

# unsupported
join -j 1 -v 2 -o 2.2 "$tmp/supp-all" "$tmp/all" >"$opt_out/unsupported-modules"

exit 0


++++++ supported.conf ++++++
++++ 2726 lines (skipped)

++++++ try-disable-staging-driver ++++++
#!/bin/bash

#############################################################################
# Copyright (c) 2011 Novell, Inc.
# All Rights Reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, contact Novell, Inc.
#
# To contact Novell about this file by physical or electronic mail,
# you may find current contact information at www.novell.com
#############################################################################


# If make fails, check if it happened due to a staging driver and disable it.
# That way, staging does not spoil automatic package building and we also
# do not need to worry about forgetting to reenable manually disabled drivers.

if test -L source; then
        source="source"
else
        source="."
fi
makefile="$source/drivers/staging/Makefile"
skipped_options=staging-skipped-options
logfile=$1

if test -z "$logfile"; then
        echo "Usage: $0 logfile" >&2
        exit 1
fi
if ! test -f "$logfile"; then
        echo "$logfile not found" >&2
        exit 1
fi

# safety precaution
if test "0$(wc -l "$skipped_options" 2>/dev/null)" -gt 20; then
        echo "Possible loop detected in $0, exiting after 20 attempts" >&2
        exit 1
fi

# find out if the error happened in drivers/staging
dir=$(sed -rn 's@.*/drivers/staging/([^/]*)/.*: error: .*@\1@p; T; q' 
"$logfile")
if test -z "$dir"; then
        exit 1
else
        echo "Build failed due to drivers/staging/$dir"
fi

option=$(sed -n 's/obj-\$(\(.*\))[[:space:]]*+=[[:space:]]*'"$dir"'\//\1/p' 
"$makefile")
if test -z "$option"; then
        echo "Cannot determine config option to skip drivers/staging/$dir" >&2
        exit 1
fi
# we need to be carefull not to loop endlessly
if grep -qsFx "$option" "$skipped_options"; then
        echo "$option has already been disabled, but drivers/staging/$dir is 
still failing" >&2
        exit 1
fi

echo "Trying to disable $option"
"$source/scripts/config" --disable "$option"
if ! make silentoldconfig $MAKE_ARGS || grep "^$option" .config; then
        echo "Could not disable $option" >&2
        exit 1
fi
echo "$option" >>"$skipped_options"

exit 0
-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to