From 10b7423c965e1ed35dba8395acde142fc97e74a1 Mon Sep 17 00:00:00 2001 From: Minh Diep Date: Fri, 5 Mar 2021 09:24:50 -0800 Subject: [PATCH] EX-2782 build: build lipe using lbuild Lustre-change: https://review.whamcloud.com/41904 Lustre-commit: 849db551a86a8c707d7bb5b83eebf639f2e453e9 Change-Id: I1b63a0378b76984ad24f14af89553bb00f659d35 Signed-off-by: Minh Diep Reviewed-by: Jian Yu Reviewed-by: John L. Hammond Reviewed-by: Li Xi Reviewed-on: https://review.whamcloud.com/43124 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- contrib/lbuild/lbuild | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/contrib/lbuild/lbuild b/contrib/lbuild/lbuild index cc76909..91780bf 100755 --- a/contrib/lbuild/lbuild +++ b/contrib/lbuild/lbuild @@ -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 -- 1.8.3.1