1 # vim:expandtab:shiftwidth=4:softtabstop=4:tabstop=4:
3 # increment this if you have made a change that should force a new kernel
6 #BUILD_GEN=2 # bz19952: remove -lustre tag from kernel RPM names
7 BUILD_GEN=3 # bz19975 enable the building of src.rpms by default
9 source ${0%/*}/lbuild-sles
11 # this is what lnxrel really should be, once bug 19336 lands
12 real_lnxrel=${lnxrel##${lnxmin#.}-}
16 # edit the SPECs with our changes
18 for spec in $RPMSMPTYPE source; do
19 #cp $TOPDIR/SOURCES/kernel-$spec.spec{,.orig}
20 sed -i -e "s/^\(Release: *\).*$/\1${real_lnxrel}_${buildid}/" \
21 -e "s/^ExclusiveArch:.*/& ppc ppc64/" \
23 cp %_sourcedir/linux-2.6.27-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/^\(BuildRequires: kernel-dummy\)/# \1/" \
28 SOURCES/kernel-${spec}.spec
30 if $KERNEL_LUSTRE_NAMING; then
31 # these are all of the changes needed because we change the package names
32 # to kernel-lustre-*. these should all go away when we stop this insanity
33 sed -i -e 's/^\(Name:.*kernel-\)\(.*\)/\1lustre-\2/' \
34 -e "/^Provides: *kernel = /a\
35 Provides: kernel-$spec = %{version}-%{release}
37 -e 's/^\([ ][ ]*-i %_builddir\/kernel-\)\(source-2.6.27.21\/\$patch; then\)/\1lustre-\2/' \
38 -e '/^%build/,/^%changelog/s/\(kernel-\)\(source\.files\)/\1lustre-\2/g' \
39 -e '/--no-backup-if-mismatch/,/fi/s/kernel-source-/kernel-lustre-source-/g' \
40 -e "s/^\(%package -n kernel-\)\(.*\)/\1lustre-\2/" \
41 -e "s/^\(%description -n kernel-\)\(.*\)/\1lustre-\2/" \
42 -e "s/^\(%files -n kernel-\)\(.*\)/\1lustre-\2/" \
43 -e "s/^\(Provides:.*kernel-\)\(.*\)/\1lustre-\2/" \
44 -e "s/^\(Requires:.*kernel-\)\(.*\)/\1lustre-\2/" \
45 -e "s/^\(Supplements:.*kernel-\)\(.*\)/\1lustre-\2/" \
46 SOURCES/kernel-${spec}.spec
49 # XXX - a building-on-Ubuntu hack
50 if grep -q "Ubuntu" /etc/issue; then
51 sed -i -e '/^%_sourcedir\/install-configs %_sourcedir .*/i\
52 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' \
53 -e 's/^\(BuildRequires: .*\)$/#NOU \1/g' \
54 -e 's/%(\(chmod .*\))$/%(bash -c "\1")/' \
56 SOURCES/kernel-${spec}.spec
61 unpack_linux_devel_rpm-sles11() {
62 local callers_rpm="$1"
64 local rpmdir="${callers_rpm%/*}"
67 local wanted_kernel="${lnxmaj}${lnxmin}${TARGET_DELIMITER}${lnxrel}"
69 # this $PATCHLESS block should go away when bug 19336 lands.
70 wanted_kernel="${lnxmaj}${lnxmin}${TARGET_DELIMITER}${real_lnxrel}"
72 # this is a hack that should go away when the modified lustre kernel
73 # Provides kernel-default-base vvvvvvvvv
74 if ! kernelrpm=$(find_rpm "$rpmdir" provides "^kernel-(lustre-)?default-base = $wanted_kernel"); then
75 fatal 1 "Could not find the kernel-default-base in $rpmdir/"
78 if ! rpm2cpio < "$rpmdir/$kernelrpm" | cpio -id > /dev/null 2>&1; then
79 fatal 1 "Unpack error for $kernelrpm"
84 # this is actually valid for sles10 and sles11 but let's test it on sles11 only, first
85 find_linux_devel_paths() {
88 LINUX=$path/usr/src/linux-${lnxmaj}${lnxmin}${delimiter}${lnxrel##${lnxmin#.}-}
90 local objects=$TARGET_ARCH/$RPMSMPTYPE
91 if [ -d $path/usr/src/linux-${lnxmaj}${lnxmin}${delimiter}${lnxrel##${lnxmin#.}-}-obj/powerpc ]; then
92 objects="powerpc/$TARGET_ARCH"
93 elif [ $TARGET_ARCH == 'i686' ]; then
94 objects="i386/$RPMSMPTYPE"
97 LINUXOBJ=$path/usr/src/linux-${lnxmaj}${lnxmin}${delimiter}${lnxrel##${lnxmin#.}-}-obj/$objects
99 LINUXRELEASE=$(find_linux_release ${LINUXOBJ:-$LINUX})
100 if [ -z "$LINUXRELEASE" ]; then
101 echo "Failed to find linux release in ${LINUXOBJ:-$LINUX}"