Whamcloud - gitweb
add support for sles 8:
[fs/lustre-release.git] / build / lbuild
index c0c0474..453e563 100755 (executable)
@@ -32,6 +32,7 @@ BOOT_ARCHS=
 JENSEN_ARCHS=
 SMP_ARCHS=
 BIGSMP_ARCHS=
+PSERIES64_ARCHS=
 UP_ARCHS=
 
 DATE=$(date)
@@ -39,6 +40,20 @@ DATE=$(date)
 USE_DATESTAMP=1
 RPMBUILD=
 
+export CC=${CC:-gcc}
+
+# Readlink is not present on some older distributions: emulate it.
+readlink() {
+    local path=$1 ll
+
+    if [ -L "$path" ]; then
+       ll="$(LC_ALL=C ls -l "$path" 2> /dev/null)" &&
+       echo "${ll/* -> }"
+    else
+       return 1
+    fi
+}
+
 cleanup()
 {
     true
@@ -227,11 +242,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}"
     fi
     # EXTRA_VERSION=${EXTRA_VERSION//-/_}
 
-    ALL_ARCHS="$BASE_ARCHS $BIGMEM_ARCHS $BOOT_ARCHS $JENSEN_ARCHS $SMP_ARCHS $BIGSMP_ARCHS $UP_ARCHS"
+    ALL_ARCHS="$BASE_ARCHS $BIGMEM_ARCHS $BOOT_ARCHS $JENSEN_ARCHS $SMP_ARCHS $BIGSMP_ARCHS $PSERIES64_ARCHS $UP_ARCHS"
 
     BUILD_ARCHS=
     for arch in $(uniqify "$ALL_ARCHS") ; do
@@ -336,7 +353,8 @@ patch_linux()
     rm -f linux/configs/*
     copysuccess=0
     for patchesdir in "$EXTERNAL_PATCHES" "lustre/lustre/kernel_patches" ; do
-       cp -v $patchesdir/kernel_configs/kernel-${VERSION}-${TARGET}*.config linux/configs/ >/dev/null && copysuccess=1
+       [ "$patchesdir" ] && \
+           cp -v $patchesdir/kernel_configs/kernel-${VERSION}-${TARGET}*.config linux/configs/ >/dev/null && copysuccess=1
     done
     [ "$copysuccess" = "1" ] || \
        fatal 1 "Error copying in kernel configs."
@@ -363,11 +381,7 @@ clean_linux()
 prep_build()
 {
     # make .spec file
-    if [ -f /etc/init.d/functions -a -f /etc/sysconfig/network ] ; then
-        ENABLE_INIT_SCRIPTS=""
-    else
-        ENABLE_INIT_SCRIPTS="# "
-    fi
+    ENABLE_INIT_SCRIPTS=""
     sed \
        -e "s^@BASE_ARCHS@^$BASE_ARCHS^g" \
        -e "s^@BIGMEM_ARCHS@^$BIGMEM_ARCHS^g" \
@@ -383,6 +397,7 @@ prep_build()
        -e "s^@LINUX26@^$LINUX26^g" \
        -e "s^@LUSTRE_SOURCE@^${LUSTRE##*/}^g" \
        -e "s^@LUSTRE_TARGET@^$TARGET^g" \
+       -e "s^@PSERIES64_ARCHS@^$PSERIES64_ARCHS^g" \
        -e "s^@RHBUILD@^$RHBUILD^g" \
        -e "s^@SMP_ARCHS@^$SMP_ARCHS^g" \
        -e "s^@SUSEBUILD@^$SUSEBUILD^g" \
@@ -395,7 +410,8 @@ prep_build()
     [ -d BUILD ] || mkdir BUILD
     [ -d SOURCES ] || mkdir SOURCES
     for script in linux-{rhconfig.h,merge-config.awk,merge-modules.awk} \
-       suse-{functions.sh,post.sh,postun.sh,trigger-script.sh.in} ; do
+       suse-{functions.sh,post.sh,postun.sh,trigger-script.sh.in} \
+       sles8-{pre,post,postun,update_{INITRD_MODULES,rcfile_setting}}.sh ; do
        cp $TOPDIR/lustre/build/$script SOURCES
     done
     cp "$LUSTRE" "$KERNEL_FILE" SOURCES
@@ -426,7 +442,7 @@ build()
        --define "_topdir $TOPDIR" || \
        fatal 1 "Error building rpms for $arch."
 
-    if (( $DO_SRC )) ; then
+    if false && (( $DO_SRC )) ; then
        $RPMBUILD -bs lustre-kernel-2.4.spec \
            --define "_topdir $TOPDIR" || \
            fatal 1 "Error building .src.rpm."