Whamcloud - gitweb
b=17258 fix error with make rpms after configure --disable-tests
authorBrian J. Murrell <brian@sun.com>
Wed, 3 Mar 2010 16:51:40 +0000 (11:51 -0500)
committerJohann Lombardi <johann@sun.com>
Thu, 4 Mar 2010 13:02:01 +0000 (14:02 +0100)
If one configures lustre with "--disable-tests" a subsequent "make rpms"
will fail as it would still try to package up the lustre-tests RPM.
Fixing this provided the opportunity to fix another wart, that being the
subst'ing the configure arguments into the lustre.spec.  Now they are
passed as value with "--define 'configure_args ...'" when calling rpmbuild.

autoMakefile.am
build/autoMakefile.am.toplevel
build/lbuild
build/lmake
build/lustre-kernel-2.4.spec.in
lustre.spec.in

index 87f7181..3cffd9c 100644 (file)
@@ -8,6 +8,9 @@ EXTRA_SOURCES := @SYMVERFILE@
 endif
 endif
 
+@TESTS_TRUE@BUILD_TESTS = true
+@TESTS_FALSE@BUILD_TESTS = false
+
 include build/autoMakefile.am.toplevel
 
 EXTRA_DIST += config.h.in debian/*
index c95f165..fd961a9 100644 (file)
@@ -109,10 +109,18 @@ EXTRA_DIST = @PACKAGE_TARNAME@.spec                                       \
        build/mptlinux.spec.patch build/patches
 
 rpms-real: @PACKAGE_TARNAME@.spec dist Makefile
-       rpmbuild -ta $(distdir).tar.gz
+       CONFIGURE_ARGS=$$(echo $$(eval echo $(ac_configure_args)) | sed -re 's/--(en|dis)able-tests//'); \
+       RPMARGS="--define \"configure_args $$CONFIGURE_ARGS\""; \
+       if ! $(BUILD_TESTS); then \
+               RPMARGS="$$RPMARGS --define \"build_lustre_tests 0\""; \
+       fi; \
+       eval rpmbuild $$RPMARGS -ta $(distdir).tar.gz
 
 srpm-real: @PACKAGE_TARNAME@.spec dist Makefile
-       rpmbuild -ts $(distdir).tar.gz
+       if ! $(BUILD_TESTS); then \
+               RPMARGS="--define \"build_lustre_tests 0\""; \
+       fi; \
+       eval rpmbuild $$RPMARGS -ta $(distdir).tar.gz
 
 rpms:
        for subdir in $(RPM_SUBDIRS) ; do                               \
index 04e972b..2134d96 100755 (executable)
@@ -86,6 +86,9 @@ UP_ARCHS=
 # not in the target file any more
 CONFIG=
 
+# build the lustre-tests rpm?
+LUSTRE_TESTS=true
+
 DATE=$(date)
 
 USE_DATESTAMP=1
@@ -836,15 +839,24 @@ build_lustre() {
         echo NORPM mode. Only compiling.
     fi
 
-    # convert the $PATCHLESS boolean to an empty/no-empty boolean
+    # convert the $PATCHLESS boolean to an empty/not-empty boolean
     # as silly as this seems, it makes the syntax of the rpmbuild command
     # simpler and not need an eval to deal with the quotes in the quotes
     local is_patchless=""
     if $PATCHLESS; then
         is_patchless="yes"
     fi
+
+    # ditto for the lustre-tests boolean
+    local lustre_tests=""
+    if ! $LUSTRE_TESTS; then
+        lustre_tests="no"
+    fi
+
     $RPMBUILD $targets $rpmbuildopt ../lustre.spec \
         ${is_patchless:+--define "lustre_name lustre-client"} \
+        ${lustre_tests:+--define "build_lustre_tests 0"} \
+        --define "configure_args $confoptions ${CONFIGURE_FLAGS}" \
         --define "_tmppath $TMPDIR" \
         --define "_topdir $TOPDIR" 2>&1 || \
         fatal 1 "Error building rpms for $BUILD_ARCHS."
@@ -1878,6 +1890,11 @@ while [ "$1" ]; do
             ;;
         --)
             shift
+            # there are actually some lustre configure flags that we need to
+            # handle ourselves (but we still give them to configure)
+            if [[ \ $@\  == *\ --disable-tests\ * ]]; then
+                LUSTRE_TESTS=false
+            fi
             CONFIGURE_FLAGS=$@
             CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-liblustre --enable-liblustre-tests"
             break
index 66f61e5..9a2288e 100755 (executable)
@@ -49,6 +49,9 @@ CONFIG_FILE=
 RPMBUILD=
 XEN=false
 
+# build the lustre-tests rpm?
+LUSTRE_TESTS=true
+
 canon()
 {
     pushd $1 >/dev/null
@@ -388,7 +391,7 @@ timed_run() {
     #bash -c "$@" &
     ("$@") &
     child_pid=$!
-    
+
     (sleep $SLEEP_TIME
     kill -TERM -$child_pid 2>/dev/null
     sleep 5
@@ -579,11 +582,20 @@ build_lustre()
        -e s^@VERSION@^${LUSTRE_VERSION}^g \
        -e s^@LINUXRELEASE@^${FULL_VERSION}^g \
        -e s^@RELEASE@^${FULL_VERSION//-/_}^g \
-       -e s^@ac_configure_args@^"--with-linux=${PWD}/linux ${CONFIGURE_FLAGS}"^g \
        < lustre.spec.in \
        > lustre.spec
+    # convert the $LUSTRE_TESTS boolean to an empty/not-empty boolean
+    # as silly as this seems, it makes the syntax of the rpmbuild command
+    # simpler and not need an eval to deal with the quotes in the quotes
+    # ditto for the lustre-tests boolean
+    local lustre_tests=""
+    if ! $LUSTRE_TESTS; then
+        lustre_tests="no"
+    fi
+
     $RPMBUILD --target ${TARGET_ARCH} -bb lustre.spec \
-        ${PATCHLESS:+--define "lustre_name lustre-client"} \
+        --define "configure_args --with-linux=${PWD}/linux ${CONFIGURE_FLAGS}" \
+        ${lustre_tests:+--define "build_lustre_tests 0"} \
         --define "_tmppath $TMPDIR" \
        --define "_topdir $(lbuild_topdir)" 2>&1 || \
        fatal 1 "Error building Lustre rpms."
@@ -742,7 +754,7 @@ save_headers()
 
     KVERREL="${VERSION}${EXTRA_VERSION_DELIMITER}${EXTRA_VERSION}"
     # deal with the kernel headers that are version specific
-    
+
     saveddir="$RPM_BUILD_ROOT/usr/src/linux-${KVERREL}/savedheaders/${TARGET_ARCH}/${TARGET_CONFIG:-up}"
     mkdir -p "$saveddir"
     install -m 644 include/linux/autoconf.h "$saveddir/autoconf.h"
@@ -791,7 +803,7 @@ longopts="$longopts,save-headers,target:,target-arch:,target-config:,unpack-kern
 options=$(getopt -o hj: -l "$longopts" -- "$@")
 
 eval set -- "$options"
-    
+
 while [ "$1" ] ; do
     case "$1" in
        '')
@@ -875,6 +887,11 @@ while [ "$1" ] ; do
             ;;
        --)
            shift
+            # there are actually some lustre configure flags that we need to
+            # handle ourselves (but we still give them to configure)
+            if [[ \ $@\  == *\ --disable-tests\ * ]]; then
+                LUSTRE_TESTS=false
+            fi
            CONFIGURE_FLAGS=$@
            break
            ;; 
index 292b527..a96b074 100644 (file)
@@ -407,7 +407,7 @@ for flavor in "" smp bigmem bigsmp pseries64 BOOT jensen ; do
                                # /sbin/update-modules.dep compares when the modules were built, rather
                                # than installed, so force modules.dep to be recreated
                                echo "rm -f /lib/modules/%{KVERREL}${delim_flavor}/modules.dep" >> ${script}
-                               echo "if [ -f /etc/modprobe.conf ] ; then" >> ${script}                 
+                               echo "if [ -f /etc/modprobe.conf ] ; then" >> ${script}
                                sed -e "s^%ver_str^%{KVERREL}${delim_flavor}^g" -e "s^%flavor^${flavor}^" %{SOURCE26} >> ${script}
 
                                echo "else" >> ${script}
@@ -415,10 +415,10 @@ for flavor in "" smp bigmem bigsmp pseries64 BOOT jensen ; do
                                echo "fi" >> ${script}
                                ;;
                        postun)
-                               echo "if [ -f /etc/modprobe.conf ] ; then" >> ${script}                 
+                               echo "if [ -f /etc/modprobe.conf ] ; then" >> ${script}
                                sed -e "s^%ver_str^%{KVERREL}${delim_flavor}^g" %{SOURCE27} >> ${script}
 
-                               echo "else" >> ${script}                        
+                               echo "else" >> ${script}
                                sed -e "s^%ver_str^%{KVERREL}${delim_flavor}^g" %{SOURCE30} >> ${script}
                                echo "fi" >> ${script}
                                ;;
@@ -429,7 +429,7 @@ for flavor in "" smp bigmem bigsmp pseries64 BOOT jensen ; do
                                if [ -z "${flavor}" ] ; then
                                        cat >> ${script} <<EOF
 cd /boot
-%ifnarch ia64 
+%ifnarch ia64
 ln -sf vmlinuz-%{KVERREL} vmlinuz
 %endif
 ln -sf System.map-%{KVERREL} System.map
index c9d38e1..26eb8e7 100644 (file)
@@ -3,6 +3,7 @@
 %{!?kversion: %define kversion @LINUXRELEASE@}
 %{!?release: %define release @RELEASE@}
 %{!?lustre_name: %define lustre_name lustre}
+%{!?build_lustre_tests: %define build_lustre_tests 1}
 
 %define is_client %(bash -c "if [[ %{lustre_name} = *-client ]]; then echo -n '1'; else echo -n '0'; fi")
 # for those uses that don't want the -smp/-bigsmp on the end of %kversion
@@ -109,7 +110,13 @@ cd $RPM_BUILD_DIR/lustre-%{version}
 # override %optflags so that the vendor's overzealous flags don't create
 # build failures
 %define optflags -g -O2 -Werror
-%configure @ac_configure_args@ %{?configure_flags:configure_flags}
+CONFIGURE_ARGS=""
+%if %{build_lustre_tests}
+CONFIGURE_ARGS="$CONFIGURE_ARGS --enable-tests --enable-liblustre-tests"
+%else
+CONFIGURE_ARGS="$CONFIGURE_ARGS --disable-tests --disable-liblustre-tests"
+%endif
+%configure %{?configure_args:%configure_args} $CONFIGURE_ARGS
 make -j $RPM_BUILD_NCPUS -s
 
 %install
@@ -180,15 +187,17 @@ if [ -f $RPM_BUILD_DIR/lustre-%{version}/lustre/include/linux/lustre_types.h ] ;
   echo '%attr(-, root, root) /usr/include/linux/lustre_types.h' >>lustre.files
 fi
 
+%if %{build_lustre_tests}
 echo '%attr(-, root, root) %{_libdir}/lustre/tests/*' >lustre-tests.files
 echo '%attr(-, root, root) /lib/modules/%{kversion}/kernel/fs/lustre/llog_test.*' >>lustre-tests.files
-modules_excludes="llog_test"
+modules_excludes="|llog_test"
 if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre/liblustre/tests ] ; then
   echo '%attr(-, root, root) %{_libdir}/lustre/liblustre/tests/*' >>lustre-tests.files
 fi
+%endif
 
 pushd $RPM_BUILD_ROOT >/dev/null
-find lib/modules/%{kversion}/kernel -type f | awk "!/($modules_excludes)/ {print \"%attr(-, root, root) /\"\$0}" >>$RPM_BUILD_DIR/lustre-%{version}/lustre-modules.files
+find lib/modules/%{kversion}/kernel -type f | awk "!/(ZZZZZZZZZZ$modules_excludes)/ {print \"%attr(-, root, root) /\"\$0}" >>$RPM_BUILD_DIR/lustre-%{version}/lustre-modules.files
 popd >/dev/null
 
 %files -f lustre.files
@@ -205,7 +214,9 @@ popd >/dev/null
 # %files deps-sles
 # %files deps-rhel
 
+%if %{build_lustre_tests}
 %files tests -f lustre-tests.files
+%endif
 
 %post modules
 if [ -f /boot/System.map-%{kversion} ]; then
@@ -265,6 +276,7 @@ else
        depmod -ae %{kversion} || exit 0
 fi
 
+%if %{build_lustre_tests}
 %post tests
 if [ -f /boot/System.map-%{kversion} ]; then
        depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
@@ -278,6 +290,7 @@ if [ -f /boot/System.map-%{kversion} ]; then
 else
        depmod -ae %{kversion} || exit 0
 fi
+%endif
 
 %clean
 rm -rf $RPM_BUILD_ROOT