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