unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#43872] [PATCH] Add package go-ethereum
@ 2020-10-08 21:59 Helio Machado
  2020-10-09 12:11 ` bug#43872: Closing due to consistency issues Helio Machado
  0 siblings, 1 reply; 5+ messages in thread
From: Helio Machado @ 2020-10-08 21:59 UTC (permalink / raw)
  To: 43872


[-- Attachment #1.1: Type: text/plain, Size: 2567 bytes --]

# Add package `go-ethereum`

These patches add the [go-ethereum][5] package and a small workaround that
allows experimental module support.

## [Checklist][1]

1. Code authentication: all the code is being pulled from Git repositories
and Go packages, so there isn't any specific code signature we can verify.

2. Synopsis and description: built from the official documentation and
around the style guidelines.

3. Results for `guix lint`: everything seems to be fine, and it seems to
have scheduled a [Software Heritage][2] archival (?).

4. Native build check: the package builds correctly on my platform
(x86-64), using `guix build` package.

5. Cross-build check: package was not tested on any other supported
platform because `go-build-system` [doesn't seem to support
cross-compilation][3].

6. Package deduplication: dependencies are being pulled from their
respective module repositories at build time; there isn't practically any
overlap between the package code and the Guix repositories.

7. Package size: as per `guix size`, this package requires a total of 418.7
MiB, with a package (self) size of 282.4 MiB.

8. Dependent packages: this is a freshly added package with no dependent
items.

9. Deterministic build: this package is fully deterministic and has fixed
hashes for both the initial download and the build derivation.

10. Inclusive language: documentation was written with neutrality in mind
and there isn't any obvious bias, though it might need proofreading.

11. Patch atomicity: this patch contains only one set of related changes,
though modifications affect two files.

12. Code formatting: added lines were formatted by using `indent-code.el`.

13. Source consistency: all the involved downloads are being pulled along
with a Git tag or commit, so results should be consistent enough.

14. Guix build: these changes don't affect Guix builds nor introduce any
warning.

15. Guix consistency: these changes do not break Guix in any obvious way.

## Desiderata

It would be great to have easier ways to replace Go module management
system with Guix in a seamless and painless way. Rust build system for Guix
has a cleaner implementation, majorly due to the existence of a
[centralized package registry][4].

[1]: https://guix.gnu.org/manual/en/html_node/Submitting-Patches.html
[2]: https://www.softwareheritage.org/
[3]:
https://git.savannah.gnu.org/cgit/guix.git/tree/guix/build-system/go.scm#n60
[4]: https://crates.io
[5]: https://github.com/ethereum/go-ethereum
[6]: https://gist.github.com/0x2b3bfa0/1805037bf5efa2655fa71d32e69fdd14

[-- Attachment #1.2: Type: text/html, Size: 3581 bytes --]

[-- Attachment #2: 0001-build-system-go-Allow-packages-to-create-fixed-outpu.patch --]
[-- Type: application/octet-stream, Size: 2079 bytes --]

From 44951639a2bd8525cc4a022b2a6d684c7bb92a30 Mon Sep 17 00:00:00 2001
From: Helio Machado <0x2b3bfa0+git@googlemail.com>
Date: Thu, 8 Oct 2020 23:28:17 +0200
Subject: [PATCH 1/2] build-system/go: Allow packages to create fixed-output
 derivations

As per the libstore source code, fixed-output derivations have
unrestricted network access as long as their contents are kept
deterministic and you provide a hash of the derivation state.
---
 guix/build-system/go.scm | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/guix/build-system/go.scm b/guix/build-system/go.scm
index f8ebaefb27..baea3e5708 100644
--- a/guix/build-system/go.scm
+++ b/guix/build-system/go.scm
@@ -88,6 +88,9 @@
                    (allow-go-reference? #f)
                    (system (%current-system))
                    (guile #f)
+                   (derivation-hash #f)
+                   (derivation-hash-algorithm #f)
+                   (derivation-hash-recursive? #f)
                    (imported-modules %go-build-system-modules)
                    (modules '((guix build go-build-system)
                               (guix build union)
@@ -114,6 +117,9 @@
                 #:build-flags ,build-flags
                 #:tests? ,tests?
                 #:allow-go-reference? ,allow-go-reference?
+                #:derivation-hash ,derivation-hash
+                ;; FIXME  #:derivation-hash-algorithm ,derivation-hash-algorithm
+                #:derivation-hash-recursive? ,derivation-hash-recursive?
                 #:inputs %build-inputs)))
 
   (define guile-for-build
@@ -131,6 +137,9 @@
                                 #:system system
                                 #:modules imported-modules
                                 #:outputs outputs
+                                #:hash derivation-hash
+                                #:hash-algo derivation-hash-algorithm
+                                #:recursive? derivation-hash-recursive?
                                 #:guile-for-build guile-for-build))
 
 (define go-build-system
-- 
2.24.3 (Apple Git-128)


[-- Attachment #3: 0002-gnu-Add-go-github-com-ethereum-go-ethereum.patch --]
[-- Type: application/octet-stream, Size: 3842 bytes --]

From 13213667fa3e92262dc1a15b1e5a6eb0b6b0b712 Mon Sep 17 00:00:00 2001
From: Helio Machado <0x2b3bfa0+git@googlemail.com>
Date: Thu, 8 Oct 2020 23:36:10 +0200
Subject: [PATCH 2/2] gnu: Add go-github-com-ethereum-go-ethereum

* gnu/packages/golang.scm (go-github-com-ethereum-go-ethereum): new package.
---
 gnu/packages/golang.scm | 57 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)

diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index fe34d34491..ce7644bef3 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -46,6 +46,7 @@
   #:use-module (guix build-system go)
   #:use-module (gnu packages)
   #:use-module (gnu packages admin)
+  #:use-module (gnu packages certs)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages base)
@@ -477,6 +478,62 @@ jar struct to manage the cookies added to the cookie jar.")
       (home-page "https://github.com/aki237/nscjar")
       (license license:expat))))
 
+(define-public go-github-com-ethereum-go-ethereum
+  (package
+    (name "go-github-com-ethereum-go-ethereum")
+    (version "1.9.22")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/ethereum/go-ethereum")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "08i31xil2lygfcn2igsvn4hpg8xnf8l6g914f78hgl4wj6v1dja9"))))
+    (build-system go-build-system)
+    (arguments
+     `(#:import-path "github.com/ethereum/go-ethereum"
+       #:tests? #f ; tests are broken
+       #:derivation-hash ,(base32 "1ab7gd90g85ciwsrw6zjaxs76j7y0a11kavp50xkwmm26x34sjss")
+       #:derivation-hash-algorithm sha256
+       #:derivation-hash-recursive? ,#t
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'setup-go-environment 'modify-go-environment
+           (lambda _
+             (setenv "GO111MODULE" "on")
+             (setenv "SSL_CERT_DIR" (string-append
+                                     (assoc-ref %build-inputs "nss-certs")
+                                     "/etc/ssl/certs"))
+             (setenv "SSL_CERT_FILE" (string-append
+                                      (getenv "SSL_CERT_DIR")
+                                      "/ca-certificates.crt"))
+             #t))
+         (replace 'build
+           (lambda* (#:key import-path build-flags #:allow-other-keys)
+             (with-directory-excursion (string-append "src/" import-path)
+               (invoke "go" "run" "build/ci.go" "install"))))
+         (replace 'install
+           (lambda* (#:key outputs import-path #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (source (string-append (getenv "GOPATH") "/src/" import-path "/build"))
+                    (dest out))
+               (mkdir-p dest)
+               (copy-recursively source dest #:keep-mtime? #t))))
+         (replace 'check
+           (lambda* (#:key tests? import-path #:allow-other-keys)
+             (if tests?
+                 (with-directory-excursion (string-append "src/" import-path)
+                   (invoke "go" "run" "build/ci.go" "test"))
+                 #t))))))
+    (inputs `(("nss-certs" ,nss-certs)))
+    (home-page "https://github.com/ethereum/go-ethereum")
+    (synopsis "Official Go implementation of the Ethereum protocol")
+    (description "This repository contains the official Go implementation of
+the Ethereum protocol and command line tools (geth) for interacting with the blockchain.")
+    (license license:lgpl3)))
+
 (define-public go-github.com-jessevdk-go-flags
   (package
     (name "go-github.com-jessevdk-go-flags")
-- 
2.24.3 (Apple Git-128)


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

end of thread, other threads:[~2020-10-10 20:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-08 21:59 [bug#43872] [PATCH] Add package go-ethereum Helio Machado
2020-10-09 12:11 ` bug#43872: Closing due to consistency issues Helio Machado
2020-10-09 18:34   ` [bug#43872] " Marius Bakke
2020-10-10 18:07     ` Helio Machado
2020-10-10 20:35       ` Marius Bakke

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).