From patchwork Thu Nov 21 12:25:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Abramov X-Patchwork-Id: 70621 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 1F8EB27BBED; Thu, 21 Nov 2024 12:27:20 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 53DD127BBE2 for ; Thu, 21 Nov 2024 12:27:18 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tE6H4-0008Av-1c; Thu, 21 Nov 2024 07:27:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tE6H1-0008AJ-6h for guix-patches@gnu.org; Thu, 21 Nov 2024 07:27:03 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tE6H0-00025S-U8 for guix-patches@gnu.org; Thu, 21 Nov 2024 07:27:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=zdB6oszxWcHGs3/0Xy+10pSZQOcqxowhAntw76GvOGk=; b=G29AIDCwmeyLiFtcjA7me1no3WAFx1YL0NylUWbp+leJAJrK6Q/38nU0vZ3Hz0dNTLFho8Ixy+JDRPSL3RER50AzSKk4+FNyNpeXBdcQ74i88VixUJVveOO/2qNtyta5xZ0KEXWqiDec8/biaoftl/PGyaEu7owt8fThROIR5FMtwK/7aWMU9t9fqPcf1Oo12wdYbLroBiwjW9Zk3eanJn5sXZg5XkIKp52n/mFr2rk5fGZphSSNQBhoP995Zyu4b1UIL+xG4vC7QDfs9CspvB0Brt8qmEOkkS8xEVvoemeKUu59v6yTroXGH/fUnEhbHuaojxtEAjuQ/MyFhl2YhQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tE6H0-00088k-Jz for guix-patches@gnu.org; Thu, 21 Nov 2024 07:27:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#42899] [PATCH v6 1/3] gnu: dovecot: Set moduledir to global directory. Resent-From: Alexey Abramov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 21 Nov 2024 12:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42899 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 42899@debbugs.gnu.org Received: via spool by 42899-submit@debbugs.gnu.org id=B42899.173219197531200 (code B ref 42899); Thu, 21 Nov 2024 12:27:02 +0000 Received: (at 42899) by debbugs.gnu.org; 21 Nov 2024 12:26:15 +0000 Received: from localhost ([127.0.0.1]:49391 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tE6GE-000878-Jr for submit@debbugs.gnu.org; Thu, 21 Nov 2024 07:26:14 -0500 Received: from mail.mmer.org ([178.22.65.174]:58744) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tE6GA-00086V-1I for 42899@debbugs.gnu.org; Thu, 21 Nov 2024 07:26:10 -0500 Received: from mail.mmer.org (localhost [127.0.0.1]) by mail.mmer.org (OpenSMTPD) with ESMTP id c4ef6cd8 for <42899@debbugs.gnu.org>; Thu, 21 Nov 2024 12:26:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=mmer.org; h=from:to :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=dkim; bh=VoS8CVkA2K/TrOTAn9ZaUJBQO J313G0MWiTFwYc26lw=; b=yCIr6FBI+HQfhaEPtki2XU6RIzLhp+TEnPcwJ4+C1 0E7RI8PIbrEWPePcawnXwkqz5+Q6RrIbO66nwy7tcLf+maUfXefmDluIGDyclAfG nLzTC026MTwBesgmDkGJxSCRQGsZQuUmUvOaL9HPMuDWCalXld46la1p5tILi6w4 OI= Received: from delta (142-212-98-95.ftth.glasoperator.nl [95.98.212.142]) by mail.mmer.org (OpenSMTPD) with ESMTPSA id b509f615 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for <42899@debbugs.gnu.org>; Thu, 21 Nov 2024 12:25:59 +0000 (UTC) Date: Thu, 21 Nov 2024 12:25:56 +0000 Message-ID: <20241121122558.8617-2-levenson@mmer.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241121122558.8617-1-levenson@mmer.org> References: <20241121122558.8617-1-levenson@mmer.org> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Alexey Abramov X-ACL-Warn: , Alexey Abramov via Guix-patches X-Patchwork-Original-From: Alexey Abramov via Guix-patches via From: Alexey Abramov Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/packages/mail.scm (dovecot)[arguments]: Add configure-flag to set moduledir. Adjust custom 'install phase to override moduledir so it successfully installs. --- gnu/packages/mail.scm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm index 636961aae79..1c537b70a27 100644 --- a/gnu/packages/mail.scm +++ b/gnu/packages/mail.scm @@ -2141,7 +2141,8 @@ (define-public dovecot `(#:configure-flags '("--sysconfdir=/etc" "--localstatedir=/var" "--with-sqlite" ; not auto-detected - "--with-lucene") ; not auto-detected + "--with-lucene" + "--with-moduledir=/usr/lib/dovecot") ; not auto-detected ;; The -rdynamic linker flag is needed for the backtrace() function to ;; have symbol names rather than just addresses. Dovecot's tests rely ;; on this, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=962630. @@ -2161,9 +2162,12 @@ (define-public dovecot "src/lib-smtp/test-bin/sendmail-success.sh") (("cat") (which "cat"))))) (replace 'install - (lambda* (#:key make-flags #:allow-other-keys) + (lambda* (#:key outputs make-flags #:allow-other-keys) + ;; The .la files don't like having the moduledir moved. + (for-each delete-file (find-files "." "\\.la")) ;; Simple hack to avoid installing a trivial README in /etc. (apply invoke "make" "install" "sysconfdir=/tmp/bogus" + (string-append "moduledir=" (assoc-ref outputs "out") "/lib/dovecot") make-flags)))))) (home-page "https://www.dovecot.org") (synopsis "Secure POP3/IMAP server") From patchwork Thu Nov 21 12:25:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Abramov X-Patchwork-Id: 70622 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 0CE4727BBE2; Thu, 21 Nov 2024 12:27:21 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id C575A27BBEA for ; Thu, 21 Nov 2024 12:27:18 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tE6H7-0008BL-Ae; Thu, 21 Nov 2024 07:27:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tE6H1-0008AR-Ot for guix-patches@gnu.org; Thu, 21 Nov 2024 07:27:04 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tE6H1-00025Y-Ap for guix-patches@gnu.org; Thu, 21 Nov 2024 07:27:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=a5xHvB8njj3PuDKITpFarqQijFGIbRhMIn3757+/kTk=; b=fpUIRVBof2rkMKRXKKWVco51OZm7HBJOG5Dpyekhg+Mm0/AWnNsQUYtM9EGJWWi5N3hLSdEPzdF1FDbrGnlsTPYBeC01EWSr0BwVbTM78oO9HjlOXDGDIG1YTnQQPXabCznD0M74q8VsG7lGpSFYlkeAhPUYI0/ta8l3Hqbvh7KOYhlMjyfKNm16U6r3nWmNMKVdMRjHKmpQ6QTOIcMgq/o7HCpfbiLqIVudjmwxglZG+l30hlXdfXBBxx5ueSqeWg1uqH58LK4R5IL3D5cGojDV3ye5NyEixztRCgu2zWpALPwFYKRCj+prp/bzktMTCUzbpwDOHpYRAbB7zWFPoA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tE6H1-00088r-5T for guix-patches@gnu.org; Thu, 21 Nov 2024 07:27:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#42899] [PATCH v6 2/3] services: dovecot: Provide plugins through a /gnu/store directory. Resent-From: Alexey Abramov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 21 Nov 2024 12:27:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42899 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 42899@debbugs.gnu.org Received: via spool by 42899-submit@debbugs.gnu.org id=B42899.173219197531207 (code B ref 42899); Thu, 21 Nov 2024 12:27:03 +0000 Received: (at 42899) by debbugs.gnu.org; 21 Nov 2024 12:26:15 +0000 Received: from localhost ([127.0.0.1]:49393 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tE6GF-00087B-0u for submit@debbugs.gnu.org; Thu, 21 Nov 2024 07:26:15 -0500 Received: from mail.mmer.org ([178.22.65.174]:58744) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tE6GB-00086V-8A for 42899@debbugs.gnu.org; Thu, 21 Nov 2024 07:26:11 -0500 Received: from mail.mmer.org (localhost [127.0.0.1]) by mail.mmer.org (OpenSMTPD) with ESMTP id 50b2e749 for <42899@debbugs.gnu.org>; Thu, 21 Nov 2024 12:26:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=mmer.org; h=from:to :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=dkim; bh=Wa1UJgFcN2/VJ1aKCZESoFjiY VwR7HJcIggcPg9YXcs=; b=ije43gltcRSDbPPCQvviyUkqZTLbK7lJodcEB7/60 3vkQhq9bSyMrwrcakSZbbts0+RHKOZOi68T2/OEpMWqhQJhUsrPGNA9PtIiC0vIE hDckQ+8oWAD+3Jo4zGtKYWszLm2K2N8tXNG6AJ5t3qXAnlpFdcUr7ve4spwpTGgg UQ= Received: from delta (142-212-98-95.ftth.glasoperator.nl [95.98.212.142]) by mail.mmer.org (OpenSMTPD) with ESMTPSA id ec9b634d (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for <42899@debbugs.gnu.org>; Thu, 21 Nov 2024 12:25:59 +0000 (UTC) Date: Thu, 21 Nov 2024 12:25:57 +0000 Message-ID: <20241121122558.8617-3-levenson@mmer.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241121122558.8617-1-levenson@mmer.org> References: <20241121122558.8617-1-levenson@mmer.org> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Alexey Abramov X-ACL-Warn: , Alexey Abramov via Guix-patches X-Patchwork-Original-From: Alexey Abramov via Guix-patches via From: Alexey Abramov Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/services/mail.scm (package-list?, serialize-package-list): * gnu/services/mail.scm (dovecot-configuration)[extensions]: New field. The field lets you provide a list of dovecot plugins that need to be available during the runtime. A union of the set of modules will be created on the activation time. * gnu/services/mail.scm (opaque-dovecot-configuration)[extensions]: Likewise. * gnu/services/mail.scm (make-dovecot-moduledir): New function. * gnu/services/mail.scm (%dovecot-activation): Add step to compute a set of modules, and provide them over the shared link at /usr/lib/dovecot. * doc/guix.texi (Mail Services)[extension]: Add documentation. Clarify the purpose and usage of the extensions parameter. Add an example showing how to enable Sieve filtering using dovecot-pigeonhole. Better explain the module directory structure and requirements. --- doc/guix.texi | 19 +++++++++++++++++++ gnu/services/mail.scm | 44 +++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 61 insertions(+), 2 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 1c39628ffaf..8ab628af0a4 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -26629,6 +26629,25 @@ Available @code{dovecot-configuration} fields are: The dovecot package. @end deftypevr +@deftypevr {@code{dovecot-configuration} parameter} package-list extensions +A list of additional Dovecot plugin packages to make available at runtime. During +service activation, the @file{lib/dovecot} directory from each specified package +is combined with Dovecot's core modules into a unified module directory. + +For example, to enable Sieve filtering: + +@lisp +(extensions (list dovecot-pigeonhole)) +@end lisp + +Each package in the list must provide its modules at @file{lib/dovecot}, +as this is where @code{make-dovecot-moduledir} expects to find its +extensions. The service combines these directories to create a unified +module structure. + +The default value is an empty list, providing only core Dovecot functionality. +@end deftypevr + @deftypevr {@code{dovecot-configuration} parameter} comma-separated-string-list listen A list of IPs or hosts where to listen for connections. @samp{*} listens on all IPv4 interfaces, @samp{::} listens on all IPv6 diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm index 18b482272c7..ce0a37dc5f9 100644 --- a/gnu/services/mail.scm +++ b/gnu/services/mail.scm @@ -521,11 +521,21 @@ (define (serialize-list-of-namespace-configuration field-name val) (serialize-namespace-configuration field-name val)) val)) +(define (package-list? val) + (and (list? val) (and-map package? val))) +(define (serialize-package-list field-name val) + #f) + (define-configuration dovecot-configuration (dovecot (file-like dovecot) "The dovecot package.") + (extensions + (package-list '()) + "Plugins and extensions to the Dovecot package. Specify a list of dovecot +plugins that needs to be available for dovecot and its modules.") + (listen (comma-separated-string-list '("*" "::")) "A list of IPs or hosts where to listen in for connections. @samp{*} @@ -1109,7 +1119,7 @@ (define-configuration dovecot-configuration @item fcntl Use this if possible. Works with NFS too if lockd is used. @item flock -May not exist in all systems. Doesn't work with NFS. +May not exist in all systems. Doesn't work with NFS. @item lockf May not exist in all systems. Doesn't work with NFS. @end table @@ -1500,6 +1510,11 @@ (define-configuration opaque-dovecot-configuration (file-like dovecot) "The dovecot package.") + (extensions + (package-list '()) + "Plugins and extensions to the Dovecot package. Specify a list of dovecot +plugins that needs to be available for dovecot and its modules.") + (string (string (configuration-missing-field 'opaque-dovecot-configuration 'string)) @@ -1525,6 +1540,21 @@ (define %dovecot-accounts (home-directory "/var/empty") (shell (file-append shadow "/sbin/nologin"))))) +(define (make-dovecot-moduledir packages) + "Return a computed file containing a union of Dovecot module directories from PACKAGES. +Each package's '/lib/dovecot' directory is combined into a single location." + ;; Create a union of the set of modules and dovecot itself. + (with-imported-modules '((guix build union)) + (computed-file + "dovecot-moduledir" + #~(begin + (use-modules (guix build union) (srfi srfi-26)) + + (union-build #$output + (map (cut string-append <> + "/lib/dovecot") + (list #$@packages))))))) + (define (%dovecot-activation config) ;; Activation gexp. (let ((config-str @@ -1535,7 +1565,15 @@ (define (%dovecot-activation config) (with-output-to-string (lambda () (serialize-configuration config - dovecot-configuration-fields))))))) + dovecot-configuration-fields)))))) + (moduledir-directory + (cond + ((opaque-dovecot-configuration? config) + (make-dovecot-moduledir (cons* (opaque-dovecot-configuration-dovecot config) + (opaque-dovecot-configuration-extensions config)))) + (else + (make-dovecot-moduledir (cons* (dovecot-configuration-dovecot config) + (dovecot-configuration-extensions config))))))) (with-imported-modules (source-module-closure '((gnu build activation))) #~(begin (use-modules (guix build utils) (gnu build activation)) @@ -1586,6 +1624,8 @@ (define* (create-self-signed-certificate-if-absent (copy-file #$(plain-file "dovecot.conf" config-str) "/etc/dovecot/dovecot.conf") (mkdir-p/perms "/etc/dovecot/private" user #o700) + (mkdir-p "/usr/lib") + (switch-symlinks "/usr/lib/dovecot" #$moduledir-directory) (create-self-signed-certificate-if-absent #:private-key "/etc/dovecot/private/default.pem" #:public-key "/etc/dovecot/default.pem" From patchwork Thu Nov 21 12:25:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Abramov X-Patchwork-Id: 70623 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 7024A27BBEA; Thu, 21 Nov 2024 12:27:43 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id D48AD27BBE2 for ; Thu, 21 Nov 2024 12:27:42 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tE6HA-0008Bd-B8; Thu, 21 Nov 2024 07:27:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tE6H2-0008AT-5b for guix-patches@gnu.org; Thu, 21 Nov 2024 07:27:04 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tE6H1-00025i-T2 for guix-patches@gnu.org; Thu, 21 Nov 2024 07:27:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=2179E/YnXyM8ZBbGZmXQ1H6HB96ZBNNJdJEakthEzjk=; b=At7mvQls+lJEbBFrDhyZ+V+XMEGv4g0UXBT9qzGCyRwq4S3BSLmhg+r0VOWL+p2D4186mQTm7lq2rLladqEalKDTp8p42SWWVE7TLUYnyRVMM3Jh4VTM9BR3rWTgC/v+aXyVEiLFOgmtedpvp6T74to3iXhaIa01+VChLycVtpGs6aBciGR/HyOAW/sae1mBEJ0hpGde075mvCbHr+iW4EexPudmza/PcUySfLmqSIEeVOMI/OIjAnP5g9KGRVsrApLJ5RONfKa8Pu7oMc/SNkPsn7rTuoXAubdqAsAPCkf56B2dnQuXFuMWZyaxOY+wMp0mRKoKvOyGTnNuICaHmQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tE6H1-000890-O7 for guix-patches@gnu.org; Thu, 21 Nov 2024 07:27:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#42899] [PATCH v6 3/3] tests: dovecot: Add sieve. Resent-From: Alexey Abramov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 21 Nov 2024 12:27:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42899 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 42899@debbugs.gnu.org Received: via spool by 42899-submit@debbugs.gnu.org id=B42899.173219197631214 (code B ref 42899); Thu, 21 Nov 2024 12:27:03 +0000 Received: (at 42899) by debbugs.gnu.org; 21 Nov 2024 12:26:16 +0000 Received: from localhost ([127.0.0.1]:49395 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tE6GF-00087I-Jj for submit@debbugs.gnu.org; Thu, 21 Nov 2024 07:26:16 -0500 Received: from mail.mmer.org ([178.22.65.174]:58744) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tE6GC-00086V-6q for 42899@debbugs.gnu.org; Thu, 21 Nov 2024 07:26:12 -0500 Received: from mail.mmer.org (localhost [127.0.0.1]) by mail.mmer.org (OpenSMTPD) with ESMTP id 3e5fba11 for <42899@debbugs.gnu.org>; Thu, 21 Nov 2024 12:26:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=mmer.org; h=from:to :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=dkim; bh=UbmnPpHQzLSxIROX3fbzqvygM WgSBEOfWq5L0axxHGQ=; b=Lg5HQWL2SY3R1X99BY1xcp+Xlbej1mV5Uv9IT71cf u7jcCMani9QSXhEgjcXuZoG70MJOUUKO8KH1q1DbcIkgQGW5cJSwdHDhYOv6aL7k nfzKpOytDQwIqzDR5jo98HD0i2V2Oww9hE3P46ZvghLCzhgY4DMCSOVhzIazd8LU CY= Received: from delta (142-212-98-95.ftth.glasoperator.nl [95.98.212.142]) by mail.mmer.org (OpenSMTPD) with ESMTPSA id 01f15c1f (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for <42899@debbugs.gnu.org>; Thu, 21 Nov 2024 12:25:59 +0000 (UTC) Date: Thu, 21 Nov 2024 12:25:58 +0000 Message-ID: <20241121122558.8617-4-levenson@mmer.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241121122558.8617-1-levenson@mmer.org> References: <20241121122558.8617-1-levenson@mmer.org> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Alexey Abramov X-ACL-Warn: , Alexey Abramov via Guix-patches X-Patchwork-Original-From: Alexey Abramov via Guix-patches via From: Alexey Abramov Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/tests/mail.scm (%dovecot-os): Add dovecot-pigeonhole and simple imapsieve configuration. * gnu/tests/mail.scm (run-dovecot-test): Define simple sieve script. Add SELECT TESTBOX step to let dovecot properly do mailbox synchronization. --- gnu/tests/mail.scm | 67 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 62 insertions(+), 5 deletions(-) diff --git a/gnu/tests/mail.scm b/gnu/tests/mail.scm index 176e7c1d074..3b498b5b575 100644 --- a/gnu/tests/mail.scm +++ b/gnu/tests/mail.scm @@ -297,10 +297,42 @@ (define %dovecot-os (service dhcp-client-service-type) (service dovecot-service-type (dovecot-configuration + (extensions (list dovecot-pigeonhole)) (disable-plaintext-auth? #f) + ;; Required for sieve! + (postmaster-address "postmaster@komputilo") (ssl? "no") (auth-mechanisms '("anonymous")) (auth-anonymous-username "alice") + (protocols + (list (protocol-configuration + (name "imap") + (mail-plugins '("$mail_plugins" "imap_sieve")) + (imap-metadata? #t)))) + + (plugin-configuration + (plugin-configuration + (entries (list + (cons 'sieve-global "/tmp") + (cons 'sieve-extensions "+editheader") + + (cons 'imapsieve-mailbox1-name "*") + (cons 'imapsieve-mailbox1-causes "APPEND") + ;; Run the script *before* the user scripts + (cons 'imapsieve-mailbox1-before "file:/tmp/main.sieve") + ;; We want to automatically remove original email + (cons 'imapsieve-expunge-discarded "yes") + + (cons 'sieve-trace-debug "yes") + (cons 'sieve-trace-dir "/tmp") + (cons 'sieve-trace-level "tests") + (cons 'sieve-plugins "sieve_imapsieve") + ;; You cannot run scripts anywhere you want + ;; Sieve allows you to only run scripts under + ;; sieve_pipe_bin_dir. + (cons 'sieve-pipe-bin-dir "/tmp") + )))) + (mail-location (string-append "maildir:~/Maildir" ":INBOX=~/Maildir/INBOX" @@ -334,6 +366,18 @@ (define* (message-length message #:key (encoding "iso-8859-1")) (define message "From: test@example.com\n\ Subject: Hello Nice to meet you!") + (define sieve-script + "require \"editheader\";\n +addheader \"X-Sieve-Filtered\" \"Guix\"; +") + ;; Install our sieve script + (marionette-eval + `(begin + (with-output-to-file "/tmp/main.sieve" + (lambda () + (display ,sieve-script)))) + marionette) + (test-runner-current (system-test-runner #$output)) (test-begin "dovecot") @@ -367,6 +411,19 @@ (define message "From: test@example.com\n\ ;; Create a TESTBOX mailbox (write-line "a CREATE TESTBOX" imap) (read-line imap) ;OK + ;; Select mailbox. This is required so that dovecot did + ;; synchronization correctly. + (write-line "a SELECT TESTBOX" imap) + ;; ("* FLAGS (\\Answered \\Flagged \\Deleted \\Seen \\Draft)\r") + ;; ("* OK [PERMANENTFLAGS (\\Answered \\Flagged \\Deleted \\Seen \\Draft \\*)] Flags permitted.\r") + ;; ("* 1 EXISTS\r") + ;; ("* 1 RECENT\r") + ;; ("* OK [UNSEEN 1] First unseen.\r") + ;; ("* OK [UIDVALIDITY 1732177859] UIDs valid\r") + ;; ("* OK [UIDNEXT 3] Predicted next UID\r") + (for-each (lambda (n) + (read-line imap)) + (iota 7)) ;; Append a message to a TESTBOX mailbox (write-line (format #f "a APPEND TESTBOX {~a}" (number->string (message-length message))) @@ -380,18 +437,18 @@ (define message "From: test@example.com\n\ #t)) (test-equal "mail arrived" - message + (string-join (list "X-Sieve-Filtered: Guix" message) "\n") (marionette-eval '(begin (use-modules (ice-9 ftw) (ice-9 match) (rnrs io ports)) - - (let ((TESTBOX/new "/home/alice/Maildir/TESTBOX/new/")) - (match (scandir TESTBOX/new) + ;; XXX: We expect a new email in /cur directory + (let ((TESTBOX/cur "/home/alice/Maildir/TESTBOX/cur/")) + (match (scandir TESTBOX/cur) (("." ".." message-file) (call-with-input-file - (string-append TESTBOX/new message-file) + (string-append TESTBOX/cur message-file) get-string-all))))) marionette))