/[packages]/updates/5/389-ds-base/current/SPECS/389-ds-base.spec
ViewVC logotype

Contents of /updates/5/389-ds-base/current/SPECS/389-ds-base.spec

Parent Directory Parent Directory | Revision Log Revision Log


Revision 308664 - (show annotations) (download)
Sun Oct 21 05:18:37 2012 UTC (11 years, 6 months ago) by spuhler
Original Path: cauldron/389-ds-base/current/SPECS/389-ds-base.spec
File size: 9631 byte(s)
upgrade to version 2.12.11.15
1 %define major 0
2 %define libname %mklibname 389-ds-base %major
3
4
5 %global pkgname dirsrv
6 # for a pre-release, define the prerel field e.g. .a1 .rc2 - comment out for official release
7 # also remove the space between % and global - this space is needed because
8 # fedpkg verrel stupidly ignores comment lines
9 # % global prerel .a1
10 # also need the relprefix field for a pre-release e.g. .0 - also comment out for official release
11 # %global relprefix 0.
12
13 %global use_openldap 1
14 %global use_db4 0
15 # If perl-Socket-2.000 or newer is available, set 0 to use_Socket6.
16 %global use_Socket6 0
17
18 # fedora 15 and later uses tmpfiles.d
19 # otherwise, comment this out
20 #%{!?with_tmpfiles_d: %global with_tmpfiles_d %{_sysconfdir}/tmpfiles.d}
21
22 # systemd support
23 %global groupname %{pkgname}.target
24
25 Summary: 389 Directory Server (base)
26 Name: 389-ds-base
27 Version: 1.2.11.15
28 Release: %mkrel 1
29 License: GPLv2 with exceptions
30 URL: http://port389.org/
31 Group: System/Servers
32 Obsoletes: %{name}-selinux
33 Conflicts: selinux-policy-base < 3.9.8
34 Requires: %{name}-libs = %{version}-%{release}
35 Provides: ldif2ldbm
36
37 BuildRequires: nspr-devel
38 BuildRequires: nss-devel
39 BuildRequires: krb5-devel
40 BuildRequires: svrcore-devel
41 %if %{use_openldap}
42 BuildRequires: openldap-devel
43 %else
44 BuildRequires: mozldap-devel
45 %endif
46 %if %{use_db4}
47 BuildRequires: db4-devel
48 %else
49 BuildRequires: db-devel
50 %endif
51 BuildRequires: libsasl-devel
52 BuildRequires: icu
53 BuildRequires: libicu-devel
54 BuildRequires: pcre-devel
55 BuildRequires: gcc-c++
56 # The following are needed to build the snmp ldap-agent
57 BuildRequires: net-snmp-devel
58 BuildRequires: bzip2-devel
59 BuildRequires: zlib-devel
60 BuildRequires: openssl-devel
61 BuildRequires: tcp_wrappers
62 # the following is for the pam passthru auth plug-in
63 BuildRequires: pam-devel
64 BuildRequires: systemd-units
65
66 # this is needed for using semanage from our setup scripts
67 Requires: policycoreutils-python
68
69 # the following are needed for some of our scripts
70 %if %{use_openldap}
71 Requires: openldap-clients
72 %else
73 Requires: mozldap-tools
74 %endif
75 # use_openldap assumes perl-Mozilla-LDAP is built with openldap support
76 Requires: perl-Mozilla-LDAP
77
78 # this is needed to setup SSL if you are not using the
79 # administration server package
80 Requires: nss
81
82 # these are not found by the auto-dependency method
83 # they are required to support the mandatory LDAP SASL mechs
84 Requires: sasl-plug-gssapi
85 Requires: sasl-plug-digestmd5
86
87 # this is needed for verify-db.pl
88 %if %{use_db4}
89 Requires: db4-utils
90 %else
91 Requires: db5-utils
92 %endif
93
94 # This picks up libperl.so as a Requires, so we add this versioned one
95 #Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
96
97 # for the init script
98 Requires(post): systemd-units
99 Requires(preun): systemd-units
100 Requires(postun): systemd-units
101
102 # for setup-ds.pl to support ipv6
103 %if %{use_Socket6}
104 Requires: perl-Socket6
105 %else
106 Requires: perl-Socket
107 %endif
108 Requires: perl-NetAddr-IP
109
110 Source0: http://port389.org/sources/%{name}-%{version}%{?prerel}.tar.bz2
111 # 389-ds-git.sh should be used to generate the source tarball from git
112 Source1: %{name}-git.sh
113 Source2: %{name}-devel.README
114
115 %description
116 389 Directory Server is an LDAPv3 compliant server. The base package includes
117 the LDAP server and command line utilities for server administration.
118
119 %package libs
120 Summary: Core libraries for 389 Directory Server
121 Group: System/Servers
122 BuildRequires: nspr-devel
123 BuildRequires: nss-devel
124 BuildRequires: svrcore-devel
125 %if %{use_openldap}
126 BuildRequires: openldap-devel
127 %else
128 BuildRequires: mozldap-devel
129 %endif
130 %if %{use_db4}
131 BuildRequires: db4-devel
132 %else
133 BuildRequires: db-devel
134 %endif
135 BuildRequires: libsasl-devel
136 BuildRequires: libicu-devel
137 BuildRequires: pcre-devel
138
139 %description libs
140 Core libraries for the 389 Directory Server base package. These libraries
141 are used by the main package and the -devel package. This allows the -devel
142 package to be installed with just the -libs package and without the main package.
143
144 %package devel
145 Summary: Development libraries for 389 Directory Server
146 Group: System/Libraries
147 Requires: %{name}-libs = %{version}-%{release}
148 Requires: pkgconfig
149 Requires: nspr-devel
150 Requires: nss-devel
151 Requires: svrcore-devel
152 %if %{use_openldap}
153 Requires: openldap-devel
154 %else
155 Requires: mozldap-devel
156 %endif
157
158 %description devel
159 Development Libraries and headers for the 389 Directory Server base package.
160
161 %prep
162 %setup -q -n %{name}-%{version}%{?prerel}
163 cp %{SOURCE2} README.devel
164
165 %build
166 autoreconf -fi
167 %if %{use_openldap}
168 OPENLDAP_FLAG="--with-openldap"
169 %endif
170 %configure2_5x --enable-autobind \
171 --with-selinux $OPENLDAP_FLAG $TMPFILES_FLAG \
172 --with-systemdsystemunitdir=%{_unitdir} \
173 --with-systemdsystemconfdir=%{_sysconfdir}/systemd/system \
174 --with-systemdgroupname=%{groupname} \
175 LDFLAGS=-L%{perl_archlib}/CORE
176
177 # Generate symbolic info for debuggers
178 export XCFLAGS=$RPM_OPT_FLAGS
179
180
181 %make
182
183
184 %install
185 rm -rf $RPM_BUILD_ROOT
186
187 make DESTDIR="$RPM_BUILD_ROOT" install
188
189 mkdir -p $RPM_BUILD_ROOT/var/log/%{pkgname}
190 mkdir -p $RPM_BUILD_ROOT/var/lib/%{pkgname}
191 mkdir -p $RPM_BUILD_ROOT/var/lock/%{pkgname}
192
193 # for systemd
194 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/systemd/system/%{groupname}.wants
195
196 #remove libtool and static libs
197 rm -f $RPM_BUILD_ROOT%{_libdir}/%{pkgname}/*.a
198 rm -f $RPM_BUILD_ROOT%{_libdir}/%{pkgname}/*.la
199 rm -f $RPM_BUILD_ROOT%{_libdir}/%{pkgname}/plugins/*.a
200 rm -f $RPM_BUILD_ROOT%{_libdir}/%{pkgname}/plugins/*.la
201
202 # make sure perl scripts have a proper shebang
203 sed -i -e 's|#{{PERL-EXEC}}|#!/usr/bin/perl|' $RPM_BUILD_ROOT%{_datadir}/%{pkgname}/script-templates/template-*.pl
204
205 %clean
206 rm -rf $RPM_BUILD_ROOT
207
208 %post
209 # reload to pick up any changes to systemd files
210 /bin/systemctl daemon-reload >/dev/null 2>&1 || :
211 # reload to pick up any shared lib changes
212 /sbin/ldconfig
213 # restart the snmp subagent if needed
214 /bin/systemctl try-restart %{pkgname}-snmp.service > $output 2>&1 || :
215 # find all instances
216 instances="" # instances that require a restart after upgrade
217 ninst=0 # number of instances found in total
218 output=/dev/null
219 if [ -n "$DEBUGPOSTTRANS" ] ; then
220 output=$DEBUGPOSTTRANS
221 fi
222 echo looking for services in %{_sysconfdir}/systemd/system/%{groupname}.wants/* > $output 2>&1 || :
223 for service in %{_sysconfdir}/systemd/system/%{groupname}.wants/* ; do
224 if [ ! -f "$service" ] ; then continue ; fi # in case nothing matches
225 inst=`echo $service | sed -e 's,%{_sysconfdir}/systemd/system/%{groupname}.wants/,,'`
226 echo found instance $inst - getting status > $output 2>&1 || :
227 if /bin/systemctl -q is-active $inst ; then
228 echo instance $inst is running > $output 2>&1 || :
229 instances="$instances $inst"
230 else
231 echo instance $inst is not running > $output 2>&1 || :
232 fi
233 ninst=`expr $ninst + 1`
234 done
235 if [ $ninst -eq 0 ] ; then
236 echo no instances to upgrade > $output 2>&1 || :
237 exit 0 # have no instances to upgrade - just skip the rest
238 fi
239 # shutdown all instances
240 echo shutting down all instances . . . > $output 2>&1 || :
241 /bin/systemctl stop %{groupname} > $output 2>&1 || :
242 echo remove pid files . . . > $output 2>&1 || :
243 /bin/rm -f /var/run/%{pkgname}*.pid /var/run/%{pkgname}*.startpid
244 # do the upgrade
245 echo upgrading instances . . . > $output 2>&1 || :
246 %{_sbindir}/setup-ds.pl -l $output -u -s General.UpdateMode=offline > $output 2>&1 || :
247 # restart instances that require it
248 for inst in $instances ; do
249 echo restarting instance $inst > $output 2>&1 || :
250 /bin/systemctl start $inst > $output 2>&1 || :
251 done
252 exit 0
253
254 %preun
255 if [ $1 -eq 0 ]; then # Final removal
256 # Package removal, not upgrade
257 /bin/systemctl --no-reload disable %{pkgname}-snmp.service %{groupname} > /dev/null 2>&1 || :
258 /bin/systemctl stop %{pkgname}-snmp.service %{groupname} > /dev/null 2>&1 || :
259 # remove instance specific service files/links
260 rm -rf %{_sysconfdir}/systemd/system/%{groupname}.wants/* > /dev/null 2>&1 || :
261 fi
262
263 %postun
264 /sbin/ldconfig
265 if [ $1 = 0 ]; then # Final removal
266 rm -rf /var/run/%{pkgname}
267 fi
268
269 %files
270 %doc LICENSE EXCEPTION LICENSE.GPLv2
271 %dir %{_sysconfdir}/%{pkgname}
272 %dir %{_sysconfdir}/%{pkgname}/schema
273 %config(noreplace)%{_sysconfdir}/%{pkgname}/schema/*.ldif
274 %dir %{_sysconfdir}/%{pkgname}/config
275 %dir %{_sysconfdir}/systemd/system/%{groupname}.wants
276 %config(noreplace)%{_sysconfdir}/%{pkgname}/config/slapd-collations.conf
277 %config(noreplace)%{_sysconfdir}/%{pkgname}/config/certmap.conf
278 %config(noreplace)%{_sysconfdir}/%{pkgname}/config/ldap-agent.conf
279 %config(noreplace)%{_sysconfdir}/%{pkgname}/config/template-initconfig
280 %config(noreplace)%{_sysconfdir}/sysconfig/%{pkgname}
281 %config(noreplace)%{_sysconfdir}/sysconfig/%{pkgname}.systemd
282 %{_datadir}/%{pkgname}
283 %{_unitdir}
284 %{_bindir}/*
285 %{_sbindir}/*
286 %{_libdir}/%{pkgname}/libns-dshttpd.so*
287 %{_libdir}/%{pkgname}/perl
288 %{_libdir}/%{pkgname}/plugins/*.so
289 %dir %{_localstatedir}/lib/%{pkgname}
290 %dir %{_logdir}/%{pkgname}
291 %ghost %dir %{_localstatedir}/lock/%{pkgname}
292 %{_mandir}/man1/*
293 %{_mandir}/man8/*
294
295 %files devel
296
297 %doc LICENSE EXCEPTION LICENSE.GPLv2 README.devel
298 %{_includedir}/%{pkgname}
299 %{_libdir}/%{pkgname}/libslapd.so
300 %{_libdir}/pkgconfig/*
301
302 %files libs
303 %doc LICENSE EXCEPTION LICENSE.GPLv2 README.devel
304 %{_libdir}/%{pkgname}/libslapd.so.*

  ViewVC Help
Powered by ViewVC 1.1.30