1 # vim:expandtab:shiftwidth=4:softtabstop=4:tabstop=4:
3 # increment this if you have made a change that should force a new kernel
7 DEVEL_KERNEL_TYPE="source"
9 prepare_and_build_srpm() {
11 pushd $TOPDIR >/dev/null
12 # seems there is a bug (on Ubuntu at least) where all of the .specs
13 # are not put into SPECS
14 mv SOURCES/*.spec SPECS/
16 # generate our buildid
17 local buildid="lustre${EXTRA_VERSION##*_lustre}"
19 # edit the SPECs with our changes
21 for spec in $RPMSMPTYPE source; do
22 #cp $TOPDIR/SPECS/kernel-$spec.spec{,.orig}
23 sed -i -e 's/^\(Name:.*kernel-\)\(.*\)/\1lustre-\2/' \
24 -e "s/^Release:.*/&_${buildid}/" \
25 -e "/^Provides: *kernel = /a\
26 Provides: kernel-$spec = %{version}-%{release}
28 -e "s/^ExclusiveArch:.*/& ppc ppc64/" \
29 -e '/^# Apply the patches needed for this architecture\./a\
30 cp %_sourcedir/linux-2.6.16-lustre.patch %_builddir/%{name}-%{version}/lustre.patch\
31 ! grep -q lustre.patch %_sourcedir/series.conf && echo -e "\\n\\tlustre.patch" >> %_sourcedir/series.conf' \
32 -e "/flavor=\${config/a\
33 [ \"\$flavor\" == \"$RPMSMPTYPE\" ] || continue" \
34 -e 's/\(.*\)\([^#].*\)fookernel-source/\1\2kernel-lustre-source/g' \
35 -e '/^%build/,/^%changelog/s/kernel-\({*\)source/kernel-\1lustre-source/g' \
36 SPECS/kernel-${spec}.spec
38 # XXX - a building-on-Ubuntu hack
39 if grep -q "Ubuntu" /etc/issue; then
40 sed -i -e '/^%_sourcedir\/install-configs %_sourcedir .*/i\
41 curl ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.17/2.6.17-mm1/broken-out/i386-use-c-code-for-current_thread_info.patch | patch -p1' \
42 -e 's/^\(BuildRequires: .*\)$/#NOU \1/g' \
43 -e 's/%(\(chmod .*\))$/%(bash -c "\1")/' \
45 SPECS/kernel-${spec}.spec
49 # XXX - need to flesh this out per the rhel5 method
51 for arch in $BUILD_ARCHS; do
52 targets="--target $arch $targets"
53 mkdir -p config/$(basearch $arch)
54 cp $CONFIG_FILE config/$(basearch $arch)/$RPMSMPTYPE
57 tar cjf SOURCES/config.tar.bz2 config
60 # do we need any special rpm build options
61 local rpmbuildopt="-bb"
66 # XXX - ignore the kabi changes. need to figure out what this is really
68 touch SOURCES/IGNORE-KABI-BADNESS
71 # XXX temp speedup hack
74 if ! $RPMBUILD $rpmbuildopt $targets \
75 --define "_topdir $TOPDIR" \
76 $TOPDIR/SPECS/kernel-$RPMSMPTYPE.spec >&2; then
77 fatal 1 "Failed to build kernel RPM"
81 # for SLES10, we also need to build the kernel-source rpm
82 if ! $RPMBUILD $rpmbuildopt $targets \
83 --define "_topdir $TOPDIR" \
84 $TOPDIR/SPECS/kernel-source.spec >&2; then
85 fatal 1 "Failed to build kernel source RPM"
91 local lustre=${1:-false}
94 echo "kernel-lustre-$DEVEL_KERNEL_TYPE"
96 echo "kernel-$DEVEL_KERNEL_TYPE"
101 rpm_BUILD_kernel_dirname() {
102 local rpmsmptype="$1"
107 echo kernel-lustre-${rpmsmptype}-${lnxmaj}${lnxmin}/linux-${lnxmaj}