guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

06/09: gnu: sendgmail: Don't limit domain name of sender.


From: guix-commits
Subject: 06/09: gnu: sendgmail: Don't limit domain name of sender.
Date: Fri, 10 Dec 2021 09:33:41 -0500 (EST)

civodul pushed a commit to branch master
in repository guix.

commit 7c2d84df1c05d41ba9eafb6f64abd694166e55c3
Author: Philip McGrath <philip@philipmcgrath.com>
AuthorDate: Sat Nov 20 00:43:53 2021 -0500

    gnu: sendgmail: Don't limit domain name of sender.
    
    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.
    
    Signed-off-by: Ludovic Courtès <ludo@gnu.org>
---
 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(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index 2afd025..223055c 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1760,6 +1760,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 b75c1a0..e52b48a 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -4661,7 +4661,7 @@ feeds, converts them into emails, and sends them.")
 
 (define-public sendgmail
   (let ((commit "e3229155a4037267ce40f1a3a681f53221aa4d8d")
-        (revision "0"))
+        (revision "1"))
     (package
       (name "sendgmail")
       (version (git-version "0.0.0" revision commit))
@@ -4672,6 +4672,9 @@ feeds, converts them into emails, and sends them.")
                (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"))))
@@ -4691,5 +4694,9 @@ feeds, converts them into emails, and sends them.")
        "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 0000000..8405ff4
--- /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 <philip@philipmcgrath.com>
+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 0000000..d23af33
--- /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 <tamas@tklengyel.com>
+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
+



reply via email to

[Prev in Thread] Current Thread [Next in Thread]