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

  ViewVC Help
Powered by ViewVC 1.1.30