1 # vim:expandtab:shiftwidth=4:softtabstop=4:tabstop=4:
3 DEVEL_KERNEL_TYPE="source"
5 prepare_and_build_srpm() {
7 pushd $TOPDIR >/dev/null
8 # seems there is a bug (on Ubuntu at least) where all of the .specs
9 # are not put into SPECS
10 mv SOURCES/*.spec SPECS/
12 # generate our buildid
13 local buildid="lustre${EXTRA_VERSION##*_lustre}"
15 # edit the SPECs with our changes
17 for spec in $RPMSMPTYPE source; do
18 #cp $TOPDIR/SPECS/kernel-$spec.spec{,.orig}
19 sed -i -e 's/^\(Name:.*kernel-\)\(.*\)/\1lustre-\2/' \
20 -e "s/^Release:.*/&_${buildid}/" \
21 -e "s/^ExclusiveArch:.*/& ppc ppc64/" \
22 -e '/^# Apply the patches needed for this architecture\./a\
23 cp %_sourcedir/linux-2.6.16-lustre.patch %_builddir/%{name}-%{version}/lustre.patch\
24 ! grep -q lustre.patch %_sourcedir/series.conf && echo -e "\\n\\tlustre.patch" >> %_sourcedir/series.conf' \
25 -e "/flavor=\${config/a\
26 [ \"\$flavor\" == \"$RPMSMPTYPE\" ] || continue" \
27 -e 's/\(.*\)\([^#].*\)fookernel-source/\1\2kernel-lustre-source/g' \
28 -e '/^%build/,/^%changelog/s/kernel-\({*\)source/kernel-\1lustre-source/g' \
29 SPECS/kernel-${spec}.spec
31 # XXX - a building-on-Ubuntu hack
32 if grep -q "Ubuntu" /etc/issue; then
33 sed -i -e '/^%_sourcedir\/install-configs %_sourcedir .*/i\
34 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' \
35 -e 's/^\(BuildRequires: .*\)$/#NOU \1/g' \
36 -e 's/%(\(chmod .*\))$/%(bash -c "\1")/' \
38 SPECS/kernel-${spec}.spec
42 # XXX - need to flesh this out per the rhel5 method
44 for arch in $BUILD_ARCHS; do
45 targets="--target $arch $targets"
46 mkdir -p config/$(basearch $arch)
47 cp $CONFIG_FILE config/$(basearch $arch)/$RPMSMPTYPE
50 tar cjf SOURCES/config.tar.bz2 config
53 # do we need any special rpm build options
54 local rpmbuildopt="-bb"
59 # XXX - ignore the kabi changes. need to figure out what this is really
61 touch SOURCES/IGNORE-KABI-BADNESS
64 # XXX temp speedup hack
67 if ! $RPMBUILD $rpmbuildopt $targets \
68 --define "_topdir $TOPDIR" \
69 $TOPDIR/SPECS/kernel-$RPMSMPTYPE.spec >&2; then
70 fatal 1 "Failed to build kernel RPM"
74 # for SLES10, we also need to build the kernel-source rpm
75 if ! $RPMBUILD $rpmbuildopt $targets \
76 --define "_topdir $TOPDIR" \
77 $TOPDIR/SPECS/kernel-source.spec >&2; then
78 fatal 1 "Failed to build kernel source RPM"
84 local lustre=${1:-false}
87 echo "kernel-lustre-$DEVEL_KERNEL_TYPE"
89 echo "kernel-$DEVEL_KERNEL_TYPE"
94 rpm_BUILD_kernel_dirname() {
100 echo kernel-lustre-${rpmsmptype}-${lnxmaj}${lnxmin}/linux-${lnxmaj}