Whamcloud - gitweb
Need to use the flavtgt instead of flavor. flavtgt == "" when flavor == up.
[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 License: 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@ %{?configure_flags:configure_flags} \
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
121 %attr(-, root, root) %{_mandir}/man?/*
122
123 %attr(-, root, root) /etc/openldap/slapd-lustre.conf
124 %attr(-, root, root) /etc/openldap/schema/lustre.schema
125 EOF
126 if [ -f $RPM_BUILD_ROOT%{_libdir}/liblustre.so ] ; then
127   echo '%attr(-, root, root) %{_libdir}/liblustre.a' >>lustre.files
128   echo '%attr(-, root, root) %{_libdir}/liblustre.so' >>lustre.files
129 fi
130
131 if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre/snmp ] ; then
132   echo '%attr(-, root, root) %{_libdir}/lustre/snmp' >>lustre.files
133   echo '%attr(-, root, root) %{_datadir}/lustre/snmp/mibs' >>lustre.files
134 fi
135
136 # Have universal lustre headers 
137 if [ -f $RPM_BUILD_DIR/lustre-%{version}/lustre/include/lustre/lustre_idl.h ] ; then
138   echo '%attr(-, root, root) /usr/include/lustre/lustre_idl.h' >>lustre.files
139   echo '%attr(-, root, root) /usr/include/linux/lustre_types.h' >>lustre.files
140   echo '%attr(-, root, root) /usr/include/linux/lustre_user.h' >>lustre.files
141 else
142   echo '%attr(-, root, root) /usr/include/linux/lustre_idl.h' >>lustre.files
143 fi
144
145 %files -f lustre.files
146
147 %files modules
148 %attr(-, root, root) %doc COPYING
149 %attr(-, root, root) /lib/modules/%{kversion}/kernel/fs/lustre
150 %attr(-, root, root) /lib/modules/%{kversion}/kernel/net/lustre
151
152 %files source
153 %attr(-, root, root) /usr/src/lustre-%{version}
154
155 # uncomment these lines to enable deps packages
156 # %files deps-sles
157 # %files deps-rhel
158
159 %post
160 if [ -f /etc/init.d/lustre ] ; then
161         /sbin/chkconfig --add lustre
162         /sbin/chkconfig --add lustrefs
163 fi
164
165 %preun
166 if [ $1 = 0 -a -f /etc/init.d/lustre ] ; then
167         /sbin/chkconfig --del lustre
168         /sbin/chkconfig --del lustrefs
169 fi
170 rm -f %{_libdir}/lustre/python/Lustre/*.pyc
171
172 %post modules
173 if [ -f /boot/System.map-%{kversion} ]; then
174         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
175 else
176         depmod -ae %{kversion} || exit 0
177 fi
178
179 # for update from < v1.4.6
180
181 for f in /etc/modules.conf /etc/modprobe.conf /etc/modprobe.conf.local ; 
182 do
183         if [ -f $f ]; then
184                 if ! grep 'lustre llite' $f >/dev/null 2>/dev/null ; then
185                         cat >> $f <<-EOF
186 alias lustre llite
187 EOF
188                 fi
189                 if egrep "^[^#]*(add below|install) ptlrpc" $f ; then
190                         [ ! -f $f.rpmsave ] && cp $f $f.rpmsave
191                         TMPFILE=`mktemp $f.XXXXXX` && \
192                         sed -e "s/^[^#]*\(add below\|install\) ptlrpc.*/#&/" $f > $TMPFILE && \
193                         mv $TMPFILE $f
194                 fi
195         fi
196 done
197
198
199 %postun modules
200 if [ -f /boot/System.map-%{kversion} ]; then
201         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
202 else
203         depmod -ae %{kversion} || exit 0
204 fi
205
206 %clean
207 rm -rf $RPM_BUILD_ROOT