Whamcloud - gitweb
885b9eefd3f8dc5b32f1f4ecdd57796106d32d5c
[fs/lustre-release.git] / build / lustre.spec.in
1 # lustre.spec
2 %define version @VERSION@
3 %define kversion @LINUXRELEASE@
4
5 Summary: Lustre File System
6 Name: lustre
7 Version: %{version}
8 Release: @RELEASE@
9 Copyright: GPL
10 Group: Utilities/System
11 Source: lustre-%{version}.tar.gz
12 URL: http://clusterfs.com/
13 BuildRoot: /var/tmp/lustre-%{version}-root
14 Obsoletes: lustre-lite, lustre-lite-utils, lustre-ldap
15 Provides: lustre-lite = %{version}, lustre-lite-utils = %{version}, lustre-ldap = %{version}
16
17 %description
18 Userspace tools and files for the Lustre file system.
19
20 %package modules
21 Summary: Kernel Lustre modules for Linux %{kversion}
22 Requires: modutils >= 2.4.10
23 Group: Development/Kernel
24
25 %description modules
26 Lustre file system, server and network drivers for Linux %{kversion}.
27
28 %package source
29 Summary: Object-Based Disk storage driver source
30 Group: Development/Kernel
31
32 %description source
33 Lustre sources for further development
34
35 # Since the RPMs we ship are to be used on both SLES and RHEL, we
36 # can't include any dependency information (since the package names
37 # are different on the two platforms).
38 #
39 # Instead, we can build these empty meta-packages that only include
40 # dependency information.  These let people get the correct
41 # dependencies for their platform and lets them use tools like yum and
42 # red carpet to install the correct files.
43 #
44 # Unfortunately I have not seen this come up on the lists much, so I
45 # have disabled them (by commenting out their empty files section
46 # below) until it's clear that they resolve more confusion than they
47 # add.
48
49 %package deps-sles
50 Summary: Lustre dependencies meta-package for SLES
51 Group: Utilities/System
52 Provides: lustre-deps = %{version}
53 Requires: lustre = %{version}, sles-release, python-xml
54 Conflicts: lustre-deps-rhel
55
56 %description deps-sles
57 This package has RPM dependencies appropriate for SLES systems.
58
59 %package deps-rhel
60 Summary: Lustre dependencies meta-package for RHEL
61 Group: Utilities/System
62 Provides: lustre-deps = %{version}
63 Requires: lustre = %{version}, redhat-release, PyXML
64 Conflicts: lustre-deps-sles
65
66 %description deps-rhel
67 This package has RPM dependencies appropriate for RHEL, RHL, and FC
68 systems.
69
70 %prep
71 %setup -qn lustre-%{version}
72
73 %build
74 # if RPM_BUILD_NCPUS unset, set it
75 if [ -z "$RPM_BUILD_NCPUS" ] ; then
76     RPM_BUILD_NCPUS=$(egrep -c "^cpu[0-9]+" /proc/stat 2>/dev/null || echo 0 :)
77     if [ $RPM_BUILD_NCPUS -eq 0 ] ; then
78         RPM_BUILD_NCPUS=1
79     fi
80     if [ $RPM_BUILD_NCPUS -gt 8 ] ; then
81         RPM_BUILD_NCPUS=8
82     fi
83 fi
84
85 rm -rf $RPM_BUILD_ROOT
86
87 # Set an explicit path to our Linux tree, if we can.
88 cd $RPM_BUILD_DIR/lustre-%{version}
89 ./configure @ac_configure_args@ \
90         --sysconfdir=%{_sysconfdir} \
91         --mandir=%{_mandir} \
92         --libdir=%{_libdir}
93 make -j $RPM_BUILD_NCPUS -s
94
95 %install
96 make install DESTDIR=$RPM_BUILD_ROOT
97 # hack to avoid changing the libsysio code for "make install"
98 rm -f $RPM_BUILD_ROOT%{_libdir}/libsysio.a
99
100 # Create the pristine source directory.
101 cd $RPM_BUILD_DIR/lustre-%{version}
102 mkdir -p $RPM_BUILD_ROOT/usr/src
103 rm -f lustre-source
104 ln -s $RPM_BUILD_ROOT/usr/src lustre-source
105 make distdir distdir=lustre-source/lustre-%{version}
106
107 cat >lustre.files <<EOF
108 %attr(-, root, root) /sbin/mount.lustre
109 %attr(-, root, root) /usr/sbin/*
110 %attr(-, root, root) /usr/bin/*
111 %attr(-, root, root) %{_libdir}/lustre/python
112 %attr(-, root, root) /usr/share/lustre/*
113
114 %attr(-, root, root) /etc/init.d/lustre
115 %attr(-, root, root) /etc/init.d/lustrefs
116
117 %attr(-, root, root) %{_libdir}/libptlctl.a
118 %attr(-, root, root) %{_libdir}/liblustreapi.a
119 %attr(-, root, root) /usr/include/lustre
120 %attr(-, root, root) /usr/include/linux/lustre_idl.h
121
122 %attr(-, root, root) %{_mandir}/man?/*
123
124 %attr(-, root, root) /etc/openldap/slapd-lustre.conf
125 %attr(-, root, root) /etc/openldap/schema/lustre.schema
126 EOF
127 if [ -f $RPM_BUILD_ROOT%{_libdir}/liblustre.so ] ; then
128   echo '%attr(-, root, root) %{_libdir}/liblustre.a' >>lustre.files
129   echo '%attr(-, root, root) %{_libdir}/liblustre.so' >>lustre.files
130 fi
131
132 if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre/snmp ] ; then
133   echo '%attr(-, root, root) %{_libdir}/lustre/snmp' >>lustre.files
134   echo '%attr(-, root, root) %{_datadir}/lustre/snmp/mibs' >>lustre.files
135 fi
136
137 %files -f lustre.files
138
139 %files modules
140 %attr(-, root, root) %doc COPYING
141 %attr(-, root, root) /lib/modules/%{kversion}/kernel/fs/lustre
142 %attr(-, root, root) /lib/modules/%{kversion}/kernel/net/lustre
143
144 %files source
145 %attr(-, root, root) /usr/src/lustre-%{version}
146
147 # uncomment these lines to enable deps packages
148 # %files deps-sles
149 # %files deps-rhel
150
151 %post
152 if [ -f /etc/init.d/lustre ] ; then
153         /sbin/chkconfig --add lustre
154         /sbin/chkconfig --add lustrefs
155 fi
156
157 %preun
158 if [ $1 = 0 -a -f /etc/init.d/lustre ] ; then
159         /sbin/chkconfig --del lustre
160         /sbin/chkconfig --del lustrefs
161 fi
162 rm -f %{_libdir}/lustre/python/Lustre/*.pyc
163
164 %post modules
165 if [ ! -e /dev/obd ]; then
166    mknod /dev/obd c 10 241
167 fi
168 if [ ! -e /dev/portals ]; then
169    mknod /dev/portals c 10 240
170 fi
171 if [ -f /boot/System.map-%{kversion} ]; then
172         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
173 else
174         depmod -ae %{kversion} || exit 0
175 fi
176 for ext in .local "" ; do
177         f=/etc/modprobe.conf$ext
178         if [ -f $f ] && ! grep llite $f >/dev/null 2>/dev/null ; then
179                 cat >> $f <<EOF
180 install kptlrouter modprobe portals ; modprobe --ignore-install kptlrouter
181 install ptlrpc modprobe ksocknal ; modprobe --ignore-install ptlrpc
182 install llite modprobe lov osc ; modprobe --ignore-install llite
183 alias lustre llite
184 EOF
185                 break
186         fi
187 done
188 f=/etc/modules.conf
189 if [ -f $f ] && ! grep llite $f >/dev/null 2>/dev/null ; then
190         cat >> $f <<EOF
191 add below kptlrouter portals
192 add below ptlrpc ksocknal
193 add below llite lov osc
194 alias lustre llite
195 EOF
196 fi
197
198 %postun modules
199 if [ -f /boot/System.map-%{kversion} ]; then
200         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
201 else
202         depmod -ae %{kversion} || exit 0
203 fi
204
205 %clean
206 rm -rf $RPM_BUILD_ROOT