Whamcloud - gitweb
EX-2782 build: build lipe using lbuild
authorMinh Diep <mdiep@whamcloud.com>
Fri, 5 Mar 2021 17:24:50 +0000 (09:24 -0800)
committerAndreas Dilger <adilger@whamcloud.com>
Fri, 9 Apr 2021 21:59:31 +0000 (21:59 +0000)
Lustre-change: https://review.whamcloud.com/41904
Lustre-commit: 849db551a86a8c707d7bb5b83eebf639f2e453e9

Change-Id: I1b63a0378b76984ad24f14af89553bb00f659d35
Signed-off-by: Minh Diep <mdiep@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: John L. Hammond <jhammond@whamcloud.com>
Reviewed-by: Li Xi <lixi@ddn.com>
Reviewed-on: https://review.whamcloud.com/43124
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
contrib/lbuild/lbuild

index cc76909..91780bf 100755 (executable)
@@ -877,6 +877,61 @@ do_patch_linux() {
 
 }
 
+build_lipe() {
+       local source="$1"
+       local lustre_install_root
+       local lustre_rpm=''
+       local name
+
+       # Find the lustre rpm
+       for rpm in ${source}/*.rpm; do
+               name=$(rpm --query --queryformat '%{NAME}\n' --package "$rpm")
+               if [[ "$name" == "lustre-devel" ]]; then
+                       lustre_rpm="$rpm"
+                       break
+               fi
+       done
+
+       if [[ "$lustre_rpm" == "" ]]; then
+               echo "cannot find lustre RPM" >&2
+               return 255
+       fi
+
+       # Extract headers and liblustreapi.so from lustre RPM for build.
+       lustre_install_root=$(mktemp -d ${TOPDIR}/root.XXXXXXXX)
+       pushd $lustre_install_root > /dev/null
+       rpm2cpio $lustre_rpm | cpio -idv
+       popd > /dev/null
+
+       # since lipe is not included in 'make dist', we have to assume two places
+       # user copy lipe to current directory
+       # lipe exist in one uppper directory
+       if [[ -d ${TOPDIR}/../lipe ]]; then
+               pushd ${TOPDIR}/../lipe > /dev/null
+       elif [[ -d {TOPDIR}/lipe ]]; then
+               pushd ${TOPDIR}/lipe > /dev/null
+       else
+               fatal 1 "Can not find lipe source"
+       fi
+
+       sh autogen.sh
+
+       CPPFLAGS="\
+               -I${lustre_install_root}/usr/include/linux/lnet \
+               -I${lustre_install_root}/usr/include/linux/lustre \
+               -I${lustre_install_root}/usr/include/lustre \
+               -I${lustre_install_root}/usr/include \
+       " \
+       LDFLAGS="\
+               -L${lustre_install_root}/usr/lib64 \
+       " \
+       ./configure || fatal 1 "Error in configure lipe."
+
+       make rpms || fatal 1 "Error building rpms for lipe"
+       mv -f build/RPMS/${TARGET_ARCH}/lipe*.rpm $TOPDIR/RPMS/${TARGET_ARCH}/
+       popd > /dev/null
+}
+
 build_lustre() {
     local linux="$1"
     local linuxobj="$2"
@@ -946,6 +1001,10 @@ build_lustre() {
     mv -f lustre-*.src.rpm $TOPDIR/SRPMS/
 
     popd >/dev/null
+
+       if [ $PATCHLESS == false ] && ! build_lipe $TOPDIR/RPMS/${TARGET_ARCH}; then
+               return 255
+       fi
        if type -p cleanup_rpmmacros; then
                cleanup_rpmmacros
        fi