Whamcloud - gitweb
b=8007
[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}
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
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
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
112 %attr(-, root, root) /usr/share/lustre/*
113
114 %attr(-, root, root) %{_libdir}/libptlctl.a
115 %attr(-, root, root) %{_libdir}/liblustreapi.a
116 %attr(-, root, root) /usr/include/lustre
117
118 %attr(-, root, root) %{_mandir}/man?/*
119 EOF
120
121 if [ -f $RPM_BUILD_ROOT%{_libdir}/liblustre.so ] ; then
122   echo '%attr(-, root, root) %{_libdir}/liblustre.a' >>lustre.files
123   echo '%attr(-, root, root) %{_libdir}/liblustre.so' >>lustre.files
124 fi
125
126 if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre/snmp ] ; then
127   echo '%attr(-, root, root) %{_libdir}/lustre/snmp' >>lustre.files
128   echo '%attr(-, root, root) %{_datadir}/lustre/snmp/mibs' >>lustre.files
129 fi
130
131 # Have universal lustre headers 
132 if [ -f $RPM_BUILD_DIR/lustre-%{version}/lustre/include/lustre/lustre_idl.h ] ; then
133   echo '%attr(-, root, root) /usr/include/lustre/lustre_idl.h' >>lustre.files
134   echo '%attr(-, root, root) /usr/include/linux/lustre_types.h' >>lustre.files
135   echo '%attr(-, root, root) /usr/include/linux/lustre_user.h' >>lustre.files
136 else
137   echo '%attr(-, root, root) /usr/include/linux/lustre_idl.h' >>lustre.files
138 fi
139
140 %files -f lustre.files
141
142 %files modules
143 %attr(-, root, root) %doc COPYING
144 %attr(-, root, root) /lib/modules/%{kversion}/kernel/fs/lustre
145 %attr(-, root, root) /lib/modules/%{kversion}/kernel/net/lustre
146
147 %files source
148 %attr(-, root, root) /usr/src/lustre-%{version}
149
150 # uncomment these lines to enable deps packages
151 # %files deps-sles
152 # %files deps-rhel
153
154 %post modules
155 if [ -f /boot/System.map-%{kversion} ]; then
156         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
157 else
158         depmod -ae %{kversion} || exit 0
159 fi
160
161 # for update from < v1.4.6
162
163 for f in /etc/modules.conf /etc/modprobe.conf /etc/modprobe.conf.local ; 
164 do
165         if [ -f $f ]; then
166                 if grep 'lustre llite' $f >/dev/null 2>/dev/null ; then
167                         [ ! -f $f.rpmsave ] && cp $f $f.rpmsave
168                         TMPFILE=`mktemp $f.XXXXXX` && \
169                         grep -v 'lustre llite' $f > $TMPFILE && \
170                         mv $TMPFILE $f
171                 fi
172                 if egrep "^[^#]*(add below|install) ptlrpc" $f ; then
173                         [ ! -f $f.rpmsave ] && cp $f $f.rpmsave
174                         TMPFILE=`mktemp $f.XXXXXX` && \
175                         sed -e "s/^[^#]*\(add below\|install\) ptlrpc.*/#&/" $f > $TMPFILE && \
176                         mv $TMPFILE $f
177                 fi
178         fi
179 done
180
181
182 %postun modules
183 if [ -f /boot/System.map-%{kversion} ]; then
184         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
185 else
186         depmod -ae %{kversion} || exit 0
187 fi
188
189 %clean
190 rm -rf $RPM_BUILD_ROOT