From a099da9d1c751efa4e4846da780a5ae73a11dc7c Mon Sep 17 00:00:00 2001 From: Simon Pichugin Date: Fri, 21 Jun 2024 09:28:52 -0700 Subject: [PATCH] Remove libslapi from the main package Add "with servers" conditional which includes libslapi Resolves: RHEL-35581 --- openldap.spec | 81 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 65 insertions(+), 16 deletions(-) diff --git a/openldap.spec b/openldap.spec index 9398229..7c056e9 100644 --- a/openldap.spec +++ b/openldap.spec @@ -6,6 +6,9 @@ %global so_ver 2 %global so_ver_compat 2 +# Build openldap-servers package and its libslapi in openldap-devel and openldap-compat +%bcond servers 0 + # When you change "Version: " to the new major version, remember to change this value too %global major_version 2.6 @@ -14,7 +17,7 @@ Name: openldap Version: 2.6.7 -Release: 1%{?dist} +Release: 2%{?dist} Summary: LDAP support libraries License: OLDAP-2.8 URL: http://www.openldap.org/ @@ -47,8 +50,7 @@ Patch6: openldap-switch-to-lt_dlopenadvise-to-get-RTLD_GLOBAL-set.patch # System-wide default for CA certs Patch7: openldap-openssl-manpage-defaultCA.patch Patch8: openldap-add-export-symbols-LDAP_CONNECTIONLESS.patch -Patch9: openldap-slapi-fix-plugin-plugin_pblock_new-usage.patch -Patch10: openldap-explicitly-cast-private-values.patch +Patch9: openldap-explicitly-cast-private-values.patch # check-password module specific patches Patch90: check-password-makefile.patch @@ -68,6 +70,10 @@ BuildRequires: perl-devel BuildRequires: perl-generators BuildRequires: perl-interpreter BuildRequires: unixODBC-devel +BuildRequires: cracklib-devel +BuildRequires: systemd +BuildRequires: systemd-rpm-macros +%{?sysusers_requires_compat} %description OpenLDAP is an open source suite of LDAP (Lightweight Directory Access @@ -99,32 +105,37 @@ Requires: openldap%{?_isa} = %{version}-%{release} Provides: libldap-2.4.so.%{so_ver_compat} Provides: libldap_r-2.4.so.%{so_ver_compat} Provides: liblber-2.4.so.%{so_ver_compat} +%if %{with servers} Provides: libslapi-2.4.so.%{so_ver_compat} +%endif %else Provides: libldap-2.4.so.%{so_ver_compat}()(%{__isa_bits}bit) Provides: libldap_r-2.4.so.%{so_ver_compat}()(%{__isa_bits}bit) Provides: liblber-2.4.so.%{so_ver_compat}()(%{__isa_bits}bit) +%if %{with servers} Provides: libslapi-2.4.so.%{so_ver_compat}()(%{__isa_bits}bit) %endif +%endif %description compat The openldap-compat package contains shared libraries named as libldap-2.4.so, +%if %{with servers} libldap_r-2.4.so, liblber-2.4.so and libslapi-2.4.so. +%else +libldap_r-2.4.so and liblber-2.4.so +%endif The libraries are just links to the current version shared libraries, and are available for compatibility reasons. +%if %{with servers} %package servers Summary: LDAP server License: OpenLDAP Requires: openldap%{?_isa} = %{version}-%{release} +%{?systemd_requires} Requires(pre): shadow-utils -BuildRequires: systemd -BuildRequires: systemd-rpm-macros -%{?sysusers_requires_compat} -BuildRequires: cracklib-devel # migrationtools (slapadd functionality): Provides: ldif2ldbm -%{?systemd_requires} %description servers OpenLDAP is an open-source suite of LDAP (Lightweight Directory Access @@ -133,6 +144,8 @@ protocols for accessing directory services (usually phone book style information, but other information is possible) over the Internet, similar to the way DNS (Domain Name System) information is propagated over the Internet. This package contains the slapd server and related files. +# endif servers +%endif %package clients Summary: LDAP client utilities @@ -160,7 +173,6 @@ pushd openldap-%{version} %patch -P7 -p1 %patch -P8 -p1 %patch -P9 -p1 -%patch -P10 -p1 # build smbk5pwd with other overlays ln -s ../../../contrib/slapd-modules/smbk5pwd/smbk5pwd.c servers/slapd/overlays @@ -206,7 +218,9 @@ pushd openldap-%{version} --enable-perl \ --enable-rewrite \ --enable-rlookups \ +%if %{with servers} --enable-slapi \ +%endif --disable-slp \ \ --enable-backends=mod \ @@ -244,7 +258,9 @@ popd %install mkdir -p %{buildroot}%{_libdir}/ +%if %{with servers} install -p -D -m 0644 %{SOURCE6} %{buildroot}%{_sysusersdir}/openldap.conf +%endif pushd openldap-%{version} %make_install STRIP_OPTS="" @@ -317,10 +333,14 @@ done pushd %{buildroot}%{_libdir} v=%{version} version=$(echo ${v%.[0-9]*}) -for lib in liblber libldap libslapi; do +for lib in liblber libldap; do rm -f ${lib}.so ln -s ${lib}.so.%{so_ver} ${lib}.so done +%if %{with servers} +rm -f libslapi.so +ln -s libslapi.so.%{so_ver} libslapi.so +%endif for lib in $(ls | grep libldap); do IFS='.' @@ -343,12 +363,14 @@ gcc -shared -o "%{buildroot}%{_libdir}/libldap_r-2.4.so.${so_ver_short_2_4}" -Wl -Wl,-soname -Wl,libldap_r-2.4.so.${so_ver_short_2_4} -L "%{buildroot}%{_libdir}" -lldap gcc -shared -o "%{buildroot}%{_libdir}/liblber-2.4.so.${so_ver_short_2_4}" -Wl,--no-as-needed \ -Wl,-soname -Wl,liblber-2.4.so.${so_ver_short_2_4} -L "%{buildroot}%{_libdir}" -llber +%if %{with servers} gcc -shared -o "%{buildroot}%{_libdir}/libslapi-2.4.so.${so_ver_short_2_4}" -Wl,--no-as-needed \ -Wl,-soname -Wl,libslapi-2.4.so.${so_ver_short_2_4} -L "%{buildroot}%{_libdir}" -lslapi +ln -s libslapi-2.4.so.{${so_ver_short_2_4},${so_ver_full_2_4}} +%endif ln -s libldap-2.4.so.{${so_ver_short_2_4},${so_ver_full_2_4}} ln -s libldap_r-2.4.so.{${so_ver_short_2_4},${so_ver_full_2_4}} ln -s liblber-2.4.so.{${so_ver_short_2_4},${so_ver_full_2_4}} -ln -s libslapi-2.4.so.{${so_ver_short_2_4},${so_ver_full_2_4}} popd @@ -374,16 +396,12 @@ rm %{buildroot}%{_libdir}/*.la # because we do not want files in %{_libdir}/ope %ldconfig_scriptlets +%if %{with servers} %pre servers # create ldap user and group # sysusers.d format https://fedoraproject.org/wiki/Changes/Adopting_sysusers.d_format %sysusers_create_compat %{SOURCE6} -getent group ldap &>/dev/null || groupadd -r -g 55 ldap -getent passwd ldap &>/dev/null || \ - useradd -r -g ldap -u 55 -d %{_sharedstatedir}/ldap -s /sbin/nologin -c "OpenLDAP server" ldap -exit 0 - %post servers %systemd_post slapd.service @@ -414,6 +432,8 @@ exit 0 %postun servers %systemd_postun_with_restart slapd.service +%endif +# endif servers %files %doc openldap-%{version}/ANNOUNCEMENT @@ -427,10 +447,13 @@ exit 0 %dir %{_libexecdir}/openldap/ %{_libdir}/liblber.so.* %{_libdir}/libldap.so.* +%if %{with servers} %{_libdir}/libslapi.so.* +%endif %{_mandir}/man5/ldif.5* %{_mandir}/man5/ldap.conf.5* +%if %{with servers} %files servers %doc openldap-%{version}/contrib/slapd-modules/smbk5pwd/README.smbk5pwd %doc openldap-%{version}/doc/guide/admin/*.html @@ -494,6 +517,24 @@ exit 0 %{_sysusersdir}/openldap.conf # obsolete configuration %ghost %config(noreplace,missingok) %attr(0640,ldap,ldap) %{_sysconfdir}/openldap/slapd.conf +%else +%exclude %{_datadir}/openldap-servers/ +%exclude %{_libdir}/openldap/ +%exclude %{_libexecdir}/openldap/check-config.sh +%exclude %{_libexecdir}/openldap/functions +%exclude %{_mandir}/man5/slapd*.5* +%exclude %{_mandir}/man5/slapo-*.5* +%exclude %{_mandir}/man5/lloadd.conf.5* +%exclude %{_mandir}/man5/slappw-argon2.5* +%exclude %{_mandir}/man8/* +%exclude %{_sbindir}/sl* +%exclude %{_sysconfdir}/openldap/check_password.conf +%exclude %{_sysconfdir}/openldap/schema +%exclude %{_tmpfilesdir}/slapd.conf +%exclude %{_unitdir}/slapd.service +%endif +# endif servers + %files clients %{_bindir}/* @@ -503,7 +544,9 @@ exit 0 %doc openldap-%{version}/doc/drafts openldap-%{version}/doc/rfc %{_libdir}/liblber.so %{_libdir}/libldap.so +%if %{with servers} %{_libdir}/libslapi.so +%endif %{_includedir}/* %{_libdir}/pkgconfig/lber.pc %{_libdir}/pkgconfig/ldap.pc @@ -513,9 +556,15 @@ exit 0 %{_libdir}/libldap-2.4*.so.* %{_libdir}/libldap_r-2.4*.so.* %{_libdir}/liblber-2.4*.so.* +%if %{with servers} %{_libdir}/libslapi-2.4*.so.* +%endif %changelog +* Mon Jun 24 2024 Simon Pichugin - 2.6.7-2 +- Remove libslapi from the main package (RHEL-35581) +- Add "servers" conditional which includes libslapi + * Fri Feb 9 2024 Simon Pichugin - 2.6.7-1 - Rebase to version 2.6.7 (rhbz#2261163) - Use systemd-sysusers for ldap user and group (rhbz#2173965)