diff mbox series

[bug#36752,1/2] gnu: git-annex: Don't patch shebang used in hooks.

Message ID 20190721195058.11263-1-kyle@kyleam.com
State Accepted
Headers show
Series git-annex: Don't patch hook shebangs and update version | expand

Commit Message

Kyle Meyer July 21, 2019, 7:50 p.m. UTC
git-annex relies on configuring Git's pre-commit and post-receive hooks.
Avoid patching the shebang that git-annex embeds when generating these hooks
so that the hooks don't fail if garbage collection claims the bash that was
current when the annex repository was initialized.

* gnu/packages/haskell-apps.scm (git-annex):[arguments]: Patch hook shebangs
only temporarily for tests.
---
 gnu/packages/haskell-apps.scm | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Comments

Kyle Meyer July 23, 2019, 2:47 a.m. UTC | #1
Kyle Meyer <kyle@kyleam.com> writes:

> * gnu/packages/haskell-apps.scm (git-annex):[arguments]: Patch hook shebangs
> only temporarily for tests.

Oops, a stray ":" slipped in there.  If a reroll doesn't end up being
needed for other reasons, I'd appreciate if that could be touched up
when applying.
diff mbox series

Patch

diff --git a/gnu/packages/haskell-apps.scm b/gnu/packages/haskell-apps.scm
index d675863090..15a6686ed6 100644
--- a/gnu/packages/haskell-apps.scm
+++ b/gnu/packages/haskell-apps.scm
@@ -6,6 +6,7 @@ 
 ;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2016, 2017 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2015 Paul van der Walt <paul@denknerd.org>
+;;; Copyright © 2019 Kyle Meyer <kyle@kyleam.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -158,8 +159,13 @@  (define-public git-annex
        '("--flags=-Android -Assistant -Pairing -S3 -Webapp -WebDAV")
        #:phases
        (modify-phases %standard-phases
-         (add-before 'configure 'patch-shell
+         (add-before 'configure 'patch-shell-for-tests
            (lambda _
+             ;; Shell.hs defines "/bin/sh" that is used in Git hooks.  We
+             ;; shouldn't patch hooks with Guix's current bash because the
+             ;; hooks can exist after that bash is garbage collected, but
+             ;; let's temporarily patch it so that we can run the tests.
+             (copy-file "Utility/Shell.hs" "/tmp/Shell.hs")
              (substitute* "Utility/Shell.hs"
                (("/bin/sh") (which "sh")))
              #t))
@@ -193,6 +199,11 @@  (define-public git-annex
                (symlink "git-annex" "git-annex-shell"))
              (invoke "git-annex" "test")
              #t))
+         (add-after 'check 'unpatch-shell-and-rebuild
+           (lambda args
+             ;; Undo `patch-shell-for-tests'.
+             (copy-file "/tmp/Shell.hs" "Utility/Shell.hs")
+             (apply (assoc-ref %standard-phases 'build) args)))
          (add-after 'install 'install-symlinks
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))