Whamcloud - gitweb
Branch b1_8
[fs/lustre-release.git] / build / lbuild-sles11
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
7 source ${0%/*}/lbuild-sles
8
9 # this is what lnxrel really should be, once bug 19336 lands
10 real_lnxrel=${lnxrel##${lnxmin#.}-}
11
12 edit_specs() {
13
14     # edit the SPECs with our changes
15     local spec
16     for spec in $RPMSMPTYPE source; do
17         #cp $TOPDIR/SPECS/kernel-$spec.spec{,.orig}
18         sed -i -e 's/^\(Name:.*kernel-\)\(.*\)/\1lustre-\2/' \
19                -e "s/^\(Release: *\).*$/\1${real_lnxrel}_${buildid}/" \
20                -e "/^Provides:  *kernel = /a\
21 Provides:       kernel-$spec = %{version}-%{release}
22 " \
23                -e "s/^ExclusiveArch:.*/& ppc ppc64/" \
24                -e '/^%setup /a\
25 cp  %_sourcedir/linux-2.6.27-lustre.patch %_builddir/%{name}-%{version}/lustre.patch\
26 ! grep -q lustre.patch %_sourcedir/series.conf && echo -e "\\n\\tlustre.patch" >> %_sourcedir/series.conf' \
27                -e "/flavor=\${config/a\
28     [ \"\$flavor\" == \"$RPMSMPTYPE\" ] || continue" \
29                -e 's/^\([       ][      ]*-i %_builddir\/kernel-\)\(source-2.6.27.21\/\$patch; then\)/\1lustre-\2/' \
30                -e '/^%build/,/^%changelog/s/\(kernel-\)\(source\.files\)/\1lustre-\2/g' \
31                -e '/--no-backup-if-mismatch/,/fi/s/kernel-source-/kernel-lustre-source-/g' \
32                -e "s/^\(%package -n kernel-\)\(.*\)/\1lustre-\2/" \
33                -e "s/^\(%description -n kernel-\)\(.*\)/\1lustre-\2/" \
34                -e "s/^\(%files -n kernel-\)\(.*\)/\1lustre-\2/" \
35                -e "s/^\(Provides:.*kernel-\)\(.*\)/\1lustre-\2/" \
36                -e "s/^\(Requires:.*kernel-\)\(.*\)/\1lustre-\2/" \
37                -e "s/^\(Supplements:.*kernel-\)\(.*\)/\1lustre-\2/" \
38                -e "s/^\(BuildRequires:  kernel-dummy\)/# \1/" \
39           SPECS/kernel-${spec}.spec
40
41     # XXX - a building-on-Ubuntu hack
42         if grep -q "Ubuntu" /etc/issue; then
43             sed -i -e '/^%_sourcedir\/install-configs %_sourcedir .*/i\
44 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' \
45                    -e 's/^\(BuildRequires: .*\)$/#NOU \1/g' \
46                    -e 's/%(\(chmod .*\))$/%(bash -c "\1")/' \
47                    -e 's/ -a 109//' \
48               SPECS/kernel-${spec}.spec
49     fi
50     done
51 }
52
53 unpack_linux_devel_rpm-sles11() {
54     local callers_rpm="$1"
55
56     local rpmdir="${callers_rpm%/*}"
57
58     local kernelrpm
59     # this is a hack that should go away when the modified lustre kernel
60     # Provides kernel-default-base                        vvvvvvvvv
61     if ! kernelrpm=$(find_rpm "$rpmdir" provides "^kernel-(lustre-)?default-base ="); then
62         fatal 1 "Could not find the kernel-default-base in $rpmdir/"
63     fi
64
65     if ! rpm2cpio < "$rpmdir/$kernelrpm" | cpio -id > /dev/null 2>&1; then
66         fatal 1 "Unpack error for $kernelrpm"
67     fi
68
69 }
70
71 # this is actually valid for sles10 and sles11 but let's test it on sles11 only, first
72 find_linux_devel_paths() {
73     local path="$1"
74
75     LINUX=$path/usr/src/linux-${lnxmaj}${lnxmin}${delimiter}${lnxrel##${lnxmin#.}-}
76
77     local objects=$TARGET_ARCH/$RPMSMPTYPE
78     if [ -d $path/usr/src/linux-${lnxmaj}${lnxmin}${delimiter}${lnxrel##${lnxmin#.}-}-obj/powerpc ]; then
79         objects="powerpc/$TARGET_ARCH"
80     elif [ $TARGET_ARCH == 'i686' ]; then
81         objects="i386/$RPMSMPTYPE"
82     fi
83
84     LINUXOBJ=$path/usr/src/linux-${lnxmaj}${lnxmin}${delimiter}${lnxrel##${lnxmin#.}-}-obj/$objects
85
86     LINUXRELEASE=$(find_linux_release ${LINUXOBJ:-$LINUX})
87     if [ -z "$LINUXRELEASE" ]; then
88         echo "Failed to find linux release in ${LINUXOBJ:-$LINUX}"
89         RC=255
90     fi
91 }