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