New 383-ds packages

This commit is contained in:
2020-12-22 08:05:43 +01:00
parent bbc7d644a3
commit b1db3c373a

View File

@@ -1,37 +1,44 @@
%global pkgname dirsrv %global pkgname dirsrv
%global srcname 389-ds-base %global srcname 389-ds-base
# Exclude i686 bit arches %global bundle_jemalloc 1
ExcludeArch: i686 %if %{bundle_jemalloc}
%global jemalloc_name jemalloc
%global jemalloc_ver 5.2.1
%endif
# for a pre-release, define the prerel field e.g. .a1 .rc2 - comment out for official release # for a pre-release, define the prerel field e.g. .a1 .rc2 - comment out for official release
# also remove the space between % and global - this space is needed because # also remove the space between % and global - this space is needed because
# fedpkg verrel stupidly ignores comment lines # fedpkg verrel stupidly ignores comment lines
#% global prerel .rc3 %global prerel %{nil}
# also need the relprefix field for a pre-release e.g. .0 - also comment out for official release # also need the relprefix field for a pre-release e.g. .0 - also comment out for official release
#% global relprefix 0. #% global relprefix 0.
# If perl-Socket-2.000 or newer is available, set 0 to use_Socket6. # If perl-Socket-2.000 or newer is available, set 0 to use_Socket6.
%global use_Socket6 0 %global use_Socket6 0
# This enables a sanitized build. This should not go to production, so we rename.
%global use_asan 0 %global use_asan 0
%global use_rust 0 %global use_msan 0
%global use_perl 1 %global use_tsan 0
%global bundle_jemalloc 1 %global use_ubsan 0
%if %{use_asan}
%global bundle_jemalloc 0
%endif
%if %{bundle_jemalloc} # This enables rust in the build.
%global jemalloc_name jemalloc %global use_rust 0
%global jemalloc_ver 5.2.0
%global __provides_exclude ^libjemalloc\\.so.*$ %define nspr_version 4.6
%define nss_version 3.11
%if %{use_asan} || %{use_msan} || %{use_tsan} || %{use_ubsan}
%global variant base-xsan
%endif %endif
# Use Clang instead of GCC # Use Clang instead of GCC
%global use_clang 0 %global use_clang 0
# Build cockpit plugin
%global use_cockpit 1
# fedora 15 and later uses tmpfiles.d # fedora 15 and later uses tmpfiles.d
# otherwise, comment this out # otherwise, comment this out
%{!?with_tmpfiles_d: %global with_tmpfiles_d %{_sysconfdir}/tmpfiles.d} %{!?with_tmpfiles_d: %global with_tmpfiles_d %{_sysconfdir}/tmpfiles.d}
@@ -42,21 +49,23 @@ ExcludeArch: i686
# set PIE flag # set PIE flag
%global _hardened_build 1 %global _hardened_build 1
Summary: 389 Directory Server (base) Summary: 389 Directory Server (%{variant})
Name: 389-ds-base Name: 389-ds-base
Version: 1.4.4.9 Version: 1.4.4.9
Release: %{?relprefix}1%{?prerel}%{?dist} Release: %{?relprefix}2%{?prerel}%{?dist}
License: GPLv3+ License: GPLv3+
URL: https://www.port389.org URL: https://www.port389.org/
Group: System Environment/Daemons Group: System Environment/Daemons
Conflicts: selinux-policy-base < 3.9.8 Conflicts: selinux-policy-base < 3.9.8
Conflicts: freeipa-server < 4.0.3 Conflicts: freeipa-server < 4.0.3
Obsoletes: %{name} <= 1.4.0.9 Obsoletes: %{name} <= 1.4.0.9
Provides: ldif2ldbm >= 0 Obsoletes: %{name}-legacy-tools < 1.4.4.6
Obsoletes: %{name}-legacy-tools-debuginfo < 1.4.4.6
Provides: ldif2ldbm
# Attach the buildrequires to the top level package:
BuildRequires: nspr-devel BuildRequires: nspr-devel
BuildRequires: nss-devel >= 3.34 BuildRequires: nss-devel >= 3.34
BuildRequires: perl-generators
BuildRequires: openldap-devel BuildRequires: openldap-devel
BuildRequires: libdb-devel BuildRequires: libdb-devel
BuildRequires: cyrus-sasl-devel BuildRequires: cyrus-sasl-devel
@@ -67,13 +76,19 @@ BuildRequires: cracklib-devel
%if %{use_clang} %if %{use_clang}
BuildRequires: libatomic BuildRequires: libatomic
BuildRequires: clang BuildRequires: clang
BuildRequires: compiler-rt
%else %else
BuildRequires: gcc BuildRequires: gcc
BuildRequires: gcc-c++ BuildRequires: gcc-c++
%endif %endif
%if %{use_tsan}
BuildRequires: libtsan
%endif
%if %{use_ubsan}
BuildRequires: libubsan
%endif
# The following are needed to build the snmp ldap-agent # The following are needed to build the snmp ldap-agent
BuildRequires: net-snmp-devel BuildRequires: net-snmp-devel
BuildRequires: lm_sensors-devel
BuildRequires: bzip2-devel BuildRequires: bzip2-devel
BuildRequires: zlib-devel BuildRequires: zlib-devel
BuildRequires: openssl-devel BuildRequires: openssl-devel
@@ -81,9 +96,6 @@ BuildRequires: openssl-devel
BuildRequires: pam-devel BuildRequires: pam-devel
BuildRequires: systemd-units BuildRequires: systemd-units
BuildRequires: systemd-devel BuildRequires: systemd-devel
%if %{use_asan}
BuildRequires: libasan
%endif
# If rust is enabled # If rust is enabled
%if %{use_rust} %if %{use_rust}
BuildRequires: cargo BuildRequires: cargo
@@ -92,7 +104,6 @@ BuildRequires: rust
BuildRequires: pkgconfig BuildRequires: pkgconfig
BuildRequires: pkgconfig(systemd) BuildRequires: pkgconfig(systemd)
BuildRequires: pkgconfig(krb5) BuildRequires: pkgconfig(krb5)
# Needed to support regeneration of the autotool artifacts. # Needed to support regeneration of the autotool artifacts.
BuildRequires: autoconf BuildRequires: autoconf
BuildRequires: automake BuildRequires: automake
@@ -102,77 +113,70 @@ BuildRequires: doxygen
# For tests! # For tests!
BuildRequires: libcmocka-devel BuildRequires: libcmocka-devel
BuildRequires: libevent-devel BuildRequires: libevent-devel
# For lib389 and related components # For lib389 and related components.
BuildRequires: python%{python3_pkgversion} BuildRequires: python%{python3_pkgversion}
BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-setuptools BuildRequires: python%{python3_pkgversion}-setuptools
BuildRequires: python%{python3_pkgversion}-ldap BuildRequires: python%{python3_pkgversion}-ldap
BuildRequires: python%{python3_pkgversion}-six
BuildRequires: python%{python3_pkgversion}-pyasn1 BuildRequires: python%{python3_pkgversion}-pyasn1
BuildRequires: python%{python3_pkgversion}-pyasn1-modules BuildRequires: python%{python3_pkgversion}-pyasn1-modules
BuildRequires: python%{python3_pkgversion}-dateutil BuildRequires: python%{python3_pkgversion}-dateutil
BuildRequires: python%{python3_pkgversion}-argcomplete BuildRequires: python%{python3_pkgversion}-argcomplete
BuildRequires: python%{python3_pkgversion}-argparse-manpage BuildRequires: python%{python3_pkgversion}-argparse-manpage
BuildRequires: python%{python3_pkgversion}-libselinux
BuildRequires: python%{python3_pkgversion}-policycoreutils BuildRequires: python%{python3_pkgversion}-policycoreutils
BuildRequires: python%{python3_pkgversion}-libselinux
# For cockpit # For cockpit
%if %{use_cockpit}
BuildRequires: rsync BuildRequires: rsync
BuildRequires: npm BuildRequires: npm
BuildRequires: nodejs BuildRequires: nodejs
%endif
# END BUILD REQUIRES
# Now, attach the requires only to the package that needs them.
# -libs has most of our runtime libs
Requires: %{name}-libs = %{version}-%{release} Requires: %{name}-libs = %{version}-%{release}
%if 0%{?rhel} > 7 || 0%{?fedora}
Requires: python%{python3_pkgversion}-lib389 = %{version}-%{release} Requires: python%{python3_pkgversion}-lib389 = %{version}-%{release}
%endif
# this is needed for using semanage from our setup scripts # this is needed for using semanage from our setup scripts
Requires: policycoreutils-python-utils Requires: policycoreutils-python-utils
Requires: /usr/sbin/semanage # This is needed for our future move to python selinux interaction.
Requires: libsemanage-python%{python3_pkgversion} Requires: libsemanage-python%{python3_pkgversion}
Requires: selinux-policy >= 3.14.1-29
# the following are needed for some of our scripts # the following are needed for some of our scripts
Requires: openldap-clients Requires: openldap-clients
Requires: openssl-perl
Requires: python%{python3_pkgversion}-ldap
# this is needed to setup SSL if you are not using the # this is needed to setup SSL if you are not using the
# administration server package # administration server package
Requires: nss-tools Requires: nss-tools
Requires: nss >= 3.34 Requires: nss >= 3.34
# these are not found by the auto-dependency method # these are not found by the auto-dependency method
# they are required to support the mandatory LDAP SASL mechs # they are required to support the mandatory LDAP SASL mechs
Requires: cyrus-sasl-gssapi Requires: cyrus-sasl-gssapi
Requires: cyrus-sasl-md5 Requires: cyrus-sasl-md5
# This is optionally supported by us, as we use it in our tests
Requires: cyrus-sasl-plain Requires: cyrus-sasl-plain
# this is needed for verify-db.pl and backldbm
# this is needed for verify-db.pl
Requires: libdb-utils Requires: libdb-utils
Requires: libdb
# This picks up libperl.so as a Requires, so we add this versioned one # This picks up libperl.so as a Requires, so we add this versioned one
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
Requires: perl-Errno >= 1.23-360
# Needed by logconv.pl # Needed by logconv.pl
Requires: perl-DB_File Requires: perl-DB_File
Requires: perl-Archive-Tar Requires: perl-Archive-Tar
# Needed for password dictionary checks # Needed for password dictionary checks
Requires: cracklib-dicts Requires: cracklib-dicts
# Picks up our systemd deps. # Picks up our systemd deps.
%{?systemd_requires} %{?systemd_requires}
Obsoletes: %{name} <= 1.3.5.4 Source0: %{name}-%{version}%{?prerel}.tar.bz2
Source0: https://releases.pagure.org/389-ds-base/%{name}-%{version}%{?prerel}.tar.gz
# 389-ds-git.sh should be used to generate the source tarball from git # 389-ds-git.sh should be used to generate the source tarball from git
Source1: %{name}-git.sh Source1: %{name}-git.sh
Source2: %{name}-devel.README Source2: %{name}-devel.README
%if %{bundle_jemalloc}
Source3: https://github.com/jemalloc/%{jemalloc_name}/releases/download/%{jemalloc_ver}/%{jemalloc_name}-%{jemalloc_ver}.tar.bz2 Source3: https://github.com/jemalloc/%{jemalloc_name}/releases/download/%{jemalloc_ver}/%{jemalloc_name}-%{jemalloc_ver}.tar.bz2
%endif Source4: ds-389-cockpit-console.tar.gz
%description %description
389 Directory Server is an LDAPv3 compliant server. The base package includes 389 Directory Server is an LDAPv3 compliant server. The base package includes
@@ -183,25 +187,38 @@ isnt what you want. Please contact support immediately.
Please see http://seclists.org/oss-sec/2016/q1/363 for more information. Please see http://seclists.org/oss-sec/2016/q1/363 for more information.
%endif %endif
%package libs %package libs
Summary: Core libraries for 389 Directory Server Summary: Core libraries for 389 Directory Server (%{variant})
Group: System Environment/Daemons Group: System Environment/Daemons
BuildRequires: nspr-devel
BuildRequires: nss-devel >= 3.34
BuildRequires: openldap-devel
BuildRequires: libdb-devel
BuildRequires: cyrus-sasl-devel
BuildRequires: libicu-devel
BuildRequires: pcre-devel
BuildRequires: libtalloc-devel
BuildRequires: libevent-devel
BuildRequires: libtevent-devel
Requires: krb5-libs
Requires: libevent
BuildRequires: systemd-devel
Provides: svrcore = 4.1.4 Provides: svrcore = 4.1.4
Conflicts: svrcore
Obsoletes: svrcore <= 4.1.3 Obsoletes: svrcore <= 4.1.3
Conflicts: svrcore
# You can work this out by running LDD on libslapd.so to see what it needs in
# isolation.
Requires: nss >= 3.34
Requires: nspr
Requires: openldap
Requires: libevent
Requires: systemd-libs
# Pull in sasl
Requires: cyrus-sasl-lib
# KRB
Requires: krb5-libs
%if %{use_clang}
Requires: llvm
Requires: compiler-rt
%else
%if %{use_asan}
Requires: libasan
%endif
%if %{use_tsan}
Requires: libtsan
%endif
%if %{use_ubsan}
Requires: libubsan
%endif
%endif
%description libs %description libs
Core libraries for the 389 Directory Server base package. These libraries Core libraries for the 389 Directory Server base package. These libraries
@@ -209,66 +226,70 @@ are used by the main package and the -devel package. This allows the -devel
package to be installed with just the -libs package and without the main package. package to be installed with just the -libs package and without the main package.
%package devel %package devel
Summary: Development libraries for 389 Directory Server Summary: Development libraries for 389 Directory Server (%{variant})
Group: Development/Libraries Group: Development/Libraries
Provides: svrcore-devel = 4.1.4
Obsoletes: svrcore-devel <= 4.1.3
Conflicts: svrcore-devel
Requires: %{name}-libs = %{version}-%{release} Requires: %{name}-libs = %{version}-%{release}
Requires: pkgconfig Requires: pkgconfig
Requires: nspr-devel Requires: nspr-devel
Requires: nss-devel >= 3.34 Requires: nss-devel >= 3.34
Requires: openldap-devel Requires: openldap-devel
Requires: libtalloc # systemd-libs contains the headers iirc.
Requires: libevent
Requires: libtevent
Requires: systemd-libs Requires: systemd-libs
Provides: svrcore-devel = 4.1.4
Conflicts: svrcore-devel
Obsoletes: svrcore-devel <= 4.1.3
%description devel %description devel
Development Libraries and headers for the 389 Directory Server base package. Development Libraries and headers for the 389 Directory Server base package.
%package snmp %package snmp
Summary: SNMP Agent for 389 Directory Server Summary: SNMP Agent for 389 Directory Server
Group: System Environment/Daemons Group: System Environment/Daemons
Requires: %{name} = %{version}-%{release} Requires: %{name} = %{version}-%{release}
Obsoletes: %{name} <= 1.3.5.4
Obsoletes: %{name} <= 1.4.0.0
%description snmp %description snmp
SNMP Agent for the 389 Directory Server base package. SNMP Agent for the 389 Directory Server base package.
%package -n python%{python3_pkgversion}-lib389 %package -n python%{python3_pkgversion}-lib389
Summary: A library for accessing, testing, and configuring the 389 Directory Server Summary: A library for accessing, testing, and configuring the 389 Directory Server
BuildArch: noarch BuildArch: noarch
Group: Development/Libraries Group: Development/Libraries
Requires: krb5-workstation
Requires: krb5-server
Requires: openssl Requires: openssl
# This is for /usr/bin/c_rehash tool, only needed for openssl < 1.1.0
Requires: openssl-perl
Requires: iproute Requires: iproute
Requires: python%{python3_pkgversion} Requires: python%{python3_pkgversion}
Requires: python%{python3_pkgversion}-distro
Requires: python%{python3_pkgversion}-pytest
Requires: python%{python3_pkgversion}-ldap Requires: python%{python3_pkgversion}-ldap
Requires: python%{python3_pkgversion}-six
Requires: python%{python3_pkgversion}-pyasn1 Requires: python%{python3_pkgversion}-pyasn1
Requires: python%{python3_pkgversion}-pyasn1-modules Requires: python%{python3_pkgversion}-pyasn1-modules
Requires: python%{python3_pkgversion}-dateutil Requires: python%{python3_pkgversion}-dateutil
Requires: python%{python3_pkgversion}-argcomplete Requires: python%{python3_pkgversion}-argcomplete
Requires: python%{python3_pkgversion}-libselinux Requires: python%{python3_pkgversion}-libselinux
Requires: python%{python3_pkgversion}-setuptools
Recommends: bash-completion
%{?python_provide:%python_provide python%{python3_pkgversion}-lib389} %{?python_provide:%python_provide python%{python3_pkgversion}-lib389}
%description -n python%{python3_pkgversion}-lib389 %description -n python%{python3_pkgversion}-lib389
This module contains tools and libraries for accessing, testing, This module contains tools and libraries for accessing, testing,
and configuring the 389 Directory Server. and configuring the 389 Directory Server.
%if %{use_cockpit}
%package -n cockpit-389-ds %package -n cockpit-389-ds
Summary: Cockpit UI Plugin for configuring and administering the 389 Directory Server Summary: Cockpit UI Plugin for configuring and administering the 389 Directory Server
BuildArch: noarch BuildArch: noarch
Requires: cockpit Requires: cockpit
Requires: 389-ds-base
Requires: python%{python3_pkgversion} Requires: python%{python3_pkgversion}
Requires: python%{python3_pkgversion}-packaging
Requires: python%{python3_pkgversion}-lib389 Requires: python%{python3_pkgversion}-lib389
%description -n cockpit-389-ds %description -n cockpit-389-ds
A cockpit UI Plugin for configuring and administering the 389 Directory Server A cockpit UI Plugin for configuring and administering the 389 Directory Server
%endif
%prep %prep
%setup -q -n %{name}-%{version}%{?prerel} %setup -q -n %{name}-%{version}%{?prerel}
@@ -281,54 +302,79 @@ cp %{SOURCE2} README.devel
%build %build
OPENLDAP_FLAG="--with-openldap"
%{?with_tmpfiles_d: TMPFILES_FLAG="--with-tmpfiles-d=%{with_tmpfiles_d}"}
%if %{use_asan}
ASAN_FLAGS="--enable-asan --enable-debug"
%endif
%if %{use_rust}
RUST_FLAGS="--enable-rust"
%endif
%if !%{use_perl}
PERL_FLAGS="--disable-perl"
%endif
%if %{use_clang} %if %{use_clang}
export CC=clang export CC=clang
export CXX=clang++ export CXX=clang++
CLANG_FLAGS="--enable-clang" CLANG_FLAGS="--enable-clang"
%endif %endif
%{?with_tmpfiles_d: TMPFILES_FLAG="--with-tmpfiles-d=%{with_tmpfiles_d}"}
%if %{use_asan} && !%{use_rust}
ASAN_FLAGS="--enable-asan --enable-debug"
%endif
%if %{use_msan} && !%{use_rust}
MSAN_FLAGS="--enable-msan --enable-debug"
%endif
%if %{use_tsan} && !%{use_rust}
TSAN_FLAGS="--enable-tsan --enable-debug"
%endif
%if %{use_ubsan} && !%{use_rust}
UBSAN_FLAGS="--enable-ubsan --enable-debug"
%endif
%if %{use_rust}
RUST_FLAGS="--enable-rust"
%endif
%if !%{use_cockpit}
COCKPIT_FLAGS="--disable-cockpit"
%endif
%if %{bundle_jemalloc} %if %{bundle_jemalloc}
# Override page size, bz #1545539
# 4K
%ifarch %ix86 %arm x86_64 s390x
%define lg_page --with-lg-page=12
%endif
# 64K
%ifarch ppc64 ppc64le aarch64
%define lg_page --with-lg-page=16
%endif
# Override huge page size on aarch64
# 2M instead of 512M
%ifarch aarch64
%define lg_hugepage --with-lg-hugepage=21
%endif
# Build jemalloc # Build jemalloc
pushd ../%{jemalloc_name}-%{jemalloc_ver} pushd ../%{jemalloc_name}-%{jemalloc_ver}
%configure \ %configure \
--libdir=%{_libdir}/%{pkgname}/lib \ --libdir=%{_libdir}/%{pkgname}/lib \
--bindir=%{_libdir}/%{pkgname}/bin --bindir=%{_libdir}/%{pkgname}/bin \
make --enable-prof %{lg_page}
make %{?_smp_mflags}
popd popd
%endif %endif
# Enforce strict linking
%define _strict_symbol_defs_build 1
# Rebuild the autotool artifacts now. # Rebuild the autotool artifacts now.
autoreconf -fiv autoreconf -fiv
%configure --enable-autobind --with-selinux $OPENLDAP_FLAG $TMPFILES_FLAG \ %configure --with-selinux $TMPFILES_FLAG \
--with-systemd \ --with-systemd \
--with-systemdsystemunitdir=%{_unitdir} \ --with-systemdsystemunitdir=%{_unitdir} \
--with-systemdsystemconfdir=%{_sysconfdir}/systemd/system \ --with-systemdsystemconfdir=%{_sysconfdir}/systemd/system \
--with-systemdgroupname=%{groupname} \ --with-systemdgroupname=%{groupname} \
--libexecdir=%{_libexecdir}/%{pkgname} \ --libexecdir=%{_libexecdir}/%{pkgname} \
$ASAN_FLAGS $RUST_FLAGS $PERL_FLAGS $CLANG_FLAGS \ $ASAN_FLAGS $MSAN_FLAGS $TSAN_FLAGS $UBSAN_FLAGS $RUST_FLAGS $CLANG_FLAGS $COCKPIT_FLAGS \
--with-openldap \
--enable-debug \
--enable-cmocka --enable-cmocka
%if 0%{?rhel} > 7 || 0%{?fedora}
# lib389 # lib389
pushd ./src/lib389 pushd ./src/lib389
%py3_build %py3_build
@@ -340,40 +386,60 @@ sed -i "1s/\"1\"/\"8\"/" %{_builddir}/%{name}-%{version}%{?prerel}/src/lib389/m
sed -i "1s/\"1\"/\"8\"/" %{_builddir}/%{name}-%{version}%{?prerel}/src/lib389/man/dsidm.8 sed -i "1s/\"1\"/\"8\"/" %{_builddir}/%{name}-%{version}%{?prerel}/src/lib389/man/dsidm.8
sed -i "1s/\"1\"/\"8\"/" %{_builddir}/%{name}-%{version}%{?prerel}/src/lib389/man/dscreate.8 sed -i "1s/\"1\"/\"8\"/" %{_builddir}/%{name}-%{version}%{?prerel}/src/lib389/man/dscreate.8
%endif
# Generate symbolic info for debuggers # Generate symbolic info for debuggers
export XCFLAGS=$RPM_OPT_FLAGS export XCFLAGS=$RPM_OPT_FLAGS
#make %{?_smp_mflags} make %{?_smp_mflags}
make
%install %install
rm -rf $RPM_BUILD_ROOT
mkdir -p %{buildroot}%{_datadir}/gdb/auto-load%{_sbindir} mkdir -p %{buildroot}%{_datadir}/gdb/auto-load%{_sbindir}
%if %{use_cockpit}
mkdir -p %{buildroot}%{_datadir}/cockpit mkdir -p %{buildroot}%{_datadir}/cockpit
%endif
make DESTDIR="$RPM_BUILD_ROOT" install make DESTDIR="$RPM_BUILD_ROOT" install
# Cockpit branding, and directory and file list # For cockpit, fix for npm not building on CentOS 8
%if %{use_cockpit}
pushd $RPM_BUILD_ROOT
tar xzf %{S:4}
popd
%endif
%if %{use_cockpit}
find %{buildroot}%{_datadir}/cockpit/389-console -type d | sed -e "s@%{buildroot}@@" | sed -e 's/^/\%dir /' > cockpit.list find %{buildroot}%{_datadir}/cockpit/389-console -type d | sed -e "s@%{buildroot}@@" | sed -e 's/^/\%dir /' > cockpit.list
find %{buildroot}%{_datadir}/cockpit/389-console -type f | sed -e "s@%{buildroot}@@" >> cockpit.list find %{buildroot}%{_datadir}/cockpit/389-console -type f | sed -e "s@%{buildroot}@@" >> cockpit.list
%endif
# Copy in our docs from doxygen. # Copy in our docs from doxygen.
cp -r %{_builddir}/%{name}-%{version}%{?prerel}/man/man3 $RPM_BUILD_ROOT/%{_mandir}/man3 cp -r %{_builddir}/%{name}-%{version}%{?prerel}/man/man3 $RPM_BUILD_ROOT/%{_mandir}/man3
%if 0%{?rhel} > 7 || 0%{?fedora}
# lib389 # lib389
pushd src/lib389 pushd src/lib389
%py3_install %py3_install
popd popd
%endif
mkdir -p $RPM_BUILD_ROOT/var/log/%{pkgname} mkdir -p $RPM_BUILD_ROOT/var/log/%{pkgname}
mkdir -p $RPM_BUILD_ROOT/var/lib/%{pkgname} mkdir -p $RPM_BUILD_ROOT/var/lib/%{pkgname}
mkdir -p $RPM_BUILD_ROOT/var/lock/%{pkgname} mkdir -p $RPM_BUILD_ROOT/var/lock/%{pkgname} \
&& chmod 770 $RPM_BUILD_ROOT/var/lock/%{pkgname}
# for systemd # for systemd
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/systemd/system/%{groupname}.wants mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/systemd/system/%{groupname}.wants
#remove libtool archives and static libs #remove libtool and static libs
find %{buildroot} -type f -name "*.la" -delete rm -f $RPM_BUILD_ROOT%{_libdir}/%{pkgname}/*.a
find %{buildroot} -type f -name "*.a" -delete rm -f $RPM_BUILD_ROOT%{_libdir}/%{pkgname}/*.la
rm -f $RPM_BUILD_ROOT%{_libdir}/%{pkgname}/plugins/*.a
rm -f $RPM_BUILD_ROOT%{_libdir}/%{pkgname}/plugins/*.la
rm -f $RPM_BUILD_ROOT%{_libdir}/libsvrcore.a
rm -f $RPM_BUILD_ROOT%{_libdir}/libsvrcore.la
%if %{bundle_jemalloc} %if %{bundle_jemalloc}
pushd ../%{jemalloc_name}-%{jemalloc_ver} pushd ../%{jemalloc_name}-%{jemalloc_ver}
@@ -385,6 +451,9 @@ popd
%check %check
# This checks the code, if it fails it prints why, then re-raises the fail to shortcircuit the rpm build. # This checks the code, if it fails it prints why, then re-raises the fail to shortcircuit the rpm build.
%if %{use_tsan}
export TSAN_OPTIONS=print_stacktrace=1:second_deadlock_stack=1:history_size=7
%endif
if ! make DESTDIR="$RPM_BUILD_ROOT" check; then cat ./test-suite.log && false; fi if ! make DESTDIR="$RPM_BUILD_ROOT" check; then cat ./test-suite.log && false; fi
%clean %clean
@@ -398,9 +467,14 @@ else
output=/dev/null output=/dev/null
output2=/dev/null output2=/dev/null
fi fi
# reload to pick up any changes to systemd files # reload to pick up any changes to systemd files
/bin/systemctl daemon-reload >$output 2>&1 || : /bin/systemctl daemon-reload >$output 2>&1 || :
# find all instances
instances="" # instances that require a restart after upgrade
ninst=0 # number of instances found in total
# https://fedoraproject.org/wiki/Packaging:UsersAndGroups#Soft_static_allocation # https://fedoraproject.org/wiki/Packaging:UsersAndGroups#Soft_static_allocation
# Soft static allocation for UID and GID # Soft static allocation for UID and GID
USERNAME="dirsrv" USERNAME="dirsrv"
@@ -409,18 +483,53 @@ GROUPNAME="dirsrv"
ALLOCATED_GID=389 ALLOCATED_GID=389
HOMEDIR="/usr/share/dirsrv" HOMEDIR="/usr/share/dirsrv"
getent group $GROUPNAME >/dev/null || /usr/sbin/groupadd -f -g $ALLOCATED_GID -r $GROUPNAME getent group $GROUPNAME >/dev/null || groupadd -f -g $ALLOCATED_GID -r $GROUPNAME
if ! getent passwd $USERNAME >/dev/null ; then if ! getent passwd $USERNAME >/dev/null ; then
if ! getent passwd $ALLOCATED_UID >/dev/null ; then if ! getent passwd $ALLOCATED_UID >/dev/null ; then
/usr/sbin/useradd -r -u $ALLOCATED_UID -g $GROUPNAME -d $HOMEDIR -s /sbin/nologin -c "user for 389-ds-base" $USERNAME useradd -r -u $ALLOCATED_UID -g $GROUPNAME -d $HOMEDIR -s /sbin/nologin -c "user for 389-ds-base" $USERNAME
else else
/usr/sbin/useradd -r -g $GROUPNAME -d $HOMEDIR -s /sbin/nologin -c "user for 389-ds-base" $USERNAME useradd -r -g $GROUPNAME -d $HOMEDIR -s /sbin/nologin -c "user for 389-ds-base" $USERNAME
fi fi
fi fi
# Reload our sysctl before we restart (if we can) # Reload our sysctl before we restart (if we can)
sysctl --system &> $output; true sysctl --system &> $output; true
# Gather the running instances so we can restart them
instbase="%{_sysconfdir}/%{pkgname}"
ninst=0
for dir in $instbase/slapd-* ; do
echo dir = $dir >> $output 2>&1 || :
if [ ! -d "$dir" ] ; then continue ; fi
case "$dir" in *.removed) continue ;; esac
basename=`basename $dir`
inst="%{pkgname}@`echo $basename | sed -e 's/slapd-//g'`"
echo found instance $inst - getting status >> $output 2>&1 || :
if /bin/systemctl -q is-active $inst ; then
echo instance $inst is running >> $output 2>&1 || :
instances="$instances $inst"
else
echo instance $inst is not running >> $output 2>&1 || :
fi
ninst=`expr $ninst + 1`
done
if [ $ninst -eq 0 ] ; then
echo no instances to upgrade >> $output 2>&1 || :
exit 0 # have no instances to upgrade - just skip the rest
else
# restart running instances
echo shutting down all instances . . . >> $output 2>&1 || :
for inst in $instances ; do
echo stopping instance $inst >> $output 2>&1 || :
/bin/systemctl stop $inst >> $output 2>&1 || :
done
for inst in $instances ; do
echo starting instance $inst >> $output 2>&1 || :
/bin/systemctl start $inst >> $output 2>&1 || :
done
fi
%preun %preun
if [ $1 -eq 0 ]; then # Final removal if [ $1 -eq 0 ]; then # Final removal
# remove instance specific service files/links # remove instance specific service files/links
@@ -441,6 +550,7 @@ fi
%postun snmp %postun snmp
%systemd_postun_with_restart %{pkgname}-snmp.service %systemd_postun_with_restart %{pkgname}-snmp.service
%files %files
%if %{bundle_jemalloc} %if %{bundle_jemalloc}
%doc LICENSE LICENSE.GPLv3+ LICENSE.openssl README.jemalloc %doc LICENSE LICENSE.GPLv3+ LICENSE.openssl README.jemalloc
@@ -470,9 +580,12 @@ fi
%{_mandir}/man1/logconv.pl.1.gz %{_mandir}/man1/logconv.pl.1.gz
%{_bindir}/pwdhash %{_bindir}/pwdhash
%{_mandir}/man1/pwdhash.1.gz %{_mandir}/man1/pwdhash.1.gz
# We have to seperate this from being a glob to ensure the caps are applied.
# %caps(CAP_NET_BIND_SERVICE=pe) {_sbindir}/ns-slapd # %caps(CAP_NET_BIND_SERVICE=pe) {_sbindir}/ns-slapd
%{_sbindir}/ns-slapd %{_sbindir}/ns-slapd
%{_mandir}/man8/ns-slapd.8.gz %{_mandir}/man8/ns-slapd.8.gz
%{_sbindir}/openldap_to_ds
%{_mandir}/man8/openldap_to_ds.8.gz
%{_libexecdir}/%{pkgname}/ds_systemd_ask_password_acl %{_libexecdir}/%{pkgname}/ds_systemd_ask_password_acl
%{_mandir}/man5/99user.ldif.5.gz %{_mandir}/man5/99user.ldif.5.gz
%{_mandir}/man5/certmap.conf.5.gz %{_mandir}/man5/certmap.conf.5.gz
@@ -480,8 +593,6 @@ fi
%{_mandir}/man5/dirsrv.5.gz %{_mandir}/man5/dirsrv.5.gz
%{_mandir}/man5/dirsrv.systemd.5.gz %{_mandir}/man5/dirsrv.systemd.5.gz
%{_libdir}/%{pkgname}/python %{_libdir}/%{pkgname}/python
%{_sbindir}/openldap_to_ds
%{_mandir}/man8/openldap_to_ds.8.gz
%dir %{_libdir}/%{pkgname}/plugins %dir %{_libdir}/%{pkgname}/plugins
%{_libdir}/%{pkgname}/plugins/*.so %{_libdir}/%{pkgname}/plugins/*.so
# This has to be hardcoded to /lib - $libdir changes between lib/lib64, but # This has to be hardcoded to /lib - $libdir changes between lib/lib64, but
@@ -530,9 +641,6 @@ fi
%if %{bundle_jemalloc} %if %{bundle_jemalloc}
%{_libdir}/%{pkgname}/lib/libjemalloc.so.2 %{_libdir}/%{pkgname}/lib/libjemalloc.so.2
%endif %endif
%if %{use_rust}
%{_libdir}/%{pkgname}/librsds.so
%endif
%files snmp %files snmp
%doc LICENSE LICENSE.GPLv3+ LICENSE.openssl README.devel %doc LICENSE LICENSE.GPLv3+ LICENSE.openssl README.devel
@@ -552,13 +660,18 @@ fi
%{_mandir}/man8/dsctl.8.gz %{_mandir}/man8/dsctl.8.gz
%{_sbindir}/dsidm %{_sbindir}/dsidm
%{_mandir}/man8/dsidm.8.gz %{_mandir}/man8/dsidm.8.gz
%{_libexecdir}/dirsrv/dscontainer %{_libexecdir}/%{pkgname}/dscontainer
%if %{use_cockpit}
%files -n cockpit-389-ds -f cockpit.list %files -n cockpit-389-ds -f cockpit.list
%{_datarootdir}/metainfo/389-console/org.port389.cockpit_console.metainfo.xml %{_datarootdir}/metainfo/389-console/org.port389.cockpit_console.metainfo.xml
%doc README.md %doc README.md
%endif
%changelog %changelog
* Tue Dec 22 2020 Daniel Steiner <daniel.steiner@threema.ch>
- Fix for cockpit console (npm does not compile the web conten). Prebuild content added
* Wed Dec 9 2020 Daniel Steiner <daniel.steiner@threema.ch> * Wed Dec 9 2020 Daniel Steiner <daniel.steiner@threema.ch>
- Update to latest version (1.4.4.9). - Update to latest version (1.4.4.9).