From 98bf9c9e3ecaa6736dcb066d0c76e20610fa9725 Mon Sep 17 00:00:00 2001 From: "Brian J. Murrell" Date: Fri, 25 Mar 2011 00:48:57 -0400 Subject: [PATCH] LU-177 lbuild autonomy fixes Fixes to allow lbuild to work without uneeded help from it's caller: - kernel srpm location for rhel5 - CentOS is a "rhel" distro Direct output to the output FD. Refactor find_linux_rpm-rhel{5,6}. Signed-off-by: Brian J. Murrell Change-Id: I714b90b53b14ac4ef4cd6bfe638a029656a151b0 Reviewed-on: http://review.whamcloud.com/361 Reviewed-by: Oleg Drokin Tested-by: Hudson Reviewed-by: Michael MacDonald --- build/funcs.sh | 2 +- build/lbuild | 4 ++-- build/lbuild-rhel | 23 +++++++++++++++++++++++ build/lbuild-rhel5 | 14 ++++++++++++++ build/lbuild-rhel6 | 9 +-------- 5 files changed, 41 insertions(+), 11 deletions(-) diff --git a/build/funcs.sh b/build/funcs.sh index 5e8db78..09292d0 100644 --- a/build/funcs.sh +++ b/build/funcs.sh @@ -137,7 +137,7 @@ autodetect_distro() { name="oel" version="${version%%.*}" ;; - "RedHatEnterpriseServer" | "ScientificSL") + "RedHatEnterpriseServer" | "ScientificSL" | "CentOS") name="rhel" version="${version%%.*}" ;; diff --git a/build/lbuild b/build/lbuild index 20ed08b..b4a91c2 100755 --- a/build/lbuild +++ b/build/lbuild @@ -1231,7 +1231,7 @@ build_kernel_with_srpm() { "$REUSE_SIGNATURE"; then # nothing cached, build from scratch if [ ! -r "$KERNELDIR/$KERNEL_SRPM" ]; then - echo "Downloading kernel SRPM" + echo "Downloading kernel SRPM" >&${outfd} download_srpm "$CANONICAL_TARGET" "$KERNEL_SRPM" >&${outfd} fi @@ -1256,7 +1256,7 @@ build_kernel_with_srpm() { "kernel" "$REUSEBUILD" "$REUSE_SIGNATURE" \ "$CAN_LINK_FOR_REUSE"; then error "Failed to store kernel RPMS for reuse" - echo "unknown" + echo "unknown" >&${outfd} return 1 fi fi diff --git a/build/lbuild-rhel b/build/lbuild-rhel index bcac604..3ad89d8 100644 --- a/build/lbuild-rhel +++ b/build/lbuild-rhel @@ -170,3 +170,26 @@ unpack_linux_devel_rpm-rhel() { return 0 } + +# this of course requires a sudo rule on the builder for real RHEL: +# hudson ALL= NOPASSWD: /usr/bin/yumdownloader +# also must disable the requiretty attribute in the sudoers file +find_linux_rpm-rhel() { + local prefix="$1" + local wanted_kernel="$2" + local pathtorpms=${3:-"${KERNELRPMSBASE}/${lnxmaj}/${DISTRO}/${TARGET_ARCH}"} + + local tmpdir=$(mktemp -d $pathtorpms/yumXXXXXX) + local sudo="" + if [ "$(lsb_release -s -i)" = "RedHatEnterpriseServer" ]; then + sudo="sudo" + fi + $sudo yumdownloader --destdir "$tmpdir" kernel-devel-"$wanted_kernel" > /dev/null + local rpm=$(cd $tmpdir; echo *) + mv "$tmpdir/$rpm" "$pathtorpms" + rmdir $tmpdir + echo "$rpm" + + return 0 + +} diff --git a/build/lbuild-rhel5 b/build/lbuild-rhel5 index 1ab4b8a..7bd8909 100644 --- a/build/lbuild-rhel5 +++ b/build/lbuild-rhel5 @@ -98,3 +98,17 @@ unpack_linux_devel_rpm-rhel5() { return 0 } + +find_linux_rpm-rhel5() { + local prefix="$1" + local wanted_kernel="$2" + local pathtorpms=${3:-"${KERNELRPMSBASE}/${lnxmaj}/${DISTRO}/${TARGET_ARCH}"} + + find_linux_rpm-rhel "$prefix" "$wanted_kernel" "$pathtorpms" +} + +kernel_srpm_location() { + + echo "http://mirror.centos.org/centos-5/5/updates/SRPMS/" + +} diff --git a/build/lbuild-rhel6 b/build/lbuild-rhel6 index 9ac2a48..53bcee7 100644 --- a/build/lbuild-rhel6 +++ b/build/lbuild-rhel6 @@ -60,14 +60,7 @@ find_linux_rpm-rhel6() { local wanted_kernel="$2" local pathtorpms=${3:-"${KERNELRPMSBASE}/${lnxmaj}/${DISTRO}/${TARGET_ARCH}"} - local tmpdir=$(mktemp -d $pathtorpms/yumXXXXXX) - sudo yumdownloader --destdir "$tmpdir" kernel-devel-"$wanted_kernel" > /dev/null - local rpm=$(cd $tmpdir; echo *) - mv "$tmpdir/$rpm" "$pathtorpms" - rmdir $tmpdir - echo "$rpm" - - return 0 + find_linux_rpm-rhel "$prefix" "$wanted_kernel" "$pathtorpms" } -- 1.8.3.1