Whamcloud - gitweb
b=21759 Miscellaneous build fixes
authorBrian J. Murrell <brian@sun.com>
Tue, 12 Jan 2010 17:06:04 +0000 (12:06 -0500)
committerRobert Read <rread@sun.com>
Tue, 12 Jan 2010 17:30:45 +0000 (09:30 -0800)
The message string given to fatal() cannot be slit with line continuations
as you would strings elsewhere -- for whatever reason.  So let's just un-
split them for now.
Coding style fixups.
Adds a "--set-var" option to lbuild to set/override an environment variable.
This is mainly meant for lbuild testers.
Fix missing - from tar so that the --exclude parameters will be honoured.
Some stderr->stdout redirections to get output into the correct log.

build/lbuild
build/lbuild.old_school
build/lmake

index e3380ba..1f3c69e 100755 (executable)
@@ -375,8 +375,7 @@ autodetect_distro() {
                   sed -e 's/^[^0-9.]*//g' | sed -e 's/[ \.].*//')
     fi
     if [ -z "$name" -o -z "$version" ]; then
-        fatal 1 "I don't know how to determine distro type/version.\n" \
-                "Either update autodetect_distro() or use the --distro argument"
+        fatal 1 "I don't know how to determine distro type/version.\nEither update autodetect_distro() or use the --distro argument"
     fi
 
     echo ${name}${version}
@@ -403,8 +402,7 @@ download_srpm() {
             if ! wget -nv "$location/$srpm" -O "$KERNELDIR/$srpm" ||
                [ ! -s "$KERNELDIR/$srpm" ]; then
                 rm -f $KERNELDIR/$srpm
-                fatal 1 "Could not download target $target's kernel SRPM" \
-                        "$srpm from $location."
+                fatal 1 "Could not download target $target's kernel SRPM $srpm from $location."
             fi
         else
             fatal 1 "$srpm not found in directory $KERNELDIR."
@@ -594,9 +592,7 @@ load_target() {
             for patchesdir in "$EXTERNAL_PATCHES" "$TOPDIR/lustre/lustre/kernel_patches"; do
                 [ -r "$patchesdir/series/$series" ] && continue 2
             done
-            fatal 1 "Target $TARGET's series $SERIES could not be" \
-                    "found.\nSearched:\n\t$EXTERNAL_PATCHES/series\n" \
-                    "\t$TOPDIR/lustre/lustre/kernel_patches/series."
+            fatal 1 "Target $TARGET's series $SERIES could not be found.\nSearched:\n\t$EXTERNAL_PATCHES/series\n\t$TOPDIR/lustre/lustre/kernel_patches/series."
         done
     fi
 
@@ -619,8 +615,7 @@ load_target() {
     PRISTINE_EXTRA_VERSION=$EXTRA_VERSION
 
     if ! $PATCHLESS && [ ! -f "$CONFIG_FILE" ]; then
-        fatal 1 "Config file for target $TARGET missing from" \
-                "$TOPDIR/lustre/lustre/kernel_patches/kernel_configs/."
+        fatal 1 "Config file for target $TARGET missing from $TOPDIR/lustre/lustre/kernel_patches/kernel_configs/."
     fi
 
     if [ "$EXTRA_VERSION_save" ]; then
@@ -1141,16 +1136,14 @@ EOF
     fi
 
     local linuxrelease=$(find_linux_release "$linux")
-    $RPMBUILD $BUILD_TYPE --define 'build_kernel_ib 1' --define 'build_kernel_ib_devel 1' \
-              --define "_topdir ${TOPDIR}" --target ${TARGET_ARCH} \
-              --define "KVERSION ${linuxrelease}" \
-              --define "$K_SRC ${linux}" \
-              --define "LIB_MOD_DIR /lib/modules/${linuxrelease}/updates" \
-              ${OFA_KERNEL_RELEASE:+--define "_release $OFA_KERNEL_RELEASE"} \
-              --define "configure_options --without-quilt $OFED_CORE $OFED_HARDWARE $OFED_ISCSI" \
-              ${SOURCE}
-
-    if [ ${PIPESTATUS[0]} != 0 ]; then
+    if ! $RPMBUILD $BUILD_TYPE --define 'build_kernel_ib 1' --define 'build_kernel_ib_devel 1' \
+                  --define "_topdir ${TOPDIR}" --target ${TARGET_ARCH} \
+                  --define "KVERSION ${linuxrelease}" \
+                  --define "$K_SRC ${linux}" \
+                  --define "LIB_MOD_DIR /lib/modules/${linuxrelease}/updates" \
+                  ${OFA_KERNEL_RELEASE:+--define "_release $OFA_KERNEL_RELEASE"} \
+                  --define "configure_options --without-quilt $OFED_CORE $OFED_HARDWARE $OFED_ISCSI" \
+                  ${SOURCE} 2>&1; then
         fatal 1 "Error building kernel-ib"
     fi
 
@@ -1211,9 +1204,7 @@ reuse() {
             # signal that the caching was completed.  if that flag is not
             # there, then the cache is invalid (and should be removed in fact)
             mv "$REUSEBUILD/$signature/$module"{,-bad-$(date +%s)} ||
-                fatal 1 "failed to clean up a bad cache in location" \
-                      "\"$REUSEBUILD/$signature/$module\" -- manual cleanup" \
-                      "will be necessary"
+                fatal 1 "failed to clean up a bad cache in location $REUSEBUILD/$signature/$module\" -- manual cleanup will be necessary"
             return 1
         fi
 
@@ -1761,7 +1752,7 @@ set -E
 
 [ -r ~/.lbuildrc ] && . ~/.lbuildrc
 
-options=$(getopt -o d:D:h -l kerneltree:,distro:,kernelrpm:,reusebuild:,patchless,ldiskfs,ccache,reuse:,norpm,disable-datestamp,external-patches:,timestamp:,extraversion:,kerneldir:,linux:,lustre:,nodownload,nosrc,ofed-version:,publish,release,src,stage:,tag:,target:,target-archs:,with-linux:,xen -- "$@")
+options=$(getopt -o d:D:h -l kerneltree:,distro:,kernelrpm:,reusebuild:,patchless,ldiskfs,ccache,reuse:,norpm,disable-datestamp,external-patches:,timestamp:,extraversion:,kerneldir:,linux:,lustre:,nodownload,nosrc,ofed-version:,publish,release,set-value:,src,stage:,tag:,target:,target-archs:,with-linux:,xen -- "$@")
 
 if [ $? != 0 ]; then
     usage 1
@@ -1900,6 +1891,10 @@ while [ "$1" ]; do
             XEN=true
             shift
             ;;
+        --set-value)
+            eval $2
+            shift 2
+            ;;
         --)
             shift
             CONFIGURE_FLAGS=$@
index 869be39..6a0708b 100644 (file)
@@ -90,8 +90,8 @@ patch_linux() {
 pack_linux() {
     TARBALL="$(readlink linux)-$EXTRA_VERSION.tar.gz"
     echo "Creating patched linux tarball $TARBALL..."
-    tar zcf "$TARBALL" "$(readlink linux)" \
-        --exclude "CVS" --exclude ".cvsignore" || \
+    tar -zcf "$TARBALL" "$(readlink linux)" \
+        --exclude "CVS" --exclude ".cvsignore" \
         --exclude "*.orig" --exclude "*~" --exclude "*.rej" || \
         fatal 1 "Error creating patched Linux tarball."
 }
@@ -203,19 +203,17 @@ build_kernel() {
     < $ldiskfs_spec \
     > ../lustre-ldiskfs.spec
 
-    $RPMBUILD $targets $rpmbuildopt ../lustre-ldiskfs.spec \
-        --define "_tmppath /var/tmp" \
-        --define "_topdir $TOPDIR"
-    if [ "$?" != "0" ] ; then
+    if ! $RPMBUILD $targets $rpmbuildopt ../lustre-ldiskfs.spec \
+                   --define "_tmppath /var/tmp" \
+                   --define "_topdir $TOPDIR" 2>&1; then
         popd
         return 255
     fi
 
     if $DO_SRC; then
-            $RPMBUILD -bs ../lustre-ldiskfs.spec \
-            --define "_tmppath /var/tmp" \
-            --define "_topdir $TOPDIR"
-        if [ "$?" != "0" ] ; then
+            if ! $RPMBUILD -bs ../lustre-ldiskfs.spec \
+                           --define "_tmppath /var/tmp" \
+                           --define "_topdir $TOPDIR" 2>&1; then
             popd
             return 255
         fi
index b883453..66f61e5 100755 (executable)
@@ -538,14 +538,12 @@ build_kernel_ib()
     if [ "$OFED_VERSION" = "1.3" ]; then
         K_SRC="KSRC"
     fi
-    $RPMBUILD --rebuild --define 'build_kernel_ib 1' --define 'build_kernel_ib_devel 1' \
-             --define "_topdir $(lbuild_topdir)" --target ${TARGET_ARCH} \
-             --define "KVERSION ${FULL_VERSION}" \
-             --define "$K_SRC ${PWD}/linux" \
-             --define "LIB_MOD_DIR /lib/modules/${FULL_VERSION}" \
-             --define "configure_options --without-quilt --with-core-mod --with-user_mad-mod --with-user_access-mod --with-addr_trans-mod --with-srp-target-mod --with-core-mod --with-mthca-mod --with-mlx4-mod --with-cxgb3-mod --with-nes-mod --with-ipoib-mod --with-sdp-mod --with-srp-mod --with-rds-mod --with-iser-mod --with-qlgc_vnic-mod --with-madeye-mod $configure_options" $(lbuild_topdir)/OFED/SRPMS/ofa_kernel-*.src.rpm
-
-    if [ ${PIPESTATUS[0]} != 0 ]; then
+    if ! $RPMBUILD --rebuild --define 'build_kernel_ib 1' --define 'build_kernel_ib_devel 1' \
+                   --define "_topdir $(lbuild_topdir)" --target ${TARGET_ARCH} \
+                   --define "KVERSION ${FULL_VERSION}" \
+                   --define "$K_SRC ${PWD}/linux" \
+                   --define "LIB_MOD_DIR /lib/modules/${FULL_VERSION}" \
+                   --define "configure_options --without-quilt --with-core-mod --with-user_mad-mod --with-user_access-mod --with-addr_trans-mod --with-srp-target-mod --with-core-mod --with-mthca-mod --with-mlx4-mod --with-cxgb3-mod --with-nes-mod --with-ipoib-mod --with-sdp-mod --with-srp-mod --with-rds-mod --with-iser-mod --with-qlgc_vnic-mod --with-madeye-mod $configure_options" $(lbuild_topdir)/OFED/SRPMS/ofa_kernel-*.src.rpm 2>&1; then
         fatal 1 "Error building kernel-ib"
     fi
 
@@ -587,7 +585,7 @@ build_lustre()
     $RPMBUILD --target ${TARGET_ARCH} -bb lustre.spec \
         ${PATCHLESS:+--define "lustre_name lustre-client"} \
         --define "_tmppath $TMPDIR" \
-       --define "_topdir $(lbuild_topdir)" || \
+       --define "_topdir $(lbuild_topdir)" 2>&1 || \
        fatal 1 "Error building Lustre rpms."
     # $MAKE_J "$MAKE_CC" || fatal 1 "Error building Lustre."
     popd >/dev/null
@@ -905,7 +903,7 @@ if [ -n "$OFED_VERSION" ]; then
     if [ "$OFED_VERSION" = "inkernel" ]; then
        CONFIGURE_FLAGS="--with-o2ib=yes ${CONFIGURE_FLAGS}"
     else
-    build_kernel_ib
+        build_kernel_ib
     fi
 fi