From c1e4ddfd46bffd14e7fe3d7efc63522d6089fb1b Mon Sep 17 00:00:00 2001 From: Martin Osvald Date: Mon, 10 Jun 2024 19:36:04 +0200 Subject: [PATCH] Cassandane: do not depend on imaptest, clean up BuildRequires - Re-enable LTO Related: RHEL-40084 --- cyrus-imapd.spec | 204 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 150 insertions(+), 54 deletions(-) diff --git a/cyrus-imapd.spec b/cyrus-imapd.spec index c128463..c0d2933 100644 --- a/cyrus-imapd.spec +++ b/cyrus-imapd.spec @@ -5,10 +5,6 @@ Summary: A high-performance email, contacts and calendar server License: BSD-Attribution-HPND-disclaimer 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 %define uid 76 %define gid 76 @@ -21,12 +17,11 @@ URL: http://www.cyrusimap.org/ %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 -# CASSANDANE* and CASSANDANE*_END used for extracting commands needed for running the testsuite. -# Run: `rpmbuild '--with cassandane'` to enable it. -# Run: `echo '%%_with_cassandane 1' >> ~/.rpmmacros && dnf builddep rpmbuild/SPECS/cyrus-imapd.spec` -# to install cassandane dependencies. +# Do not remove CASSANDANE* and CASSANDANE*_END tags - the content between them is extracted and executed inside the CI test. +# If you want to run cassandane locally: +# Run: `rpmbuild '--with cassandane'` or `echo '%%_with_cassandane 1' >> ~/.rpmmacros`. %bcond_with cassandane 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://github.com/cyrusimap/cyrus-imapd/issues/2629#issuecomment-456925909 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 # Cassandane patches: @@ -81,7 +81,7 @@ BuildRequires: perl(Pod::Html) BuildRequires: gnupg2 %endif -%if 0%{?fedora} && 0%{?fedora} >= 0 +%if 0%{?fedora} BuildRequires: clamav-devel shapelib-devel %endif BuildRequires: CUnit-devel cyrus-sasl-devel glib2-devel @@ -97,42 +97,89 @@ BuildRequires: systemd-rpm-macros %if %{with cassandane} # 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(AnyEvent) perl(AnyEvent::Handle) perl(AnyEvent::Socket) -BuildRequires: perl(AnyEvent::Util) perl(attributes) perl(base) -BuildRequires: perl(BSD::Resource) perl(bytes) perl(Carp) perl(charnames) -BuildRequires: perl(Clone) perl(Config) perl(Config::IniFiles) perl(constant) -BuildRequires: perl(Cwd) perl(Data::Dumper) perl(DateTime) -BuildRequires: perl(DateTime::Format::ISO8601) perl(Digest::MD5) perl(Encode) -BuildRequires: perl(Errno) perl(experimental) perl(Exporter) -BuildRequires: perl(File::Basename) perl(File::chdir) perl(File::Find) -BuildRequires: perl(File::Path) perl(File::Slurp) perl(File::stat) -BuildRequires: perl(File::Temp) perl(Getopt::Long) perl(HTTP::Tiny) -BuildRequires: perl(IO::File) perl(IO::Handle) perl(IO::Scalar) -BuildRequires: perl(IO::Socket::INET) perl(IO::Socket::INET6) -BuildRequires: perl(IO::Socket::UNIX) perl(JSON) perl(JSON::XS) perl(lib) -BuildRequires: perl(Mail::IMAPTalk) perl(Mail::JMAPTalk) >= 0.11 -BuildRequires: perl(Math::Int64) perl(MIME::Base64) -BuildRequires: perl(Net::CalDAVTalk) >= 0.12 perl(Net::CardDAVTalk) >= 0.05 -BuildRequires: perl(Net::CardDAVTalk::VCard) perl(Net::DAVTalk) -BuildRequires: perl(Net::POP3) perl(Net::Server::PreForkSimple) -BuildRequires: perl(News::NNTPClient) perl(overload) -BuildRequires: perl(POSIX) perl(Scalar::Util) perl(Storable) perl(strict) -BuildRequires: perl(String::CRC32) perl(Sys::Hostname) perl(Sys::Syslog) -BuildRequires: perl(Test::Unit::Exception) perl(Test::Unit::Listener) -BuildRequires: perl(Test::Unit::Result) perl(Test::Unit::Runner) -BuildRequires: perl(Test::Unit::TestCase) perl(Test::Unit::TestRunner) -BuildRequires: perl(Time::HiRes) perl(URI) perl(URI::Escape) perl(User::pwent) -BuildRequires: perl(utf8) perl(vars) perl(warnings) perl(XML::DOM) -BuildRequires: perl(XML::Generator) perl(XML::Spice) -BuildRequires: clamav-data perl(Unix::Syslog) -BuildRequires: perl(HTTP::Daemon) perl(DBI) perl(Net::LDAP::Constant) -BuildRequires: perl(Net::LDAP::Server) +%if 0%{?fedora} +BuildRequires: cld2-devel +%endif +# Dependency list generated by this command: +# cd cassandane; grep -R -h '^[ \t]*use .*;$' | sed -e 's/.*use \([^ ]*\).*;/\1/' | sort | uniq | \ +# egrep -v 'Cassandane::|Cyrus::|v5|Net::XmtpServer' | sed -e 's/\(.*\)/BuildRequires: perl(\1)/' +BuildRequires: perl(attributes) +BuildRequires: perl(base) +BuildRequires: perl(BSD::Resource) +BuildRequires: perl(bytes) +BuildRequires: perl(Carp) +BuildRequires: perl(charnames) +BuildRequires: perl(Clone) +BuildRequires: perl(Config) +BuildRequires: perl(constant) +BuildRequires: perl(Cwd) +BuildRequires: perl(Data::Dumper) +BuildRequires: perl(Data::UUID) +BuildRequires: perl(DBI) +BuildRequires: perl(Digest::file) +BuildRequires: perl(Digest::MD5) +BuildRequires: perl(Encode) +BuildRequires: perl(Errno) +BuildRequires: perl(Error) +BuildRequires: perl(experimental) +BuildRequires: perl(Exporter) +BuildRequires: perl(feature) +BuildRequires: perl(fields) +BuildRequires: perl(File::Basename) +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: cpan cld2-devel -BuildRequires: perl(Plack::Loader) perl(Test::TCP) perl(Data::GUID) perl(Digest::CRC) perl(Moo) perl(Types::Standard) +BuildRequires: perl(Net::LDAP::Filter) +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(Digest::CRC) +BuildRequires: perl(Moo) +BuildRequires: perl(Unix::Syslog) +BuildRequires: perl(XML::Parser) %endif Requires(pre): shadow-utils @@ -273,7 +320,7 @@ popd %build #autoreconf -vi -%if %{with cassandane} +%if %{with cassandane} && 0%{?fedora} # Needed for Cyrus::FastMail tests to pass export CLD2_CFLAGS="-I/usr/include/cld2" export CLD2_LIBS="-lcld2" @@ -284,7 +331,7 @@ export CLD2_LIBS="-lcld2" \ --libexecdir=%cyrexecdir \ --with-clamav \ -%if %{with cassandane} +%if %{with cassandane} && 0%{?fedora} `# Needed for Cyrus::FastMail tests to pass` \ --with-cld2 \ %endif @@ -333,7 +380,45 @@ make notifyd/notifytest # CASSANDANE_BUILD %if %{with cassandane} # 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. 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: %ifnarch ppc64le -make -j%{?_smp_build_ncpus} check || exit 1 +LD_LIBRARY_PATH=%buildroot/%_libdir make -j%{?_smp_build_ncpus} check || exit 1 %endif # 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 # 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 # server components, but running it in a mock chroot is rather an exercise. 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 -ln -s /usr/bin/imaptest imaptest/src -ln -s /usr/share/imaptest/tests imaptest/src +ln -sfr ./imaptest-src/src/imaptest imaptest/src +ln -sfr ./imaptest-src/src/tests imaptest/src chown -R cyrus:mail . @@ -527,7 +620,7 @@ chown -R cyrus:mail . # --------------------------------------------------------- exclude=() 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 # intercepts coredumps, which includes our builders. @@ -550,6 +643,9 @@ tests=( Cyrus::SearchSquat.nonincremental Cyrus::SearchSquat.incremental 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