unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Christopher Baines <mail@cbaines.net>
To: 35386@debbugs.gnu.org
Subject: [bug#35386] [PATCH] gnu: direnv: Change to the go-build-system.
Date: Tue, 23 Apr 2019 00:57:19 +0100	[thread overview]
Message-ID: <20190422235719.5427-1-mail@cbaines.net> (raw)

The go-build-system is slightly more appropriate, and switching resolves an
issue with combining the 'unpack phase from the gnu-build-system, and the
'setup-go-environment from the go-build-system. With both of those phases
creating a directory, the first-subdirectory call at the end of the 'unpack
phase can return different values depending on the filesystem ordering.

* gnu/packages/shellutils.scm (direnv)[source]: Use the git repository, as
this works better with the go-build-system.
[build-system]: Change to the go-build-system.
[arguments]: Adjust for the go-build-system.
[native-inputs]: Remove go.
---
 gnu/packages/shellutils.scm | 51 ++++++++++++++++++++-----------------
 1 file changed, 28 insertions(+), 23 deletions(-)

diff --git a/gnu/packages/shellutils.scm b/gnu/packages/shellutils.scm
index 59a8b744eb..56359ce160 100644
--- a/gnu/packages/shellutils.scm
+++ b/gnu/packages/shellutils.scm
@@ -105,35 +105,40 @@ are already there.")
     (name "direnv")
     (version "2.15.2")
     (source
-     (origin (method url-fetch)
-             (uri (string-append "https://github.com/direnv/" name
-                                 "/archive/v" version ".tar.gz"))
-             (file-name (string-append name "-" version ".tar.gz"))
+     (origin (method git-fetch)
+             (uri (git-reference
+                   (url "https://github.com/direnv/direnv.git")
+                   (commit (string-append "v" version))))
+             (file-name (git-file-name name version))
              (sha256
               (base32
-               "1hhmc6rb7b1d4s4kgb4blrq35h388ax37ap88dq3dgfcw9w6j1rm"))))
-    (build-system gnu-build-system)
+               "1y18619pmhfl0vrf4w0h75ybkkwgi9wcb7d9kv4n8drg1xp4aw4w"))))
+    (build-system go-build-system)
     (arguments
-     `(#:test-target "test"
-       #:make-flags (list (string-append "DESTDIR=" (assoc-ref %outputs "out")))
-       #:modules ((guix build gnu-build-system)
-                  ((guix build go-build-system) #:prefix go:)
-                  (guix build union)
-                  (guix build utils))
-       #:imported-modules (,@%gnu-build-system-modules
-                            (guix build union)
-                            (guix build go-build-system))
+     '(#:import-path "github.com/direnv/direnv"
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure)
-         ;; Help the build scripts find the Go language dependencies.
-         (add-before 'unpack 'setup-go-environment
-           (assoc-ref go:%standard-phases 'setup-go-environment))
-         (add-after 'install 'remove-go-references
-           (assoc-ref go:%standard-phases 'remove-go-references)))))
+         (add-after 'unpack 'delete-vendor
+           (lambda _
+             ;; Using a snippet causes issues with the name of the directory,
+             ;; so delete the extra source code here.
+             (delete-file-recursively "src/github.com/direnv/direnv/vendor")
+             #t))
+         (replace 'check
+           (lambda* (#:key tests? #:allow-other-keys)
+             (when tests?
+               (setenv "HOME" "/tmp")
+               (with-directory-excursion "src/github.com/direnv/direnv"
+                 ;; The following file needs to be writable so it can be
+                 ;; modified by the testsuite.
+                 (make-file-writable "test/scenarios/base/.envrc")
+                 (invoke "make" "test")
+                 ;; Clean up from the tests, especially so that the extra
+                 ;; direnv executable that's generated is removed.
+                 (invoke "make" "clean")))
+             #t)))))
     (native-inputs
-     `(("go" ,go)
-       ("go-github-com-burntsushi-toml" ,go-github-com-burntsushi-toml)
+     `(("go-github-com-burntsushi-toml" ,go-github-com-burntsushi-toml)
        ("go-github-com-direnv-go-dotenv" ,go-github-com-direnv-go-dotenv)
        ("which" ,which)))
     (home-page "https://direnv.net/")
-- 
2.21.0

             reply	other threads:[~2019-04-22 23:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-22 23:57 Christopher Baines [this message]
2019-04-29  7:58 ` [bug#35386] [PATCH] gnu: direnv: Change to the go-build-system Ludovic Courtès
2019-04-29 19:42   ` bug#35386: " Christopher Baines

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190422235719.5427-1-mail@cbaines.net \
    --to=mail@cbaines.net \
    --cc=35386@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).