unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#50420] [PATCH 0/2] Add sendgmail.
@ 2021-09-06  5:36 Philip McGrath
  2021-09-06  5:37 ` [bug#50420] [PATCH 1/2] gnu: Add go-cloud-google-com-go-compute-metadata Philip McGrath
  2021-09-14  9:32 ` bug#50420: [PATCH 0/2] Add sendgmail Ludovic Courtès
  0 siblings, 2 replies; 7+ messages in thread
From: Philip McGrath @ 2021-09-06  5:36 UTC (permalink / raw)
  To: 50420; +Cc: Philip McGrath

This patch series adds `sendgmail`, a tool for using `git send-email`
with Gmail accounts via OAuth2 authentication.

Philip McGrath (2):
  gnu: Add go-cloud-google-com-go-compute-metadata.
  gnu: Add go-github-com-google-gmail-oauth2-tools-go-sendgmail.

 gnu/packages/golang.scm | 62 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)

-- 
2.30.2





^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#50420] [PATCH 1/2] gnu: Add go-cloud-google-com-go-compute-metadata.
  2021-09-06  5:36 [bug#50420] [PATCH 0/2] Add sendgmail Philip McGrath
@ 2021-09-06  5:37 ` Philip McGrath
  2021-09-06  5:37   ` [bug#50420] [PATCH 2/2] gnu: Add go-github-com-google-gmail-oauth2-tools-go-sendgmail Philip McGrath
  2021-09-14  9:32 ` bug#50420: [PATCH 0/2] Add sendgmail Ludovic Courtès
  1 sibling, 1 reply; 7+ messages in thread
From: Philip McGrath @ 2021-09-06  5:37 UTC (permalink / raw)
  To: 50420; +Cc: Philip McGrath

* gnu/packages/golang.scm (go-cloud-google-com-go-compute-metadata): New
variable.
---
 gnu/packages/golang.scm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index b6e8b84749..7980859b26 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -2754,6 +2754,33 @@ developers to use @code{http} methods explicitly and in a way that's consistent
 with the HTTP protocol definition.")
     (license license:expat)))
 
+(define-public go-cloud-google-com-go-compute-metadata
+  (package
+    (name "go-cloud-google-com-go-compute-metadata")
+    (version "0.81.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/googleapis/google-cloud-go")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "15jgynqb5pbxqbj3a7ii970yn4srsw1dbxzxnhpkfkmplalpgyh3"))))
+    (build-system go-build-system)
+    (arguments
+     '(#:unpack-path "cloud.google.com/go"
+       #:import-path "cloud.google.com/go/compute/metadata"))
+    (home-page
+     "https://pkg.go.dev/cloud.google.com/go/compute/metadata")
+    (synopsis
+     "Go wrapper for Google Compute Engine metadata service")
+    (description
+     "This package provides access to Google Compute Engine (GCE) metadata and
+API service accounts for Go.")
+    (license license:asl2.0)))
+
 (define-public go-github-com-google-cadvisor
   (let ((commit "2ed7198f77395ee9a172878a0a7ab92ab59a2cfd")
         (revision "0"))
-- 
2.30.2





^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [bug#50420] [PATCH 2/2] gnu: Add go-github-com-google-gmail-oauth2-tools-go-sendgmail.
  2021-09-06  5:37 ` [bug#50420] [PATCH 1/2] gnu: Add go-cloud-google-com-go-compute-metadata Philip McGrath
@ 2021-09-06  5:37   ` Philip McGrath
  0 siblings, 0 replies; 7+ messages in thread
From: Philip McGrath @ 2021-09-06  5:37 UTC (permalink / raw)
  To: 50420; +Cc: Philip McGrath

* gnu/packages/golang.scm
(go-github-com-google-gmail-oauth2-tools-go-sendgmail): New variable.
---
 gnu/packages/golang.scm | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 7980859b26..214365c73b 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -2781,6 +2781,41 @@ with the HTTP protocol definition.")
 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"))
-- 
2.30.2





^ permalink raw reply related	[flat|nested] 7+ messages in thread

* bug#50420: [PATCH 0/2] Add sendgmail.
  2021-09-06  5:36 [bug#50420] [PATCH 0/2] Add sendgmail Philip McGrath
  2021-09-06  5:37 ` [bug#50420] [PATCH 1/2] gnu: Add go-cloud-google-com-go-compute-metadata Philip McGrath
@ 2021-09-14  9:32 ` Ludovic Courtès
  2021-09-23  9:59   ` [bug#50420] " Philip McGrath
  1 sibling, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2021-09-14  9:32 UTC (permalink / raw)
  To: Philip McGrath; +Cc: 50420-done

Hi,

Philip McGrath <philip@philipmcgrath.com> skribis:

>   gnu: Add go-cloud-google-com-go-compute-metadata.
>   gnu: Add go-github-com-google-gmail-oauth2-tools-go-sendgmail.

Applied, thanks!

Perhaps the 2nd package could be called just “sendgmail” since it
provides a CLI?

Thanks,
Ludo’.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#50420] [PATCH 0/2] Add sendgmail.
  2021-09-14  9:32 ` bug#50420: [PATCH 0/2] Add sendgmail Ludovic Courtès
@ 2021-09-23  9:59   ` Philip McGrath
  2021-09-23 18:42     ` Leo Famulari
  0 siblings, 1 reply; 7+ messages in thread
From: Philip McGrath @ 2021-09-23  9:59 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 50420-done

On 9/14/21 5:32 AM, Ludovic Courtès wrote:
> Hi,
> 
> Philip McGrath <philip@philipmcgrath.com> skribis:
> 
>>    gnu: Add go-cloud-google-com-go-compute-metadata.
>>    gnu: Add go-github-com-google-gmail-oauth2-tools-go-sendgmail.
> 
> Applied, thanks!
> 
> Perhaps the 2nd package could be called just “sendgmail” since it
> provides a CLI?

That would make sense to me: I'm not sure what the general rule is for 
breaking out of the language-specific naming conventions, and I'm not a 
Go programmer, but 
“go-github-com-google-gmail-oauth2-tools-go-sendgmail” seemed especially 
egregiously long.

The sengmail utility is recommended in 
<https://git-send-email.io/#step-2> (by the SourceHut developers). There 
are some things I don't like about it, but it seems better than other 
approaches I've tried, like configuring an MTA with (even more) ambient 
authority.

It might also be nice (or it might not) to apply one of the three pull 
requests since 2019 to support non-"@gmail.com" addresses (e.g. for work 
or school, from what has variously been known as Google Workspace, G 
Suite, or Google Apps for Your Domain). Indeed, the upstream repository 
has not been updated at all since 2019 ... I used 
<https://github.com/google/gmail-oauth2-tools/pull/37> via a package 
transformation to submit this patch series, whereupon I discovered I 
wasn't the first person to have this idea.

-Philip




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#50420] [PATCH 0/2] Add sendgmail.
  2021-09-23  9:59   ` [bug#50420] " Philip McGrath
@ 2021-09-23 18:42     ` Leo Famulari
  2021-09-23 19:40       ` Sarah Morgensen
  0 siblings, 1 reply; 7+ messages in thread
From: Leo Famulari @ 2021-09-23 18:42 UTC (permalink / raw)
  To: Philip McGrath; +Cc: Ludovic Courtès, 50420-done

On Thu, Sep 23, 2021 at 05:59:44AM -0400, Philip McGrath wrote:
> That would make sense to me: I'm not sure what the general rule is for
> breaking out of the language-specific naming conventions, and I'm not a Go
> programmer, but “go-github-com-google-gmail-oauth2-tools-go-sendgmail”
> seemed especially egregiously long.

In general, end-user applications (like a CLI program) can use a simple
name like 'sendgmail', which is what users expect.

Libraries, on the other hand, should use the long name. For Go, this
should match the "import path" of the program, with slashes changed to
hyphens, plus a "go-" prefix.

Internally to Go software, the "import path" is the true name of the
program:

https://golang.org/doc/gopath_code#ImportPaths

For example, there could be multiple Go libraries named 'sendgmail', but
Go software distinguishes them by including their network location in
the name.

We could invent another naming system, but Go naming is already so
complicated that I think it's worth trying to match the internal "import
path" names.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#50420] [PATCH 0/2] Add sendgmail.
  2021-09-23 18:42     ` Leo Famulari
@ 2021-09-23 19:40       ` Sarah Morgensen
  0 siblings, 0 replies; 7+ messages in thread
From: Sarah Morgensen @ 2021-09-23 19:40 UTC (permalink / raw)
  To: Leo Famulari; +Cc: Ludovic Courtès, 50420, Philip McGrath

Hi all,

Leo Famulari <leo@famulari.name> writes:

> On Thu, Sep 23, 2021 at 05:59:44AM -0400, Philip McGrath wrote:
>> That would make sense to me: I'm not sure what the general rule is for
>> breaking out of the language-specific naming conventions, and I'm not a Go
>> programmer, but “go-github-com-google-gmail-oauth2-tools-go-sendgmail”
>> seemed especially egregiously long.
>
> In general, end-user applications (like a CLI program) can use a simple
> name like 'sendgmail', which is what users expect.
>
> Libraries, on the other hand, should use the long name. For Go, this
> should match the "import path" of the program, with slashes changed to
> hyphens, plus a "go-" prefix.
>
> Internally to Go software, the "import path" is the true name of the
> program:
>
> https://golang.org/doc/gopath_code#ImportPaths
>
> For example, there could be multiple Go libraries named 'sendgmail', but
> Go software distinguishes them by including their network location in
> the name.
>
> We could invent another naming system, but Go naming is already so
> complicated that I think it's worth trying to match the internal "import
> path" names.

For what it's worth, I concur, especially since the importer won't see a
package with an "incorrect" name, so we may end up with duplicates.

In the rare case that a module contains both a library and commands, the
command package can inherit from the library package, and set
`#:install-source? #f' (and #:import-path, if necessary).

--
Sarah




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-09-23 19:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-06  5:36 [bug#50420] [PATCH 0/2] Add sendgmail Philip McGrath
2021-09-06  5:37 ` [bug#50420] [PATCH 1/2] gnu: Add go-cloud-google-com-go-compute-metadata Philip McGrath
2021-09-06  5:37   ` [bug#50420] [PATCH 2/2] gnu: Add go-github-com-google-gmail-oauth2-tools-go-sendgmail Philip McGrath
2021-09-14  9:32 ` bug#50420: [PATCH 0/2] Add sendgmail Ludovic Courtès
2021-09-23  9:59   ` [bug#50420] " Philip McGrath
2021-09-23 18:42     ` Leo Famulari
2021-09-23 19:40       ` Sarah Morgensen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).