Whamcloud - gitweb
LU-1199 lbuild: Remove obsolete CVS functionality
[fs/lustre-release.git] / contrib / lbuild / 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+=".1" #LU-3337 add missing build files for sles11sp2 server
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
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     # because we build an i686 kernel, we need to know if the arch we are
90     # resolving for is for the patched or patchless kernel (which is i586)
91     # we really should be building an i586 kernel to match what Novell does
92     local for_patchless=${2:-true}
93     local canonical=${3:-false}
94
95     case $arch in
96         ppc64)  arch=powerpc
97                 ;;
98         i?86)   if $canonical; then
99                     arch=i386
100                 elif $(eval $for_patchless); then
101                     arch=i586
102                 fi
103                 ;;
104     esac
105
106     echo "$arch"
107
108 }
109
110 find_linux_devel_paths() {
111     local path="$1"
112
113     LINUX=$path/usr/src/linux-${lnxmaj}${lnxmin}-${lnxrel}
114     LINUXOBJ=$path/usr/src/linux-${lnxmaj}${lnxmin}-${lnxrel}-obj/$(resolve_arch $TARGET_ARCH $PATCHLESS)/$RPMSMPTYPE
115     # XXX this has been commented out in th rhel5 build file for a while
116     # as it says there, it's probably not needed anymore and can be deleted
117     #LINUXRELEASE=$(find_linux_release "$LINUXOBJ")
118     #if [ -z "$LINUXRELEASE" ]; then
119     #    echo "Failed to find linux release in $LINUXOBJ"
120     #    return 255
121     #fi
122
123     return 0
124 }
125
126 mcpu_rpmbuild_opt() {
127
128     echo "--define \'jobs $(/usr/bin/getconf _NPROCESSORS_ONLN)\'"
129     return 0
130 }
131
132 # This function digs out the linux release from a linux-obj tree
133 find_linux_release() {
134         _find_linux_release $LINUXOBJ
135 }