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 DEVEL_KERNEL_TYPE="source"
8
9 prepare_and_build_srpm() {
10
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/
15
16     # generate our buildid
17     local buildid="lustre${EXTRA_VERSION##*_lustre}"
18
19     # edit the SPECs with our changes
20     local spec
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}
27 " \
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
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           SPECS/kernel-${spec}.spec
46      fi
47 done
48
49     # XXX - need to flesh this out per the rhel5 method
50     local targets
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
55     done
56
57     tar cjf SOURCES/config.tar.bz2 config
58     rm -rf config
59
60     # do we need any special rpm build options
61     local rpmbuildopt="-bb"
62     if $DO_SRC; then
63         rpmbuildopt="-ba"
64     fi
65
66     # XXX - ignore the kabi changes.  need to figure out what this is really
67     #       all about.
68     touch SOURCES/IGNORE-KABI-BADNESS
69
70
71 # XXX temp speedup hack
72 #if false; then
73     # now build it
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"
78     fi
79 #fi
80
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"
86     fi
87
88 }
89
90 devel_kernel_name() {
91     local lustre=${1:-false}
92
93     if $lustre; then
94         echo "kernel-lustre-$DEVEL_KERNEL_TYPE"
95     else
96         echo "kernel-$DEVEL_KERNEL_TYPE"
97     fi
98
99 }
100
101 rpm_BUILD_kernel_dirname() {
102     local rpmsmptype="$1"
103     local lnxmaj="$2"
104     local lnxmin="$3"
105     local arch="$4"
106
107     echo kernel-lustre-${rpmsmptype}-${lnxmaj}${lnxmin}/linux-${lnxmaj}
108 }