rpms/kernel/devel kernel-2.6.spec,1.3253,1.3254

Jarod Wilson (jwilson) fedora-extras-commits at redhat.com
Tue Jul 3 15:24:14 UTC 2007


Author: jwilson

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv21023

Modified Files:
	kernel-2.6.spec 
Log Message:
- New kernel versioning scheme, intended to more closely
  match with that of the upstream Linus kernel
- Add --with/without debuginfo flag
- Redundancy reduction wrt kernel-debug flags
- Make one-off kernel-vanilla build correctly again



Index: kernel-2.6.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel-2.6.spec,v
retrieving revision 1.3253
retrieving revision 1.3254
diff -u -r1.3253 -r1.3254
--- kernel-2.6.spec	3 Jul 2007 05:59:02 -0000	1.3253
+++ kernel-2.6.spec	3 Jul 2007 15:23:38 -0000	1.3254
@@ -1,5 +1,50 @@
 Summary: The Linux kernel (the core of the Linux operating system)
 
+# For a stable, released kernel, released_kernel should be 1. For rawhide and/or
+# a kernel built from an rc or git snapshot, released_kernel should be 0.
+%define released_kernel 0
+
+# Versions of various parts
+
+# Polite request for people who spin their own kernel rpms:
+# please modify the "buildid" define in a way that identifies
+# that the kernel isn't the stock distribution kernel, for example,
+# by setting the define to ".local" or ".bz123456"
+#
+#% define buildid .local
+
+# fedora_build defines which build revision of this kernel version we're building. In the
+# non-kernel world, this is analogous to the Release: field, and is formatted similarly.
+%define fedora_build 1%{?dist}
+
+# base_sublevel is the kernel version we're starting with and patching
+# on top of -- for example, 2.6.22-rc7-git1 starts with a 2.6.21 base,
+# which yields a base_sublevel of 21.
+%define base_sublevel 21
+
+## If this is a released kernel ##
+%if %{released_kernel}
+# Do we have a 2.6.21.y update to apply?
+%define stable_update 5
+# Set rpm version accordingly
+%if 0%{stable_update}
+%define stablerev .%{stable_update}
+%endif
+%define rpmversion 2.6.%{base_sublevel}%{stablerev}
+
+## The not-released-kernel case ##
+%else
+# The next upstream release sublevel (base_sublevel+1)
+%define upstream_sublevel 22
+# The rc snapshot level
+%define rcrev 7
+# The git snapshot level
+%define gitrev 0
+# Set rpm version accordingly
+%define rpmversion 2.6.%{upstream_sublevel}
+%endif
+# Nb: The above rcrev and gitrev values automagically define Patch00 and Patch01 below.
+
 # What parts do we want to build?  We must build at least one kernel.
 # These are the kernels that are built IF the architecture allows it.
 # All should default to 1 (enabled) and be flipped to 0 (disabled)
@@ -10,30 +55,32 @@
 # to 0 in here to disable them.
 #
 # standard kernel
-%define with_up      %{?_without_up:      0} %{?!_without_up:      1}
+%define with_up        %{?_without_up:        0} %{?!_without_up:        1}
 # kernel-smp (only valid for ppc 32-bit, sparc64)
-%define with_smp     %{?_without_smp:     0} %{?!_without_smp:     1}
+%define with_smp       %{?_without_smp:       0} %{?!_without_smp:       1}
 # kernel-PAE (only valid for i686)
-%define with_pae     %{?_without_pae:     0} %{?!_without_pae:     1}
+%define with_pae       %{?_without_pae:       0} %{?!_without_pae:       1}
 # kernel-xen
-%define with_xen     %{?_without_xen:     0} %{?!_without_xen:     1}
+%define with_xen       %{?_without_xen:       0} %{?!_without_xen:       1}
 # kernel-kdump
-%define with_kdump   %{?_without_kdump:   0} %{?!_without_kdump:   1}
+%define with_kdump     %{?_without_kdump:     0} %{?!_without_kdump:     1}
 # kernel-debug
-%define with_debug   %{?_without_debug:   0} %{!?_without_debug:   1}
+%define with_debug     %{?_without_debug:     0} %{!?_without_debug:     1}
 # kernel-doc
-%define with_doc     %{?_without_doc:     0} %{?!_without_doc:     1}
+%define with_doc       %{?_without_doc:       0} %{?!_without_doc:       1}
 # kernel-headers
-%define with_headers %{?_without_headers: 0} %{?!_without_headers: 1}
+%define with_headers   %{?_without_headers:   0} %{?!_without_headers:   1}
+# kernel-debuginfo
+%define with_debuginfo %{?_without_debuginfo: 0} %{!?_without_debuginfo: 1}
 
 # Additional options for user-friendly one-off kernel building:
 #
 # Only build the base kernel (--with baseonly):
-%define with_baseonly %{?_with_baseonly: 1} %{?!_with_baseonly: 0}
+%define with_baseonly  %{?_with_baseonly:     1} %{?!_with_baseonly:     0}
 # Only build the smp kernel (--with smponly):
-%define with_smponly  %{?_with_smponly:  1} %{?!_with_smponly:  0}
+%define with_smponly   %{?_with_smponly:      1} %{?!_with_smponly:      0}
 # Only build the xen kernel (--with xenonly):
-%define with_xenonly  %{?_with_xenonly:  1} %{?!_with_xenonly:  0}
+%define with_xenonly   %{?_with_xenonly:      1} %{?!_with_xenonly:      0}
 
 # Whether or not to gpg sign modules
 %define with_modsign 1
@@ -54,23 +101,28 @@
 # See also 'make debug' and 'make release'.
 %define debugbuildsenabled 0
 
-%if ! %{debugbuildsenabled}
-%define with_debug 0
+# Want to build a vanilla kernel build without any non-upstream patches?
+# (well, almost none, we need nonintconfig for build purposes). Default to 0 (off).
+%define with_vanilla %{?_with_vanilla: 1} %{?!_with_vanilla: 0}
+
+# pkg_release is what we'll fill in for the rpm Release: field
+%if %{released_kernel}
+%define pkg_release %{fedora_build}%{?buildid}
+%else
+%if 0%{?rcrev}
+%define rctag .rc%rcrev
+%endif
+%if 0%{?gitrev}
+%define gittag .git%gitrev
+%if !0%{?rcrev}
+%define rctag .rc0
+%endif
+%endif
+%define pkg_release 0%{?rctag}%{?gittag}.%{fedora_build}%{?buildid}
 %endif
 
-# Versions of various parts
-
-# Polite request for people who spin their own kernel rpms:
-# please modify the "buildid" define in a way that identifies
-# that the kernel isn't the stock distribution kernel, for example,
-# by setting the define to ".local" or ".bz123456"
-#
-#% define buildid .local
-%define sublevel 21
-%define kversion 2.6.%{sublevel}
-%define rpmversion 2.6.%{sublevel}
-%define specrelease %(R="$Revision$"; RR="${R##: }"; echo ${RR%%?})%{?dist}%{?buildid}
-%define release %{specrelease}
+# The kernel tarball/base version
+%define kversion 2.6.%{base_sublevel}
 
 %define make_target bzImage
 %define kernel_image x86
@@ -87,6 +139,10 @@
 %define nopatches 0
 %endif
 
+%if %{with_vanilla}
+%define nopatches 1
+%endif
+
 %if %{nopatches}
 %define includexen 0
 %define with_xen 0
@@ -99,7 +155,15 @@
 %if 0%{?upstream_branch:1}
 %define using_upstream_branch 1
 %define variant -%{upstream_branch}%{?variant_fedora}
-%define release %{upstream_branch_release}.%{specrelease}
+%define pkg_release %{upstream_branch_release}.%{pkg_release}
+%endif
+
+%if !%{debugbuildsenabled}
+%define with_debug 0
+%endif
+
+%if !%{with_debuginfo}
+%define _enable_debug_packages 0
 %endif
 
 # if requested, only build base kernel
@@ -109,7 +173,6 @@
 %define with_xen 0
 %define with_kdump 0
 %define with_debug 0
-%define debugbuildsenabled 0
 %endif
 
 # if requested, only build smp kernel
@@ -119,7 +182,6 @@
 %define with_xen 0
 %define with_kdump 0
 %define with_debug 0
-%define debugbuildsenabled 0
 %endif
 
 # if requested, only build xen kernel
@@ -129,7 +191,6 @@
 %define with_pae 0
 %define with_kdump 0
 %define with_debug 0
-%define debugbuildsenabled 0
 %endif
 
 %define all_x86 i386 i686
@@ -289,6 +350,7 @@
 %define with_pae 0
 %define with_xen 0
 %define with_kdump 0
+%define with_debuginfo 0
 %define _enable_debug_packages 0
 %endif
 
@@ -326,7 +388,7 @@
 Group: System Environment/Kernel
 License: GPLv2
 Version: %{rpmversion}
-Release: %{release}
+Release: %{pkg_release}
 # DO NOT CHANGE THE 'ExclusiveArch' LINE TO TEMPORARILY EXCLUDE AN ARCHITECTURE BUILD.
 # SET %nobuildarches (ABOVE) INSTEAD
 ExclusiveArch: noarch %{all_x86} x86_64 ppc ppc64 ia64 sparc sparc64 s390x alpha alphaev56
@@ -405,7 +467,20 @@
 ### BRANCH PATCH ###
 %else
 # Here should be only the patches up to the upstream canonical Linus tree.
-Patch00: patch-2.6.22-rc7.bz2
+# These are automagically defined by the rcrev and gitrev values set up 
+# near the top of this spec file.
+%if 0%{?rcrev}
+Patch00: patch-2.6.%{upstream_sublevel}-rc%{rcrev}.bz2
+%if 0%{?gitrev}
+Patch01: patch-2.6.%{upstream_sublevel}-rc%{rcrev}-git%{gitrev}.bz2
+%endif
+%else
+# pre-{base_sublevel+1}-rc1 case
+%if 0%{?gitrev}
+Patch00: patch-2.6.%{base_sublevel}-git%{gitrev}.bz2
+%endif
+%endif
+
 %endif
 
 %if !%{nopatches}
@@ -836,7 +911,7 @@
 if [ ! -d kernel-%{kversion}/vanilla ]; then
   # Ok, first time we do a make prep.
   rm -f pax_global_header
-%setup -q -n kernel-%{version} -c
+%setup -q -n kernel-%{kversion} -c
   mv linux-%{kversion} vanilla
 else
   # We already have a vanilla dir.
@@ -874,9 +949,20 @@
 %else
 
 # Update to latest upstream.
-ApplyPatch patch-2.6.22-rc7.bz2
+%if 0%{?rcrev}
+ApplyPatch patch-2.6.%{upstream_sublevel}-rc%{rcrev}.bz2
+%if 0%{?gitrev}
+ApplyPatch patch-2.6.%{upstream_sublevel}-rc%{rcrev}-git%{gitrev}.bz2
+%endif
+%else
+# pre-{base_sublevel+1}-rc1 case
+%if 0%{?gitrev}
+ApplyPatch patch-2.6.%{base_sublevel}-git%{gitrev}.bz2
+%endif
+%endif
 
 %endif
+
 %if !%{nopatches}
 
 # Ingo's new scheduler.
@@ -968,7 +1054,7 @@
 ApplyPatch linux-2.6-debug-taint-vm.patch
 ApplyPatch linux-2.6-debug-spinlock-taint.patch
 
-%if ! %{debugbuildsenabled}
+%if !%{debugbuildsenabled}
 # Only spew extra warnings on rawhide builds.
 ApplyPatch linux-2.6-debug-extra-warnings.patch
 # Turn slub debug on by default in rawhide
@@ -1083,7 +1169,7 @@
 
 cp -f %{all_arch_configs} .
 
-%if ! %{with_debug}
+%if !%{with_debug}
 rm -f kernel-%{kversion}-*-debug.config
 %endif
 
@@ -1097,14 +1183,6 @@
   cat .config >> configs/$i
 done
 
-rm -f $RPM_SOURCE_DIR/kernel-*.config
-
-# make sure the kernel has the sublevel we know it has. This looks weird
-# but for -pre and -rc versions we need it since we only want to use
-# the higher version when the final kernel is released.
-perl -p -i -e "s/^SUBLEVEL.*/SUBLEVEL = %{sublevel}/" Makefile
-perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -prep/" Makefile
-
 # get rid of unwanted files resulting from patch fuzz
 find . \( -name "*.orig" -o -name "*~" \) -exec rm -f {} \; >/dev/null
 
@@ -1182,7 +1260,7 @@
 
     # Start installing the results
 
-%if "%{_enable_debug_packages}" == "1"
+%if %{with_debuginfo}
     mkdir -p $RPM_BUILD_ROOT/usr/lib/debug/boot
     mkdir -p $RPM_BUILD_ROOT/usr/lib/debug/%{image_install_path}
 %endif
@@ -1266,7 +1344,7 @@
     #
     # save the vmlinux file for kernel debugging into the kernel-debuginfo rpm
     #
-%if "%{_enable_debug_packages}" == "1"
+%if %{with_debuginfo}
     mkdir -p $RPM_BUILD_ROOT/usr/lib/debug/lib/modules/$KernelVer
     cp vmlinux $RPM_BUILD_ROOT/usr/lib/debug/lib/modules/$KernelVer
 %endif
@@ -1403,15 +1481,15 @@
 # This macro is used by %%install, so we must redefine it before that.
 %define debug_package %{nil}
 
-%if "%{_enable_debug_packages}" == "1"
+%if %{with_debuginfo}
 %ifnarch noarch
 %global __debug_package 1
 %files debuginfo-common
 %defattr(-,root,root)
-/usr/src/debug/%{name}-%{version}/linux-%{kversion}.%{_target_cpu}
+/usr/src/debug/kernel-%{kversion}/linux-%{kversion}.%{_target_cpu}
 %if %{includexen}
 %if %{with_xen}
-/usr/src/debug/%{name}-%{version}/xen
+/usr/src/debug/kernel-%{kversion}/xen
 %endif
 %endif
 %dir /usr/src/debug
@@ -1705,7 +1783,7 @@
 %define elf_image_install_path %{?kernel_image_elf:%{image_install_path}}
 
 %if %{with_up}
-%if "%{_enable_debug_packages}" == "1"
+%if %{with_debuginfo}
 %ifnarch noarch
 %files debuginfo
 %defattr(-,root,root)
@@ -1749,7 +1827,7 @@
 
 
 %if %{with_debug}
-%if "%{_enable_debug_packages}" == "1"
+%if %{with_debuginfo}
 %ifnarch noarch
 %files debug-debuginfo
 %defattr(-,root,root)
@@ -1788,7 +1866,7 @@
 
 
 %if %{with_pae}
-%if "%{_enable_debug_packages}" == "1"
+%if %{with_debuginfo}
 %ifnarch noarch
 %files PAE-debuginfo
 %defattr(-,root,root)
@@ -1824,7 +1902,7 @@
 /usr/src/kernels/%{KVERREL}PAE-%{_target_cpu}
 
 %if %{with_debug}
-%if "%{_enable_debug_packages}" == "1"
+%if %{with_debuginfo}
 %ifnarch noarch
 %files PAE-debug-debuginfo
 %defattr(-,root,root)
@@ -1864,7 +1942,7 @@
 
 
 %if %{with_smp}
-%if "%{_enable_debug_packages}" == "1"
+%if %{with_debuginfo}
 %ifnarch noarch
 %files smp-debuginfo
 %defattr(-,root,root)
@@ -1903,7 +1981,7 @@
 
 %if %{includexen}
 %if %{with_xen}
-%if "%{_enable_debug_packages}" == "1"
+%if %{with_debuginfo}
 %ifnarch noarch
 %files xen-debuginfo
 %defattr(-,root,root)
@@ -1945,7 +2023,7 @@
 %endif
 
 %if %{with_kdump}
-%if "%{_enable_debug_packages}" == "1"
+%if %{with_debuginfo}
 %ifnarch noarch
 %files kdump-debuginfo
 %defattr(-,root,root)
@@ -1992,6 +2070,13 @@
 %endif
 
 %changelog
+* Tue Jul 03 2007 Jarod Wilson <jwilson at redhat.com>
+- New kernel versioning scheme, intended to more closely
+  match with that of the upstream Linus kernel
+- Add --with/without debuginfo flag
+- Redundancy reduction wrt kernel-debug flags
+- Make one-off kernel-vanilla build correctly again
+
 * Tue Jul 03 2007 Dave Jones <davej at redhat.com>
 - Drop warning about OSS usage. The API will probably never die.
 




More information about the fedora-extras-commits mailing list