Drop libdb for RHEL>9

Related: rhbz#1788480
This commit is contained in:
Jaroslav Škarvada 2023-10-09 18:22:23 +02:00
parent e1e2ac872b
commit 6a2621e4d7
3 changed files with 64 additions and 16 deletions

View File

@ -51,15 +51,20 @@ conf_check() {
} }
make_aliasesdb() { make_aliasesdb() {
if [ "$(/usr/sbin/postconf -h alias_database)" == "hash:/etc/aliases" ] local MAP=""
local ALIASESDB="$(/usr/sbin/postconf -h alias_database)"
[ "$ALIASESDB" = "hash:/etc/aliases" ] && MAP="db"
[ "$ALIASESDB" = "lmdb:/etc/aliases" ] && MAP="lmdb"
if [ "$MAP" = "db" -o "$MAP" = "lmdb" ]
then then
# /etc/aliases.db may be used by other MTA, make sure nothing # /etc/aliases.db|lmdb may be used by other MTA, make sure nothing
# has touched it since our last newaliases call # has touched it since our last newaliases call
[ /etc/aliases -nt /etc/aliases.db ] || [ /etc/aliases -nt /etc/aliases.$MAP ] ||
[ "$ALIASESDB_STAMP" -nt /etc/aliases.db ] || [ "$ALIASESDB_STAMP" -nt /etc/aliases.$MAP ] ||
[ "$ALIASESDB_STAMP" -ot /etc/aliases.db ] || return [ "$ALIASESDB_STAMP" -ot /etc/aliases.$MAP ] || return
/usr/bin/newaliases /usr/bin/newaliases
touch -r /etc/aliases.db "$ALIASESDB_STAMP" touch -r /etc/aliases.$MAP "$ALIASESDB_STAMP"
else else
/usr/bin/newaliases /usr/bin/newaliases
fi fi

View File

@ -3,15 +3,20 @@
ALIASESDB_STAMP=/var/lib/misc/postfix.aliasesdb-stamp ALIASESDB_STAMP=/var/lib/misc/postfix.aliasesdb-stamp
make_aliasesdb() { make_aliasesdb() {
if [ "$(/usr/sbin/postconf -h alias_database)" == "hash:/etc/aliases" ] local MAP=""
local ALIASESDB="$(/usr/sbin/postconf -h alias_database)"
[ "$ALIASESDB" = "hash:/etc/aliases" ] && MAP="db"
[ "$ALIASESDB" = "lmdb:/etc/aliases" ] && MAP="lmdb"
if [ "$MAP" = "db" -o "$MAP" = "lmdb" ]
then then
# /etc/aliases.db may be used by other MTA, make sure nothing # /etc/aliases.db|lmdb may be used by other MTA, make sure nothing
# has touched it since our last newaliases call # has touched it since our last newaliases call
[ /etc/aliases -nt /etc/aliases.db ] || [ /etc/aliases -nt /etc/aliases.$MAP ] ||
[ "$ALIASESDB_STAMP" -nt /etc/aliases.db ] || [ "$ALIASESDB_STAMP" -nt /etc/aliases.$MAP ] ||
[ "$ALIASESDB_STAMP" -ot /etc/aliases.db ] || return 0 [ "$ALIASESDB_STAMP" -ot /etc/aliases.$MAP ] || return 0
/usr/bin/newaliases /usr/bin/newaliases
touch -r /etc/aliases.db "$ALIASESDB_STAMP" touch -r /etc/aliases.$MAP "$ALIASESDB_STAMP"
else else
/usr/bin/newaliases /usr/bin/newaliases
fi fi

View File

@ -1,6 +1,11 @@
# plugins have unresolvable symbols in compile time # plugins have unresolvable symbols in compile time
%undefine _strict_symbol_defs_build %undefine _strict_symbol_defs_build
%if 0%{?rhel} < 10
%bcond_without db
%else
%bcond_with db
%endif
%bcond_without mysql %bcond_without mysql
%bcond_without pgsql %bcond_without pgsql
%bcond_without sqlite %bcond_without sqlite
@ -13,6 +18,12 @@
%bcond_without ipv6 %bcond_without ipv6
%bcond_without pflogsumm %bcond_without pflogsumm
%if %{without db} && %{with lmdb}
%global defmap_lmdb 1
%else
%global defmap_lmdb 0
%endif
%global sysv2systemdnvr 2.8.12-2 %global sysv2systemdnvr 2.8.12-2
# hardened build if not overrided # hardened build if not overrided
@ -46,7 +57,7 @@
Name: postfix Name: postfix
Summary: Postfix Mail Transport Agent Summary: Postfix Mail Transport Agent
Version: 3.8.2 Version: 3.8.2
Release: 1%{?dist} Release: 2%{?dist}
Epoch: 2 Epoch: 2
URL: http://www.postfix.org URL: http://www.postfix.org
License: (IBM and GPLv2+) or (EPL-2.0 and GPLv2+) License: (IBM and GPLv2+) or (EPL-2.0 and GPLv2+)
@ -103,10 +114,19 @@ Patch13: pflogsumm-1.1.5-syslog-name-underscore-fix.patch
# Determine the different packages required for building postfix # Determine the different packages required for building postfix
BuildRequires: make BuildRequires: make
BuildRequires: libdb-devel, perl-generators, pkgconfig, zlib-devel %if %{with db}
BuildRequires: systemd-units, libicu-devel BuildRequires: libdb-devel
BuildRequires: gcc, m4, findutils %endif
BuildRequires: perl-generators
BuildRequires: pkgconfig
BuildRequires: zlib-devel
BuildRequires: systemd-units
BuildRequires: libicu-devel
BuildRequires: gcc
BuildRequires: m4
BuildRequires: findutils
BuildRequires: systemd-rpm-macros BuildRequires: systemd-rpm-macros
BuildRequires: sed
%if 0%{?rhel} < 9 %if 0%{?rhel} < 9
BuildRequires: libnsl2-devel BuildRequires: libnsl2-devel
%endif %endif
@ -121,6 +141,10 @@ BuildRequires: libnsl2-devel
%{?with_cdb:BuildRequires: tinycdb-devel} %{?with_cdb:BuildRequires: tinycdb-devel}
%{?with_tls:BuildRequires: openssl-devel} %{?with_tls:BuildRequires: openssl-devel}
%if 0%{?defmap_lmdb}
Requires: %{name}-lmdb%{?_isa} = %{epoch}:%{version}-%{release}
%endif
%description %description
Postfix is a Mail Transport Agent (MTA). Postfix is a Mail Transport Agent (MTA).
@ -258,6 +282,12 @@ for f in README_FILES/TLS_{LEGACY_,}README TLS_ACKNOWLEDGEMENTS; do
touch -r ${f}{,_} && mv -f ${f}{_,} touch -r ${f}{,_} && mv -f ${f}{_,}
done done
# fix default maps
%if 0%{?defmap_lmdb}
sed -i '/^\s*alias_maps\s*=\s*hash:\/etc\/aliases/ s|hash:|lmdb:|g' conf/main.cf
sed -i '/^\s*alias_database\s*=\s*hash:\/etc\/aliases/ s|hash:|lmdb:|g' conf/main.cf
%endif
%build %build
%set_build_flags %set_build_flags
unset AUXLIBS AUXLIBS_LDAP AUXLIBS_LMDB AUXLIBS_PCRE AUXLIBS_MYSQL AUXLIBS_PGSQL AUXLIBS_SQLITE AUXLIBS_CDB unset AUXLIBS AUXLIBS_LDAP AUXLIBS_LMDB AUXLIBS_PCRE AUXLIBS_MYSQL AUXLIBS_PGSQL AUXLIBS_SQLITE AUXLIBS_CDB
@ -268,6 +298,10 @@ AUXLIBS=""
AUXLIBS="-lnsl" AUXLIBS="-lnsl"
%endif %endif
%if %{without db}
CCARGS="${CCARGS} -DNO_DB"
%endif
%ifarch s390 s390x ppc %ifarch s390 s390x ppc
CCARGS="${CCARGS} -fsigned-char" CCARGS="${CCARGS} -fsigned-char"
%endif %endif
@ -804,6 +838,10 @@ fi
%endif %endif
%changelog %changelog
* Mon Oct 9 2023 Jaroslav Škarvada <jskarvad@redhat.com> - 2:3.8.2-2
- Drop libdb for RHEL>9
Related: rhbz#1788480
* Tue Sep 5 2023 Jaroslav Škarvada <jskarvad@redhat.com> - 2:3.8.2-1 * Tue Sep 5 2023 Jaroslav Škarvada <jskarvad@redhat.com> - 2:3.8.2-1
- New version - New version
Resolves: rhbz#2236828 Resolves: rhbz#2236828