spec hacks for vanilla and git-based kernel rpm builds

Roland McGrath roland at frob.com
Fri Jun 8 19:59:26 UTC 2007


Here I am again with those hacks to do alternate builds from the kernel
spec file.  Can I commit at least the spec parts to rawhide now?  

The diff is only this:


--- kernel-2.6.spec	08 Jun 2007 12:55:12 -0700	1.3213
+++ kernel-2.6.spec	08 Jun 2007 12:55:05 -0700	
@@ -63,7 +63,8 @@ Summary: The Linux kernel (the core of t
 %define sublevel 21
 %define kversion 2.6.%{sublevel}
 %define rpmversion 2.6.%{sublevel}
-%define release %(R="$Revision: 1.3213 $"; RR="${R##: }"; echo ${RR%%?})%{?dist}%{?buildid}
+%define specrelease %(R="$Revision: 1.3213 $"; RR="${R##: }"; echo ${RR%%?})%{?dist}%{?buildid}
+%define release %{specrelease}
 
 %define make_target bzImage
 %define kernel_image x86
@@ -76,6 +77,24 @@ Summary: The Linux kernel (the core of t
 %define KVERREL %{PACKAGE_VERSION}-%{PACKAGE_RELEASE}
 %define hdrarch %_target_cpu
 
+%if 0%{!?nopatches:1}
+%define nopatches 0
+%endif
+
+%if %{nopatches}
+%define includexen 0
+%define variant -vanilla
+%else
+%define variant_fedora -fedora
+%endif
+
+%define using_upstream_branch 0
+%if 0%{?upstream_branch:1}
+%define using_upstream_branch 1
+%define variant -%{upstream_branch}%{?variant_fedora}
+%define release %{upstream_branch_release}.%{specrelease}
+%endif
+
 # if requested, only build base kernel
 %if %{with_baseonly}
 %define with_smp 0
@@ -248,6 +267,15 @@ Summary: The Linux kernel (the core of t
 %define kernel_image vmlinux
 %endif
 
+%if %{nopatches}
+%define with_modsign 0
+# Ignore unknown options in our config-* files.
+# Some options go with patches we're not applying.
+%define oldconfig_target loose_nonint_oldconfig
+%else
+%define oldconfig_target nonint_oldconfig
+%endif
+
 # To temporarily exclude an architecture from being built, add it to
 # %nobuildarches. Do _NOT_ use the ExclusiveArch: line, because if we
 # don't build kernel-headers then the new build system will no longer let
@@ -297,7 +325,7 @@ Summary: The Linux kernel (the core of t
 #
 %define kernel_prereq  fileutils, module-init-tools, initscripts >= 8.11.1-1, mkinitrd >= 6.0.9-1
 
-Name: kernel
+Name: kernel%{?variant}
 Group: System Environment/Kernel
 License: GPLv2
 Version: %{rpmversion}
@@ -332,7 +360,9 @@ BuildPreReq: bzip2, findutils, gzip, m4,
 BuildPreReq: gnupg
 %endif
 BuildRequires: gcc >= 3.4.2, binutils >= 2.12, redhat-rpm-config
+%if %{usesparse}
 BuildRequires: sparse >= 0.3
+%endif
 BuildConflicts: rhbuildsys(DiskFree) < 500Mb
 
 
@@ -380,7 +410,16 @@ Source80: config-rhel-generic
 Source81: config-rhel-x86-generic
 Source82: config-olpc-generic
 
+%if %{using_upstream_branch}
+### BRANCH PATCH ###
+%else
+# Here should be only the patches up to the upstream canonical Linus tree.
 Patch00: patch-2.6.22-rc4.bz2
+%endif
+
+%if !%{nopatches}
+
+# Patches 10 through 99 are for things that are going upstream really soon.
 Patch10: linux-2.6-utrace.patch
 Patch20: nouveau-drm.patch
 Patch30: linux-2.6-sysrq-c.patch
@@ -849,10 +888,16 @@ ApplyPatch()
     patch -p1 -F1 -s < $RPM_SOURCE_DIR/$1
 }
 
+%if %{using_upstream_branch}
+### BRANCH APPLY ###
+%else
 
 # Update to latest upstream.
 bzcat $RPM_SOURCE_DIR/patch-2.6.22-rc4.bz2 | patch -p1 -F1 -s
 
+%endif
+%if !%{nopatches}
+
 # Patches 10 through 100 are meant for core subsystem upgrades
 
 # Roland's utrace ptrace replacement.
@@ -895,12 +940,14 @@ ApplyPatch linux-2.6-pmac-zilog.patch
 #
 # Bugfixes to the core system and patches related to how RPMs are build
 #
+%endif
 
 # This patch adds a "make nonint_oldconfig" which is non-interactive and
 # also gives a list of missing options at the end. Useful for automated
 # builds (as used in the buildsystem).
-ApplyPatch linux-2.6-build-nonintconfig.patch
+ApplyPatch linux-2.6.17-build-nonintconfig.patch
 
+%if !%{nopatches}
 # Exec shield
 ApplyPatch linux-2.6-execshield.patch
 
@@ -1076,6 +1123,7 @@ ApplyPatch linux-2.6-warnings-emptymacro
 ApplyPatch linux-2.6-warnings-register.patch
 
 # END OF PATCH APPLICATIONS
+%endif
 
 cp %{SOURCE10} Documentation/
 
@@ -1098,7 +1146,7 @@ for i in *.config
 do
   mv $i .config
   Arch=`head -1 .config | cut -b 3-`
-  make ARCH=$Arch nonint_oldconfig > /dev/null
+  make ARCH=$Arch %{oldconfig_target} > /dev/null
   echo "# $Arch" > configs/$i
   cat .config >> configs/$i
 done
@@ -1184,7 +1232,7 @@ BuildKernel() {
        KernelImage=arch/$Arch/boot/bzImage
     fi
 
-    make -s ARCH=$Arch nonint_oldconfig > /dev/null
+    make -s ARCH=$Arch %{oldconfig_target} > /dev/null
     make -s ARCH=$Arch %{?_smp_mflags} $MakeTarget %{?sparse_mflags}
     make -s ARCH=$Arch %{?_smp_mflags} modules %{?sparse_mflags} || exit 1
 




More information about the Fedora-kernel-list mailing list