From e4db346fe23192183dd391fbbbb618e4005730af Mon Sep 17 00:00:00 2001 From: "Brian J. Murrell" Date: Wed, 3 Mar 2010 11:51:40 -0500 Subject: [PATCH] b=17258 fix error with make rpms after configure --disable-tests 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 | 3 +++ build/autoMakefile.am.toplevel | 12 ++++++++++-- build/lbuild | 19 ++++++++++++++++++- build/lmake | 27 ++++++++++++++++++++++----- build/lustre-kernel-2.4.spec.in | 8 ++++---- lustre.spec.in | 19 ++++++++++++++++--- 6 files changed, 73 insertions(+), 15 deletions(-) diff --git a/autoMakefile.am b/autoMakefile.am index 87f7181..3cffd9c 100644 --- a/autoMakefile.am +++ b/autoMakefile.am @@ -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/* diff --git a/build/autoMakefile.am.toplevel b/build/autoMakefile.am.toplevel index c95f165..fd961a9 100644 --- a/build/autoMakefile.am.toplevel +++ b/build/autoMakefile.am.toplevel @@ -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 \ diff --git a/build/lbuild b/build/lbuild index 04e972b..2134d96 100755 --- a/build/lbuild +++ b/build/lbuild @@ -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 diff --git a/build/lmake b/build/lmake index 66f61e5..9a2288e 100755 --- a/build/lmake +++ b/build/lmake @@ -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 ;; diff --git a/build/lustre-kernel-2.4.spec.in b/build/lustre-kernel-2.4.spec.in index 292b527..a96b074 100644 --- a/build/lustre-kernel-2.4.spec.in +++ b/build/lustre-kernel-2.4.spec.in @@ -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} <>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 -- 1.8.3.1