Whamcloud - gitweb
LU-3389 build: Fix build fails on RHEL6.4 kernel with OFED-3.5
[fs/lustre-release.git] / contrib / lbuild / lbuild
index a39b36d..fc1c705 100755 (executable)
@@ -262,7 +262,7 @@ canon_path() {
 
 check_options() {
 
-    if [ -z "$LUSTRE" -o ! -r "$LUSTRE"]; then
+    if [ -z "$LUSTRE" -o ! -r "$LUSTRE" ]; then
         usage 1 "Could not find Lustre source tarball '$LUSTRE'."
     fi
 
@@ -539,9 +539,9 @@ download_ofed() {
 
     local location="http://www.openfabrics.org/downloads/OFED/ofed-${OFED_BASE_VERSION}/"
 
-    if [[ $OFED_VERSION = *-rc[0-9] ]]; then
+    if [[ $OFED_VERSION = *-[rR][cC][0-9] ]]; then
         local Mmv
-        Mmv=${OFED_VERSION%%-*}
+        Mmv=${OFED_VERSION%%-[rR][cC][0-9]}
         location="http://www.openfabrics.org/downloads/OFED/ofed-${Mmv}/"
     fi
 
@@ -1213,12 +1213,12 @@ build_kernel_ib() {
     local SOURCE="${TOPDIR}/OFED/SRPMS/${kib_prefix}-*.src.rpm"
 
     # but switch to building from the SPEC if we need to apply patches
-    if ls ${TOPDIR}/lustre/build/patches/ofed/* >/dev/null; then
+    if ls ${TOPDIR}/lustre/contrib/patches/ofed/* >/dev/null; then
         BUILD_TYPE="-bb"
         rpm --define "_topdir ${TOPDIR}" -ivh $SOURCE
         SOURCE="${TOPDIR}/SPECS/${kib_prefix}.spec"
         local file ed_fragment1 ed_fragment2 n=1
-        for file in $(ls ${TOPDIR}/lustre/build/patches/ofed/*.patch); do
+        for file in $(ls ${TOPDIR}/lustre/contrib/patches/ofed/*.patch); do
             ed_fragment1="$ed_fragment1
 Patch$n: ${file%%*/}"
             ed_fragment2="$ed_fragment2
@@ -1226,9 +1226,9 @@ Patch$n: ${file%%*/}"
             cp $file ${TOPDIR}/SOURCES
             let n=$n+1
         done
-        for file in $(ls ${TOPDIR}/lustre/build/patches/ofed/*.ed); do
+        for file in $(ls ${TOPDIR}/lustre/contrib/patches/ofed/*.ed); do
             # Only apply the ed-scripts that should be used for the canonical target
-            # ed-files in ${TOPDIR}/lustre/build/patches/ofed/ have to follow the naming
+            # ed-files in ${TOPDIR}/lustre/contrib/patches/ofed/ have to follow the naming
             # convention
             # <two-digits>-<descriptive-name>:<canonical_target_1>: ...:<canonical_target_N>.ed
             # To apply the same change to multiple canonical target simply specify
@@ -1421,7 +1421,7 @@ build_kernel_with_srpm() {
         local REUSE_SIGNATURE=$({ echo -en $release_str;
                                   echo $BUILD_GEN;
                                   cat $CONFIG_FILE $TARGET_FILE $FULL_PATCH;
-                                  cat ${0%/lbuild}/lbuild ${0%/lbuild}/lbuild-${DISTRO}; } |
+                                  cat $LBUILD_DIR/lbuild $LBUILD_DIR/lbuild-${DISTRO}; } |
                                 md5sum | cut -d" " -f1)
         # see if we can link to the reuse pool
         # XXX - hrm.  i'm not convinced this doesn't belong in the reuse
@@ -1538,8 +1538,8 @@ build_ofed() {
                                   echo "$(find_linux_release;
                                   echo "$BUILD_GEN")";
                                   cat "${linux}/include/linux/autoconf.h";
-                                  cat "${0%/lbuild}/lbuild" ;
-                                  cat "${0%/lbuild}/lbuild-${DISTRO}"; } |
+                                  cat "$LBUILD_DIR/lbuild" ;
+                                  cat "$LBUILD_DIR/lbuild-${DISTRO}"; } |
                                 md5sum | cut -d" " -f1)
         # see if we can link to the reuse pool
         # XXX - hrm.  i'm not convinced this doesn't belong in the reuse
@@ -1595,6 +1595,13 @@ build_ofed() {
     local linuxrelease=$(find_linux_release)
     ofed_version=$(echo $ofed_version |
                    sed -re 's/-(20[0-9]{6,6}-[0-9]{4,4}|rc[0-9]*)$//')
+    # FIXME
+    # OFED version will have 'hyphen' for minor release. (e.g. 3.5-1, instead
+    # of 3.5.1) compat-rdma and compat-rdma-devel could have same version
+    # number, but currectly not. Once OFED fix this in the future release, we
+    # can remove following filter.
+    ofed_version=$(echo $ofed_version |
+                   sed -re 's/-([0-9]*-[rR][cC][0-9]*)$//')
     local rpm=$(ls $TOPDIR/RPMS/*/${kib_rpm}-devel-${ofed_version}-${linuxrelease//-/_}.*.rpm)
     if ! rpm2cpio < $rpm | cpio -id; then
         fatal 1 "could not unpack the ${kib_rpm}-devel rpm."