Whamcloud - gitweb
*** empty log message ***
[fs/lustre-release.git] / build / lbuild-sles10
1 # vim:expandtab:shiftwidth=4:softtabstop=4:tabstop=4:
2
3 DEVEL_KERNEL_TYPE="source"
4
5 prepare_and_build_srpm() {
6
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/
11
12     # generate our buildid
13     local buildid="lustre${EXTRA_VERSION##*_lustre}"
14
15     # edit the SPECs with our changes
16     local spec
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
30
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")/' \
37                -e 's/ -a 109//' \
38           SPECS/kernel-${spec}.spec
39      fi
40 done
41
42     # XXX - need to flesh this out per the rhel5 method
43     local targets
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
48     done
49
50     tar cjf SOURCES/config.tar.bz2 config
51     rm -rf config
52
53     # do we need any special rpm build options
54     local rpmbuildopt="-bb"
55     if $DO_SRC; then
56         rpmbuildopt="-ba"
57     fi
58
59     # XXX - ignore the kabi changes.  need to figure out what this is really
60     #       all about.
61     touch SOURCES/IGNORE-KABI-BADNESS
62
63
64 # XXX temp speedup hack
65 #if false; then
66     # now build it
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"
71     fi
72 #fi
73
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"
79     fi
80
81 }
82
83 devel_kernel_name() {
84     local lustre=${1:-false}
85
86     if $lustre; then
87         echo "kernel-lustre-$DEVEL_KERNEL_TYPE"
88     else
89         echo "kernel-$DEVEL_KERNEL_TYPE"
90     fi
91
92 }