Whamcloud - gitweb
b=23278 replay-single test 86 does not remount client
[fs/lustre-release.git] / build / lbuild.old_school
index 869be39..2a2d2dc 100644 (file)
@@ -7,6 +7,15 @@ SUSEBUILD=${SUSEBUILD:-0}
 LINUX26=${LINUX26:-0}
 SUSEBUILD=${SUSEBUILD:-0}
 
+# make sure this module does not get used for anything other than RHEL4
+# as this will die when our RHEL4 support (read: need to build binaries)
+# dies
+if [ "$DISTRO" != "rhel4" -a "$DISTRO" != "sles9" ]; then
+    fatal 1 "lbuild.old_school is deprecated and only supported for RHEL4
+to add lbuild support for $DISTRO you probably want to create an lbuild-$DISTRO
+file in the lustre-build module"
+fi
+
 build_tarball() {
     local TARGET=$1
     local SRPM=$2
@@ -25,7 +34,7 @@ build_tarball() {
         mkdir $RPMTOPDIR/BUILD/
         rpm -ivh $KERNELDIR/$SRPM --define "_topdir $RPMTOPDIR" || \
             { rm -rf $RPMTOPDIR; fatal 1 "Error installing kernel SRPM."; }
-        $RPMBUILD -bp --nodeps --target i686 $RPMTOPDIR/SPECS/$SPEC --define "_topdir $RPMTOPDIR"
+        $RPMBUILD -bp --nodeps --target i686 $RPMTOPDIR/SPECS/$SPEC --define "_topdir $RPMTOPDIR" 2>&1
         pushd $RPMTOPDIR/BUILD/kernel-${lnxmaj}/linux-${lnxmaj} && {
             make mrproper
             cp configs/kernel-${lnxmaj}-i686-smp.config .config
@@ -90,8 +99,8 @@ patch_linux() {
 pack_linux() {
     TARBALL="$(readlink linux)-$EXTRA_VERSION.tar.gz"
     echo "Creating patched linux tarball $TARBALL..."
-    tar zcf "$TARBALL" "$(readlink linux)" \
-        --exclude "CVS" --exclude ".cvsignore" || \
+    tar -zcf "$TARBALL" "$(readlink linux)" \
+        --exclude "CVS" --exclude ".cvsignore" \
         --exclude "*.orig" --exclude "*~" --exclude "*.rej" || \
         fatal 1 "Error creating patched Linux tarball."
 }
@@ -175,13 +184,13 @@ build_kernel() {
 
     $RPMBUILD $targets $rpmbuildopt lustre-kernel-2.4.spec \
         --define "_tmppath $TMPDIR" \
-        --define "_topdir $TOPDIR" || \
+        --define "_topdir $TOPDIR" 2>&1 || \
         fatal 1 "Error building rpms for $BUILD_ARCHS."
 
     if $DO_SRC; then
         $RPMBUILD -bs lustre-kernel-2.4.spec \
             --define "_tmppath $TMPDIR" \
-            --define "_topdir $TOPDIR" || \
+            --define "_topdir $TOPDIR" 2>&1 || \
             fatal 1 "Error building .src.rpm."
     fi
 
@@ -203,19 +212,17 @@ build_kernel() {
     < $ldiskfs_spec \
     > ../lustre-ldiskfs.spec
 
-    $RPMBUILD $targets $rpmbuildopt ../lustre-ldiskfs.spec \
-        --define "_tmppath /var/tmp" \
-        --define "_topdir $TOPDIR"
-    if [ "$?" != "0" ] ; then
+    if ! $RPMBUILD $targets $rpmbuildopt ../lustre-ldiskfs.spec \
+                   --define "_tmppath /var/tmp" \
+                   --define "_topdir $TOPDIR" 2>&1; then
         popd
         return 255
     fi
 
     if $DO_SRC; then
-            $RPMBUILD -bs ../lustre-ldiskfs.spec \
-            --define "_tmppath /var/tmp" \
-            --define "_topdir $TOPDIR"
-        if [ "$?" != "0" ] ; then
+            if ! $RPMBUILD -bs ../lustre-ldiskfs.spec \
+                           --define "_tmppath /var/tmp" \
+                           --define "_topdir $TOPDIR" 2>&1; then
             popd
             return 255
         fi
@@ -501,7 +508,7 @@ patchless_build_sequence() {
        lnxmaj=$(echo $LINUXRELEASE | cut -f1 -d-)
        EXTRA_VERSION=$(echo $LINUXRELEASE | cut -f2 -d-)_lustre.$LUSTRE_VERSION
         RPMSMPTYPE=" "
-        build_lustre && buildsuccess=true
+        build_lustre "${LINUX}" "${LINUXOBJ}" && buildsuccess=true
     else
     #try to build from kernel-devel RPM (RHEL)
     LINUX=
@@ -546,7 +553,7 @@ patchless_build_sequence() {
     if [ -n "$OFED_VERSION" -a "$OFED_VERSION" != "inkernel" ]; then
         $rpmfound && build_kernel_ib
     fi
-    ( $rpmfound ) && build_lustre && buildsuccess=true && find_linux_source_rpm
+    ( $rpmfound ) && build_lustre "${LINUX}" "${LINUXOBJ}" && buildsuccess=true && find_linux_source_rpm
     fi
 
     if $buildsuccess; then
@@ -643,7 +650,7 @@ build_sequence_rpm_reuse() {
             # by OFED >= 1.3.0 and this function appears to only be used for sles9
 
             [ -d $TOPDIR/reused ] && rm -rf $TOPDIR/reused
-            reuse_kernel_rpm "$reusedkernelsourcerpm" "" && build_linux nofullmake copyrpmkernel && build_lustre && buildsuccess=true
+            reuse_kernel_rpm "$reusedkernelsourcerpm" "" && build_linux nofullmake copyrpmkernel && build_lustre "${LINUX}" "${LINUXOBJ}" && buildsuccess=true
             ( $buildsuccess ) || continue
             if ( ! $NORPM ) && ( ! $PATCHLESS ) ; then
                 [ -f "$reusedkernelrpm" ] && \
@@ -707,7 +714,7 @@ build_sequence_reuse() {
                fi
             fi
             LINUX="$curdir"
-            build_lustre || continue
+            build_lustre "${LINUX}" "${LINUXOBJ}" || continue
             touch "$curdir/../"
             buildsuccess=true
             if ( ! $NORPM ) && ( ! $PATCHLESS ) ; then