diff mbox series

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

Message ID wSNw-jqZU6IDZfx_hFcgQDluwOnvx4UN5JVK3unRNHaq5gW63kYHuTPN1mzC9cA4WuHrdW-b_ldAXbiRPxpS8Wqk6AYHDQhIumqtuqq21hw=@protonmail.com
State New
Headers show
Series [bug#49581,v3] gnu: Add git-issues. | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

phodina Sept. 18, 2021, 8:31 a.m. UTC
* gnu/packages/version-control.scm (git-issues): New variable.

--
2.32.0

Comments

Sarah Morgensen Sept. 22, 2021, 10:14 p.m. UTC | #1
Hello Petr,

Thanks for your updated patch.  This looks like a great tool.  After
making the changes below, I gave it a try, and I might use it myself
when I can't use fossil!

I was unable to apply your patch with `git am'; I had to guess which
commit it was based on and manually apply it.  In the future, please
configure your git to include the base commit with

  git config --local format.useautobase whenAble

or use the `--base' command line option:

  git format-patch --base=a916d50566

phodina <phodina@protonmail.com> writes:

> * gnu/packages/version-control.scm (git-issues): New variable.
>
> diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
> index 7c1dbe8b26..cff1190094 100644
> --- a/gnu/packages/version-control.scm
> +++ b/gnu/packages/version-control.scm
> @@ -39,6 +39,7 @@
>  ;;; Copyright © 2021 LibreMiami <packaging-guix@libremiami.org>
>  ;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
>  ;;; Copyright © 2021 François J. <francois-oss@avalenn.eu>
> +;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -1267,6 +1268,36 @@ subcommands helps automate some parts of the flow to make working with it a
>  lot easier.")
>      (license license:bsd-2)))
>
> +(define-public git-issues

The name should be "git-issue" since that's the name of the project and
the command.

> +  (let ((commit "67aacad35888b4c51e2d7be35c86fef137874f12")
> +        (revision "1"))
> +    (package
> +      (name "git-issues")
> +      (version commit)
> +      (source (origin
> +                (method git-fetch)
> +                (uri
> +                 (git-reference
> +                  (url "https://github.com/dspinellis/git-issue")
> +                  (commit version)))
> +                (file-name (git-file-name name version))
> +                (sha256
> +                 (base32
> +                  "1z6dpwbikmiq5acpbji4kvmxqc2jw995rfk5703k5mvp5ps9a29q"))))
> +      (build-system gnu-build-system)
> +      (arguments
> +       '(#:tests? #f

Please add a comment explaining why tests are disabled.  For example, I
attempted to run the tests and found that they must be run in a git
repository, and that a global user.name and user.email must be
configured.

> +         #:make-flags (list (string-append "PREFIX="(assoc-ref %outputs "out")))

Please add a space after "PREFIX=" and wrap the line.

> +         #:phases (modify-phases %standard-phases
> +                    (delete 'configure)
> +                    (delete 'build))))
> +      (synopsis "Git-based decentralized issue management")
> +      (description "Git-issues provide a minimalist decentralized issue
> +management system based on Git, offering (optional) bidirectional integration
> +with GitHub and GitLab issue management.")

This is a bit short.  How about:

--8<---------------cut here---------------start------------->8---
      (description "@command{git-issue} provides a minimalist decentralized
issue management system based on Git, offering (optional) bidirectional
integration with GitHub and GitLab issue management.  Issues are stored as
simple text files, so no special tools are required to access your data, and
issues are changed and shared through Git, so no special infrastructure is
necessary to manage your data.")
--8<---------------cut here---------------end--------------->8---


> +      (home-page "https://github.com/dspinellis/git-issue")
> +      (license license:gpl3+))))
> +
>  (define-public stgit
>    (package
>      (name "stgit")
> --
> 2.32.0

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:

--8<---------------cut here---------------start------------->8---
(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)))))
--8<---------------cut here---------------end--------------->8---

I may have missed a few utilities, though.

Thank you!

--
Sarah
Sarah Morgensen Sept. 23, 2021, 7:15 a.m. UTC | #2
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
diff mbox series

Patch

diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 7c1dbe8b26..cff1190094 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -39,6 +39,7 @@ 
 ;;; Copyright © 2021 LibreMiami <packaging-guix@libremiami.org>
 ;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
 ;;; Copyright © 2021 François J. <francois-oss@avalenn.eu>
+;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1267,6 +1268,36 @@  subcommands helps automate some parts of the flow to make working with it a
 lot easier.")
     (license license:bsd-2)))

+(define-public git-issues
+  (let ((commit "67aacad35888b4c51e2d7be35c86fef137874f12")
+        (revision "1"))
+    (package
+      (name "git-issues")
+      (version commit)
+      (source (origin
+                (method git-fetch)
+                (uri
+                 (git-reference
+                  (url "https://github.com/dspinellis/git-issue")
+                  (commit version)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "1z6dpwbikmiq5acpbji4kvmxqc2jw995rfk5703k5mvp5ps9a29q"))))
+      (build-system gnu-build-system)
+      (arguments
+       '(#:tests? #f
+         #:make-flags (list (string-append "PREFIX="(assoc-ref %outputs "out")))
+         #:phases (modify-phases %standard-phases
+                    (delete 'configure)
+                    (delete 'build))))
+      (synopsis "Git-based decentralized issue management")
+      (description "Git-issues provide a minimalist decentralized issue
+management system based on Git, offering (optional) bidirectional integration
+with GitHub and GitLab issue management.")
+      (home-page "https://github.com/dspinellis/git-issue")
+      (license license:gpl3+))))
+
 (define-public stgit
   (package
     (name "stgit")