Whamcloud - gitweb
b=23428 Fix lustre built with --enable-lu_ref
[fs/lustre-release.git] / build / lbuild-sles10
1 # vim:expandtab:shiftwidth=4:softtabstop=4:tabstop=4:
2
3 # increment this if you have made a change that should force a new kernel
4 # to build built
5 #BUILD_GEN=1
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
8
9 source ${0%/*}/lbuild-sles
10
11 edit_specs() {
12
13     # edit the SPECs with our changes
14     local spec
15     for spec in $RPMSMPTYPE source; do
16         #cp $TOPDIR/SOURCES/kernel-$spec.spec{,.orig}
17         sed -i -e "s/^Release:.*/&_${buildid}/" \
18                -e "s/^ExclusiveArch:.*/& ppc ppc64/" \
19                -e '/^# Apply the patches needed for this architecture\./a\
20 cp  %_sourcedir/linux-2.6.16-lustre.patch %_builddir/%{name}-%{version}/lustre.patch\
21 ! grep -q lustre.patch %_sourcedir/series.conf && echo -e "\\n\\tlustre.patch" >> %_sourcedir/series.conf' \
22                -e "/flavor=\${config/a\
23     [ \"\$flavor\" == \"$RPMSMPTYPE\" ] || continue" \
24           SOURCES/kernel-${spec}.spec || fatal 1 "Error while editing SOURCES/kernel-${spec}.spec"
25
26         if $KERNEL_LUSTRE_NAMING; then
27             # these are all of the changes needed because we change the package names
28             # to kernel-lustre-*.  these should all go away when we stop this insanity
29             sed -i -e 's/^\(Name:.*kernel-\)\(.*\)/\1lustre-\2/' \
30                    -e "/^Provides:  *kernel = /a\
31 Provides:       kernel-$spec = %{version}-%{release}
32 " \
33                    -e 's/\(.*\)\([^#].*\)fookernel-source/\1\2kernel-lustre-source/g' \
34                    -e '/^%build/,/^%changelog/s/kernel-\({*\)source/kernel-\1lustre-source/g' \
35               SOURCES/kernel-${spec}.spec || fatal 1 "Error while editing SOURCES/kernel-${spec}.spec"
36         fi
37
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")/' \
44                -e 's/ -a 109//' \
45           SOURCES/kernel-${spec}.spec || fatal 1 "Error while editing SOURCES/kernel-${spec}.spec"
46      fi
47     done
48 }
49
50 unpack_linux_devel_rpm-sles10() {
51     local callers_rpm="$1"
52
53     # get the Module.symvers out of the kenrel-flavor RPM
54     local kernelrpm=${callers_rpm/-source-/-$RPMSMPTYPE-}
55
56     if ! rpm2cpio < "$kernelrpm" | cpio -id ./usr/src/linux-${lnxmaj}${lnxmin}-${lnxrel}-obj/$TARGET_ARCH/$RPMSMPTYPE/Module.symvers > /dev/null 2>&1; then
57         return 255
58     fi
59
60     return 0
61
62 }