Whamcloud - gitweb
b=21938 wait and signal correct waitq
[fs/lustre-release.git] / build / lbuild-sles
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     # all of the specs but one are put into SOURCES, so let's just move
9     # the one lone one in SPECS into SOURCES and just reference them from
10     # there
11     mv SPECS/*.spec SOURCES/
12
13     # generate our buildid
14     local buildid="lustre${EXTRA_VERSION##*_lustre}"
15
16     # do release specific spec editing
17     edit_specs
18
19     # XXX - need to flesh this out per the rhel5 method
20     local targets
21     for arch in $BUILD_ARCHS; do
22         targets="--target $arch $targets"
23         mkdir -p config/$(basearch $arch)
24         cp $CONFIG_FILE config/$(basearch $arch)/$RPMSMPTYPE
25     done
26
27     tar cjf SOURCES/config.tar.bz2 config
28     rm -rf config
29
30     # do we need any special rpm build options
31     local rpmbuildopt="-bb"
32     if $DO_SRC; then
33         rpmbuildopt="-ba"
34     fi
35
36     # XXX - ignore the kabi changes.  need to figure out what this is really
37     #       all about.
38     touch SOURCES/IGNORE-KABI-BADNESS
39
40
41 # XXX testing speedup hack - never let an inspection pass without this
42 #     commented out!  in fact it should be removed completely before a
43 #     landing.
44 #if false; then
45     # now build it
46     if ! $RPMBUILD $rpmbuildopt $targets \
47                    --define "_topdir $TOPDIR" \
48                    $TOPDIR/SOURCES/kernel-$RPMSMPTYPE.spec 2>&1; then
49         fatal 1 "Failed to build kernel RPM"
50     fi
51 #fi
52
53     # for SLES, we also need to build the kernel-source rpm
54     if ! $RPMBUILD $rpmbuildopt $targets \
55                    --define "_topdir $TOPDIR" \
56                    $TOPDIR/SOURCES/kernel-source.spec 2>&1; then
57         fatal 1 "Failed to build kernel source RPM"
58     fi
59
60 }
61
62 devel_kernel_name() {
63     local lustre=${1:-false}
64
65     if $lustre; then
66         echo "kernel-lustre-$DEVEL_KERNEL_TYPE"
67     else
68         echo "kernel-$DEVEL_KERNEL_TYPE"
69     fi
70
71 }
72
73 rpm_BUILD_kernel_dirname() {
74     local rpmsmptype="$1"
75     local lnxmaj="$2"
76     local lnxmin="$3"
77     local arch="$4"
78
79     local lustre=""
80     if $KERNEL_LUSTRE_NAMING; then
81         $lustre="-lustre"
82     fi
83     echo kernel${lustre}-${rpmsmptype}-${lnxmaj}${lnxmin}/linux-${lnxmaj}
84 }
85
86 find_linux_devel_paths() {
87     local path="$1"
88
89     LINUX=$path/usr/src/linux-${lnxmaj}${lnxmin}${delimiter}${lnxrel##${lnxmin#.}-}
90
91     local objects=$TARGET_ARCH/$RPMSMPTYPE
92     if [ -d $path/usr/src/linux-${lnxmaj}${lnxmin}${delimiter}${lnxrel##${lnxmin#.}-}-obj/powerpc ]; then
93         objects="powerpc/$TARGET_ARCH"
94     elif [ $TARGET_ARCH == 'i686' ]; then
95         objects="i386/$RPMSMPTYPE"
96     fi
97
98     LINUXOBJ=$path/usr/src/linux-${lnxmaj}${lnxmin}${delimiter}${lnxrel##${lnxmin#.}-}-obj/$objects
99
100     LINUXRELEASE=$(find_linux_release ${LINUXOBJ:-$LINUX})
101     if [ -z "$LINUXRELEASE" ]; then
102         echo "Failed to find linux release in ${LINUXOBJ:-$LINUX}"
103         return 255
104     fi
105 }
106
107 mcpu_rpmbuild_opt() {
108
109     echo "--define \'jobs $(/usr/bin/getconf _NPROCESSORS_ONLN)\'"
110     return 0
111 }
112