Whamcloud - gitweb
EX-2439 build: Add opa-src option to lbuild
authorMinh Diep <mdiep@whamcloud.com>
Wed, 27 Jan 2021 19:58:40 +0000 (11:58 -0800)
committerAndreas Dilger <adilger@whamcloud.com>
Thu, 25 Feb 2021 20:23:08 +0000 (20:23 +0000)
Create an option to pass in the opa tarball directly,
since we can not download directly from Intel site
anymore

Test-Parameters: trivial

Lustre-change: https://review.whamcloud.com/41334
Lustre-commit: 3a1a94db3c84c94ad99b8437f482aebfeb6b6246

Change-Id: I3fcad6ee7eff35d26ad7659b6148b0df67c48ad0
Signed-off-by: Minh Diep <mdiep@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: James Nunez <jnunez@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/41749
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Andreas Dilger <adilger@whamcloud.com>
contrib/lbuild/lbuild

index 8feddbe..592a236 100755 (executable)
@@ -184,9 +184,6 @@ Usage: ${0##*/} [OPTION]... [-- <lustre configure options>]
   --ofed-version
     Version of external OFED to build with lustre
 
-  --mlnx-version
-    Version of external Mellanox OFED to build with lustre
-
   --ofed-src
     Tarball for either OFED. Tarball must follow below format
     OFED-<ofed-version>.tgz regardless of vendors
@@ -1570,6 +1567,69 @@ build_kernel_with_srpm() {
 
 }
 
+# The download site is no longer existed! We have to drop the tgz in builders
+# under workspace/kerneltree
+declare -A opa_supported_map=(
+["10.9.1.0.15"]="https://downloadmirror.intel.com/28565/eng/"
+["10.9.2.0.9"]="https://downloadmirror.intel.com/28721/eng/"
+["10.9.3.1.1"]="https://downloadmirror.intel.com/28866/eng/"
+["10.10.0.0.445"]="https://downloadmirror.intel.com/29107/eng/"
+["10.10.1.0.36"]="https://downloadmirror.intel.com/29278/eng/"
+["10.10.2.0.44"]="https://downloadmirror.intel.com/29496/eng/"
+["10.10.3.1.1"]="https://downloadmirror.intel.com/"
+)
+
+#currently used by DDN only
+build_opa() {
+       local linux="$1"
+       local ofed_version="$OPA_VERSION"
+       local linuxrelease=$(find_linux_release)
+
+       rhel_major=$(grep "RHEL_MAJOR =" $linux/Makefile | awk -F '= ' '{print $2}')
+       rhel_minor=$(grep "RHEL_MINOR =" $linux/Makefile | awk -F '= ' '{print $2}')
+       location=${opa_supported_map["$ofed_version"]}
+       # the download location is no longer existed but we keep it a bit longer
+       # and in this case we'll require external src
+       file="IntelOPA-IFS.RHEL$rhel_major$rhel_minor-${TARGET_ARCH}.${ofed_version}"
+       if [ -n "${location}" ]; then
+               download_file "$location/$file.tgz" "$KERNELTREE" "false"
+       fi
+       if [ ! -e $KERNELTREE/${file}.tgz ] && [ -n "${OPA_SRC}" ]; then
+               # try again
+               download_file "${OPA_SRC}" "$KERNELTREE/${file}.tgz" "false"
+       fi
+       if ! untar "$KERNELTREE/${file}.tgz"; then
+               # we'll try the external source before giving up
+               fatal 1 "failed to untar $KERNELTREE/${file}.tgz"
+       fi
+
+       file="IntelOPA-IFS.*.${ofed_version}"
+       rpm --define "_topdir ${TOPDIR}" -ivh \
+               ${TOPDIR}/$file/IntelOPA-*.*/SRPMS/ifs-kernel-updates-*.src.rpm ||
+               fatal 1 "could not install ifs-kernel-updates.*.src.rpm."
+
+       #-e "s#\$kbuild/%kbuild#g" this looks like a bug of spec files..
+       cp ${TOPDIR}/SPECS/ifs-kernel-updates.spec ${TOPDIR}/SPECS/ifs-kernel-updates.spec.orig
+       sed -i -e '/%define kver/d' -e '/%define kdir/d' \
+               -e "s#KDIR=\%{kernel_source \$flavor}#KDIR=${linux}#g" \
+               -e "s#\$kbuild#%kbuild#g" \
+               ${TOPDIR}/SPECS/ifs-kernel-updates.spec
+
+       $RPMBUILD -bs --define "kver ${linuxrelease}" \
+               ${FIND_REQUIRES:+--define "__find_requires $FIND_REQUIRES"} \
+               --define "kdir ${linux}" \
+               --define "kbuild ${linux}" --define "_topdir ${TOPDIR}" \
+               ${TOPDIR}/SPECS/ifs-kernel-updates.spec  ||
+               fatal 1 "could not build ifs-kernel*.src.rpm"
+
+       $RPMBUILD --rebuild --define "kver ${linuxrelease}" \
+               ${FIND_REQUIRES:+--define "__find_requires $FIND_REQUIRES"} \
+               --define "kdir ${linux}" \
+               --define "kbuild ${linux}" \
+               --define "_topdir ${TOPDIR}" ${TOPDIR}/SRPMS/ifs-kernel-updates*.src.rpm ||
+               fatal 1 "could not rebuild ifs-kernel*.rpm"
+}
+
 # build OFED
 # globals used:
 #    TOPDIR
@@ -1935,8 +1995,8 @@ set -E
 options=$(getopt -o D:h -l kerneltree:,distro:,kernelrpm:,reusebuild:,\
 patchless,patchless-server,enable-kernel-debug,ccache,norpm,external-patches:,timestamp:,\
 extraversion:,kerneldir:,linux:,lustre:,nodownload,nosrc,noiokit,ofed-type:,\
-ofed-version:,mlnx-version:,ofed-src:,publish,disable-zfs,release,set-value:,\
-src,stage:,target:,with-linux:,xen -- "$@")
+ofed-version:,opa-version:,ofed-src:,opa-src:,publish,disable-zfs,release,\
+set-value:,src,stage:,target:,with-linux:,xen -- "$@")
 
 if [ $? != 0 ]; then
     usage 1
@@ -2041,6 +2101,14 @@ while [ "$1" ]; do
             OFED_VERSION="$2"
             shift 2
             ;;
+        --opa-version)
+            OPA_VERSION="$2"
+            shift 2
+            ;;
+       --opa-src)
+               OPA_SRC="$2"
+               shift 2
+               ;;
        --ofed-type)
                OFED_TYPE="$2"
                shift 2