Whamcloud - gitweb
LU-1199 build: Fix paths after move to contrib dir 97/6497/2
authorDmitry Eremin <dmitry.eremin@intel.com>
Thu, 30 May 2013 14:37:12 +0000 (18:37 +0400)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 10 Jul 2013 02:38:55 +0000 (02:38 +0000)
Fix usage of lbuild's support files from the directory where
lbuild and support files are realy palced.

Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Change-Id: Ie0bb4f98ee0adcbf1643b15a9d131f69a47b7360
Reviewed-on: http://review.whamcloud.com/6497
Tested-by: Hudson
Reviewed-by: Christopher J. Morrone <chris.morrone.llnl@gmail.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Minh Diep <minh.diep@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
contrib/lbuild/find_linux_rpms
contrib/lbuild/lbuild

index 94fd400..b84d156 100644 (file)
@@ -7,7 +7,12 @@
 #exec 3>&1; STDOUT=3
 STDOUT=2
 
-. ${0%/find_linux_rpms}/funcs.sh
+# Assume that lbuild's support files can be found in the same
+# canonicalized path as this very script.
+THIS_SCRIPT=$(readlink -f ${0})
+LBUILD_DIR=${LBUILD_DIR:-$(dirname ${THIS_SCRIPT})}
+
+. $LBUILD_DIR/funcs.sh
 
 TOPDIR=$PWD
 
@@ -16,7 +21,7 @@ KERNELRPMSDIR="$1"
 
 DISTRO=$(autodetect_distro)
 
-source ${0%/*}/lbuild-$DISTRO
+source $LBUILD_DIR/lbuild-$DISTRO
 
 TARGET_ARCH="$(uname -m)"
 TARGET_ARCHS="$(uname -m)"
index a39b36d..8af01e0 100755 (executable)
@@ -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