Whamcloud - gitweb
b=12348
[fs/lustre-release.git] / build / lbuild
index 450236d..41ffe3f 100755 (executable)
@@ -18,6 +18,7 @@ CONFIGURE_FLAGS=
 EXTERNAL_PATCHES=
 EXTRA_VERSION=
 STAGEDIR=
+TMPDIR=${TMPDIR:-"/var/tmp"}
 
 # from target file
 KERNEL=
@@ -82,12 +83,9 @@ is_release()
 
 list_targets()
 {
-    echo -n "Available targets:"
-    for target in $TOPDIR/lustre/lustre/kernel_patches/targets/*.target ; do
-        target_file=${target##*/}
-        echo -n " ${target_file%%.target}"
+    for target in $TOPDIR/lustre/kernel_patches/targets/*.target.in ; do
+        echo -n "$(basename $target .target.in) "
     done
-    echo
 }
 
 usage()
@@ -146,9 +144,9 @@ Usage: ${0##*/} [OPTION]... [-- <lustre configure options>]
     A CVS branch/tag name to build from when pulling from CVS.
 
   --target=TARGET
-    The name of the target to build.  The available targets are listed
-    below.
-
+    The name of the target to build.  
+    One of: $(list_targets)
+    
   --target-archs=TARGET_ARCHS
     A (space delimited) list of architectures to build.  By default,
     all of the archs supported by the TARGET will be built, in
@@ -166,8 +164,6 @@ Usage: ${0##*/} [OPTION]... [-- <lustre configure options>]
 
 EOF
 
-#   list_targets
-
     fatal "$1" "$2"
 }
 
@@ -208,6 +204,9 @@ check_options()
         2.6-suse)
             CANONICAL_TARGET="sles-2.6"
             ;;
+        2.6-sles10)
+            CANONICAL_TARGET="sles10-2.6"
+            ;;
         hp_pnnl-2.4)
             CANONICAL_TARGET="hp-pnnl-2.4"
             ;;
@@ -341,9 +340,13 @@ load_target()
     if [ "$EXTRA_VERSION_save" ] ; then
         EXTRA_VERSION="$EXTRA_VERSION_save"
     elif ! (( $RELEASE )) ; then
-        #remove the @VERSION@ (lustre version)
-        EXTRA_VERSION=$(echo $EXTRA_VERSION | sed -e "s/\(.*_lustre\)\..*/\1/")
-        EXTRA_VERSION="${EXTRA_VERSION}-${TAG}.${TIMESTAMP}"
+        # if there is no patch series, then this is not a lustre specific
+        # kernel.  don't make it look like one
+        if [ -n "$SERIES" ]; then
+            #remove the @VERSION@ (lustre version)
+            EXTRA_VERSION=$(echo $EXTRA_VERSION | sed -e "s/\(.*_lustre\)\..*/\1/")
+            EXTRA_VERSION="${EXTRA_VERSION}-${TAG}.${TIMESTAMP}"
+        fi
     fi
     # EXTRA_VERSION=${EXTRA_VERSION//-/_}
 
@@ -391,7 +394,7 @@ unpack_lustre()
     DIRNAME="lustre-$TAG-$TIMESTAMP"
     if [ "$LUSTRE" ] ; then
         untar "$LUSTRE"
-        [ -d lustre ] || ln -sf lustre* lustre
+        [ -d lustre ] || ln -sf lustre-[0-9].[0-9]* lustre
     else
         if [ "$USE_DATESTAMP" ]; then
             DATESTAMP="-D '$DATE'"
@@ -541,11 +544,13 @@ build_kernel()
     done
 
     $RPMBUILD $targets -bb lustre-kernel-2.4.spec \
+        --define "_tmppath $TMPDIR" \
         --define "_topdir $TOPDIR" || \
         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" || \
             fatal 1 "Error building .src.rpm."
     fi
@@ -570,7 +575,8 @@ build_lustre()
 
     ./configure "--with-linux=${LINUX}" ${CONFIGURE_FLAGS}
 
-    $RPMBUILD $targets -bb build/lustre.spec \
+    $RPMBUILD $targets -bb lustre.spec \
+        --define "_tmppath $TMPDIR" \
         --define "_topdir $TOPDIR" || \
         fatal 1 "Error building rpms for $BUILD_ARCHS."
 
@@ -596,7 +602,7 @@ stage()
 
 [ -r ~/.lbuildrc ] && . ~/.lbuildrc
 
-options=$(getopt -o d:D:h -l disable-datestamp,external-patches:,extraversion:,kerneldir:,linux:,lustre:,nodownload,nosrc,publish,release,stage:,tag:,target:,target-archs:,with-linux: -- "$@")
+options=$(getopt -o d:D:h -l disable-datestamp,external-patches:,extraversion:,kerneldir:,linux:,lustre:,nodownload,nosrc,publish,release,src,stage:,tag:,target:,target-archs:,with-linux: -- "$@")
 
 if [ $? != 0 ] ; then
     usage 1