From: Dmitry Eremin Date: Fri, 7 Mar 2014 15:11:50 +0000 (+0400) Subject: LU-4735 lbuild: Build Xeon Phi client RPMs for SLES X-Git-Tag: 2.6.51~78 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=0041b3977ec04bd74092dc7ea0e329074c9aba27;hp=308518230e4f410bd961e82b54e868eb53616b97 LU-4735 lbuild: Build Xeon Phi client RPMs for SLES autodetect_distro() returns DISTRO in following format: -. The for SuSE Linux is patchlevel. Adopt lbuild script for build Xeon Phi client RPMs for SLES. Also add fake dependency to avoid add incorrect one. Signed-off-by: Dmitry Eremin Change-Id: I1ef97a9da00078ae3093037d1a822fae95da87b1 Reviewed-on: http://review.whamcloud.com/9552 Tested-by: Jenkins Reviewed-by: Bob Glossman Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/contrib/lbuild/find_linux_rpms b/contrib/lbuild/find_linux_rpms index 44a7b97..8a28154 100644 --- a/contrib/lbuild/find_linux_rpms +++ b/contrib/lbuild/find_linux_rpms @@ -20,12 +20,15 @@ TOPDIR=$PWD KERNELRPMSDIR="$1" DISTRO=$(autodetect_distro) -# remove minor version only for rhel and oel -[[ $DISTRO =~ "el-" ]] && DISTRO=${DISTRO%%.*} # remove separator DISTRO=${DISTRO/-/} +DISTROMAJ=${DISTRO%%.*} -source $LBUILD_DIR/lbuild-$DISTRO +if [ -f $LBUILD_DIR/lbuild-$DISTRO ]; then + . $LBUILD_DIR/lbuild-$DISTRO +else + . $LBUILD_DIR/lbuild-$DISTROMAJ +fi TARGET_ARCH="$(uname -m)" TARGET_ARCHS="$(uname -m)" diff --git a/contrib/lbuild/funcs.sh b/contrib/lbuild/funcs.sh index 1f6726c..71633b3 100644 --- a/contrib/lbuild/funcs.sh +++ b/contrib/lbuild/funcs.sh @@ -55,14 +55,14 @@ find_rpm() { find_linux_rpms() { local prefix="$1" - local pathtorpms=${2:-"${KERNELRPMSBASE}/${lnxmaj}/${DISTRO}/${TARGET_ARCH}"} + local pathtorpms=${2:-"$KERNELRPMSBASE/$lnxmaj/$DISTROMAJ/$TARGET_ARCH"} local wanted_kernel="${lnxmaj}${lnxmin}-${lnxrel}${rpmfix}" local kernel_rpms=$(find_linux_rpm "$prefix" "$pathtorpms") # call a distro specific hook, if available - if type -p find_linux_rpms-$DISTRO; then + if type -p find_linux_rpms-$DISTROMAJ; then local rpm - if rpm=$(find_linux_rpms-$DISTRO "$prefix" "$wanted_kernel" "$pathtorpms"); then + if rpm=$(find_linux_rpms-$DISTROMAJ "$prefix" "$wanted_kernel" "$pathtorpms"); then kernel_rpms="$kernel_rpms $rpm" else return 255 @@ -85,7 +85,7 @@ resolve_arch() { # or just gotten rid of. :-) find_linux_rpm() { local prefix="$1" - local pathtorpms=${2:-"${KERNELRPMSBASE}/${lnxmaj}/${DISTRO}/${TARGET_ARCH}"} + local pathtorpms=${2:-"$KERNELRPMSBASE/$lnxmaj/$DISTROMAJ/$TARGET_ARCH"} local found_rpm="" local wanted_kernel="${lnxmaj}${lnxmin}-${lnxrel}${rpmfix}" @@ -107,8 +107,8 @@ find_linux_rpm() { # done if [ -z "$found_rpm" ]; then # see if there is a distro specific way of getting the RPM - if type -p find_linux_rpm-$DISTRO; then - if found_rpm=$(find_linux_rpm-$DISTRO "$prefix" "$wanted_kernel" "$pathtorpms"); then + if type -p find_linux_rpm-$DISTROMAJ; then + if found_rpm=$(find_linux_rpm-$DISTROMAJ "$prefix" "$wanted_kernel" "$pathtorpms"); then found_rpm="${pathtorpms}/$found_rpm" ret=0 else @@ -140,6 +140,8 @@ autodetect_distro() { ;; "SUSE LINUX") name="sles" + PATCHLEVEL=$(sed -n -e 's/^PATCHLEVEL = //p' /etc/SuSE-release) + version="${version}.$PATCHLEVEL" ;; "Fedora") name="fc" @@ -149,11 +151,13 @@ autodetect_distro() { ;; esac else - echo "You really ought to install lsb_release for accurate distro identification" + error "You really ought to install lsb_release for accurate distro identification" # try some heuristics if [ -f /etc/SuSE-release ]; then name=sles version=$(sed -n -e 's/^VERSION = //p' /etc/SuSE-release) + PATCHLEVEL=$(sed -n -e 's/^PATCHLEVEL = //p' /etc/SuSE-release) + version="${version}.$PATCHLEVEL" elif [ -f /etc/redhat-release ]; then #name=$(head -1 /etc/redhat-release) name=rhel @@ -176,20 +180,16 @@ autodetect_target() { local target="" case ${distro} in - oel5) target="2.6-oel5";; - rhel5) target="2.6-rhel5";; - rhel6) target="2.6-rhel6";; - rhel7) target="3.10-rhel7";; - sles10) target="2.6-sles10";; - sles11) target="$(uname -r | cut -d . -f 1,2)-sles11" - local PLEV=$(sed -n -e 's/^PATCHLEVEL = //p' /etc/SuSE-release) - if [ "$PLEV" = "3" ]; then - target=${target}sp3 - fi - ;; - fc15) target="2.6-fc15";; - fc18) target="3.x-fc18";; - *) fatal 1 "I don't know what distro $distro is.\nEither update autodetect_target() or use the --target argument.";; + oel5*) target="2.6-oel5";; + rhel5*) target="2.6-rhel5";; + rhel6*) target="2.6-rhel6";; + rhel7*) target="3.10-rhel7";; + sles10*) target="2.6-sles10";; + sles11.3) target="$(uname -r | cut -d . -f 1,2)-sles11sp3";; + sles11*) target="$(uname -r | cut -d . -f 1,2)-sles11";; + fc15) target="2.6-fc15";; + fc18) target="3.x-fc18";; + *) fatal 1 "I don't know what distro $distro is.\nEither update autodetect_target() or use the --target argument.";; esac echo ${target} diff --git a/contrib/lbuild/lbuild b/contrib/lbuild/lbuild index 8a18607..24c3a1e 100755 --- a/contrib/lbuild/lbuild +++ b/contrib/lbuild/lbuild @@ -261,11 +261,10 @@ check_options() { if [ -z "$DISTRO" ] ; then DISTRO=$(autodetect_distro) - # remove minor version only for rhel and oel - [[ $DISTRO =~ "el-" ]] && DISTRO=${DISTRO%%.*} # remove separator DISTRO=${DISTRO/-/} fi + DISTROMAJ=${DISTRO%%.*} [ -z "$TARGET" ] && TARGET=$(autodetect_target "$DISTRO") @@ -442,11 +441,11 @@ download_srpm() { [ ! -s "$KERNELDIR/$srpm" ]; then rm -f $KERNELDIR/$srpm # punt to a distro specific method if it exists - if ! type -p download_srpm-$DISTRO; then + if ! type -p download_srpm-$DISTROMAJ; then fatal 1 "Could not download target $target's kernel SRPM $srpm from $location." else - if ! download_srpm-$DISTRO "$target" "$srpm" "$force"; then - fatal 1 "Could not download target $target's kernel SRPM $srpm using download_srpm-$DISTRO." + if ! download_srpm-$DISTROMAJ "$target" "$srpm" "$force"; then + fatal 1 "Could not download target $target's kernel SRPM $srpm using download_srpm-$DISTROMAJ." fi fi fi @@ -800,18 +799,19 @@ load_target() { tarflags() { local file="$1" + echo -n '--wildcards ' case "$file" in '') fatal 1 "tarflags(): File name argument missing." ;; *.tar.gz | *.tgz) - echo 'zxf' + echo '-zxf' ;; *.tar.bz2) - echo 'jxf' + echo '-jxf' ;; *.tar) - echo 'xf' + echo '-xf' ;; *) fatal 1 "tarflags(): Unrecognized tar extension in file: $1" @@ -1298,8 +1298,8 @@ unpack_linux_devel_rpm() { fi # call a distro specific hook, if available - if type -p unpack_linux_devel_rpm-$DISTRO; then - if ! unpack_linux_devel_rpm-$DISTRO "$kernelrpm"; then + if type -p unpack_linux_devel_rpm-$DISTROMAJ; then + if ! unpack_linux_devel_rpm-$DISTROMAJ "$kernelrpm"; then return 255 fi fi @@ -1561,8 +1561,11 @@ build_kernel_with_srpm() { if $USE_BUILD_CACHE && [ -n "$REUSEBUILD" ]; then local REUSE_SIGNATURE=$({ echo -en $release_str; echo $BUILD_GEN; - cat $CONFIG_FILE $TARGET_FILE $FULL_PATCH; - cat $LBUILD_DIR/lbuild $LBUILD_DIR/lbuild-${DISTRO}; } | + cat "$CONFIG_FILE"; + cat "$TARGET_FILE"; + cat "$FULL_PATCH"; + cat "$LBUILD_DIR/lbuild"; + cat "$LBUILD_DIR/lbuild-$DISTROMAJ"; } | 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 @@ -1656,9 +1659,9 @@ build_ofed() { # XXX we need to better integrate a distro specific override with # the rest of this function so that all of the reuse cache # stuff is leveraged given that 80% of this function is reuse - if type -p build_ofed-${DISTRO}; then + if type -p build_ofed-$DISTROMAJ; then local ofed_location - ofed_location=$(build_ofed-${DISTRO} ${STDOUT}) + ofed_location=$(build_ofed-$DISTROMAJ ${STDOUT}) local rc=${PIPESTATUS[0]} CONFIGURE_FLAGS="--with-o2ib=${ofed_location} ${CONFIGURE_FLAGS}" return $rc @@ -1679,8 +1682,8 @@ build_ofed() { echo "$(find_linux_release; echo "$BUILD_GEN")"; cat "${linux}/include/linux/autoconf.h"; - cat "$LBUILD_DIR/lbuild" ; - cat "$LBUILD_DIR/lbuild-${DISTRO}"; } | + cat "$LBUILD_DIR/lbuild"; + cat "$LBUILD_DIR/lbuild-$DISTROMAJ"; } | 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 @@ -1780,7 +1783,7 @@ build_with_srpm() { # client build local kernelrpm if ! kernelrpm=$(find_linux_rpm "-$DEVEL_KERNEL_TYPE"); then - fatal 1 "Could not find the kernel-$DEVEL_KERNEL_TYPE RPM in ${KERNELRPMSBASE}/${lnxmaj}/${DISTRO}" + fatal 1 "Could not find the kernel-$DEVEL_KERNEL_TYPE RPM in $KERNELRPMSBASE/$lnxmaj/$DISTROMAJ" fi if ! lnxrel="$lnxrel" unpack_linux_devel_rpm "$kernelrpm" "-"; then fatal 1 "Could not find the Linux tree in $kernelrpm" @@ -2135,8 +2138,7 @@ unpack_lustre # XXX - should we _always_ get the buildid from the META file? what are the # other (i.e. non-lustre-tarball use cases of lbuild)? -BUILDID=$(sed -ne '/^BUILDID =/s/.*= *//p' lustre/META) -VERSION=$(sed -ne '/^VERSION =/s/.*= *//p' lustre/META) +BUILDID=$(sed -n -e 's/^BUILDID = //p' lustre/META) load_target @@ -2153,9 +2155,8 @@ if [ -n "$MPSS_VERSION" ]; then if [ "$MPSS_VERSION" = "last" ]; then MPSS_VERSION=$(parse_mpss_info "$MPSS_INFO" "" ${MPSS_DISTRO}) - [ -z "$MPSS_VERSION" ] && fatal 1 "Could not determine the last MPSS version" - elif [[ $MPSS_VERSION != [0-9].[0-9].[0-9]*-[0-9]* ]]; then - fatal 1 "Incorrect MPSS version $MPSS_VERSION" + [ -z "$MPSS_VERSION" ] && + fatal 1 "Could not determine the last MPSS version" fi download_mpss "$MPSS_INFO" @@ -2184,15 +2185,17 @@ if [ -n "$MPSS_VERSION" ]; then if [ "${MPSS_VERSION%%.*}" = "3" ]; then CC_TARGET_ARCH=k1om-mpss-linux LINUX="$TOPDIR/mpss" + RPMBUILD_DEFS="$RPMBUILD_DEFS --define \"cross_requires /bin/sh\"" else CC_TARGET_ARCH=x86_64-k1om-linux LINUX="$TOPDIR/mpss/card/kernel" RPMBUILD_DEFS="$RPMBUILD_DEFS --define \"cross_requires intel-mic-gpl = ${MPSS_VERSION%%-*}\"" fi + LUSTRE_VERSION=$(sed -n -e 's/^VERSION = //p' lustre/META) CONFIGURE_FLAGS="$CONFIGURE_FLAGS $MPSS_OFED --host=$CC_TARGET_ARCH --build=x86_64-pc-linux" RPMBUILD_DEFS="$RPMBUILD_DEFS --define \"post_script build/gen_filelist.sh\"" RPMBUILD_DEFS="$RPMBUILD_DEFS --define \"make_args ARCH=k1om CROSS_COMPILE=${CC_TARGET_ARCH}-\"" - RPMBUILD_DEFS="$RPMBUILD_DEFS --define \"cross_path ${CROSS_PATH:=/opt/lustre/${VERSION}/${CC_TARGET_ARCH}}\"" + RPMBUILD_DEFS="$RPMBUILD_DEFS --define \"cross_path ${CROSS_PATH:=/opt/lustre/${LUSTRE_VERSION}/${CC_TARGET_ARCH}}\"" RPMBUILD_DEFS="$RPMBUILD_DEFS --define \"rootdir %{cross_path}\"" RPMBUILD_DEFS="$RPMBUILD_DEFS --define \"_prefix %{cross_path}/usr\"" RPMBUILD_DEFS="$RPMBUILD_DEFS --define \"_mandir %{_prefix}/share/man\"" @@ -2216,10 +2219,10 @@ if [ -n "$LINUX" ]; then fatal 1 "error building OFED" build_lustre "$LINUX" "$LINUXOBJ" else - if [ ! -f "${LBUILD_DIR}/lbuild-$DISTRO" ]; then - fatal 1 "${LBUILD_DIR}/lbuild-$DISTRO not found" + if [ ! -f "${LBUILD_DIR}/lbuild-$DISTROMAJ" ]; then + fatal 1 "${LBUILD_DIR}/lbuild-$DISTROMAJ not found" fi - source ${LBUILD_DIR}/lbuild-$DISTRO + source ${LBUILD_DIR}/lbuild-$DISTROMAJ build_with_srpm || fatal 1 "Failed to build_with_srpm" fi diff --git a/contrib/lbuild/lbuild-fc18 b/contrib/lbuild/lbuild-fc18 index 0c3ea77..94b97a1 100644 --- a/contrib/lbuild/lbuild-fc18 +++ b/contrib/lbuild/lbuild-fc18 @@ -9,7 +9,7 @@ BUILD_GEN+=".0" find_linux_rpm-fc18() { local prefix="$1" local wanted_kernel="$2" - local pathtorpms=${3:-"${KERNELRPMSBASE}/${lnxmaj}/${DISTRO}/${TARGET_ARCH}"} + local pathtorpms=${3:-"$KERNELRPMSBASE/$lnxmaj/$DISTROMAJ/$TARGET_ARCH"} find_linux_rpm-rhel "$prefix" "$wanted_kernel" "$pathtorpms" diff --git a/contrib/lbuild/lbuild-rhel b/contrib/lbuild/lbuild-rhel index a81aff5..0015042 100644 --- a/contrib/lbuild/lbuild-rhel +++ b/contrib/lbuild/lbuild-rhel @@ -182,7 +182,7 @@ unpack_linux_devel_rpm-rhel() { find_linux_rpm-rhel() { local prefix="$1" local wanted_kernel="$2" - local pathtorpms=${3:-"${KERNELRPMSBASE}/${lnxmaj}/${DISTRO}/${TARGET_ARCH}"} + local pathtorpms=${3:-"$KERNELRPMSBASE/$lnxmaj/$DISTROMAJ/$TARGET_ARCH"} local tmpdir=$(mktemp -d $pathtorpms/yumXXXXXX) local sudo="" diff --git a/contrib/lbuild/lbuild-rhel5 b/contrib/lbuild/lbuild-rhel5 index 4aab2c7..25c374f 100644 --- a/contrib/lbuild/lbuild-rhel5 +++ b/contrib/lbuild/lbuild-rhel5 @@ -109,7 +109,7 @@ unpack_linux_devel_rpm-rhel5() { find_linux_rpm-rhel5() { local prefix="$1" local wanted_kernel="$2" - local pathtorpms=${3:-"${KERNELRPMSBASE}/${lnxmaj}/${DISTRO}/${TARGET_ARCH}"} + local pathtorpms=${3:-"$KERNELRPMSBASE/$lnxmaj/$DISTROMAJ/$TARGET_ARCH"} find_linux_rpm-rhel "$prefix" "$wanted_kernel" "$pathtorpms" } diff --git a/contrib/lbuild/lbuild-rhel6 b/contrib/lbuild/lbuild-rhel6 index 188f4fc..4f8f2ab 100644 --- a/contrib/lbuild/lbuild-rhel6 +++ b/contrib/lbuild/lbuild-rhel6 @@ -68,7 +68,7 @@ get_rpmbuildopts() { find_linux_rpm-rhel6() { local prefix="$1" local wanted_kernel="$2" - local pathtorpms=${3:-"${KERNELRPMSBASE}/${lnxmaj}/${DISTRO}/${TARGET_ARCH}"} + local pathtorpms=${3:-"$KERNELRPMSBASE/$lnxmaj/$DISTROMAJ/$TARGET_ARCH"} find_linux_rpm-rhel "$prefix" "$wanted_kernel" "$pathtorpms" diff --git a/contrib/lbuild/lbuild-rhel7 b/contrib/lbuild/lbuild-rhel7 index e0e951a..62c5acc 100644 --- a/contrib/lbuild/lbuild-rhel7 +++ b/contrib/lbuild/lbuild-rhel7 @@ -9,7 +9,7 @@ BUILD_GEN+=".0" find_linux_rpm-rhel7() { local prefix="$1" local wanted_kernel="$2" - local pathtorpms=${3:-"${KERNELRPMSBASE}/${lnxmaj}/${DISTRO}/${TARGET_ARCH}"} + local pathtorpms=${3:-"$KERNELRPMSBASE/$lnxmaj/$DISTROMAJ/$TARGET_ARCH"} find_linux_rpm-rhel "$prefix" "$wanted_kernel" "$pathtorpms" diff --git a/contrib/lbuild/lbuild-sles11 b/contrib/lbuild/lbuild-sles11 index bed32e9..a404a8c 100644 --- a/contrib/lbuild/lbuild-sles11 +++ b/contrib/lbuild/lbuild-sles11 @@ -90,7 +90,7 @@ unpack_linux_devel_rpm-sles11() { find_linux_rpm-sles11() { local prefix="$1" local wanted_kernel="$2" - local pathtorpms=${3:-"${KERNELRPMSBASE}/${lnxmaj}/${DISTRO}/${TARGET_ARCH}"} + local pathtorpms=${3:-"$KERNELRPMSBASE/$lnxmaj/$DISTROMAJ/$TARGET_ARCH"} local PLEV=$(sed -n -e 's/^PATCHLEVEL = //p' /etc/SuSE-release) local site="https://nu.novell.com/repo/\$RCE/SLES11-SP${PLEV}-Updates/sle-11-$(resolve_arch $TARGET_ARCH)/rpm/$(resolve_arch $TARGET_ARCH)" diff --git a/lustre.spec.in b/lustre.spec.in index 1f37e8c..c314717 100644 --- a/lustre.spec.in +++ b/lustre.spec.in @@ -82,6 +82,14 @@ %define rpm_post_base %(echo $(dirname %{cross_path})/%{lustre_name}) %endif +# SUSE don't support .debug_info section from cross compiler: +# /usr/lib/rpm/debugedit: Unhandled relocation 10 in .debug_info section +%if %{defined cross_path} && 0%{?suse_version} +%global __debug_install_post %{nil} +%global __debug_package %{nil} +%global debug_package %{nil} +%endif + Summary: Lustre File System Name: %{lustre_name} Version: %{version}