%define arch i586-smp
%define kernel_version 2.4.20
-%define patch_version
+%define patch_version rh
%define lustre_version 22
%define lustre_release PQ_TEST
%define lustre_branch b_devel
%define kernel_config kernel-2.4.20
+%define with_lib_lustre 1
+%define with_debug_lustre 0
# disable build root strip policy
%define __spec_install_post /usr/lib/rpm/brp-compress || :
%description
The Lustre Lite Cluster File System: kernel for lustre file system
+%if %{with_debug_lustre}
%package -n lustre-kernel-debug
Summary: lustre-kernel-packages with debug info
Group: System Environment/Kernel
%description -n lustre-kernel-debug
lustre-kernel-packages with debug info
+%endif
%package -n lustre-lite-utils
Summary: Lustre utils for Linux %{kernel_version}
%description -n lustre-ldap
Configures openldap server for LDAP Lustre config database
-#####################################################
+%if %{with_lib_lustre}
+%package -n liblustre
+Summary: Liblustre package
+Group: Development
+
+%description -n liblustre
+The Lustre Lib utilities
+%endif
+
+###################################################################################################
%prep
-%setup -q -n linux-%{kernel_version}-%{patch_version}
+%setup -q -n linux-%{kernel_version}-%{patch_version}
#patch the lustre kernel
%patch0 -p0
find . -name "*.orig" -exec rm -fv {} \;
find . -name "*~" -exec rm -fv {} \;
-#FIXME later, I do not know how to setup two build directory
-#For debug info kernel FIXME later
-rm -rf $RPM_BUILD_DIR/linux-%{kernel_version}-%{patch_version}-debug
-mkdir -p $RPM_BUILD_DIR/linux-%{kernel_version}-%{patch_version}-debug
-gzip -dc $RPM_SOURCE_DIR/linux-%{kernel_version}-%{patch_version}.tar.gz | tar -xf- -C $RPM_BUILD_DIR/linux-%{kernel_version}-%{patch_version}-debug
-
-#for release lustre
-rm -rf $RPM_BUILD_DIR/lustre-%{lustre_branch}
-gzip -dc $RPM_SOURCE_DIR/lustre-%{lustre_branch}.tar.gz | tar -xf- -C $RPM_BUILD_DIR/
-
-#for debug lustre
-rm -rf $RPM_BUILD_DIR/lustre-%{lustre_release}-debug
-mkdir -p $RPM_BUILD_DIR/lustre-%{lustre_release}-debug
-gzip -dc $RPM_SOURCE_DIR/lustre-%{lustre_branch}.tar.gz | tar -xf- -C $RPM_BUILD_DIR/lustre-%{lustre_release}-debug
-# end of prepare
-#####################################################
-
-#####################################################
-# build
-%build
+#for release lustre
+%setup -T -b 1 -q -n lustre-%{lustre_branch}
+
+#for debug kernel
+%if %{with_debug_lustre}
+%setup -T -b 0 -q -c -n $RPM_BUILD_DIR/linux-%{kernel_version}-%{patch_version}-debug
+%setup -T -b 1 -q -c -n $RPM_BUILD_DIR/lustre-%{lustre_branch}-debug
+%endif
+
+#for release lib-lustre
+%if %{with_lib_lustre}
+%setup -T -b 1 -q -c -n $RPM_BUILD_DIR/lustre-%{lustre_branch}-lib
+%endif
+
+###################################################################################################
+%build
BuildKernel() {
cd $RPM_BUILD_DIR/linux-%{kernel_version}-%{patch_version}
make distclean
cp -fv $RPM_BUILD_DIR/lustre-%{lustre_branch}/kernel_patches/kernel_configs/%{kernel_config} .config
- if [ %{arch} = "ia64" ]; then
+%ifarch ia64
make oldconfig dep vmlinux modules
- else
+%else
make oldconfig dep bzImage modules
- fi
+%endif
}
BuildLustre() {
cd $RPM_BUILD_DIR/lustre-%{lustre_branch}
cd doc
make docs
}
-
+BuildLibLustre(){
+ cd $RPM_BUILD_DIR/lustre-%{lustre_branch}-lib/lustre-%{lustre_branch}
+ sh autogen.sh
+ ./configure --with-lib
+ make
+}
BuildDebugKernel() {
cd $RPM_BUILD_DIR/linux-%{kernel_version}-%{patch_version}-debug/linux-%{kernel_version}-%{patch_version}
patch -p0 < $RPM_SOURCE_DIR/lustre-patch-%{lustre_version}
cp -fv $RPM_BUILD_DIR/lustre-%{lustre_branch}/kernel_patches/kernel_configs/%{kernel_config} .config
sed -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{patch_version}_lustre%{lustre_version}-debug/g" < Makefile > Makefile.new
mv -f Makefile.new Makefile
- if [ %{arch} = "ia64" ]; then
+%ifarch ia64
make oldconfig dep vmlinux modules
- else
+%else
make oldconfig dep bzImage modules
- fi
+%endif
}
BuildDebugLustre() {
- cd $RPM_BUILD_DIR/lustre-%{lustre_release}-debug/lustre-%{lustre_branch}
+ cd $RPM_BUILD_DIR/lustre-%{lustre_branch}-debug/lustre-%{lustre_branch}
sh autogen.sh
./configure --with-linux="$RPM_BUILD_DIR/linux-%{kernel_version}-%{patch_version}-debug/linux-%{kernel_version}-%{patch_version}"
make
#build docs
cd doc
make docs
-
}
rm -rf $RPM_BUILD_ROOT
BuildKernel
BuildLustre
-BuildDebugKernel
-BuildDebugLustre
-# end of build
-#####################################################
-#####################################################
-# install kernel and lustre_modules
+%if %{with_lib_lustre}
+ BuildLibLustre
+%endif
+
+%if %{with_debug_lustre}
+ BuildDebugKernel
+ BuildDebugLustre
+%endif
+
+###################################################################################################
%install
#install kernel
cd $RPM_BUILD_DIR/linux-%{kernel_version}-%{patch_version}
mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib $RPM_BUILD_ROOT/lib/modules
INSTALL_MOD_PATH=$RPM_BUILD_ROOT/ make modules_install
-if [ %{arch} = "ia64" ]; then
+%ifarch ia64
cp vmlinux $RPM_BUILD_ROOT/boot/vmlinuz-%{kernel_version}_lustre%{lustre_version}
-else
+%else
cp arch/i386/boot/bzImage $RPM_BUILD_ROOT/boot/vmlinuz-%{kernel_version}_lustre%{lustre_version}
-fi
+%endif
cp System.map $RPM_BUILD_ROOT/boot/System.map-%{kernel_version}-%{patch_version}_lustre%{lustre_version}
cp .config $RPM_BUILD_ROOT/boot/config-%{kernel_version}_lustre%{lustre_version}
-#install debug kernel
-cd $RPM_BUILD_DIR/linux-%{kernel_version}-%{patch_version}-debug/linux-%{kernel_version}-%{patch_version}
-mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib $RPM_BUILD_ROOT/lib/modules
-INSTALL_MOD_PATH=$RPM_BUILD_ROOT make modules_install
-if [ %{arch} = "ia64" ]; then
- cp vmlinux $RPM_BUILD_ROOT/boot/vmlinuz-%{kernel_version}_lustre%{lustre_version}-debug
-else
- cp arch/i386/boot/bzImage $RPM_BUILD_ROOT/boot/vmlinuz-%{kernel_version}_lustre%{lustre_version}-debug
-fi
-cp System.map $RPM_BUILD_ROOT/boot/System.map-%{kernel_version}-%{patch_version}_lustre%{lustre_version}-debug
-cp vmlinux $RPM_BUILD_ROOT/boot/vmlinux-%{kernel_version}_lustre%{lustre_version}-debug
-cp .config $RPM_BUILD_ROOT/boot/config-%{kernel_version}_lustre%{lustre_version}-debug
-
#install lustre
cd $RPM_BUILD_DIR/lustre-%{lustre_branch}
make install prefix="$RPM_BUILD_ROOT"
-#install debug lustre
-cd $RPM_BUILD_DIR/lustre-%{lustre_release}-debug/lustre-%{lustre_branch}
-make install prefix="$RPM_BUILD_ROOT/"
+#install debug kernel
+%if %{with_debug_lustre}
+ cd $RPM_BUILD_DIR/linux-%{kernel_version}-%{patch_version}-debug/linux-%{kernel_version}-%{patch_version}
+ mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib $RPM_BUILD_ROOT/lib/modules
+ INSTALL_MOD_PATH=$RPM_BUILD_ROOT make modules_install
+%ifarch ia64
+ cp vmlinux $RPM_BUILD_ROOT/boot/vmlinuz-%{kernel_version}_lustre%{lustre_version}-debug
+%else
+ cp arch/i386/boot/bzImage $RPM_BUILD_ROOT/boot/vmlinuz-%{kernel_version}_lustre%{lustre_version}-debug
+%endif
+ cp System.map $RPM_BUILD_ROOT/boot/System.map-%{kernel_version}-%{patch_version}_lustre%{lustre_version}-debug
+ cp vmlinux $RPM_BUILD_ROOT/boot/vmlinux-%{kernel_version}_lustre%{lustre_version}-debug
+ cp .config $RPM_BUILD_ROOT/boot/config-%{kernel_version}_lustre%{lustre_version}-debug
+ cd $RPM_BUILD_DIR/lustre-%{lustre_branch}-debug/lustre-%{lustre_branch}
+ make install prefix="$RPM_BUILD_ROOT/"
+%endif
+
+#install lib lustre
+%if %{with_lib_lustre}
+ cd $RPM_BUILD_DIR/lustre-%{lustre_branch}-lib/lustre-%{lustre_branch}
+ make install prefix="$RPM_BUILD_ROOT/"
+%endif
#install Document of lustre
mkdir -p $RPM_BUILD_ROOT/usr/share/doc/lustre
%endif
mkdir -p $RPM_BUILD_ROOT/var/lib/ldap/lustre
-# end of install
-#################################################
-
-#################################################
-# file lists
+###################################################################################################
%files
%defattr (-, root, root)
/boot/vmlinuz-%{kernel_version}_lustre%{lustre_version}
/boot/System.map-%{kernel_version}-%{patch_version}_lustre%{lustre_version}
/boot/config-%{kernel_version}_lustre%{lustre_version}
-%dir /lib/modules/%{kernel_version}-%{patch_version}_lustre%{lustre_version}
/lib/modules/%{kernel_version}-%{patch_version}_lustre%{lustre_version}
+%if %{with_debug_lustre}
%files -n lustre-kernel-debug
%defattr (-, root, root)
/boot/vmlinuz-%{kernel_version}_lustre%{lustre_version}-debug
/boot/vmlinux-%{kernel_version}_lustre%{lustre_version}-debug
/boot/System.map-%{kernel_version}-%{patch_version}_lustre%{lustre_version}-debug
/boot/config-%{kernel_version}_lustre%{lustre_version}-debug
-%dir /lib/modules/%{kernel_version}-%{patch_version}_lustre%{lustre_version}-debug
/lib/modules/%{kernel_version}-%{patch_version}_lustre%{lustre_version}-debug
+%endif
%files -n lustre-lite-utils
%attr(-, root, root) /usr/sbin/lmc
%attr(-, root, root) /usr/sbin/llanalyze
%attr(755, root, root) /usr/bin/lfind
%attr(755, root, root) /usr/bin/lstripe
-%attr(-, root, root) /usr/sbin/mcreate
-%attr(-, root, root) /usr/sbin/mkdirmany
-%attr(-, root, root) /usr/sbin/munlink
%attr(-, root, root) /usr/sbin/llstat.pl
%attr(-, root, root) /usr/sbin/llobdstat.pl
%attr(-, root, root) /usr/sbin/load_ldap.sh
%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
-
-################################################
-# clean
+
+%if %{with_lib_lustre}
+%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) /lib/lustre/libost.a
+%attr(-, root, root) /lib/lustre/libmdc.a
+%attr(-, root, root) /lib/lustre/libportals.a
+%attr(-, root, root)/lib/lustre/libtcpnal.a
+%attr(-, root, root)/lib/lustre/libptlctl.a
+
+%attr(-, root, root) /usr/bin/lfind
+%attr(-, root, root) /usr/bin/lstripe
+%attr(-, root, root) /usr/bin/libecho
+%attr(-, root, root) /usr/sbin/lctl
+%attr(-, root, root) /usr/sbin/obdio
+%attr(-, root, root) /usr/sbin/obdbarrier
+%attr(-, root, root) /usr/sbin/lload
+%attr(-, root, root) /usr/sbin/lconf
+%attr(-, root, root) /usr/sbin/lmc
+%attr(-, root, root) /usr/sbin/llanalyze
+%attr(-, root, root) /usr/sbin/ptlctl
+%attr(-, root, root) /usr/sbin/routerstat
+%attr(-, root, root) /usr/sbin/wirecheck
+%attr(-, root, root) /usr/sbin/llstat.pl
+%attr(-, root, root) /usr/sbin/llobdstat.pl
+%attr(-, root, root) /usr/sbin/lactive
+%attr(-, root, root) /usr/sbin/load_ldap.sh
+
+%attr(-, root, root) /usr/include/lustre/pqtimer.h
+%attr(-, root, root) /usr/include/lustre/dispatch.h
+%attr(-, root, root) /usr/include/lustre/table.h
+%attr(-, root, root) /usr/include/lustre/timer.h
+%attr(-, root, root) /usr/include/lustre/connection.h
+%attr(-, root, root) /usr/include/lustre/ipmap.h
+%attr(-, root, root) /usr/include/lustre/bridge.h
+%attr(-, root, root) /usr/include/lustre/procbridge.h
+%attr(-, root, root) /usr/lib/lustre/python/Lustre/__init__.py
+%attr(-, root, root) /usr/lib/lustre/python/Lustre/lustredb.py
+%attr(-, root, root) /usr/lib/lustre/python/Lustre/error.py
+%attr(-, root, root) /usr/lib/lustre/python/Lustre/cmdline.py
+%endif
+###################################################################################################
%clean
-rm -rf $RPM_BUILD_ROOT
-# end of clean
-###############################################
+rm -rf $RPM_BUILD_ROOT/lustre-%{lustre_branch}-debug
+rm -rf $RPM_BUILD_ROOT/lustre-%{lustre_branch}
+rm -rf $RPM_BUILD_ROOT/lustre-%{lustre_branch}-lib
+rm -rf $RPM_BUILD_ROOT/linux-%{kernel_version}-%{patch_version}
+rm -rf $RPM_BUILD_ROOT/linux-%{kernel_version}-%{patch_version}-debug
-###############################################
+###################################################################################################
# post
%post
if [ ! -e /dev/obd ]; then
fi
depmod -ae || exit 0
-#change the grub.conf
-#cd /boot
-#[ -x /usr/sbin/module_upgrade ] && /usr/sbin/module_upgrade
-#[ -x /sbin/mkkerneldoth ] && /sbin/mkkerneldoth
-#if [ -x /sbin/new-kernel-pkg ] ; then
-# /sbin/new-kernel-pkg --mkinitrd --depmod --install %{kernel_version}-%{patch_version}_lustre%{lustre_version}
-#fi
-
%postun
depmod -ae || exit 0
-%post -n lustre-kernel-debug
-if [ ! -e /dev/obd ]; then
- mknod /dev/obd c 10 241
-fi
-if [ ! -e /dev/portals ]; then
- mknod /dev/portals c 10 240
-fi
-depmod -ae || exit 0
-
-#change the grub.conf
-#cd /boot
-#[ -x /usr/sbin/module_upgrade ] && /usr/sbin/module_upgrade
-#[ -x /sbin/mkkerneldoth ] && /sbin/mkkerneldoth
-#if [ -x /sbin/new-kernel-pkg ] ; then
-# /sbin/new-kernel-pkg --mkinitrd --depmod --install %{kernel_version}-%{patch_version}_lustre%{lustre_version}-debug
-#fi
-
%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
rm $tmp
fi
# end of post
-##############################################
+###################################################################################################