Whamcloud - gitweb
Branch b1_8
[fs/lustre-release.git] / build / lbuild
index f285ea6..d09899a 100755 (executable)
@@ -16,7 +16,7 @@ RELEASE=false
 #       search through this file (and lbuild.old_school -- but that will
 #       be going away soon) for "-bb" and see how many places
 #       simply don't account for this option
-DO_SRC=false
+DO_SRC=true
 DOWNLOAD=true
 TAG=
 CANONICAL_TARGET=
@@ -46,6 +46,8 @@ XEN=false
 LINUXOBJ=
 DISTRO=
 KERNELTREE=
+# default to not adding -lustre- into the kernel RPM package names
+KERNEL_LUSTRE_NAMING=false
 
 # patchless build
 KERNELRPMSBASE=
@@ -282,6 +284,9 @@ check_options() {
         2.6-sles11)
             CANONICAL_TARGET="sles11"
             ;;
+        2.6-oel5)
+            CANONICAL_TARGET="oel5"
+            ;;
         hp_pnnl-2.4)
             CANONICAL_TARGET="hp-pnnl-2.4"
             ;;
@@ -755,6 +760,11 @@ skeep_ldiskfs_rpm() {
                 [[ $tag == $skiptag ]] && skip=true && break
             done
         fi
+
+        pushd $TOPDIR/BUILD/lustre-[1-9]* >/dev/null
+        grep -q '^SERVER_TRUE[ \t]=[ \t]#$' autoMakefile && skip=true
+        popd >/dev/null
+
         echo $skip
 
 }
@@ -940,7 +950,7 @@ build_kernel_ib() {
              --define "KVERSION ${LINUXRELEASE}" \
              --define "$K_SRC ${LINUXOBJ:-${LINUX}}" \
              --define "LIB_MOD_DIR /lib/modules/${LINUXRELEASE}/updates" \
-             --define "configure_options --without-quilt --with-core-mod --with-user_mad-mod --with-user_access-mod --with-addr_trans-mod --with-srp-target-mod --with-core-mod --with-mthca-mod --with-mlx4-mod --with-mlx4_en-mod --with-cxgb3-mod --with-nes-mod --with-ipoib-mod --with-sdp-mod --with-srp-mod --without-srp-target-mod --with-rds-mod --with-iser-mod --with-qlgc_vnic-mod --with-madeye-mod $configure_options" ${TOPDIR}/OFED/SRPMS/ofa_kernel-*.src.rpm
+             --define "configure_options --without-quilt --with-core-mod --with-user_mad-mod --with-user_access-mod --with-addr_trans-mod --with-srp-target-mod --with-core-mod --with-mthca-mod --with-mlx4-mod --with-mlx4_en-mod --with-cxgb3-mod --with-nes-mod --with-ipoib-mod --with-sdp-mod --with-srp-mod --with-rds-mod --with-iser-mod --with-qlgc_vnic-mod --with-madeye-mod $configure_options" ${TOPDIR}/OFED/SRPMS/ofa_kernel-*.src.rpm
 
     if [ ${PIPESTATUS[0]} != 0 ]; then
         fatal 1 "Error building kernel-ib"
@@ -1073,7 +1083,7 @@ find_rpm() {
         fatal 1 "Unable to chdir to directory \"$dir\" in find_rpm()"
 
     local file
-    for file in $(ls); do
+    for file in $(ls *.rpm); do
         if [ ! -f "$file" ]; then
             continue
         fi
@@ -1119,25 +1129,19 @@ build_kernel_with_srpm() {
     # the extra version string to use for the kernel (which might be a reused
     # kernel, remember)
     local kernel_extra_version=""
-    if $REUSERPM && reuse kernel "$TOPDIR" "$CAN_LINK_FOR_REUSE" \
-                                 "$REUSE_SIGNATURE"; then
-        # figure out the EXTRA_VERSION of the kernel we are re-using
-        local KERNEL_RPM
-        if ! KERNEL_RPM=$(find_rpm "$TOPDIR/RPMS/$TARGET_ARCH/" provides "^kernel ="); then
-            fatal 1 "Failed to find a kernel RPM in $TOPDIR/RPMS/$TARGET_ARCH/"
-        fi
-        kernel_extra_version=$(rpm -q --queryformat "%{RELEASE}" -p $TOPDIR/RPMS/$TARGET_ARCH/$KERNEL_RPM)
-    else
+    if $REUSERPM && ! reuse kernel "$TOPDIR" "$CAN_LINK_FOR_REUSE" \
+                                   "$REUSE_SIGNATURE"; then
         # nothing cached, build from scratch
         if [ ! -r "$KERNELDIR/$KERNEL_SRPM" ]; then
             download_srpm "$CANONICAL_TARGET" "$KERNEL_SRPM" >&2
         fi
 
-        rpm -ivh $KERNELDIR/$KERNEL_SRPM --define "_topdir $TOPDIR" >&2 || {
-       # should we clean this up or leave it for analysis?
+        if ! rpm -ivh $KERNELDIR/$KERNEL_SRPM \
+                  --define "_topdir $TOPDIR" >&2; then
+            # should we clean this up or leave it for analysis?
             #rm -rf $RPMTOPDIR
             fatal 1 "Error installing kernel SRPM."
-        }
+        fi
 
         # put the Lustre kernel patch into the RPM build tree
         cp $FULL_PATCH $TOPDIR/SOURCES/linux-${lnxmaj}-lustre.patch
@@ -1151,9 +1155,15 @@ build_kernel_with_srpm() {
             echo "unknown"
             return 1
         fi
-        kernel_extra_version=$EXTRA_VERSION
     fi # build reuse
 
+    # figure out the EXTRA_VERSION of the kernel we built or are re-using
+    local KERNEL_RPM
+    if ! KERNEL_RPM=$(find_rpm "$TOPDIR/RPMS/$TARGET_ARCH/" provides "^kernel ="); then
+        fatal 1 "Failed to find a kernel RPM in $TOPDIR/RPMS/$TARGET_ARCH/"
+    fi
+    kernel_extra_version=$(rpm -q --queryformat "%{RELEASE}" -p $TOPDIR/RPMS/$TARGET_ARCH/$KERNEL_RPM)
+
     # should now have the following RPMs
     # $TOPDIR/RPMS/$arch/kernel-lustre-2.6.18-53.1.21.el5_lustre.1.6.5.1.$arch.rpm
     # $TOPDIR/RPMS/$arch/kernel-lustre-devel-2.6.18-53.1.21.el5_lustre.1.6.5.1.$arch.rpm
@@ -1177,7 +1187,7 @@ build_with_srpm() {
         for arch in $BUILD_ARCHS; do
 
             local kernel_devel_rpm
-            if ! kernel_devel_rpm=$(find_rpm "$TOPDIR/RPMS/$arch/" provides "^$(devel_kernel_name true) ="); then
+            if ! kernel_devel_rpm=$(find_rpm "$TOPDIR/RPMS/$arch/" provides "^$(devel_kernel_name $KERNEL_LUSTRE_NAMING) ="); then
                 fatal 1 "Failed to find a kernel development RPM in $TOPDIR/RPMS/$arch/"
             fi
 
@@ -1279,12 +1289,15 @@ build_with_srpm() {
 
 create_rpmbuild_dirs() {
 
-    if [ ! -d RPMS ]; then
-        mkdir -p RPMS
-        for arch in $BUILD_ARCHS; do
-            mkdir RPMS/$arch
-        done
-    fi
+    [ -d RPMS ] || mkdir RPMS
+    for arch in $BUILD_ARCHS; do
+        if [[ $arch = i?86 ]]; then
+            # some stupidity in the sles11 kernel spec requires an RPMS/i386
+            # even if the target arch is i686
+            [ -d RPMS/i386 ] || mkdir RPMS/i386
+        fi
+        [ -d RPMS/$arch ] || mkdir RPMS/$arch
+    done
     [ -d BUILD ] || mkdir BUILD
     [ -d SOURCES ] || mkdir SOURCES
     [ -d SPECS ] || mkdir SPECS