From 4557e3e767c961e019070253317c1aeeec5e1803 Mon Sep 17 00:00:00 2001 From: "Brian J. Murrell" Date: Fri, 8 Jan 2010 11:25:44 -0500 Subject: [PATCH] b=21586 More stderr/stdout redirections Just a few more redirections to get some commands' output into the appropriate log files. We should actually return the 255, not just assign it to a unused variable. i=yangsheng i=wangyb --- build/lbuild | 13 +++++++------ build/lbuild-sles | 6 +++--- build/lbuild.old_school | 6 +++--- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/build/lbuild b/build/lbuild index 3478342..99513c5 100755 --- a/build/lbuild +++ b/build/lbuild @@ -986,7 +986,8 @@ find_linux_rpm() { for arch in $TARGET_ARCHS_ALL; do local found_rpm="" rpm for rpm in ${pathtorpms}/${arch}/*.rpm; do - if rpm -q --provides -p "$rpm" | grep -q "kernel${prefix} = $wanted_kernel"; then + if rpm -q --provides -p "$rpm" 2>&3 | grep -q "kernel${prefix} = $wanted_kernel" 2>&3; then + found_rpm="$rpm" ret=0 break @@ -1285,7 +1286,7 @@ find_rpm() { case "$match_type" in provides) # match is any valid ERE (i.e. given to egrep) match - if rpm -q --provides -p "$file" | egrep -q "$match"; then + if rpm -q --provides -p "$file" 2>&3 | egrep -q "$match"; then echo "$file" popd >/dev/null return 0 @@ -1432,7 +1433,7 @@ build_mptlinux() { --define "_tmppath /var/tmp" \ --define "_topdir ${TOPDIR}" \ --define "kernel_obj $linux" \ - ${TOPDIR}/SPECS/mptlinux.spec; then + ${TOPDIR}/SPECS/mptlinux.spec 2>&1; then return 1 fi if $DO_SRC; then @@ -1440,7 +1441,7 @@ build_mptlinux() { --define "_tmppath /var/tmp" \ --define "_topdir ${TOPDIR}" \ --define "kernel_obj $linux" \ - ${TOPDIR}/SPECS/mptlinux.spec; then + ${TOPDIR}/SPECS/mptlinux.spec 2>&1; then return 1 fi fi @@ -1488,7 +1489,7 @@ build_rdac() { --define "_tmppath /var/tmp" \ --define "_topdir ${TOPDIR}" \ --define "kernel_obj $linux" \ - ${TOPDIR}/SPECS/rdac.spec; then + ${TOPDIR}/SPECS/rdac.spec 2>&1; then return 1 fi if $DO_SRC; then @@ -1496,7 +1497,7 @@ build_rdac() { --define "_tmppath /var/tmp" \ --define "_topdir ${TOPDIR}" \ --define "kernel_obj $linux" \ - ${TOPDIR}/SPECS/rdac.spec; then + ${TOPDIR}/SPECS/rdac.spec 2>&1; then return 1 fi fi diff --git a/build/lbuild-sles b/build/lbuild-sles index 83fae95..94af57a 100644 --- a/build/lbuild-sles +++ b/build/lbuild-sles @@ -45,7 +45,7 @@ prepare_and_build_srpm() { # now build it if ! $RPMBUILD $rpmbuildopt $targets \ --define "_topdir $TOPDIR" \ - $TOPDIR/SOURCES/kernel-$RPMSMPTYPE.spec >&2; then + $TOPDIR/SOURCES/kernel-$RPMSMPTYPE.spec 2>&1; then fatal 1 "Failed to build kernel RPM" fi #fi @@ -53,7 +53,7 @@ prepare_and_build_srpm() { # for SLES, we also need to build the kernel-source rpm if ! $RPMBUILD $rpmbuildopt $targets \ --define "_topdir $TOPDIR" \ - $TOPDIR/SOURCES/kernel-source.spec >&2; then + $TOPDIR/SOURCES/kernel-source.spec 2>&1; then fatal 1 "Failed to build kernel source RPM" fi @@ -100,7 +100,7 @@ find_linux_devel_paths() { LINUXRELEASE=$(find_linux_release ${LINUXOBJ:-$LINUX}) if [ -z "$LINUXRELEASE" ]; then echo "Failed to find linux release in ${LINUXOBJ:-$LINUX}" - RC=255 + return 255 fi } diff --git a/build/lbuild.old_school b/build/lbuild.old_school index 6a0708b..362da9f 100644 --- a/build/lbuild.old_school +++ b/build/lbuild.old_school @@ -25,7 +25,7 @@ build_tarball() { mkdir $RPMTOPDIR/BUILD/ rpm -ivh $KERNELDIR/$SRPM --define "_topdir $RPMTOPDIR" || \ { rm -rf $RPMTOPDIR; fatal 1 "Error installing kernel SRPM."; } - $RPMBUILD -bp --nodeps --target i686 $RPMTOPDIR/SPECS/$SPEC --define "_topdir $RPMTOPDIR" + $RPMBUILD -bp --nodeps --target i686 $RPMTOPDIR/SPECS/$SPEC --define "_topdir $RPMTOPDIR" 2>&1 pushd $RPMTOPDIR/BUILD/kernel-${lnxmaj}/linux-${lnxmaj} && { make mrproper cp configs/kernel-${lnxmaj}-i686-smp.config .config @@ -175,13 +175,13 @@ build_kernel() { $RPMBUILD $targets $rpmbuildopt lustre-kernel-2.4.spec \ --define "_tmppath $TMPDIR" \ - --define "_topdir $TOPDIR" || \ + --define "_topdir $TOPDIR" 2>&1 || \ fatal 1 "Error building rpms for $BUILD_ARCHS." if $DO_SRC; then $RPMBUILD -bs lustre-kernel-2.4.spec \ --define "_tmppath $TMPDIR" \ - --define "_topdir $TOPDIR" || \ + --define "_topdir $TOPDIR" 2>&1 || \ fatal 1 "Error building .src.rpm." fi -- 1.8.3.1