Whamcloud - gitweb
b=23428 Fix lustre built with --enable-lu_ref
[fs/lustre-release.git] / build / lbuild-sles
index 5b97064..ad774d9 100644 (file)
@@ -5,9 +5,10 @@ DEVEL_KERNEL_TYPE="source"
 prepare_and_build_srpm() {
 
     pushd $TOPDIR >/dev/null
 prepare_and_build_srpm() {
 
     pushd $TOPDIR >/dev/null
-    # seems there is a bug (on Ubuntu at least) where all of the .specs
-    # are not put into SPECS
-    mv SOURCES/*.spec SPECS/
+    # all of the specs but one are put into SOURCES, so let's just move
+    # the one lone one in SPECS into SOURCES and just reference them from
+    # there
+    mv SPECS/*.spec SOURCES/
 
     # generate our buildid
     local buildid="lustre${EXTRA_VERSION##*_lustre}"
 
     # generate our buildid
     local buildid="lustre${EXTRA_VERSION##*_lustre}"
@@ -44,7 +45,7 @@ prepare_and_build_srpm() {
     # now build it
     if ! $RPMBUILD $rpmbuildopt $targets \
                    --define "_topdir $TOPDIR" \
     # now build it
     if ! $RPMBUILD $rpmbuildopt $targets \
                    --define "_topdir $TOPDIR" \
-                   $TOPDIR/SPECS/kernel-$RPMSMPTYPE.spec >&2; then
+                   $TOPDIR/SOURCES/kernel-$RPMSMPTYPE.spec 2>&1; then
         fatal 1 "Failed to build kernel RPM"
     fi
 #fi
         fatal 1 "Failed to build kernel RPM"
     fi
 #fi
@@ -52,7 +53,7 @@ prepare_and_build_srpm() {
     # for SLES, we also need to build the kernel-source rpm
     if ! $RPMBUILD $rpmbuildopt $targets \
                    --define "_topdir $TOPDIR" \
     # for SLES, we also need to build the kernel-source rpm
     if ! $RPMBUILD $rpmbuildopt $targets \
                    --define "_topdir $TOPDIR" \
-                   $TOPDIR/SPECS/kernel-source.spec >&2; then
+                   $TOPDIR/SOURCES/kernel-source.spec 2>&1; then
         fatal 1 "Failed to build kernel source RPM"
     fi
 
         fatal 1 "Failed to build kernel source RPM"
     fi
 
@@ -75,5 +76,38 @@ rpm_BUILD_kernel_dirname() {
     local lnxmin="$3"
     local arch="$4"
 
     local lnxmin="$3"
     local arch="$4"
 
-    echo kernel-lustre-${rpmsmptype}-${lnxmaj}${lnxmin}/linux-${lnxmaj}
+    local lustre=""
+    if $KERNEL_LUSTRE_NAMING; then
+        $lustre="-lustre"
+    fi
+    echo kernel${lustre}-${rpmsmptype}-${lnxmaj}${lnxmin}/linux-${lnxmaj}
+}
+
+find_linux_devel_paths() {
+    local path="$1"
+
+    LINUX=$path/usr/src/linux-${lnxmaj}${lnxmin}-${lnxrel}
+
+    local objects=$TARGET_ARCH/$RPMSMPTYPE
+    if [ -d $path/usr/src/linux-${lnxmaj}${lnxmin}-${lnxrel}-obj/powerpc ]; then
+        objects="powerpc/$TARGET_ARCH"
+    elif [ $TARGET_ARCH == 'i686' ]; then
+        objects="i386/$RPMSMPTYPE"
+    fi
+
+    LINUXOBJ=$path/usr/src/linux-${lnxmaj}${lnxmin}-${lnxrel}-obj/$objects
+    LINUXRELEASE=$(find_linux_release "$LINUXOBJ")
+
+    if [ -z "$LINUXRELEASE" ]; then
+        echo "Failed to find linux release in $LINUXOBJ"
+        return 255
+    fi
+
+    return 0
+}
+
+mcpu_rpmbuild_opt() {
+
+    echo "--define \'jobs $(/usr/bin/getconf _NPROCESSORS_ONLN)\'"
+    return 0
 }
 }