guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#49581] [PATCH v3] gnu: Add git-issues.


From: Sarah Morgensen
Subject: [bug#49581] [PATCH v3] gnu: Add git-issues.
Date: Thu, 23 Sep 2021 00:15:50 -0700

Hi again,

Sarah Morgensen <iskarian@mgsn.dev> writes:

> Additionally, it looks like git-issue depends on several tools: cat,
> curl, grep, git, find, jq, and sed, at least.  These should probably be
> included in inputs and substituted in the script, perhaps with:
>
> (add-before 'install 'patch-paths
>   (lambda* (#:key inputs #:allow-other-keys)
>     (define (input-file input file)
>       (string-append (assoc-ref inputs input) "/" file))
>
>     (substitute* '("git-issue.sh"
>                    "lib/git-issue/import-export.sh"
>                    "scripts/replacerefs.sh")
>       (("\\bcat\\b") (input-file "coreutils" "bin/cat"))
>       (("\\bcurl\\b") (input-file "curl" "bin/curl"))
>       (("\\bdate\\b") (input-file "coreutils" "bin/date"))
>       (("\\bgit\\b") (input-file "git-minimal" "bin/git"))
>       (("\\bgrep\\b") (input-file "grep" "bin/grep"))
>       (("\\bfind\\b") (input-file "findutils" "bin/find"))
>       (("\\bjq\\b") (input-file "jq" "bin/jq"))
>       (("\\bsed\\b") (input-file "sed" "bin/sed"))
>       ;; Substitute back any usage examples.
>       (("((usage|Example): )/gnu/store/[^/]+/bin/(\\w+)"
>         all start exec)
>        (string-append start exec)))))
>
> I may have missed a few utilities, though.

I belatedly realized you could also use 'wrap-program', which is
probably less error-prone.  For example (untested, and not very pretty):

--8<---------------cut here---------------start------------->8---
(let ((out (assoc-ref outputs "out"))
      (paths (map
              (lambda (input)
                (string-append (assoc-ref inputs input) "/bin"))
              '("coreutils" "curl" "findutils"
                "git-minimal" "grep" "jq" "sed")))
  (for-each
    (lambda (program)
      (wrap-program
       (string-append out "/" program)
       `("PATH" prefix ,paths)))
    '("bin/git-issue" "lib/git-issue/import-export.sh"))))
--8<---------------cut here---------------end--------------->8---

Thinking about it, I'm not sure if the bash autocompletion script
("etc/bash_completion.d/git-issue") should be wrapped as well.

Hope that helps,
--
Sarah





reply via email to

[Prev in Thread] Current Thread [Next in Thread]