-# obd.spec
-%define version 0.3.2.1
+# lustre.spec
+%define version HEAD
%define kversion @RELEASE@
%define linuxdir @LINUX@
%define portalsdir @PORTALS@
-Release: 1
+%define portalslibdir @PORTALSLIB@
+Release: 0302240920chaos
Summary: Lustre Lite File System
Name: lustre-lite
Version: %{version}
Copyright: GPL
Group: Utilities/System
-Requires: lustre-modules, libxml2
-BuildRoot: /var/tmp/obd-%{version}-root
-Source: ftp://ftp.lustre.com/pub/lustre/obd-%{version}.tar.gz
+Requires: lustre-modules, PyXML
+BuildRoot: /var/tmp/lustre-%{version}-root
+Source: ftp://ftp.lustre.com/pub/lustre/lustre-%{version}.tar.gz
%description
The Lustre Lite Cluster File System: kernel drivers for file system,
%package -n lustre-modules
Summary: Kernel Lustre drivers for Linux %{kversion}
+Requires: portals-modules
Group: Development/Kernel
%description -n lustre-modules
%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
+
+
+%package -n liblustre
+Summary: Lustre Lib
+Group: Development/Kernel
+
+%description -n liblustre
+Lustre lib binary package.
+
+
%prep
-%setup -n obd-%{version}
+%setup -qn lustre-%{version}
+%setup -c -n lustre-%{version}-lib
%build
rm -rf $RPM_BUILD_ROOT
# Set an explicit path to our Linux tree, if we can.
-./configure --enable-linuxdir=%{linuxdir} --enable-portalsdir=%{portalsdir}
-make clean
+cd $RPM_BUILD_DIR/lustre-%{version}
+./configure --with-linux='%{linuxdir}' --with-portals='%{portalsdir}' --with-portalslib='%{portalslibdir}'
make
+%ifarch i386
+cd $RPM_BUILD_DIR/lustre-%{version}-lib/lustre-%{version}
+./configure --with-lib --with-portals='%{portalsdir}' --with-portalslib='%{portalslibdir}'
+make
+%endif
+
%install
+cd $RPM_BUILD_DIR/lustre-%{version}
make install prefix=$RPM_BUILD_ROOT
+%ifarch i386
+cd $RPM_BUILD_DIR/lustre-%{version}-lib/lustre-%{version}
+make install prefix=$RPM_BUILD_ROOT
+%endif
+
+
# Create the pristine source directory.
-make distclean
-mkdir -p $RPM_BUILD_ROOT/usr/src/obd-%{version}
-find . -print | cpio -ap $RPM_BUILD_ROOT/usr/src/obd-%{version}
+cd $RPM_BUILD_DIR/lustre-%{version}
+mkdir -p $RPM_BUILD_ROOT/usr/src
+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) /usr/sbin/lmc
+%attr(-, root, root) /usr/sbin/lctl
+%attr(-, root, root) /usr/sbin/lconf
+%attr(-, root, root) /usr/sbin/llanalyze
+%attr(-, root, root) /usr/sbin/lfind
+%attr(-, root, root) /usr/sbin/lstripe
+%attr(-, root, root) /usr/sbin/mcreate
+%attr(-, root, root) /usr/sbin/mkdirmany
+%attr(-, root, root) /usr/lib/lustre/examples/llmount.sh
+%attr(-, root, root) /usr/lib/lustre/examples/llmountcleanup.sh
+%attr(-, root, root) /usr/lib/lustre/examples/llecho.sh
+%attr(-, root, root) /usr/lib/lustre/examples/local.sh
+%attr(-, root, root) /usr/lib/lustre/examples/uml.sh
+%attr(-, root, root) /usr/lib/lustre/examples/lov.sh
+%attr(-, root, root) /etc/init.d/lustre
+
+%files -n lustre-doc
%attr(-, root, root) %doc COPYING FDL
-%attr(-, root, root) %doc doc/master.pdf doc/lustre-HOWTO.txt
-%attr(-, root, root) /usr/bin/directio
-%attr(-, root, root) /usr/bin/fsx
-%attr(-, root, root) /usr/bin/mcreate
-%attr(-, root, root) /usr/bin/obdctl
-%attr(-, root, root) /usr/bin/openme
-%attr(-, root, root) /usr/bin/openunlink
-%attr(-, root, root) /usr/bin/tchmod
-%attr(-, root, root) /usr/bin/toexcl
-%attr(-, root, root) /usr/bin/truncate
-%attr(-, root, root) /usr/bin/writeme
+%attr(-, root, root) %doc doc/lustre.pdf doc/lustre-HOWTO.txt
+%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) %doc COPYING
-%attr(-, root, root) /lib/modules/%{kversion}/fs/extN.o
-%attr(-, root, root) /lib/modules/%{kversion}/fs/ldlm.o
-%attr(-, root, root) /lib/modules/%{kversion}/fs/llite.o
-%attr(-, root, root) /lib/modules/%{kversion}/fs/mdc.o
-%attr(-, root, root) /lib/modules/%{kversion}/fs/mds.o
-%attr(-, root, root) /lib/modules/%{kversion}/fs/mds_extN.o
-%attr(-, root, root) /lib/modules/%{kversion}/fs/obdclass.o
-%attr(-, root, root) /lib/modules/%{kversion}/fs/obdecho.o
-%attr(-, root, root) /lib/modules/%{kversion}/fs/obdfilter.o
-%attr(-, root, root) /lib/modules/%{kversion}/fs/obdfs.o
-%attr(-, root, root) /lib/modules/%{kversion}/fs/osc.o
-%attr(-, root, root) /lib/modules/%{kversion}/fs/ost.o
-%attr(-, root, root) /lib/modules/%{kversion}/fs/ptlrpc.o
+%attr(-, root, root) /lib/modules/%{kversion}/kernel/fs/lustre/extN.o
+%attr(-, root, root) /lib/modules/%{kversion}/kernel/fs/lustre/ldlm.o
+%attr(-, root, root) /lib/modules/%{kversion}/kernel/fs/lustre/llite.o
+%attr(-, root, root) /lib/modules/%{kversion}/kernel/fs/lustre/mdc.o
+%attr(-, root, root) /lib/modules/%{kversion}/kernel/fs/lustre/mds.o
+%attr(-, root, root) /lib/modules/%{kversion}/kernel/fs/lustre/fsfilt_extN.o
+%attr(-, root, root) /lib/modules/%{kversion}/kernel/fs/lustre/obdclass.o
+%attr(-, root, root) /lib/modules/%{kversion}/kernel/fs/lustre/obdecho.o
+%attr(-, root, root) /lib/modules/%{kversion}/kernel/fs/lustre/obdfilter.o
+%attr(-, root, root) /lib/modules/%{kversion}/kernel/fs/lustre/lov.o
+%attr(-, root, root) /lib/modules/%{kversion}/kernel/fs/lustre/osc.o
+%attr(-, root, root) /lib/modules/%{kversion}/kernel/fs/lustre/ost.o
+%attr(-, root, root) /lib/modules/%{kversion}/kernel/fs/lustre/ptlrpc.o
%files -n lustre-source
-%attr(-, root, root) /usr/src/obd-%{version}
+%attr(-, root, root) /usr/src/lustre-%{version}
+
+%ifarch i386
+%files -n liblustre
+%attr(-, root, root) /lib/lustre
+%attr(-, root, root) /lib/lustre/liblov.a
+%attr(-, root, root) /lib/lustre/liblustreclass.a
+%attr(-, root, root) /lib/lustre/libptlrpc.a
+%attr(-, root, root) /lib/lustre/libobdecho.a
+%attr(-, root, root) /lib/lustre/libldlm.a
+%attr(-, root, root) /lib/lustre/libosc.a
+%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/lib/lustre/lustre2ldif.xsl
+%attr(-, root, root) /usr/lib/lustre/top.ldif
+%dir /var/lib/ldap/lustre
+%attr(700, ldap, ldap) /var/lib/ldap/lustre
%post
+if [ ! -e /dev/obd ]; then
+ mknod /dev/obd c 10 241
+fi
depmod -ae || exit 0
+grep -q obdclass /etc/modules.conf || \
+ echo 'alias char-major-10-241 obdclass' >> /etc/modules.conf
+
+grep -q '/dev/obd' /etc/modules.conf || \
+ echo 'alias /dev/obd obdclass' >> /etc/modules.conf
+
+grep -q '/dev/lustre' /etc/modules.conf || \
+ echo 'alias /dev/lustre obdclass' >> /etc/modules.conf
+
%postun
depmod -ae || exit 0
+%post -n lustre-ldap
+if ! grep -q slapd-lustre /etc/openldap/slapd.conf; then
+ echo "include /etc/openldap/slapd-lustre.conf" >> /etc/openldap/slapd.conf
+fi
+
+%postun -n lustre-ldap
+slapd=/etc/openldap/slapd.conf
+if grep -q slapd-lustre $slapd; then
+ tmp=/tmp/lustre-ldap.$$
+ sed "/slapd-lustre/d" $slapd >> $tmp
+ cp $tmp $slapd
+ rm $tmp
+fi
+
%clean
#rm -rf $RPM_BUILD_ROOT