From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id 0GJpJ6hms2QTuwAASxT56A (envelope-from ) for ; Sun, 16 Jul 2023 05:40:24 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id UEunJqhms2RBKgAAG6o9tA (envelope-from ) for ; Sun, 16 Jul 2023 05:40:24 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 2C192526A1 for ; Sun, 16 Jul 2023 05:40:24 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b=UzsVCsVq; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1689478824; a=rsa-sha256; cv=none; b=OFym980xdSjSQDAWy1UOtE7nEsqCVNmCJCC3LRXb8TdoXhwsgVngpmkAQqJbE4oepzax7Q GFvqpDtSvKKpsBswNfpbBK+Q+8L6R+7wHZX9/GHbUXHV2H9bFFhyuTrVRP0Um+J4ziWVFB BMnjnNzYabExJulgPdr+oRX2+xsxRRUiREWpmVOmFoufkh9cRCLWn1mOoxE97wu4f4kS9q wz4hBsphTePXtTXmQ/w1FZ7T59KZ329dGjT1p1hVKxxaOCz99+D+MwGQ90sTSREqtMVz+k 8bg1holkkrhRnjRBYGqAjEI1M7qhXzr6s7hA22x3Yf57ESHtCC2PaOmdZ7IdeQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b=UzsVCsVq; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1689478824; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=JUYZKhL9o48FI/kXgJftiNWvgrQI+jq7smJ137lFoiE=; b=jQkfHlDn35DCE3oLH5GMaGhQK6vuu01sJmEZQOUZRsiAFmJtgX6jZlHoispsJkuuVZ9MGm Z1npN5oFZgCW3E85/eX3k/z0CgL3iZd8SW5qR9+TsX4BT8X8V+dEbkulE4NLnEMzsHIgIJ KVqqRTRe1Ep6ECIbEthb8Lx9FGJtB2iO9Z9YZFnyhDvnIJSrAnSrsTURiEsyb+RXFDgrtz 3KrV3eMvlcLuuAz6sSJFQc185kGqBJvyZoOFFhi+GOWCwjhqMua4+WW1BEtHNZZwHKAp05 VG8e6RC2dvGpp66wQp7X2RtHw4MC7jiYloT+m8aCe2E4P/26SukYisTKpVtKPQ== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKsc8-0002Pm-Vv; Sat, 15 Jul 2023 23:40:05 -0400 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 1qKsc7-0002PQ-Gv for guix-patches@gnu.org; Sat, 15 Jul 2023 23:40:03 -0400 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 1qKsc7-0004D2-7w for guix-patches@gnu.org; Sat, 15 Jul 2023 23:40:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qKsc6-0008Tr-K0 for guix-patches@gnu.org; Sat, 15 Jul 2023 23:40:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63802] [mumi PATCH 0/3] Use consolidated X-Debbugs-Cc header Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 16 Jul 2023 03:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63802 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Arun Isaac Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , 63802@debbugs.gnu.org Received: via spool by 63802-submit@debbugs.gnu.org id=B63802.168947879932585 (code B ref 63802); Sun, 16 Jul 2023 03:40:02 +0000 Received: (at 63802) by debbugs.gnu.org; 16 Jul 2023 03:39:59 +0000 Received: from localhost ([127.0.0.1]:46316 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKsc2-0008TU-OQ for submit@debbugs.gnu.org; Sat, 15 Jul 2023 23:39:59 -0400 Received: from mail-qv1-xf2f.google.com ([2607:f8b0:4864:20::f2f]:44034) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKsbw-0008TF-Rs for 63802@debbugs.gnu.org; Sat, 15 Jul 2023 23:39:57 -0400 Received: by mail-qv1-xf2f.google.com with SMTP id 6a1803df08f44-635e5b06aaeso17884936d6.0 for <63802@debbugs.gnu.org>; Sat, 15 Jul 2023 20:39:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689478787; x=1692070787; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=JUYZKhL9o48FI/kXgJftiNWvgrQI+jq7smJ137lFoiE=; b=UzsVCsVqIUJAUnsgtcqfxA0ab2fcqT2Qo7TdKRV3XQKUBqDMUFDgGS4EuF2yt/1Vh4 DzTvPQeUb+PHJa90gnMHj4IhnDJQOUSAcn6RbUYJ1bjhtRW1VCn4FwqyLuRs15cJnpDC Ad/caP6tSRWWSR+zGeHpRwcU4IH1ZP2ElYIa6pdtem4pYULra5JT6GeKbJj/NdctSXfW cWgKRJr9TC1EqFO52PLnypo2qqdHR61FvzqSsjATzR67PRzas0OYjXG72GnxZ5+sVW9T EntfHlivFe/QyQ4eMCW/CmLB7s7FBjjt1evZUJ0mbIqgNUMY2GBeAomjhl+Mt7uTW2kF qekA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689478787; x=1692070787; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=JUYZKhL9o48FI/kXgJftiNWvgrQI+jq7smJ137lFoiE=; b=J/0gPBgzMhXuSPtItjy2nhNGGglSYR75+V/2nLSuVgNaEk3N3RHHN9cwdBeZqSHPpt Y4Ya0JFRP3kP7DANanYWdK5i6Ioq5oDA3oFxlgUlCpiHabJLTlQFki9bveO10qQsk43F NHJZ7lcsBz1q5QoiIAVs+YsplGorkDPEcC6tahcRDF9ZLlj/PC4PSqhm3H4REf/FTl70 9ije755RwywrPxiJPUhkYNn1OiWYWCORMh7euMBjUipd0SEiuxRXj0ck8oWajuGcmwcM Lyn0WDc1Tp/Yo1eCX3KFul8vIPnj2z1feijj5YXKt6YsbFEc5y8Ixu9yIO+GMWWj/tia Dg0g== X-Gm-Message-State: ABy/qLbrhlJEFIP2+8MhcB0Lc0WCACHK6uUZlS8//kI0D/PGqzDYnBEz 7piBcvghOX9Fc97oCil4yW8= X-Google-Smtp-Source: APBJJlGxznfD26FLpJVOubxk1/dyJH7oFi9h6kwHuSOvwtcrv8tm8G3/BvitLeenY07PqBrzwK2Wmw== X-Received: by 2002:a05:620a:191a:b0:767:4016:29f3 with SMTP id bj26-20020a05620a191a00b00767401629f3mr9415434qkb.58.1689478786839; Sat, 15 Jul 2023 20:39:46 -0700 (PDT) Received: from hurd (dsl-205-151-56-16.b2b2c.ca. [205.151.56.16]) by smtp.gmail.com with ESMTPSA id w12-20020a05620a128c00b00767e9662d4bsm4018479qki.115.2023.07.15.20.39.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 20:39:46 -0700 (PDT) From: Maxim Cournoyer References: <20230608171453.14788-1-arunisaac@systemreboot.net> <20230608171453.14788-2-arunisaac@systemreboot.net> Date: Sat, 15 Jul 2023 23:39:44 -0400 In-Reply-To: <20230608171453.14788-2-arunisaac@systemreboot.net> (Arun Isaac's message of "Thu, 8 Jun 2023 18:14:51 +0100") Message-ID: <87351ov81r.fsf_-_@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Queue-Id: 2C192526A1 X-Migadu-Scanner: mx1.migadu.com X-Migadu-Spam-Score: 2.85 X-Spam-Score: 2.85 X-TUID: Kg1jCPN9XoZj Hello, Arun Isaac writes: > * mumi/client.scm: Import (rnrs exceptions). > (git-send-email-headers): New public function. > (split-cc): New function. nitpick: I guess these should be called 'procedures', which seems to be the preferred term in Scheme (ironically enough for a functional language? eh!). CC'ing Ludovic in case they have some thoughts on the matter, as I think they were the one originally teaching me that. If that was just me, intuitively I'd use 'procedure' for something involving side effects while 'function' as something taking an input and always returning the same output, without side effects (pure function), but that doesn't seem to be the prevalent style in the Scheme community. > * scripts/mumi.in: Add git-send-email-headers subcommand. > * tests/client.scm (split-cc): New variable. > ("split Cc field"): New test. > --- > mumi/client.scm | 52 +++++++++++++++++++++++++++++++++++++++++++++++- > scripts/mumi.in | 2 ++ > tests/client.scm | 8 ++++++++ > 3 files changed, 61 insertions(+), 1 deletion(-) > > diff --git a/mumi/client.scm b/mumi/client.scm > index c30429d..b89e608 100644 > --- a/mumi/client.scm > +++ b/mumi/client.scm > @@ -17,6 +17,7 @@ > ;;; along with mumi. If not, see . > > (define-module (mumi client) > + #:use-module (rnrs exceptions) > #:use-module (rnrs io ports) > #:use-module (srfi srfi-1) > #:use-module (srfi srfi-19) > @@ -38,7 +39,9 @@ > print-current-issue > set-current-issue! > clear-current-issue! > - send-email)) > + send-email > + git-send-email-headers > + compose)) I think you've exported 'compose' erroneously here. > (define (git-top-level) > "Return the top-level directory of the current git repository." > @@ -229,6 +232,13 @@ arguments." > name) > " <" address ">")) > > +(define (split-cc cc) > + "Split CC into a list of email addresses." > + (map (lambda (address) > + (serialize-email-address (assq-ref address 'name) > + (assq-ref address 'address))) > + (assq-ref (parse-email-headers (string-append "Cc: " cc "\n")) > + 'cc))) > > (define* (git-send-email to patches #:optional (options '())) > "Send PATCHES using git send-email to the TO address with > @@ -311,3 +321,43 @@ ISSUE-NUMBER." > "@" > (client-config 'debbugs-host)) > other-patches))))) > + > +(define (git-send-email-headers patch) > + "Print send-email headers for PATCH." > + (let* (;; Compute headers if configured in git config. > + (header-command > + (guard (ex (#t #f)) > + (call-with-input-pipe* (list "git" "config" "sendemail.headerCmd") > + get-line))) Ain't this guard equivalent to '(false-if-exception (call-with-input-pipe* ...))' ? I find the later more readable if yes, but: does call-with-input-pipe* raise an exception when git is available but 'sendemail.headerCmd' not set, thus exiting with status 1? I wasn't able to find its documentation in the Guile Reference manual. Otherwise you'd get header-command set to the empty string, which seems like it'd be a problem... > + (headers > + (if header-command > + (call-with-input-pipe (string-append header-command " " patch) ^ ... here. Also, why the mixed use of 'call-with-input-pipe*' and 'call-with-input-pipe'? I'd stick with the former. > + get-string-all) > + "")) > + (external-x-debbugs-cc > + (cond > + ((assq-ref (parse-email-headers (string-append headers "\n")) > + 'x-debbugs-cc) > + => split-cc) > + (else '()))) > + ;; Fetch Cc addresses for current issue. > + (x-debbugs-cc > + (cond > + ((assq-ref (reply-email-headers (current-issue-number)) > + 'cc) > + => split-cc) > + (else '())))) > + ;; Print X-Debbugs-Cc header. > + (display "X-Debbugs-Cc: ") > + (display (string-join (delete-duplicates > + (append x-debbugs-cc external-x-debbugs-cc)) > + ", ")) > + (newline) > + ;; Print headers other than X-Debbugs-Cc. > + ;; TODO: RFC5322 headers are not restricted to a single > + ;; line. "Folded" multi-line headers are allowed. Support them. > + (for-each (lambda (line) > + (unless (string-prefix-ci? "X-Debbugs-Cc:" line) > + (display line) > + (newline))) > + (string-split headers #\newline)))) > diff --git a/scripts/mumi.in b/scripts/mumi.in > index 2295328..8fb7cd4 100644 > --- a/scripts/mumi.in > +++ b/scripts/mumi.in > @@ -163,6 +163,8 @@ > (client:clear-current-issue!)) > (("send-email" . patches) > (client:send-email patches)) > + (("git-send-email-headers" patch) > + (client:git-send-email-headers patch)) > (("mailer" . rest) > (let* ((opts (parse-options rest)) > (sender (assoc-ref opts 'sender)) > diff --git a/tests/client.scm b/tests/client.scm > index 2b2c1be..ced573b 100644 > --- a/tests/client.scm > +++ b/tests/client.scm > @@ -68,6 +68,9 @@ called with." > (define serialize-email-address > (@@ (mumi client) serialize-email-address)) > > +(define split-cc > + (@@ (mumi client) split-cc)) > + > (test-begin "client") > > (test-equal "serialize email address" > @@ -78,6 +81,11 @@ called with." > "\"Bar, Foo\" " > (serialize-email-address "Bar, Foo" "foobar@example.com")) > > +(test-equal "split Cc field" > + (list "Foo " > + "\"Bar, Foo\" ") > + (split-cc "Foo , \"Bar, Foo\" ")) > + > (test-equal "send patches to new issue" > '(("git" "send-email" "--to=foo@patches.com" "foo.patch") > ("git" "send-email" "--to=12345@example.com" "bar.patch" "foobar.patch")) The rest LGTM. -- Thanks, Maxim