From patchwork Sun Nov 14 20:46:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 34483 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 63CBF27BBE3; Sun, 14 Nov 2021 20:48:15 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 7CAFE27BBE1 for ; Sun, 14 Nov 2021 20:48:14 +0000 (GMT) Received: from localhost ([::1]:54370 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mmMQ9-0000rh-Mz for patchwork@mira.cbaines.net; Sun, 14 Nov 2021 15:48:13 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35984) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmMPy-0000iA-AK for guix-patches@gnu.org; Sun, 14 Nov 2021 15:48:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:40316) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mmMPy-0002yW-1T for guix-patches@gnu.org; Sun, 14 Nov 2021 15:48:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mmMPx-0007ff-VU; Sun, 14 Nov 2021 15:48:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#51853] [PATCH 1/2] gnu: sendgmail: Rename package to match command. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: philip+debbugs.cc@philipmcgrath.com, guix-patches@gnu.org Resent-Date: Sun, 14 Nov 2021 20:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51853 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 51853@debbugs.gnu.org Cc: Philip McGrath X-Debbugs-Original-Xcc: Philip McGrath Received: via spool by 51853-submit@debbugs.gnu.org id=B51853.163692282329289 (code B ref 51853); Sun, 14 Nov 2021 20:48:01 +0000 Received: (at 51853) by debbugs.gnu.org; 14 Nov 2021 20:47:03 +0000 Received: from localhost ([127.0.0.1]:51859 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mmMOw-0007bz-Cf for submit@debbugs.gnu.org; Sun, 14 Nov 2021 15:47:03 -0500 Received: from mail-qv1-f47.google.com ([209.85.219.47]:43535) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mmMOu-0007bg-4e for 51853@debbugs.gnu.org; Sun, 14 Nov 2021 15:46:56 -0500 Received: by mail-qv1-f47.google.com with SMTP id j9so9992808qvm.10 for <51853@debbugs.gnu.org>; Sun, 14 Nov 2021 12:46:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=philipmcgrath.com; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=ZhN+6u0xQ/3Z6MAldyakNKjZoSVPPeeofgWJj6P5f1A=; b=NacpPQEHlX6w+xlriqaLXdvHkM3YmvG7vDm1K4XU4vf2eIathKltGul5HfnHE/D422 Tn0vHfX90knhQ5ahTlW8EUK+/cPcfQkhvVgA6/FWzB5pp80xduesaZMM3H1q/WvHl+Vh p4eG+SeGFKqmkFBxzNywJVQBL8hEVuvzcE0/bReh7ZOiEUZWVH1TMpN3ntEuJ6FK4liA HWg7OCPQ6nzKH1yEGe3gOHXwysjujuWQv27PCEutpcCvgC9JZI/0uJmv0szdAQU1l5ac aukd0+U+3Ue7seIDx3Dldg3ZM6oYV45KlR4NZJuMjwXZO6QkFvPkISrp0CjqLTkX0sk6 j+XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZhN+6u0xQ/3Z6MAldyakNKjZoSVPPeeofgWJj6P5f1A=; b=eaJ/vfFMgBsDJeU3t4E2b2RcgZn71/Irfdfx6tVoT8A0z3SzTQfkTHtOpao75cxUDH 15Rxhxvs+1nwZpwlCAPlCVXR9HlaijzLHuxkm2kpNr1qa6jZiVffhJ6TjBxctUOS7ZlR h5C2qoa4bvaXDCvHFy6Iof/NNxQnb2FoEZqyM+cyim+Ww9xKWCqYfiz6QRs0FExyebfC hBIr4elS/yDvNiw+Cd6d0F8HHkXiU5JY0ZmzBmZYDn9K+sgg8IOR2tyb+c4r31S8z2tD YMlgOZa2pjE28mxLcbIId9l7v3mzQ1tvhhyGXoJ6q/EY0G3gtKwxu2l7g9Jf7oN0QLOU e4JA== X-Gm-Message-State: AOAM531ut6PCg+NjG0eRTgHiM9ah9zmpGe/0B3Bz2/9xznfVJ6z8SMV/ njcPH3WKaYMOJ2VFq6z9K+WK8bh8+OpjWhJ8 X-Google-Smtp-Source: ABdhPJxViJ6rzzBzcFz2rlOiDqm5bJ8qi8mMQh2sh7E1YcvSvh5LT8apTXJDMs1v/0IK6i6lVcwiRQ== X-Received: by 2002:a05:6214:250d:: with SMTP id gf13mr31226422qvb.39.1636922810474; Sun, 14 Nov 2021 12:46:50 -0800 (PST) Received: from localhost (c-73-125-89-242.hsd1.fl.comcast.net. [73.125.89.242]) by smtp.gmail.com with ESMTPSA id g21sm5383343qtb.62.2021.11.14.12.46.50 for <51853@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 14 Nov 2021 12:46:50 -0800 (PST) From: Philip McGrath Date: Sun, 14 Nov 2021 15:46:48 -0500 Message-Id: <20211114204649.94670-1-philip@philipmcgrath.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211114203614.89441-1-philip@philipmcgrath.com> References: <20211114203614.89441-1-philip@philipmcgrath.com> 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: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches Suggested by Ludo’ in . * gnu/packages/golang.scm (go-github-com-google-gmail-oauth2-tools-go-sendgmail): Move to ... * gnu/packages/mail.scm (sendgmail): ... this variable. --- gnu/packages/golang.scm | 36 +----------------------------------- gnu/packages/mail.scm | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 35 deletions(-) diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm index cc2a4ebc16..aaf6194460 100644 --- a/gnu/packages/golang.scm +++ b/gnu/packages/golang.scm @@ -31,6 +31,7 @@ ;;; Copyright © 2021 jgart ;;; Copyright © 2021 Bonface Munyoki Kilyungi ;;; Copyright © 2021 Chadwain Holness +;;; Copyright © 2021 Philip McGrath ;;; ;;; This file is part of GNU Guix. ;;; @@ -3036,41 +3037,6 @@ (define-public go-cloud-google-com-go-compute-metadata API service accounts for Go.") (license license:asl2.0))) -(define-public go-github-com-google-gmail-oauth2-tools-go-sendgmail - (let ((commit "e3229155a4037267ce40f1a3a681f53221aa4d8d") - (revision "0")) - (package - (name "go-github-com-google-gmail-oauth2-tools-go-sendgmail") - (version (git-version "0.0.0" revision commit)) - (source - (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/google/gmail-oauth2-tools") - (commit commit))) - (file-name (git-file-name name version)) - (sha256 - (base32 - "1cxpkiaajhq1gjsg47r2b5xgck0r63pvkyrkm7af8c8dw7fyn64f")))) - (propagated-inputs - `(("go-golang-org-x-oauth2" ,go-golang-org-x-oauth2) - ("go-cloud-google-com-go-compute-metadata" - ,go-cloud-google-com-go-compute-metadata))) - (build-system go-build-system) - (arguments - '(#:unpack-path "github.com/google/gmail-oauth2-tools" - #:import-path "github.com/google/gmail-oauth2-tools/go/sendgmail")) - (home-page - "https://github.com/google/gmail-oauth2-tools/tree/master/go/sendgmail") - (synopsis - "Sendmail-compatible tool for using Gmail with @code{git send-email}") - (description - "The @command{sendgmail} command provides a minimal sendmail-compatible -front-end that connects to Gmail using OAuth2. It is specifically designed -for use with @code{git send-email}. The command needs a Gmail API key to -function.") - (license license:asl2.0)))) - (define-public go-github-com-google-cadvisor (let ((commit "2ed7198f77395ee9a172878a0a7ab92ab59a2cfd") (revision "0")) diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm index f00e8ac7b3..4ee878d4c6 100644 --- a/gnu/packages/mail.scm +++ b/gnu/packages/mail.scm @@ -43,6 +43,7 @@ ;;; Copyright © 2021 Xinglu Chen ;;; Copyright © 2021 Benoit Joly ;;; Copyright © 2021 Morgan Smith +;;; Copyright © 2021 Philip McGrath ;;; ;;; This file is part of GNU Guix. ;;; @@ -4603,3 +4604,38 @@ (define-public rss2email ;; GPL version 2 or 3. NOT 2+. (license (list license:gpl2 license:gpl3)))) + +(define-public sendgmail + (let ((commit "e3229155a4037267ce40f1a3a681f53221aa4d8d") + (revision "0")) + (package + (name "sendgmail") + (version (git-version "0.0.0" revision commit)) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/google/gmail-oauth2-tools") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1cxpkiaajhq1gjsg47r2b5xgck0r63pvkyrkm7af8c8dw7fyn64f")))) + (propagated-inputs + `(("go-golang-org-x-oauth2" ,go-golang-org-x-oauth2) + ("go-cloud-google-com-go-compute-metadata" + ,go-cloud-google-com-go-compute-metadata))) + (build-system go-build-system) + (arguments + '(#:unpack-path "github.com/google/gmail-oauth2-tools" + #:import-path "github.com/google/gmail-oauth2-tools/go/sendgmail")) + (home-page + "https://github.com/google/gmail-oauth2-tools/tree/master/go/sendgmail") + (synopsis + "Sendmail-compatible tool for using Gmail with @code{git send-email}") + (description + "The @command{sendgmail} command provides a minimal sendmail-compatible +front-end that connects to Gmail using OAuth2. It is specifically designed +for use with @code{git send-email}. The command needs a Gmail API key to +function.") + (license license:asl2.0)))) From patchwork Sun Nov 14 20:46:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 34482 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 D9F8627BBE3; Sun, 14 Nov 2021 20:48:09 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 2BAF227BBE1 for ; Sun, 14 Nov 2021 20:48:09 +0000 (GMT) Received: from localhost ([::1]:54152 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mmMQ4-0000ig-CW for patchwork@mira.cbaines.net; Sun, 14 Nov 2021 15:48:08 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35986) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmMPy-0000iI-M0 for guix-patches@gnu.org; Sun, 14 Nov 2021 15:48:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:40317) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mmMPy-0002yc-Dc for guix-patches@gnu.org; Sun, 14 Nov 2021 15:48:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mmMPy-0007fo-Ch; Sun, 14 Nov 2021 15:48:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#51853] [PATCH 2/2] gnu: sendgmail: Don't limit domain name of sender. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: philip+debbugs.cc@philipmcgrath.com, guix-patches@gnu.org Resent-Date: Sun, 14 Nov 2021 20:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51853 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 51853@debbugs.gnu.org Cc: Philip McGrath X-Debbugs-Original-Xcc: Philip McGrath Received: via spool by 51853-submit@debbugs.gnu.org id=B51853.163692282329297 (code B ref 51853); Sun, 14 Nov 2021 20:48:02 +0000 Received: (at 51853) by debbugs.gnu.org; 14 Nov 2021 20:47:03 +0000 Received: from localhost ([127.0.0.1]:51861 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mmMP1-0007cM-5z for submit@debbugs.gnu.org; Sun, 14 Nov 2021 15:47:03 -0500 Received: from mail-qv1-f47.google.com ([209.85.219.47]:42650) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mmMOu-0007bi-TM for 51853@debbugs.gnu.org; Sun, 14 Nov 2021 15:46:57 -0500 Received: by mail-qv1-f47.google.com with SMTP id b17so9994428qvl.9 for <51853@debbugs.gnu.org>; Sun, 14 Nov 2021 12:46:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=philipmcgrath.com; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=m+1ayIRbtUb804p3M5Q4PNAMLm5pkOL/1FSTeaqRACA=; b=JP7F9BUguP3Qk8gTWkEB45/RG2myGQr1ChQAqLVNeZYBeaLhR9dOtdUY6OIAAG1mTu +hu6AdbPuzkpG7nHkd5z48GD6BdJvzvk0MidyFTypzSFQnHfLWjzhCDy+NtkEeNcF3bi cXBSKVBlgmiyrdISjFBzbBC6nsoK6b1XQNpnrLTBtFFYf4tO9xOlm/hbDhJ37OqLzCOM tucU/u26eDoztN63lxGFWoO+Q3uAPJ8UoPX4o6O3s6ap76UfIXkOasV3YMY+/zX3wWk/ tfRXHPg/69/K0b4CAMDURlqUxWcknN12bBekqodAI5BSyDRvKlanMVwioA7iYZKgVzrj pePA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=m+1ayIRbtUb804p3M5Q4PNAMLm5pkOL/1FSTeaqRACA=; b=LGnY0ruAcd2jco+Ke/E393p6qrVTDbCdP1NX8BhReqmUW3aAyQKTpUisH3c8/CR77O S850VEXhE9Qnd5K5bZWJhSyzADC6VfmRykmygKJfPCnKSQ1O+JNUScNX9z8d8xn2f5oj l4ocuKk8jrh6Qcr3OcZRI7yNRvu+nq3wuTfuO/7xQndLKwsDCrYa2txvEXx0SXrk8R92 KkBsoJB7OEQFZCDxk6JTk3Yo2MrSxFu5Z6qe6qef+IxKtrIhfe/Aa/F3OnXdyzFKCcWy xJnUG1ElrN+6CUh7kihL6jafDeIt7/8sFpDn5jqmew3O5XLp1WGEzyLewXizRwlYCjgz orkQ== X-Gm-Message-State: AOAM5329zTzK+/lICQ9wxCkx8nFB3mpnkXPAd7vXVgaA4uqG1+/wPY7D DaFtUDHJZjfx41lbCOHtLR52LpwD6uVUl3gE X-Google-Smtp-Source: ABdhPJz+junmJkC22TmpViP0jcK/8oCPO23LyQs4DtUkyO0rC1RtuJMekPLW6IhJEKPRS0AyHFiWXA== X-Received: by 2002:a0c:e708:: with SMTP id d8mr31797643qvn.62.1636922811228; Sun, 14 Nov 2021 12:46:51 -0800 (PST) Received: from localhost (c-73-125-89-242.hsd1.fl.comcast.net. [73.125.89.242]) by smtp.gmail.com with ESMTPSA id x125sm5674225qkd.8.2021.11.14.12.46.50 for <51853@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 14 Nov 2021 12:46:51 -0800 (PST) From: Philip McGrath Date: Sun, 14 Nov 2021 15:46:49 -0500 Message-Id: <20211114204649.94670-2-philip@philipmcgrath.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211114204649.94670-1-philip@philipmcgrath.com> References: <20211114203614.89441-1-philip@philipmcgrath.com> <20211114204649.94670-1-philip@philipmcgrath.com> 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: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches There are three open pull requests adding this functionality: - https://github.com/google/gmail-oauth2-tools/pull/17 (October 2019) - https://github.com/google/gmail-oauth2-tools/pull/26 (May 2020) - https://github.com/google/gmail-oauth2-tools/pull/37 (May 2021) (The patch here is identical to #26, so I just closed this one.) Meanwhile, the most recent commit to the upstream repository was in May 2019: that was the commit that first added `sendgmail`. This commit adjusts Guix's `sendgmail`, following Postel's advice, to make the command "liberal in its receiving behavior" (RFC 760): it always accepts email addresses with any domain name, as in #26, and it accepts (and ignores) the `-gsuite` flag used in #17. * gnu/packages/patches/sendgmail-remove-domain-restriction.patch: New file. This is the patch from #26. * gnu/packages/patches/sendgmail-accept-ignored-gsuite-flag.patch: New file, based on #17. * gnu/local.mk (dist_patch_DATA): Add the new patches. * gnu/packages/mail.scm (sendgmail)[source]: Apply the new patches. Increment the "revision" argument to `git-version` from 0 to 1. --- In case you are asking, "What does it mean for send*G*mail to support non-`@gmail.com` email addresses?", here's some more context. As part of the product variously known as Google Apps for Your Domain, GSuite, and, most recently, Google Workspace, Google offers email hosting for arbitrary domains (e.g. for work or schol, or from the "legacy free [gratis] edition"). The Gmail API works for all of these domains, but the upstream version of the `sendgmail` command checks that the email address passed as `-sender=` ends with "@gmail.com". The first fork to remove this limitation seems to have been by Flameeyes (Diego Elio Pettenò), which added an optional `-gsuite` flag to disable the check, and thereby enable alternate domains. This approach has a number of nice features. (I tried it for a while, and I've sent patches to Guix with this fork.) In particular, by making alternative domains opt-in, it preserves the nice error message for people who have merely made a typo. The main disadvantage is that, in the time since the pull request was opened, the product has been renamed, so it seems unlikely that the `-gsuite` flag will be merged upstream. The history of this product's name also suggests that a `-googleworkspace` flag might suffer the same fate eventually. A second approach was taken by Tamas K Lengyel in , which simply removes the "@gmail.com" check altogether. On the other hand, this fork's `sendgmail` fails with a usage note if it is passed a `-gsuite` flag. (Later, I came up with exactly the same patch; I only realized after I opened that of course I wasn't the first to want this feature.) Usually I want to err on the side of validation, but I've come to think that being permissive is the right trade-off in this case. The usual way of using `sendgmail` is as a backend to `git send-email`, and, in that case, you aren't supplying `-sender=` interactively: you'll set it up once with `git config` when you get your API token, and then you'll forget about it until you set up a new machine (or accidently remove the root that was protecting your command from `guix gc` ...). Ultimately, the standard for whether a `-sender=` is valid is whether the server you're talking to will accept it. If the server's error message does turn out to be slightly less good, people who are using `git send-email` seem likely to be able to cope. In that spirit, this commit applies Tamas's patch, but also adds another patch to gracefully accept and ignore the `-gsuite` flag from Flameeyes's fork. If your configuration or script worked with any of these `sendgmail` forks, it should also work with the revised Guix package. P.S. I've put the two patches to `sendgmail` in a Git repository at https://github.com/LiberalArtist/gmail-oauth2-tools/tree/guix-issue-51853 to make it easier to see the changes in context. ~Philip gnu/local.mk | 2 + gnu/packages/mail.scm | 11 +++++- ...sendgmail-accept-ignored-gsuite-flag.patch | 39 +++++++++++++++++++ .../sendgmail-remove-domain-restriction.patch | 34 ++++++++++++++++ 4 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 gnu/packages/patches/sendgmail-accept-ignored-gsuite-flag.patch create mode 100644 gnu/packages/patches/sendgmail-remove-domain-restriction.patch diff --git a/gnu/local.mk b/gnu/local.mk index 208875754b..37ad7bf7d7 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1772,6 +1772,8 @@ dist_patch_DATA = \ %D%/packages/patches/screen-hurd-path-max.patch \ %D%/packages/patches/sdl-libx11-1.6.patch \ %D%/packages/patches/seed-webkit.patch \ + %D%/packages/patches/sendgmail-accept-ignored-gsuite-flag.patch \ + %D%/packages/patches/sendgmail-remove-domain-restriction.patch \ %D%/packages/patches/seq24-rename-mutex.patch \ %D%/packages/patches/serf-python3.patch \ %D%/packages/patches/shakespeare-spl-fix-grammar.patch \ diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm index 4ee878d4c6..f29044608f 100644 --- a/gnu/packages/mail.scm +++ b/gnu/packages/mail.scm @@ -4607,7 +4607,7 @@ (define-public rss2email (define-public sendgmail (let ((commit "e3229155a4037267ce40f1a3a681f53221aa4d8d") - (revision "0")) + (revision "1")) (package (name "sendgmail") (version (git-version "0.0.0" revision commit)) @@ -4618,6 +4618,9 @@ (define-public sendgmail (url "https://github.com/google/gmail-oauth2-tools") (commit commit))) (file-name (git-file-name name version)) + (patches (search-patches + "sendgmail-remove-domain-restriction.patch" + "sendgmail-accept-ignored-gsuite-flag.patch")) (sha256 (base32 "1cxpkiaajhq1gjsg47r2b5xgck0r63pvkyrkm7af8c8dw7fyn64f")))) @@ -4637,5 +4640,9 @@ (define-public sendgmail "The @command{sendgmail} command provides a minimal sendmail-compatible front-end that connects to Gmail using OAuth2. It is specifically designed for use with @code{git send-email}. The command needs a Gmail API key to -function.") +function. + +Guix's version of @command{sendgmail} has been patched for compatibility with +all known forks, including support for non-@code{@@gmail.com} email +addresses.") (license license:asl2.0)))) diff --git a/gnu/packages/patches/sendgmail-accept-ignored-gsuite-flag.patch b/gnu/packages/patches/sendgmail-accept-ignored-gsuite-flag.patch new file mode 100644 index 0000000000..8405ff4e42 --- /dev/null +++ b/gnu/packages/patches/sendgmail-accept-ignored-gsuite-flag.patch @@ -0,0 +1,39 @@ +From 854490dc4a8a6a661b4750730c3ff749519f6e36 Mon Sep 17 00:00:00 2001 +From: Philip McGrath +Date: Sun, 14 Nov 2021 10:14:24 -0500 +Subject: [PATCH] sendgmail: accept and ignore a "-gsuite" flag + +Accepting a "-gsuite" flag provides compatability with +https://github.com/Flameeyes/gmail-oauth2-tools/commit/eabb456 +so users do not have to change their scripts or config files. + +Full hash of original: eabb45608ff4ce04045ff4ea92d05450e789ac81 + +Related to https://github.com/google/gmail-oauth2-tools/pull/17 +--- + go/sendgmail/main.go | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/go/sendgmail/main.go b/go/sendgmail/main.go +index 405aa1b..5cfd0c1 100644 +--- a/go/sendgmail/main.go ++++ b/go/sendgmail/main.go +@@ -40,6 +40,7 @@ var ( + setUp bool + dummyF string + dummyI bool ++ gsuite bool + ) + + func init() { +@@ -47,6 +48,7 @@ func init() { + flag.BoolVar(&setUp, "setup", false, "If true, sendgmail sets up the sender's OAuth2 token and then exits.") + flag.StringVar(&dummyF, "f", "", "Dummy flag for compatibility with sendmail.") + flag.BoolVar(&dummyI, "i", true, "Dummy flag for compatibility with sendmail.") ++ flag.BoolVar(&gsuite, "gsuite", true, "Dummy flag for compatibility with other forks of sendgmail.") + } + + func main() { +-- +2.32.0 + diff --git a/gnu/packages/patches/sendgmail-remove-domain-restriction.patch b/gnu/packages/patches/sendgmail-remove-domain-restriction.patch new file mode 100644 index 0000000000..d23af33375 --- /dev/null +++ b/gnu/packages/patches/sendgmail-remove-domain-restriction.patch @@ -0,0 +1,34 @@ +From a5ecd1b2302d0def2f6f8349747022a615a9f017 Mon Sep 17 00:00:00 2001 +From: Tamas K Lengyel +Date: Tue, 26 May 2020 13:27:50 -0600 +Subject: [PATCH] Don't limit to email with @gmail.com + +--- + go/sendgmail/main.go | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/go/sendgmail/main.go b/go/sendgmail/main.go +index b35ef23..405aa1b 100644 +--- a/go/sendgmail/main.go ++++ b/go/sendgmail/main.go +@@ -30,7 +30,6 @@ import ( + "log" + "net/smtp" + "os" +- "strings" + + "golang.org/x/oauth2" + googleOAuth2 "golang.org/x/oauth2/google" +@@ -52,9 +51,6 @@ func init() { + + func main() { + flag.Parse() +- if atDomain := "@gmail.com"; !strings.HasSuffix(sender, atDomain) { +- log.Fatalf("-sender must specify an %v email address.", atDomain) +- } + config := getConfig() + tokenPath := fmt.Sprintf("%v/.sendgmail.%v.json", os.Getenv("HOME"), sender) + if setUp { +-- +2.32.0 +