From 5db8cc0de19278d4b84c72895c0e4178572f48c5 Mon Sep 17 00:00:00 2001 From: jacob Date: Tue, 26 Apr 2005 22:03:38 +0000 Subject: [PATCH] b=6205 r=adilger - move the lustre kernel modules to their own package - lbuild now does 'make rpms' to build lustre modules, more or less - pass --with-linux to lbuild to build only lustre rpms against an existing kernel source tree - drop the lustre-ldap rpm --- build/autoMakefile.am.toplevel | 5 +- build/autoconf/lustre-build.m4 | 2 + build/lbuild | 111 +++++++++++++++++------- build/lmake | 43 +++++++++- build/lustre-kernel-2.4.spec.in | 45 +--------- build/lustre.spec.in | 183 ++++++++++++++-------------------------- 6 files changed, 195 insertions(+), 194 deletions(-) diff --git a/build/autoMakefile.am.toplevel b/build/autoMakefile.am.toplevel index 030d30b..2451dd3 100644 --- a/build/autoMakefile.am.toplevel +++ b/build/autoMakefile.am.toplevel @@ -60,5 +60,8 @@ dist-hook: find $(distdir) -name .deps | xargs rm -rf find $(distdir) -name CVS | xargs rm -rf -rpms: dist Makefile +build/lustre.spec: build/lustre.spec.in config.status + ./config.status build/lustre.spec + +rpms: build/lustre.spec dist Makefile rpmbuild -ta $(distdir).tar.gz diff --git a/build/autoconf/lustre-build.m4 b/build/autoconf/lustre-build.m4 index 03420fa..59dc4ff 100644 --- a/build/autoconf/lustre-build.m4 +++ b/build/autoconf/lustre-build.m4 @@ -489,6 +489,8 @@ build/lustre.spec LP_CONFIG_FILES LC_CONFIG_FILES +AC_SUBST(ac_configure_args) + AC_OUTPUT cat <<_ACEOF diff --git a/build/lbuild b/build/lbuild index b6e0710..af1590d 100755 --- a/build/lbuild +++ b/build/lbuild @@ -4,6 +4,7 @@ TOPDIR=$PWD # CVSROOT is inherited from the environment KERNELDIR= +LINUX= LUSTRE= PUBLISH=0 RELEASE=0 @@ -114,6 +115,10 @@ Usage: ${0##*/} [OPTION]... [-- ] Directory containing Linux source tarballs referenced by target files. + --linux=LINUX + Directory of Linux kernel sources. When this option is used, only + Lustre modules and userspace are built. + --lustre=LUSTRE Path to an existing lustre source tarball to use instead of pulling from CVS. @@ -132,6 +137,9 @@ Usage: ${0##*/} [OPTION]... [-- ] Specifies that the files generated do not include timestamps, and that this is an official release. + --src + Build a .src.rpm, a full kernel patch, and a patched kernel tarball. + --tag=TAG A CVS branch/tag name to build from when pulling from CVS. @@ -173,24 +181,26 @@ check_options() usage 1 "A branch/tag name must be specified with --tag when not building from a tarball." fi - [ "$KERNELDIR" ] || \ - usage 1 "A kernel directory must be specified with --kerneldir." + if [ -z "$LINUX" ] ; then + [ "$KERNELDIR" ] || \ + usage 1 "A kernel directory must be specified with --kerneldir." - [ -d "$KERNELDIR" ] || \ - usage 1 "$KERNELDIR is not a directory." + [ -d "$KERNELDIR" ] || \ + usage 1 "$KERNELDIR is not a directory." - if ! (( $RELEASE )) ; then - [ "$TAG" ] || \ - usage 1 "When building a snapshot, a tag name must be used." + if ! (( $RELEASE )) ; then + [ "$TAG" ] || \ + usage 1 "When building a snapshot, a tag name must be used." + fi + + [ "$TARGET" ] || usage 1 "A target must be specified with --target." +# TARGET_FILE="$TOPDIR/lustre/kernel_patches/targets/$TARGET.target" +# [ -r "$TARGET_FILE" ] || \ +# usage 1 "Target '$TARGET' was not found." fi TIMESTAMP=$(date -d "$DATE" "+%Y%m%d%H%M") - [ "$TARGET" ] || usage 1 "A target must be specified with --target." -# TARGET_FILE="$TOPDIR/lustre/kernel_patches/targets/$TARGET.target" -# [ -r "$TARGET_FILE" ] || \ -# usage 1 "Target '$TARGET' was not found." - RPMBUILD=$(which rpmbuild 2>/dev/null | head -1) if [ ! "$RPMBUILD" -o "$RPMBUILD" == "" ]; then RPMBUILD=$(which rpm 2>/dev/null | head -1) @@ -409,7 +419,7 @@ clean_linux() rm -rf linux } -prep_build() +prep_kernel_build() { # make .spec file ENABLE_INIT_SCRIPTS="" @@ -456,14 +466,14 @@ prep_build() clean_lustre() { [ -d lustre ] || return 0 - echo "Cleaning lustre..." + echo "Cleaning Lustre..." [ -L lustre ] && rm -rf $(readlink lustre) rm -rf lustre } -build() +build_kernel() { - echo "Building rpms for: $BUILD_ARCHS..." + echo "Building kernel + Lustre RPMs for: $BUILD_ARCHS..." targets= for arch in $BUILD_ARCHS ; do targets="--target $arch $targets" @@ -471,7 +481,7 @@ build() $RPMBUILD $targets -bb lustre-kernel-2.4.spec \ --define "_topdir $TOPDIR" || \ - fatal 1 "Error building rpms for $arch." + fatal 1 "Error building rpms for $BUILD_ARCHS." if (( $DO_SRC )) ; then $RPMBUILD -bs lustre-kernel-2.4.spec \ @@ -480,6 +490,32 @@ build() fi } +build_lustre() +{ + [ -d SRPMS ] || mkdir SRPMS + [ -d RPMS ] || mkdir RPMS + [ -d BUILD ] || mkdir BUILD + [ -d SOURCES ] || mkdir SOURCES + + cp "$LUSTRE" SOURCES + + pushd lustre >/dev/null + + echo "Building Lustre RPMs for: $BUILD_ARCHS..." + targets= + for arch in $BUILD_ARCHS ; do + targets="--target $arch $targets" + done + + ./configure "--with-linux=${LINUX}" ${CONFIGURE_FLAGS} + + $RPMBUILD $targets -bb build/lustre.spec \ + --define "_topdir $TOPDIR" || \ + fatal 1 "Error building rpms for $BUILD_ARCHS." + + popd >/dev/null +} + publish() { publishing || return 0 @@ -487,7 +523,10 @@ publish() [ -r ~/.lbuildrc ] && . ~/.lbuildrc -options=$(getopt -o d:D:h -l external-patches:,extraversion:,kerneldir:,lustre:,nodownload,nosrc,publish,release,tag:,target:,target-archs:,disable-datestamp -- "$@") +options=$(getopt -o d:D:h -l external-patches:,extraversion:,kerneldir:,linux:,lustre:,nodownload,nosrc,publish,release,tag:,target:,target-archs:,disable-datestamp -- "$@") +if [ $? != 0 ] ; then + usage 1 +fi eval set -- "$options" @@ -519,6 +558,10 @@ while [ "$1" ] ; do KERNELDIR=$2 shift 2 ;; + --linux | --with-linux) + LINUX=$2 + shift 2 + ;; --lustre) LUSTRE=$2 shift 2 @@ -539,6 +582,10 @@ while [ "$1" ] ; do RELEASE=1 shift ;; + --src) + DO_SRC=1 + shift 1 + ;; --tag) TAG=$2 shift 2 @@ -569,18 +616,24 @@ done check_options unpack_lustre -load_target - -if (( $DO_SRC )) ; then - unpack_linux - patch_linux - pack_linux - clean_linux -fi # prep_build needs the .spec.in from the lustre source -prep_build -clean_lustre +if [ -z "$LINUX" ] ; then + load_target + + if (( $DO_SRC )) ; then + unpack_linux + patch_linux + pack_linux + clean_linux + fi + + prep_kernel_build + clean_lustre + + build_kernel +else + build_lustre +fi -build publish diff --git a/build/lmake b/build/lmake index ff61519..51cba5b 100755 --- a/build/lmake +++ b/build/lmake @@ -45,6 +45,7 @@ TARGET_FILE= KERNEL_FILE= SERIES_FILE= CONFIG_FILE= +RPMBUILD= canon() { @@ -52,7 +53,24 @@ canon() echo $PWD popd >/dev/null } -TOPDIR=$(canon "${0%%${0##*/}}/..") +TOPDIR="${0%%${0##*/}}" +if [ "${TOPDIR}" ] ; then + TOPDIR=$(canon "${TOPDIR}/..") +else + TOPDIR=$(canon "..") +fi + +lbuild_topdir() +{ + retdir=$TOPDIR + while [ ! -d $retdir/BUILD ] ; do + retdir=$(canon "$retdir/..") + if [ "$retdir" = "/" ] ; then + break; + fi + done + echo "$retdir" +} cleanup() { @@ -179,6 +197,14 @@ check_options() if [ -z "$JOBS" -o "$JOBS" -lt "1" ] ; then JOBS=1 fi + + RPMBUILD=$(which rpmbuild 2>/dev/null | head -1) + if [ ! "$RPMBUILD" -o "$RPMBUILD" == "" ]; then + RPMBUILD=$(which rpm 2>/dev/null | head -1) + if [ ! "$RPMBUILD" -o "$RPMBUILD" == "" ]; then + usage 1 "Could not find binary for making rpms (tried rpmbuild and rpm)." + fi + fi } get_lustre_version() @@ -365,6 +391,7 @@ build_kernel() configure_lustre() { + return 0 (( $BUILD_LUSTRE )) || return 0 pushd "$TOPDIR" >/dev/null [ -f Makefile ] && make -s clean @@ -378,8 +405,19 @@ build_lustre() { (( $BUILD_LUSTRE )) || return 0 set_make + FULL_VERSION="${VERSION}-${EXTRA_VERSION}${TARGET_CONFIG}" pushd "$TOPDIR" >/dev/null - $MAKE_J "$MAKE_CC" || fatal 1 "Error building Lustre." + sed \ + -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 \ + < build/lustre.spec.in \ + > build/lustre.spec + $RPMBUILD --target ${TARGET_ARCH} -bb build/lustre.spec \ + --define "_topdir $(lbuild_topdir)" || \ + fatal 1 "Error building Lustre rpms." + # $MAKE_J "$MAKE_CC" || fatal 1 "Error building Lustre." popd >/dev/null } @@ -443,6 +481,7 @@ install_kernel() install_lustre() { (( $INSTALL_LUSTRE )) || return 0 + return 0 set_make FULL_VERSION="${VERSION}-${EXTRA_VERSION}${TARGET_CONFIG}" pushd "$TOPDIR" >/dev/null diff --git a/build/lustre-kernel-2.4.spec.in b/build/lustre-kernel-2.4.spec.in index d03e614..fbb0831 100644 --- a/build/lustre-kernel-2.4.spec.in +++ b/build/lustre-kernel-2.4.spec.in @@ -531,11 +531,7 @@ BuildKernel() --kerneldir $RPM_SOURCE_DIR \ -j $RPM_BUILD_NCPUS \ --destdir $RPM_BUILD_ROOT \ - -- --enable-modules \ - --disable-doc --disable-tests \ - --disable-utils --disable-liblustre \ - --sysconfdir=%{_sysconfdir} \ - --mandir=%{_mandir} \ + -- --disable-tests \ @CONFIGURE_FLAGS@ } @@ -601,7 +597,7 @@ BuildKernel %endif %if %{buildbase} -BuildLustre +# BuildLustre %endif popd >/dev/null @@ -971,40 +967,5 @@ fi %endif %if %{buildbase} - %files source -f kernel-source.files - -%files doc -%defattr(-,root,root) -%doc lustre/linux/Documentation/* - -%files -n lustre-lite-utils -%defattr(-, root, root) -%doc lustre/COPYING lustre/lustre/BUGS lustre/ChangeLog lustre/README -/sbin/* -/usr/sbin/* -/usr/bin/* -/usr/lib/lustre/python -@ENABLE_INIT_SCRIPTS@/etc/init.d/lustre -@ENABLE_INIT_SCRIPTS@/etc/init.d/lustrefs -/usr/include/lustre/* -/usr/include/linux/* -/usr/lib/lib*.a -/usr/share/man/man?/* - -#%files -n lustre-doc -#%defattr(-, root, root) -#/usr/share/doc/lustre/COPYING -#/usr/share/doc/lustre/lustre.pdf -#/usr/share/doc/lustre/COPYING - -/usr/share/lustre/examples - -%files -n lustre-ldap -%defattr(-, root, root) -/etc/openldap/slapd-lustre.conf -/etc/openldap/schema/lustre.schema -/usr/share/lustre/lustre2ldif.xsl -/usr/share/lustre/top.ldif - -%endif # %{buildbase} +%endif diff --git a/build/lustre.spec.in b/build/lustre.spec.in index da2a1c5..520bf91 100644 --- a/build/lustre.spec.in +++ b/build/lustre.spec.in @@ -1,74 +1,75 @@ # lustre.spec %define version @VERSION@ %define kversion @LINUXRELEASE@ -%define linuxdir @LINUX@ -%define enable_doc @ENABLE_DOC@ -%define enable_init_scripts @ENABLE_INIT_SCRIPTS@ -%define enable_gm @ENABLE_GM@ -Summary: Lustre Lite File System -Name: lustre-lite +Summary: Lustre File System +Name: lustre Version: %{version} Release: @RELEASE@ Copyright: GPL Group: Utilities/System -Requires: lustre-modules, PyXML -Source: ftp://ftp.lustre.com/pub/lustre/lustre-%{version}.tar.gz +Requires: lustre-modules +Source: lustre-%{version}.tar.gz +URL: http://clusterfs.com/ BuildRoot: /var/tmp/lustre-%{version}-root +Obsoletes: lustre-lite, lustre-lite-utils, lustre-ldap +Provides: lustre-lite = %{version}, lustre-lite-utils = %{version}, lustre-ldap = %{version} %description -The Lustre Lite Cluster File System: kernel drivers for file system, -servers and utilities. +Userspace tools and files for the Lustre file system. -%package -n lustre-modules -Summary: Kernel Lustre drivers for Linux %{kversion} +%package modules +Summary: Kernel Lustre modules for Linux %{kversion} Requires: modutils >= 2.4.10 Group: Development/Kernel -%description -n lustre-modules -Lustre file System, server and network drivers for Linux %{kversion}. +%description modules +Lustre file system, server and network drivers for Linux %{kversion}. -%package -n lustre-source +%package source Summary: Object-Based Disk storage driver source Group: Development/Kernel -%description -n lustre-source -Lustre Lite Source for further development - -%package -n lustre-doc -Summary: Documentation and sample configuration files -Group: Documentation -# FIXME: BuildArch overrides all the packages in rpm 4.0.4-7x -#BuildArch: noarch - -%description -n lustre-doc -Documentation and sample configuration files for Lustre - -%package -n lustre-ldap -Summary: Configures openldap server for LDAP Lustre config database -Group: Configuration -Requires: openldap-servers, openldap-clients, python-ldap, 4Suite - -%description -n lustre-ldap -Configures openldap server for LDAP Lustre config database +%description source +Lustre sources for further development + +# Since the RPMs we ship are to be used on both SLES and RHEL, we +# can't include any dependency information (since the package names +# are different on the two platforms). +# +# Instead, we can build these empty meta-packages that only include +# dependency information. These let people get the correct +# dependencies for their platform and lets them use tools like yum and +# red carpet to install the correct files. +# +# Unfortunately I have not seen this come up on the lists much, so I +# have disabled them (by commenting out their empty files section +# below) until it's clear that they resolve more confusion than they +# add. + +%package deps-sles +Summary: Lustre dependencies meta-package for SLES +Group: Utilities/System +Provides: lustre-deps = %{version} +Requires: lustre = %{version}, sles-release, python-xml +Conflicts: lustre-deps-rhel +%description deps-sles +This package has RPM dependencies appropriate for SLES systems. -#%package -n liblustre -#Summary: Lustre Lib -#Group: Development/Kernel +%package deps-rhel +Summary: Lustre dependencies meta-package for RHEL +Group: Utilities/System +Provides: lustre-deps = %{version} +Requires: lustre = %{version}, redhat-release, PyXML +Conflicts: lustre-deps-sles -#%description -n liblustre -#Lustre lib binary package. +%description deps-rhel +This package has RPM dependencies appropriate for RHEL, RHL, and FC +systems. %prep %setup -qn lustre-%{version} -#%setup -c -n lustre-%{version}-lib - -%if %{enable_doc} - %define disable_doc '' -%else - %define disable_doc --disable-doc -%endif %build # if RPM_BUILD_NCPUS unset, set it @@ -86,35 +87,17 @@ rm -rf $RPM_BUILD_ROOT # Set an explicit path to our Linux tree, if we can. cd $RPM_BUILD_DIR/lustre-%{version} -./configure \ - --enable-smfs \ - --with-linux='%{linuxdir}' \ - --with-linux-obj='@LINUX_OBJ@' \ - --with-linux-config=@LINUX_CONFIG@ \ - %{disable_doc} --disable-liblustre \ +./configure @ac_configure_args@ \ --sysconfdir=%{_sysconfdir} \ --mandir=%{_mandir} \ --libdir=%{_libdir} make -j $RPM_BUILD_NCPUS -s %install -cd $RPM_BUILD_DIR/lustre-%{version} make install DESTDIR=$RPM_BUILD_ROOT # hack to avoid changing the libsysio code for "make install" rm -f $RPM_BUILD_ROOT%{_libdir}/libsysio.a -%ifarch alpha -# this hurts me - conf_flag= - linuxdir=%{linuxdir} - test -d $linuxdir && conf_flag=--with-linux=$linuxdir - make clean - ./configure --enable-rtscts-myrinet $conf_flag %{disable_doc} - make - cp linux/rtscts/rtscts.o $RPM_BUILD_ROOT/lib/modules/%{kversion}/kernel/net/lustre/rtscts_myrinet.o - cp user/myrinet_utils/mcpload $RPM_BUILD_ROOT/usr/sbin/mcpload -%endif - # Create the pristine source directory. cd $RPM_BUILD_DIR/lustre-%{version} mkdir -p $RPM_BUILD_ROOT/usr/src @@ -122,9 +105,6 @@ rm -f lustre-source ln -s $RPM_BUILD_ROOT/usr/src lustre-source make distdir distdir=lustre-source/lustre-%{version} -# ldap database directory -mkdir -p $RPM_BUILD_ROOT/var/lib/ldap/lustre - %files %attr(-, root, root) /sbin/mount.lustre %attr(-, root, root) /usr/sbin/* @@ -132,67 +112,32 @@ mkdir -p $RPM_BUILD_ROOT/var/lib/ldap/lustre %attr(-, root, root) %{_libdir}/lustre/python %attr(-, root, root) /usr/share/lustre/examples -%if %{enable_init_scripts} %attr(-, root, root) /etc/init.d/lustre %attr(-, root, root) /etc/init.d/lustrefs -%endif %attr(-, root, root) %{_libdir}/libptlctl.a %attr(-, root, root) %{_libdir}/liblustreapi.a %attr(-, root, root) /usr/include/lustre %attr(-, root, root) /usr/include/linux/lustre_idl.h -%attr(-, root, root) /usr/share/man/man?/* - -%ifarch alpha -%attr(-, root, root) /usr/sbin/mcpload -%endif - -%files -n lustre-doc -%attr(-, root, root) %doc COPYING lustre/FDL -%if %{enable_doc} -%attr(-, root, root) %doc doc/lustre.pdf doc/lustre-HOWTO.txt -%endif -#%attr(-, root, root) %doc tests/client-echo.cfg tests/client-mount.cfg -#%attr(-, root, root) %doc tests/client-mount2.cfg -#%attr(-, root, root) %doc tests/elan-client.cfg tests/elan-server.cfg -#%attr(-, root, root) %doc tests/ldlm.cfg tests/lustre.cfg -#%attr(-, root, root) %doc tests/mds.cfg tests/net-client.cfg -#%attr(-, root, root) %doc tests/net-local.cfg tests/net-server.cfg -#%attr(-, root, root) %doc tests/obdecho.cfg tests/obdfilter.cfg - -%files -n lustre-modules +%attr(-, root, root) %{_mandir}/man?/* + +%attr(-, root, root) /etc/openldap/slapd-lustre.conf +%attr(-, root, root) /etc/openldap/schema/lustre.schema +%attr(-, root, root) /usr/share/lustre/lustre2ldif.xsl +%attr(-, root, root) /usr/share/lustre/top.ldif + +%files modules %attr(-, root, root) %doc COPYING %attr(-, root, root) /lib/modules/%{kversion}/kernel/fs/lustre -#portals modules %attr(-, root, root) /lib/modules/%{kversion}/kernel/net/lustre -%files -n lustre-source +%files source %attr(-, root, root) /usr/src/lustre-%{version} -#%ifarch i386 -#%files -n liblustre -#%attr(-, root, root) /lib/lustre -#%attr(-, root, root) /usr/sbin/lctl -#%attr(-, root, root) /usr/sbin/lfind -#%attr(-, root, root) /usr/sbin/lstripe -#%attr(-, root, root) /usr/sbin/obdio -#%attr(-, root, root) /usr/sbin/obdbarrier -#%attr(-, root, root) /usr/sbin/obdstat -#%attr(-, root, root) /usr/sbin/lload -#%attr(-, root, root) /usr/sbin/lconf -#%attr(-, root, root) /usr/sbin/lmc -#%attr(-, root, root) /usr/sbin/llanalyze -#%endif - - -%files -n lustre-ldap -%attr(-, root, root) /etc/openldap/slapd-lustre.conf -%attr(-, root, root) /etc/openldap/schema/lustre.schema -%attr(-, root, root) /usr/share/lustre/lustre2ldif.xsl -%attr(-, root, root) /usr/share/lustre/top.ldif -#%dir /var/lib/ldap/lustre -%attr(700, ldap, ldap) /var/lib/ldap/lustre +# uncomment these lines to enable deps packages +# %files deps-sles +# %files deps-rhel %post if [ -f /etc/init.d/lustre ] ; then @@ -206,7 +151,7 @@ if [ $1 = 0 -a -f /etc/init.d/lustre ] ; then /sbin/chkconfig --del lustrefs fi -%post -n lustre-modules +%post modules if [ ! -e /dev/obd ]; then mknod /dev/obd c 10 241 fi @@ -219,7 +164,7 @@ else depmod -ae %{kversion} || exit 0 fi -%postun -n lustre-modules +%postun modules if [ -f /boot/System.map-%{kversion} ]; then depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0 else @@ -227,6 +172,4 @@ else fi %clean -#rm -rf $RPM_BUILD_ROOT - -# end of file +rm -rf $RPM_BUILD_ROOT -- 1.8.3.1