Whamcloud - gitweb
b=17258 fix error with make rpms after configure --disable-tests
[fs/lustre-release.git] / build / lbuild
index 3478342..20697bf 100755 (executable)
@@ -83,6 +83,9 @@ UP_ARCHS=
 # not in the target file any more
 CONFIG=
 
+# build the lustre-tests rpm?
+LUSTRE_TESTS=true
+
 DATE=$(date)
 
 USE_DATESTAMP=1
@@ -510,7 +513,7 @@ download_ofed() {
         daily=${OFED_VERSION##$Mmv-}
         location="http://www.openfabrics.org/downloads/OFED/ofed-${Mmv}-daily/"
         # find the filename for the version for the date specified
-        OFED_VERSION=$(curl -s "$location" | sed -nre "/${daily}-/s/.*href=\"OFED-([0-9]+\.[0-9]+-${daily}-[0-9]{4,4}).tgz.*$/\1/p" | tail -1)
+        OFED_VERSION=$(curl -s "$location" | sed -nre "/${daily}-/s/.*href=\"OFED-(${Mmv//./\\.}-${daily}-[0-9]{4,4}).tgz.*$/\1/p" | tail -1)
         if [ -z "$OFED_VERSION" ]; then
             fatal 1 "Could not determine the filename of the OFED snapshot for ${daily}"
         fi
@@ -833,15 +836,24 @@ build_lustre() {
         echo NORPM mode. Only compiling.
     fi
 
-    # convert the $PATCHLESS boolean to an empty/no-empty boolean
+    # convert the $PATCHLESS boolean to an empty/not-empty boolean
     # as silly as this seems, it makes the syntax of the rpmbuild command
     # simpler and not need an eval to deal with the quotes in the quotes
     local is_patchless=""
     if $PATCHLESS; then
         is_patchless="yes"
     fi
+
+    # ditto for the lustre-tests boolean
+    local lustre_tests=""
+    if ! $LUSTRE_TESTS; then
+        lustre_tests="no"
+    fi
+
     $RPMBUILD $targets $rpmbuildopt ../lustre.spec \
         ${is_patchless:+--define "lustre_name lustre-client"} \
+        ${lustre_tests:+--define "build_lustre_tests 0"} \
+        --define "configure_args $confoptions ${CONFIGURE_FLAGS}" \
         --define "_tmppath $TMPDIR" \
         --define "_topdir $TOPDIR" 2>&1 || \
         fatal 1 "Error building rpms for $BUILD_ARCHS."
@@ -986,7 +998,8 @@ find_linux_rpm() {
     for arch in $TARGET_ARCHS_ALL; do
         local found_rpm="" rpm
         for rpm in ${pathtorpms}/${arch}/*.rpm; do
-            if rpm -q --provides -p "$rpm" | grep -q "kernel${prefix} = $wanted_kernel"; then
+            if rpm -q --provides -p "$rpm" 2>&3 | grep -q "kernel${prefix} = $wanted_kernel" 2>&3; then
+
                 found_rpm="$rpm"
                 ret=0
                 break
@@ -1285,7 +1298,7 @@ find_rpm() {
         case "$match_type" in
             provides)
                 # match is any valid ERE (i.e. given to egrep) match
-                if rpm -q --provides -p "$file" | egrep -q "$match"; then
+                if rpm -q --provides -p "$file" 2>&3 | egrep -q "$match"; then
                     echo "$file"
                     popd >/dev/null
                     return 0
@@ -1432,7 +1445,7 @@ build_mptlinux() {
                   --define "_tmppath /var/tmp" \
                   --define "_topdir ${TOPDIR}" \
                   --define "kernel_obj $linux" \
-                  ${TOPDIR}/SPECS/mptlinux.spec; then
+                  ${TOPDIR}/SPECS/mptlinux.spec 2>&1; then
         return 1
     fi
     if $DO_SRC; then
@@ -1440,7 +1453,7 @@ build_mptlinux() {
                       --define "_tmppath /var/tmp" \
                       --define "_topdir ${TOPDIR}" \
                       --define "kernel_obj $linux" \
-                      ${TOPDIR}/SPECS/mptlinux.spec; then
+                      ${TOPDIR}/SPECS/mptlinux.spec 2>&1; then
             return 1
         fi
     fi
@@ -1488,7 +1501,7 @@ build_rdac() {
                   --define "_tmppath /var/tmp" \
                   --define "_topdir ${TOPDIR}" \
                   --define "kernel_obj $linux" \
-                  ${TOPDIR}/SPECS/rdac.spec; then
+                  ${TOPDIR}/SPECS/rdac.spec 2>&1; then
         return 1
     fi
     if $DO_SRC; then
@@ -1496,7 +1509,7 @@ build_rdac() {
                       --define "_tmppath /var/tmp" \
                       --define "_topdir ${TOPDIR}" \
                       --define "kernel_obj $linux" \
-                      ${TOPDIR}/SPECS/rdac.spec; then
+                      ${TOPDIR}/SPECS/rdac.spec 2>&1; then
             return 1
         fi
     fi
@@ -1911,6 +1924,11 @@ while [ "$1" ]; do
             ;;
         --)
             shift
+            # there are actually some lustre configure flags that we need to
+            # handle ourselves (but we still give them to configure)
+            if [[ \ $@\  == *\ --disable-tests\ * ]]; then
+                LUSTRE_TESTS=false
+            fi
             CONFIGURE_FLAGS=$@
             CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-liblustre --enable-liblustre-tests"
             break