Hello community,

here is the log from the commit of package kernel-source.2918 for 
openSUSE:12.3:Update checked in at 2014-08-01 14:30:03
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:12.3:Update/kernel-source.2918 (Old)
 and      /work/SRC/openSUSE:12.3:Update/.kernel-source.2918.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "kernel-source.2918"

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

--- /dev/null   2014-07-24 01:57:42.080040256 +0200
+++ /work/SRC/openSUSE:12.3:Update/.kernel-source.2918.new/kernel-cubox.changes 
2014-08-01 14:30:05.000000000 +0200
@@ -0,0 +1,29818 @@
+-------------------------------------------------------------------
+Thu Jul 10 13:22:12 CEST 2014 - oneu...@suse.de
+
+- HID: logitech-dj: Fix USB 3.0 issue (bnc#788080).
+- commit 9b06319
+
+-------------------------------------------------------------------
+Tue Jul  8 21:17:54 CEST 2014 - jbo...@suse.cz
+
+- sctp: Fix sk_ack_backlog wrap-around problem (bnc#885422,
+  CVE-2014-4667).
+- commit 73ed3df
+
+-------------------------------------------------------------------
+Mon Jul  7 11:13:30 CEST 2014 - vba...@suse.cz
+
+- shmem: fix faulting into a hole while it's punched, take 2
+  (bnc#883518, CVE-2014-4171).
+- commit 6a1ec77
+
+-------------------------------------------------------------------
+Fri Jul  4 11:33:22 CEST 2014 - mho...@suse.cz
+
+- ptrace,x86: force IRET path after a ptrace_stop() (bnc#885725,
+  CVE-2014-4699).
+- commit 811c95d
+
+-------------------------------------------------------------------
+Thu Jul  3 10:19:04 CEST 2014 - to...@suse.de
+
+- x86_32, entry: Do syscall exit work on badsys (CVE-2014-4508)
+  (bnc#883724, CVE-2014-4508).
+- commit 1fc41bd
+
+-------------------------------------------------------------------
+Thu Jun 26 11:34:21 CEST 2014 - ti...@suse.de
+
+- Fix kABI breakage due to addition of user_ctl_lock (bnc#883795).
+- ALSA: control: Make sure that id->index does not overflow
+  (CVE-2014-4656,bnc#883795).
+- ALSA: control: Handle numid overflow (CVE-2014-4656,bnc#883795).
+- ALSA: control: Don't access controls outside of protected
+  regions (CVE-2014-4653,bnc#883795).
+- ALSA: control: Fix replacing user controls
+  (CVE-2014-4654,CVE-2014-4655,bnc#883795).
+- ALSA: control: Protect user controls against concurrent access
+  (CVE-2014-4652,bnc#883795).
+- commit 1e02ed9
+
+-------------------------------------------------------------------
+Wed Jun 25 20:38:11 CEST 2014 - je...@suse.de
+
+- fs,userns: Change inode_capable to capable_wrt_inode_uidgid
+  (bnc#882189 CVE-2014-4014). (Updated previous commit subject)
+- commit 910d66f
+
+-------------------------------------------------------------------
+Wed Jun 25 18:41:17 CEST 2014 - je...@suse.de
+
+- fs,userns: Change inode_capable to inode_capable (bnc#882189
+  CVE-2014-4014).
+- commit 371321f
+
+-------------------------------------------------------------------
+Wed Jun 25 13:23:44 CEST 2014 - jbo...@suse.cz
+
+- ipv6: don't set DST_NOCOUNT for remotely added routes
+  (bnc#867531, CVE-2014-2309).
+- commit 46fb8f3
+
+-------------------------------------------------------------------
+Wed Jun 25 00:08:14 CEST 2014 - to...@suse.de
+
+- auditsc: audit_krule mask accesses need bounds checking
+  (bnc#880484, CVE-2014-3917).
+- commit 521eadf
+
+-------------------------------------------------------------------
+Fri Jun 20 00:48:26 CEST 2014 - bpoir...@suse.de
+
+- skbuff: skb_segment: orphan frags before copying (bnc#867723
+  CVE-2014-0131).
+- commit d9caef3
+
+-------------------------------------------------------------------
+Fri Jun 13 23:50:41 CEST 2014 - bpoir...@suse.de
+
+- filter: prevent nla extensions to peek beyond the end of the
+  message (bnc#877257 CVE-2014-3144 CVE-2014-3145).
+- commit c379f65
+
+-------------------------------------------------------------------
+Thu Jun 12 12:14:10 CEST 2014 - jkos...@suse.cz
+
+- futex: Validate atomic acquisition in futex_lock_pi_atomic()
+  (bnc#880892 CVE-2014-3153).
+- futex: Forbid uaddr == uaddr2 in futex_requeue(...,
+  requeue_pi=1) (bnc#880892 CVE-2014-3153).
+- commit fcb6f8f
+
+-------------------------------------------------------------------
+Thu Jun 12 06:39:51 CEST 2014 - dch...@suse.com
+
+- vhost: fix total length when packets are too short (bnc#870576
+  CVE-2014-0077).
+- vhost: validate vhost_get_vq_desc return value (bnc#870173
+  CVE-2014-0055).
+- commit 97c3b93
+
+-------------------------------------------------------------------
+Thu Jun  5 08:35:27 CEST 2014 - dch...@suse.com
+
+- rds: prevent dereference of a NULL device in rds_iw_laddr_check
+  (bnc#871561 CVE-2014-2678).
+- rds: prevent dereference of a NULL device (bnc#869563
+  CVE-2013-7339).
+- commit be6d65b
+
+-------------------------------------------------------------------
+Tue Jun  3 00:29:10 CEST 2014 - bpoir...@suse.de
+
+- net: ipv4: current group_info should be put after using
+  (bnc#873374 CVE-2014-2851).
+- commit 31d56de
+
+-------------------------------------------------------------------
+Fri May 16 12:04:46 CEST 2014 - mho...@suse.cz
+
+- memcg: deprecate memory.force_empty knob (bnc#878274).
+- commit 14b891a
+
+-------------------------------------------------------------------
+Wed May 14 15:50:54 CEST 2014 - vba...@suse.cz
+
+- mm: try_to_unmap_cluster() should lock_page() before mlocking
+  (bnc#876102, CVE-2014-3122).
+- commit b37b16e
+
+-------------------------------------------------------------------
+Thu May  8 02:09:34 CEST 2014 - bpoir...@suse.de
+
+- netfilter: nf_nat: fix access to uninitialized buffer in IRC
+  NAT helper (bnc#860835 CVE-2014-1690).
+- commit 5978d00
+
+-------------------------------------------------------------------
+Wed May  7 14:35:52 CEST 2014 - jkos...@suse.cz
+
+- floppy: don't write kernel-only members to FDRAWCMD ioctl output
+  (bnc#875798 CVE-2014-1737 CVE-2014-1738).
+- floppy: ignore kernel-only members in FDRAWCMD ioctl input
+  (bnc#875798 CVE-2014-1737 CVE-2014-1738).
+- commit 48e09bb
+
+-------------------------------------------------------------------
+Tue May  6 18:17:51 CEST 2014 - jbo...@suse.cz
+
+- net: sctp: fix sctp_sf_do_5_1D_ce to verify if we/peer is AUTH
+  (bnc#866102, CVE-2014-0101).
+- commit bcd8077
+
+-------------------------------------------------------------------
+Mon May  5 10:24:08 CEST 2014 - jsl...@suse.cz
+
+- n_tty: Fix n_tty_write crash when echoing in raw mode
+  (bnc#871252 bnc#875690 CVE-2014-0196).
+- commit e8d5188
+
+-------------------------------------------------------------------
+Wed Apr 16 11:01:59 CEST 2014 - jbeul...@suse.com
+
+- Refresh Xen patches.
+- commit fb1602b
+
+-------------------------------------------------------------------
+Tue Apr 15 16:03:01 CEST 2014 - je...@suse.com
+
+- netfilter: nf_ct_sip: support Cisco 7941/7945 IP phones
+  (bnc#873717).
+- commit 67d2031
+
+-------------------------------------------------------------------
+Wed Apr  2 14:34:58 CEST 2014 - jdelv...@suse.de
+
+- Update config files: re-enable twofish crypto support
+  Software twofish crypto support was disabled in several architectures
+  since openSUSE 10.3. For i386 and x86_64 it was on purpose, because
+  hardware-accelerated alternatives exist. However for all other
+  architectures it was by accident.
+  Re-enable software twofish crypto support in arm, ia64 and ppc
+  configuration files, to guarantee that at least one implementation is
+  always available (bnc#871325).
+- commit cc0e203
+
+-------------------------------------------------------------------
+Tue Apr  1 14:36:47 CEST 2014 - jdelv...@suse.de
+
++++ 29621 more lines (skipped)
++++ between /dev/null
++++ and 
/work/SRC/openSUSE:12.3:Update/.kernel-source.2918.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-highbank.changes: same change
New Changes file:

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

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

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

kernel-s390.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-versatile.changes: same change
New Changes file:

kernel-xen.changes: same change

New:
----
  README.KSYMS
  README.SUSE
  apply-patches
  arch-symbols
  check-for-config-changes
  check-supported-list
  compute-PATCHVERSION.sh
  config-options.changes.txt
  config.addon.tar.bz2
  config.conf
  config.sh
  config.tar.bz2
  configtool.pl
  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-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-highbank.changes
  kernel-highbank.spec
  kernel-imx51.changes
  kernel-imx51.spec
  kernel-module-subpackage
  kernel-omap2plus.changes
  kernel-omap2plus.spec
  kernel-pae.changes
  kernel-pae.spec
  kernel-s390.changes
  kernel-s390.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-versatile.changes
  kernel-versatile.spec
  kernel-xen.changes
  kernel-xen.spec
  linux-3.7.tar.bz2
  log.sh
  macros.kernel-source
  minmem
  mkspec
  modversions
  needed_space_in_mb
  old-packages.conf
  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 ++++++
++++ 946 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/
#

# norootforbuild

%define patchversion 3.7.10
%define variant %{nil}

%include %_sourcedir/kernel-spec-macros

Name:           kernel-docs
Summary:        Kernel Documentation
Version:        3.7.10
%if 0%{?is_kotd}
Release:        <RELEASE>.g9b06319
%else
Release:        0
%endif
BuildRequires:  docbook-toys docbook-utils ghostscript_any libjpeg-devel 
texlive transfig xmlto xorg-x11-devel
BuildRequires:  kernel-source%variant
Url:            http://www.kernel.org/
License:        GPL-2.0
Group:          Documentation/Man
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
thecurrent 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 ++++++
++++ 952 lines (skipped)

kernel-exynos.spec: same change
kernel-highbank.spec: same change
kernel-imx51.spec: same change
kernel-omap2plus.spec: same change
kernel-pae.spec: same change
kernel-s390.spec: same change
++++++ 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/
#

# norootforbuild
# icecream 0

%define srcversion 3.7
%define patchversion 3.7.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
Version:        3.7.10
%if 0%{?is_kotd}
Release:        <RELEASE>.g9b06319
%else
Release:        0
%endif
License:        GPL-2.0
Group:          Development/Sources
Url:            http://www.kernel.org/
AutoReqProv:    off
BuildRequires:  coreutils sed
BuildRequires:  fdupes
Requires(post): coreutils sed
Provides:       multiversion(kernel)
Provides:       linux
Provides:       %name = %version-%source_rel
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
Source34:       check-supported-list
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
Source60:       config.sh
Source61:       compute-PATCHVERSION.sh
Source62:       old-packages.conf
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
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 = %version-%release

%(chmod +x 
%_sourcedir/{guards,apply-patches,check-for-config-changes,check-supported-list,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:       multiversion(kernel)
Provides:       kernel-devel%variant = %version-%source_rel

%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:       multiversion(kernel)
Provides:       %name-vanilla = %version-%source_rel

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


%source_timestamp
%prep
if ! [ -e %_sourcedir/linux-%srcversion.tar.bz2 ]; then
    echo "Please get a copy of linux-%srcversion.tar.bz2 from" \
         "ftp://ftp.kernel.org/pub/linux/kernel/v2.6/.";
fi

echo "Symbol(s): %symbols"

# Unpack all sources and patches
%setup -q -c -T -a 100 -a 101 -a 102 -a 103 -a 104 -a 105 -a 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 -xjf %_sourcedir/linux-%srcversion.tar.bz2
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-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)
/usr/src/linux%variant-%kernelrelease/README.SUSE

%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-module-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/
#

# norootforbuild

%define variant %{nil}

%include %_sourcedir/kernel-spec-macros

Name:           kernel-syms
Summary:        Kernel Symbol Versions (modversions)
Version:        3.7.10
%if %using_buildservice
%if 0%{?is_kotd}
Release:        <RELEASE>.g9b06319
%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
License:        GPL-2.0
Group:          Development/Sources
Url:            http://www.kernel.org/
AutoReqProv:    off
BuildRequires:  coreutils
%ifarch armv7hl
Requires:       kernel-cubox-devel = %version-%source_rel
%endif
%ifarch 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-highbank-devel = %version-%source_rel
%endif
%ifarch armv7hl
Requires:       kernel-imx51-devel = %version-%source_rel
%endif
%ifarch armv7hl
Requires:       kernel-omap2plus-devel = %version-%source_rel
%endif
%ifarch %ix86
Requires:       kernel-pae-devel = %version-%source_rel
%endif
%ifarch s390
Requires:       kernel-s390-devel = %version-%source_rel
%endif
%ifarch armv5tel
Requires:       kernel-versatile-devel = %version-%source_rel
%endif
%ifarch %ix86 x86_64
Requires:       kernel-xen-devel = %version-%source_rel
%endif
Provides:       multiversion(kernel)
Provides:       %name = %version-%source_rel
Source:         README.KSYMS
Requires:       kernel-devel%variant = %version-%source_rel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
ExclusiveArch:  %ix86 armv5tel armv7hl ia64 ppc ppc64 s390 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 ++++++
++++ 954 lines (skipped)

kernel-vanilla.spec: same change
kernel-versatile.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 KERNEL SOURCES

Andreas Gruenbacher <agr...@suse.de>, SUSE Labs, 2003, 2004, 2005, 2006
Michal Marek <mma...@suse.de>, 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-$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
kernel-source 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/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

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

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

     This document and an external kernel module example.

  *  /etc/init.d/running-kernel

     Init script that adapts the kernel sources in /usr/src/linux to
     the running kernel.


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-source package.

  (2)  Install kernel-syms.$ARCH.rpm. This package 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).

       Starting with SuSE Linux 9.2 / SLES9 Service Pack 1, the
       modversion information for the running kernel is also
       contained in the kernel-$FLAVOR packages, and so for building
       modules for the running kernel, the kernel-syms package is no
       longer required.

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

Please take a look at the demo module installed under
/usr/share/doc/packages/kernel-source for a simple example of an Kernel
Module Package (KMP).


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 <garl...@suse.de>.


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-3.7.tar.bz2

    # Apply the patches

      $ for p in $(./guards < series.conf); do
          patch -d linux-3.7 -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-3.7.6-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/3.7.6-99-smp and similar. Note that this path contains the
kernel package release number. Modules from KMPs must be installed
below /lib/modules/3.7.6-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/3.7.6-100-smp/weak-updates/foo.ko ->
      /lib/modules/3.7.6-99-smp/updates/foo.ko

Modules in the weak-updates directory have lower priority than modules
in /lib/modules/3.7.6-100-smp/updates/, and higher priority than other
modules in /lib/modules/3.7.6-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/
++++++ 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 
armv5tel armv7hl
    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
        ;;
    *)
        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
++++++ check-supported-list ++++++
#! /bin/sh

sourcedir=$1
modpath=$2

# Check for modules not listed in supported.conf: First, for each module
# in the list, set mod_$module=1
for module in $($sourcedir/guards --list < $sourcedir/supported.conf \
                | sed -e 's,.*/,,'); do
    m=${module##*/}
    m=${m%.ko}
    eval mod_${m//-/_}=1
done

# Check if any installed module was not listed
status=
cd $modpath
for module in $(find . -name '*.ko' | sort); do
    case "$module" in
    ./kernel/drivers/staging/* | ./kernel/Documentation/*)
        continue ;;
    esac
    module=${module%.ko}
    m=${module##*/}
    m=${m//-/_}
    m="mod_$m"
    if [ -z "${!m}" ]; then
        if [ -z "$status" ]; then
            echo "Modules not listed in supported.conf:"
            status=1
        fi
        echo ${module#./}
    fi
done

exit $status
++++++ 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 ++++++
++++ 1429 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
+armv5tel       armv5tel/versatile
+armv7hl        armv7hl/default
+armv7hl        armv7hl/imx51
+armv7hl        armv7hl/omap2plus
-               armv7hl/u8500
+armv7hl        armv7hl/cubox
+armv7hl        armv7hl/exynos
+armv7hl        armv7hl/highbank

+s390           s390/s390
+s390 -syms     s390/trace
+s390           s390/vanilla
+s390x          s390x/default
+s390x -syms    s390x/trace
+s390x          s390x/vanilla

# Maintained by jengelh
# +sparc64      sparc64/default
# +sparc64 -syms        sparc64/net
++++++ config.sh ++++++
# The version of the main tarball to use
SRCVERSION=3.7
# variant of the kernel-source package, either empty or "-rt"
VARIANT=
# buildservice projects to build the kernel against
OBS_PROJECT=openSUSE:12.3: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";
        }
}
++++++ 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 (!-f $_) {
                        # 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/[^/]+/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 strip_ext($) {
#    local ($_) = @_;
#    s/\.(diff?|patch)$//;
#}

#sub try_ext($) {
#    my ($path) = @_;
#    for my $p in (($path, "$path.diff", "$path.dif", "$path.patch")) {
#       return $p
#           if (-f $p);
#    }
#    return undef;
#}

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) {
            print "Unused: $file\n" if $ref == 0;
            $problems++;
        }
        if ($ref > 1) {
            print "Warning: multiple uses: $file\n" if $ref > 1;
            # 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 eparated by a colon (C<:>) character. The
I<--prefix> option specifies the location of the files.

Use I<--list> to list all files independend 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 <agr...@suse.de>, 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 ++++++
++++ 868 lines (skipped)

++++++ 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/
#

# norootforbuild

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

%include %_sourcedir/kernel-spec-macros

Name:           kernel-docs@VARIANT@
Summary:        Kernel Documentation
Version:        @RPMVERSION@
%if 0%{?is_kotd}
Release:        <RELEASE>.g@COMMIT@
%else
Release:        @RELEASE@
%endif
BuildRequires:  docbook-toys docbook-utils ghostscript_any libjpeg-devel 
texlive transfig xmlto xorg-x11-devel
BuildRequires:  kernel-source%variant
Url:            http://www.kernel.org/
License:        GPL-2.0
Group:          Documentation/Man
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
thecurrent 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*}-%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*} = %_this_kmp_version
Provides: %{-n*} = %{-v*}
Provides: multiversion(kernel)
Requires: coreutils grep
Enhances: kernel-%1
AutoReqProv: on
%{-p:%{expand:%(cd %_sourcedir; cat %{-p*})}}
%description -n %{-n*}-%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*}-%1
nvr=%{-n*}-%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*}-%1
nvr=%{-n*}-%1-%_this_kmp_version-%{-r*}
rpm -ql $nvr | sed -n '/\.ko$/p' > /var/run/rpm-$nvr-modules
%postun -n %{-n*}-%1
nvr=%{-n*}-%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*}-%1
%{-f:%{expand:%(cd %_sourcedir; cat %{-f*})}}
%{!-f:%defattr (-,root,root)}
%{!-f:/lib/modules/%2-%1}
++++++ 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/
#

# norootforbuild
# 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
Version:        @RPMVERSION@
%if 0%{?is_kotd}
Release:        <RELEASE>.g@COMMIT@
%else
Release:        @RELEASE@
%endif
License:        GPL-2.0
Group:          Development/Sources
Url:            http://www.kernel.org/
AutoReqProv:    off
BuildRequires:  coreutils sed
BuildRequires:  fdupes
Requires(post): coreutils sed
Provides:       multiversion(kernel)
Provides:       linux
Provides:       %name = %version-%source_rel
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
Source34:       check-supported-list
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
Source60:       config.sh
Source61:       compute-PATCHVERSION.sh
Source62:       old-packages.conf
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
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 = %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:       multiversion(kernel)
Provides:       kernel-devel%variant = %version-%source_rel

%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:       multiversion(kernel)
Provides:       %name-vanilla = %version-%source_rel

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


%source_timestamp
%prep
if ! [ -e %_sourcedir/linux-%srcversion.tar.bz2 ]; then
    echo "Please get a copy of linux-%srcversion.tar.bz2 from" \
         "ftp://ftp.kernel.org/pub/linux/kernel/v2.6/.";
fi

echo "Symbol(s): %symbols"

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

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

# Unpack the vanilla kernel sources
tar -xjf %_sourcedir/linux-%srcversion.tar.bz2
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-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)
/usr/src/linux%variant-%kernelrelease/README.SUSE

%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-module-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/
#

# norootforbuild

%define variant @VARIANT@%{nil}

%include %_sourcedir/kernel-spec-macros

Name:           kernel-syms@VARIANT@
Summary:        Kernel Symbol Versions (modversions)
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
License:        GPL-2.0
Group:          Development/Sources
Url:            http://www.kernel.org/
AutoReqProv:    off
BuildRequires:  coreutils
@REQUIRES@
Provides:       multiversion(kernel)
Provides:       %name = %version-%source_rel
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 module-init-tools kernel-syms

# Defines %flavors_to_build and %kernel_source() as a side effect.
%_kernel_module_package(n:v:r:t:f:Xp:b) \
%{expand:%( \
        subpkg=%{-t*}%{!-t:/usr/lib/rpm/kernel-module-subpackage} \
        echo "%%define _suse_kernel_module_subpackage(n:v:r:f:p:b) 
%%{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}-kmp -v 
%{-v*}%{!-v:%version} -r %{-r*}%{!-r:%release} %{-p} %{-b} $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_" \
        )}

# kernel_module_package: simply pass on all options and arguments.
%kernel_module_package(n:v:r:t:f:xp:b) \
        %{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:b) \
        %{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();

$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("", $templates{source} =~ /\nSource\d+:[^\n]*/mg);
# Find all SourceN: foo.tar.bz2 lines and generate the NoSource:
# lines and the %setup line
my @tarballs = ($sources =~ /\nSource(\d+):[^\n]*\.tar\.bz2/mg);
my $nosource = join("\n", map { "NoSource:       $_" } @tarballs);
# 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}}),
        );
}
# 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;
        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;
        if (keys(%all_archs)) {
                do_spec('syms', "kernel-syms$variant.spec", %macros,
                        REQUIRES => $requires,
                        ARCHS => join(" ", sort(keys(%all_archs))));
        }
}

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)) {
                xopen(my $fh, '<', "$dir/kernel-$template.spec.in");
                local $/ = undef;
                $res{$template} = <$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 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 $arch;
}

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

        for my $arch (@archs) {
                my @packs = `$dir/guards $arch $flavor <$dir/old-packages.conf`;
                chomp @packs;
                next if (!@packs);
                my $rpmarch = arch2rpm($arch);
                chomp $rpmarch;
                $res .= "\%ifarch $rpmarch\n";
                $res .= "Provides:       @packs\n";
                $res .= "Obsoletes:      @packs\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);

        return if $specfile eq "kernel-source$variant.spec";
        my $changesfile = $specfile;
        $changesfile =~ s/\.spec$//;
        $changesfile .= ".changes";
        copy("$dir/kernel-source$variant.changes", $changesfile);
}

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-packages.conf ++++++
# Defines which package names to include in the Provides and
# Obsoletes tags of spec files.
#
# When generating Provides, `p' is defined. When generating
# Obsoletes, `o' is defined.
#
#   +ARCH: include only for this architecture.
#   -!symbol:  exclude unless symbol is also defined.
#
# Guards are always evaluated from left to right; the last
# guard that matches determines whether a line is included
# or not.
#
# For testing this file, run scripts/old-config.sh.
#

# i386 =================================================================
+i386   -!default       smp kernel-smp

+i386   -!pae           kernel-bigsmp

# x86_64 ===============================================================
+x86_64 -!default       smp kernel-smp

# ia64 =================================================================
+ia64   -!default       kernel-sn2

# ppc/ppc64 ============================================================

+ppc    -!ppc64         kernel-pmac64 kernel-pseries64 kernel-iseries64
+ppc64  -vanilla        kernel-kdump

# s390/s390x ===========================================================
+s390   -!s390          kernel-32bit

+s390x  -!s390x         kernel-64bit
++++++ 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-imx51 ===
Kernel for Freescale's iMX SoC

The standard kernel for Freescale's i.MX51 SoC, as found in
devices like the Genesi EfikaMX family.

=== kernel-omap2plus ===
Kernel for Texas instrument's OMAP SoC

The standard kernel for Texas instrument's OMAP SoC, as
found in devices like the PandaBoard and BeagleBoard.

=== kernel-u8500 ===
Kernel for ST-Ericsson's Nova SoC

The standard kernel for ST-Ericsson's Nova SoC, as found in
devices like the Snowball.

=== 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-highbank ===
Kernel for Calxeda Highbank SoC

The standard kernel for Calxeda's Highbank SoC, as found in the HP Moonshot 
project.

=== 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@.@RPM_TARGET_CPU@.rpm 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 ++++++
++++ 1612 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-07-10 13:22:12 +0200
GIT Revision: 9b06319b2b729143615b70ed95264847cc46f1f1
GIT Branch: openSUSE-12.3
++++++ split-modules ++++++
#!/bin/bash
# 
# given a Module.supported, 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 -s Module.supported [-d dir] [-i] 
[-o outdir]"
}

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

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
sed 's/ .*//; y/-/_/' "$opt_supp" | sort -u >"$tmp/supp"
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 ++++++
++++ 2724 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: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to