[PATCH 0/2] git-annex: Don't patch hook shebangs and update version

  • Done
  • quality assurance status badge
Details
2 participants
  • Kyle Meyer
  • Marius Bakke
Owner
unassigned
Submitted by
Kyle Meyer
Severity
normal

Debbugs page

Kyle Meyer wrote 6 years ago
(address . guix-patches@gnu.org)
20190721194626.10944-1-kyle@kyleam.com
The git-annex definition patches the snippet that git-annex uses as the
shebang when creating its Git hooks. As discussed previously [1], this is
problematic because the hooks refer to a bash that may later be garbage
collected.

However, a large number of the tests fail if we simply don't patch the shebang
because the hooks of course can't find the unpatched "/bin/sh" in the build
environment [2]. The first patch updates the definition to use a "patch,
build, test, revert patch, re-build" sequence. It's not pretty, but it
certainly seems better than disabling the tests. Please let me know if you
have suggestions for a cleaner approach.

The second patch updates git-annex to its latest version.


Kyle Meyer (2):
gnu: git-annex: Don't patch shebang used in hooks.
gnu: git-annex: Update to 7.20190708.

gnu/packages/haskell-apps.scm | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)

--
2.22.0
Kyle Meyer wrote 6 years ago
[PATCH 1/2] gnu: git-annex: Don't patch shebang used in hooks.
(address . 36752@debbugs.gnu.org)
20190721195058.11263-1-kyle@kyleam.com
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(-)

Toggle diff (41 lines)
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"))
--
2.22.0
Kyle Meyer wrote 6 years ago
[PATCH 2/2] gnu: git-annex: Update to 7.20190708.
(address . 36752@debbugs.gnu.org)
20190721195058.11263-2-kyle@kyleam.com
* gnu/packages/haskell-apps.scm (git-annex): Update to 7.20190708.
[inputs]: Add new dependency, ghc-concurrent-output.
---
gnu/packages/haskell-apps.scm | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

Toggle diff (32 lines)
diff --git a/gnu/packages/haskell-apps.scm b/gnu/packages/haskell-apps.scm
index 15a6686ed6..fa0111796d 100644
--- a/gnu/packages/haskell-apps.scm
+++ b/gnu/packages/haskell-apps.scm
@@ -144,7 +144,7 @@ (define-public darcs
(define-public git-annex
(package
(name "git-annex")
- (version "6.20180926")
+ (version "7.20190708")
(source
(origin
(method url-fetch)
@@ -152,7 +152,7 @@ (define-public git-annex
"git-annex/git-annex-" version ".tar.gz"))
(sha256
(base32
- "1251rj8h63y30sfqk0zh670yhz14p256y59n3590pg015pf3575d"))))
+ "18s563swrp8mx479995pdhhmn40y3xwlbm1z3w63qsnjqmj7zlij"))))
(build-system haskell-build-system)
(arguments
`(#:configure-flags
@@ -220,6 +220,7 @@ (define-public git-annex
("ghc-bloomfilter" ,ghc-bloomfilter)
("ghc-byteable" ,ghc-byteable)
("ghc-case-insensitive" ,ghc-case-insensitive)
+ ("ghc-concurrent-output" ,ghc-concurrent-output)
("ghc-crypto-api" ,ghc-crypto-api)
("ghc-cryptonite" ,ghc-cryptonite)
("ghc-data-default" ,ghc-data-default)
--
2.22.0
Kyle Meyer wrote 6 years ago
Re: [PATCH 1/2] gnu: git-annex: Don't patch shebang used in hooks.
(address . 36752@debbugs.gnu.org)(name . Timothy Sample)(address . samplet@ngyro.com)
878sspwjpl.fsf@kyleam.com
Kyle Meyer <kyle@kyleam.com> writes:

Toggle quote (3 lines)
> * 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.
Marius Bakke wrote 6 years ago
Re: [bug#36752] [PATCH 0/2] git-annex: Don't patch hook shebangs and update version
87blwzikkz.fsf@devup.no
Kyle Meyer <kyle@kyleam.com> writes:

Toggle quote (21 lines)
> The git-annex definition patches the snippet that git-annex uses as the
> shebang when creating its Git hooks. As discussed previously [1], this is
> problematic because the hooks refer to a bash that may later be garbage
> collected.
>
> However, a large number of the tests fail if we simply don't patch the shebang
> because the hooks of course can't find the unpatched "/bin/sh" in the build
> environment [2]. The first patch updates the definition to use a "patch,
> build, test, revert patch, re-build" sequence. It's not pretty, but it
> certainly seems better than disabling the tests. Please let me know if you
> have suggestions for a cleaner approach.
>
> The second patch updates git-annex to its latest version.
>
> [1] https://lists.gnu.org/archive/html/guix-devel/2018-08/msg00142.html
> [2] https://lists.gnu.org/archive/html/guix-devel/2019-02/msg00012.html
>
> Kyle Meyer (2):
> gnu: git-annex: Don't patch shebang used in hooks.
> gnu: git-annex: Update to 7.20190708.

Thank you for fixing the shebang bug, and for updating the package.

Applied both, thanks!
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAl1MaEwACgkQoqBt8qM6
VPr0KQf+L+gAzsBayY57FKbIG/1DZ/LG0LbBm0HR0m84OGA3WV//G3alp8NzvGPW
hZpb+wwUE6Kd61zzJD3Jp+92GYuAMBi6mkXiDYjDxt/ApH8rK8hIol3ONEeBF/Tl
SIajvk5OQkjDlGZE3DV0gTR/3tZXLupB4pA3fMxbZhLQl97VeHb1jAviS6QsXrBI
mv25PEvpt8O61FfFZfDV41hTkCbf71esYjgZJNK2y44u0MEIzQZ+5qJxKvIjVKoj
ev4WuOggs+1A1PyB1lDoOSTglAAq81y1AWqX8/YbXzTLy5iKmYQ3M75CQDOMYMfy
EOfOnsf+VFKVZCfD66j7ANQgIJqLeg==
=MZuy
-----END PGP SIGNATURE-----

Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 36752@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 36752
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help