Cassandane: do not depend on imaptest, clean up BuildRequires

- Re-enable LTO

Related: RHEL-40084
This commit is contained in:
Martin Osvald 2024-06-10 19:36:04 +02:00
parent a11627db57
commit c1e4ddfd46

View File

@ -5,10 +5,6 @@ Summary: A high-performance email, contacts and calendar server
License: BSD-Attribution-HPND-disclaimer License: BSD-Attribution-HPND-disclaimer
URL: http://www.cyrusimap.org/ URL: http://www.cyrusimap.org/
# cyrus-imapd does not to support LTO
# https://github.com/cyrusimap/cyrus-imapd/pull/4679
%define _lto_cflags %{nil}
# UID/GID 76 have long been reserved for Cyrus # UID/GID 76 have long been reserved for Cyrus
%define uid 76 %define uid 76
%define gid 76 %define gid 76
@ -21,12 +17,11 @@ URL: http://www.cyrusimap.org/
%global __provides_exclude ^perl\\(AnnotateInlinedCIDs\\)$ %global __provides_exclude ^perl\\(AnnotateInlinedCIDs\\)$
# Cassandane testsuite now called from separate CI test and no longer executed during build time: # Cassandane testsuite is no longer executed during build time. It is called from separate CI test:
# https://src.fedoraproject.org/tests/cyrus-imapd/blob/main/f/Sanity/cassandane # https://src.fedoraproject.org/tests/cyrus-imapd/blob/main/f/Sanity/cassandane
# CASSANDANE* and CASSANDANE*_END used for extracting commands needed for running the testsuite. # Do not remove CASSANDANE* and CASSANDANE*_END tags - the content between them is extracted and executed inside the CI test.
# Run: `rpmbuild '--with cassandane'` to enable it. # If you want to run cassandane locally:
# Run: `echo '%%_with_cassandane 1' >> ~/.rpmmacros && dnf builddep rpmbuild/SPECS/cyrus-imapd.spec` # Run: `rpmbuild '--with cassandane'` or `echo '%%_with_cassandane 1' >> ~/.rpmmacros`.
# to install cassandane dependencies.
%bcond_with cassandane %bcond_with cassandane
Source0: https://github.com/cyrusimap/cyrus-imapd/releases/download/cyrus-imapd-%version/cyrus-imapd-%version.tar.gz Source0: https://github.com/cyrusimap/cyrus-imapd/releases/download/cyrus-imapd-%version/cyrus-imapd-%version.tar.gz
@ -59,6 +54,11 @@ Patch2: patch-cyrus-rename-quota
# https://bugzilla.redhat.com/show_bug.cgi?id=1668723 # https://bugzilla.redhat.com/show_bug.cgi?id=1668723
# https://github.com/cyrusimap/cyrus-imapd/issues/2629#issuecomment-456925909 # https://github.com/cyrusimap/cyrus-imapd/issues/2629#issuecomment-456925909
Patch3: patch-cyrus-perl-linking Patch3: patch-cyrus-perl-linking
# cyrus-imapd does not support LTO
# https://github.com/cyrusimap/cyrus-imapd/pull/4679
# Remove attribute always_inline to fix compilation error and keep LTO enabled:
# https://bugzilla.redhat.com/show_bug.cgi?id=2223951
Patch4: patch-cyrus-remove-always-inline-for-buf-len
Patch5: patch-cyrus-rename-imtest Patch5: patch-cyrus-rename-imtest
# Cassandane patches: # Cassandane patches:
@ -81,7 +81,7 @@ BuildRequires: perl(Pod::Html)
BuildRequires: gnupg2 BuildRequires: gnupg2
%endif %endif
%if 0%{?fedora} && 0%{?fedora} >= 0 %if 0%{?fedora}
BuildRequires: clamav-devel shapelib-devel BuildRequires: clamav-devel shapelib-devel
%endif %endif
BuildRequires: CUnit-devel cyrus-sasl-devel glib2-devel BuildRequires: CUnit-devel cyrus-sasl-devel glib2-devel
@ -97,42 +97,89 @@ BuildRequires: systemd-rpm-macros
%if %{with cassandane} %if %{with cassandane}
# Additional packages required for cassandane to function # Additional packages required for cassandane to function
BuildRequires: imaptest net-tools words BuildRequires: cpan dovecot-devel file-devel net-tools words
BuildRequires: perl-interpreter BuildRequires: perl-interpreter
BuildRequires: perl(AnyEvent) perl(AnyEvent::Handle) perl(AnyEvent::Socket) %if 0%{?fedora}
BuildRequires: perl(AnyEvent::Util) perl(attributes) perl(base) BuildRequires: cld2-devel
BuildRequires: perl(BSD::Resource) perl(bytes) perl(Carp) perl(charnames) %endif
BuildRequires: perl(Clone) perl(Config) perl(Config::IniFiles) perl(constant) # Dependency list generated by this command:
BuildRequires: perl(Cwd) perl(Data::Dumper) perl(DateTime) # cd cassandane; grep -R -h '^[ \t]*use .*;$' | sed -e 's/.*use \([^ ]*\).*;/\1/' | sort | uniq | \
BuildRequires: perl(DateTime::Format::ISO8601) perl(Digest::MD5) perl(Encode) # egrep -v 'Cassandane::|Cyrus::|v5|Net::XmtpServer' | sed -e 's/\(.*\)/BuildRequires: perl(\1)/'
BuildRequires: perl(Errno) perl(experimental) perl(Exporter) BuildRequires: perl(attributes)
BuildRequires: perl(File::Basename) perl(File::chdir) perl(File::Find) BuildRequires: perl(base)
BuildRequires: perl(File::Path) perl(File::Slurp) perl(File::stat) BuildRequires: perl(BSD::Resource)
BuildRequires: perl(File::Temp) perl(Getopt::Long) perl(HTTP::Tiny) BuildRequires: perl(bytes)
BuildRequires: perl(IO::File) perl(IO::Handle) perl(IO::Scalar) BuildRequires: perl(Carp)
BuildRequires: perl(IO::Socket::INET) perl(IO::Socket::INET6) BuildRequires: perl(charnames)
BuildRequires: perl(IO::Socket::UNIX) perl(JSON) perl(JSON::XS) perl(lib) BuildRequires: perl(Clone)
BuildRequires: perl(Mail::IMAPTalk) perl(Mail::JMAPTalk) >= 0.11 BuildRequires: perl(Config)
BuildRequires: perl(Math::Int64) perl(MIME::Base64) BuildRequires: perl(constant)
BuildRequires: perl(Net::CalDAVTalk) >= 0.12 perl(Net::CardDAVTalk) >= 0.05 BuildRequires: perl(Cwd)
BuildRequires: perl(Net::CardDAVTalk::VCard) perl(Net::DAVTalk) BuildRequires: perl(Data::Dumper)
BuildRequires: perl(Net::POP3) perl(Net::Server::PreForkSimple) BuildRequires: perl(Data::UUID)
BuildRequires: perl(News::NNTPClient) perl(overload) BuildRequires: perl(DBI)
BuildRequires: perl(POSIX) perl(Scalar::Util) perl(Storable) perl(strict) BuildRequires: perl(Digest::file)
BuildRequires: perl(String::CRC32) perl(Sys::Hostname) perl(Sys::Syslog) BuildRequires: perl(Digest::MD5)
BuildRequires: perl(Test::Unit::Exception) perl(Test::Unit::Listener) BuildRequires: perl(Encode)
BuildRequires: perl(Test::Unit::Result) perl(Test::Unit::Runner) BuildRequires: perl(Errno)
BuildRequires: perl(Test::Unit::TestCase) perl(Test::Unit::TestRunner) BuildRequires: perl(Error)
BuildRequires: perl(Time::HiRes) perl(URI) perl(URI::Escape) perl(User::pwent) BuildRequires: perl(experimental)
BuildRequires: perl(utf8) perl(vars) perl(warnings) perl(XML::DOM) BuildRequires: perl(Exporter)
BuildRequires: perl(XML::Generator) perl(XML::Spice) BuildRequires: perl(feature)
BuildRequires: clamav-data perl(Unix::Syslog) BuildRequires: perl(fields)
BuildRequires: perl(HTTP::Daemon) perl(DBI) perl(Net::LDAP::Constant) BuildRequires: perl(File::Basename)
BuildRequires: perl(Net::LDAP::Server) BuildRequires: perl(File::Copy)
BuildRequires: perl(File::Find)
BuildRequires: perl(File::Path)
BuildRequires: perl(File::Slurp)
BuildRequires: perl(File::stat)
BuildRequires: perl(File::Temp)
BuildRequires: perl(Getopt::Long)
BuildRequires: perl(Getopt::Std)
BuildRequires: perl(HTTP::Daemon)
BuildRequires: perl(HTTP::Tiny)
BuildRequires: perl(IO::File)
BuildRequires: perl(IO::Handle)
BuildRequires: perl(IO::Scalar)
BuildRequires: perl(IO::Select)
BuildRequires: perl(IO::Socket)
BuildRequires: perl(IO::Socket::INET)
BuildRequires: perl(IO::Socket::INET6)
BuildRequires: perl(IO::Socket::UNIX)
BuildRequires: perl(JSON)
BuildRequires: perl(JSON::XS)
BuildRequires: perl(lib)
BuildRequires: perl(List::Util)
BuildRequires: perl(LWP::UserAgent)
BuildRequires: perl(MIME::Base64)
BuildRequires: perl(Module::Load::Conditional) BuildRequires: perl(Module::Load::Conditional)
BuildRequires: cpan cld2-devel BuildRequires: perl(Net::LDAP::Filter)
BuildRequires: perl(Plack::Loader) perl(Test::TCP) perl(Data::GUID) perl(Digest::CRC) perl(Moo) perl(Types::Standard) BuildRequires: perl(Net::LDAP::FilterMatch)
BuildRequires: perl(Net::LDAP::LDIF)
BuildRequires: perl(Net::LDAP::Util)
BuildRequires: perl(Net::POP3)
BuildRequires: perl(Net::Server::PreForkSimple)
BuildRequires: perl(overload)
BuildRequires: perl(POSIX)
BuildRequires: perl(Scalar::Util)
BuildRequires: perl(Storable)
BuildRequires: perl(strict)
BuildRequires: perl(Sys::Hostname)
BuildRequires: perl(Sys::Syslog)
BuildRequires: perl(Time::HiRes)
BuildRequires: perl(URI)
BuildRequires: perl(URI::Escape)
BuildRequires: perl(User::pwent)
BuildRequires: perl(utf8)
BuildRequires: perl(vars)
BuildRequires: perl(version)
BuildRequires: perl(warnings)
# These were reported as missing during build itself
BuildRequires: perl(DBD::SQLite) BuildRequires: perl(DBD::SQLite)
BuildRequires: perl(Digest::CRC)
BuildRequires: perl(Moo)
BuildRequires: perl(Unix::Syslog)
BuildRequires: perl(XML::Parser)
%endif %endif
Requires(pre): shadow-utils Requires(pre): shadow-utils
@ -273,7 +320,7 @@ popd
%build %build
#autoreconf -vi #autoreconf -vi
%if %{with cassandane} %if %{with cassandane} && 0%{?fedora}
# Needed for Cyrus::FastMail tests to pass # Needed for Cyrus::FastMail tests to pass
export CLD2_CFLAGS="-I/usr/include/cld2" export CLD2_CFLAGS="-I/usr/include/cld2"
export CLD2_LIBS="-lcld2" export CLD2_LIBS="-lcld2"
@ -284,7 +331,7 @@ export CLD2_LIBS="-lcld2"
\ \
--libexecdir=%cyrexecdir \ --libexecdir=%cyrexecdir \
--with-clamav \ --with-clamav \
%if %{with cassandane} %if %{with cassandane} && 0%{?fedora}
`# Needed for Cyrus::FastMail tests to pass` \ `# Needed for Cyrus::FastMail tests to pass` \
--with-cld2 \ --with-cld2 \
%endif %endif
@ -333,7 +380,45 @@ make notifyd/notifytest
# CASSANDANE_BUILD # CASSANDANE_BUILD
%if %{with cassandane} %if %{with cassandane}
# This module is not available in Fedora: # This module is not available in Fedora:
yes | cpan IO::File::fcntl yes | cpan -T IO::File::fcntl
# These are currently missing on RHEL10 (2024-06-10):
yes | cpan -T AnyEvent \
AnyEvent::Handle \
AnyEvent::Socket \
AnyEvent::Util \
Config::IniFiles \
Data::GUID \
Data::ICal \
DateTime \
DateTime::Format::ISO8601 \
File::chdir \
File::LibMagic \
Mail::IMAPTalk \
Mail::JMAPTalk \
Math::Int64 \
Net::CalDAVTalk \
Net::CardDAVTalk \
Net::CardDAVTalk::VCard \
Net::DAVTalk \
Net::LDAP::Server \
News::NNTPClient \
Plack::Loader \
Plack::Request \
Plack::Response \
String::CRC32 \
Test::TCP \
Test::Unit::Exception \
Test::Unit::Result \
Test::Unit::Runner::XML \
Text::VCardFast \
Types::Standard \
XML::DOM \
XML::Generator \
XML::Spice
# Fix cpan's version of perl-Test-Unit like it is done on Fedora:
# https://src.fedoraproject.org/rpms/perl-Test-Unit/c/c8ec65eb06f4f7059f9e4a32b5c521a26eef746b
sed -ie 's/defined(@{"$class\\::TESTS"})/@{"$class\::TESTS"}/' /usr/local/share/perl5/5.38/Test/Unit/TestCase.pm
# This is the test suite, which doesn't build much but does verify its dependencies. # This is the test suite, which doesn't build much but does verify its dependencies.
pushd cassandane pushd cassandane
@ -491,7 +576,7 @@ exit 0
# TODO: The mime_boundary_extended cunit test fails due to LTO on ppc64le, skip it for now: # TODO: The mime_boundary_extended cunit test fails due to LTO on ppc64le, skip it for now:
%ifnarch ppc64le %ifnarch ppc64le
make -j%{?_smp_build_ncpus} check || exit 1 LD_LIBRARY_PATH=%buildroot/%_libdir make -j%{?_smp_build_ncpus} check || exit 1
%endif %endif
# Cassandane cannot run solely as root because imap services would otherwise quit: # Cassandane cannot run solely as root because imap services would otherwise quit:
@ -509,17 +594,25 @@ getent passwd cyrus >/dev/null || /usr/sbin/useradd -c "Cyrus IMAP Server" -d /v
[ -z "`grep LD_LIBRARY_PATH /var/lib/imap/.bashrc`" ] && echo "export LD_LIBRARY_PATH=%buildroot/%_libdir" >> /var/lib/imap/.bashrc [ -z "`grep LD_LIBRARY_PATH /var/lib/imap/.bashrc`" ] && echo "export LD_LIBRARY_PATH=%buildroot/%_libdir" >> /var/lib/imap/.bashrc
# CASSANDANE # CASSANDANE
# TODO: Temporary workaround for missing mail::IMAPTalk methods.
# https://github.com/robmueller/mail-imaptalk/commit/0cf2624edca6fc0dd1cdc851a8710af928ba1f1e
dnf downgrade -y https://kojipkgs.fedoraproject.org//packages/perl-Mail-IMAPTalk/4.04/22.fc39/noarch/perl-Mail-IMAPTalk-4.04-22.fc39.noarch.rpm
# Run the Cassandane test suite. This will exhaustively test the various # Run the Cassandane test suite. This will exhaustively test the various
# server components, but running it in a mock chroot is rather an exercise. # server components, but running it in a mock chroot is rather an exercise.
pushd cassandane pushd cassandane
# Do not depend on imaptest package (missing on RHEL10)
wget https://dovecot.org/nightly/imaptest/imaptest-20210511.tar.gz
rm -rf imaptest-src
mkdir imaptest-src
tar -xf imaptest-20210511.tar.gz --strip-components=1 -C imaptest-src
pushd imaptest-src
# Workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1103927#c4 (and later)
sed -e 's@\(^LIBDOVECOT .*\)@\1 -Wl,-rpath -Wl,/usr/lib64/dovecot@' -i src/Makefile.in
./configure --with-dovecot=/usr/lib64/dovecot
make
popd
mkdir -p imaptest/src mkdir -p imaptest/src
ln -s /usr/bin/imaptest imaptest/src ln -sfr ./imaptest-src/src/imaptest imaptest/src
ln -s /usr/share/imaptest/tests imaptest/src ln -sfr ./imaptest-src/src/tests imaptest/src
chown -R cyrus:mail . chown -R cyrus:mail .
@ -527,7 +620,7 @@ chown -R cyrus:mail .
# --------------------------------------------------------- # ---------------------------------------------------------
exclude=() exclude=()
tests=( tests=(
# This exclusion list was verified on 2024-03-27. # This exclusion list was verified on 2024-06-10.
# This tests coredumping and won't work on a machine where systemd # This tests coredumping and won't work on a machine where systemd
# intercepts coredumps, which includes our builders. # intercepts coredumps, which includes our builders.
@ -550,6 +643,9 @@ tests=(
Cyrus::SearchSquat.nonincremental Cyrus::SearchSquat.nonincremental
Cyrus::SearchSquat.incremental Cyrus::SearchSquat.incremental
Cyrus::SearchSquat.one_doc_per_message Cyrus::SearchSquat.one_doc_per_message
Cyrus::JMAPBackup.restore_calendars_batch_size_bug
Cyrus::Prometheus.connection_setup_failure_imapd
) )
for i in ${tests[@]}; do exclude+=("!$i"); done for i in ${tests[@]}; do exclude+=("!$i"); done