[PATCH] Add git-issues

OpenSubmitted by phodina.
Details
4 participants
  • Giovanni Biscuolo
  • Sarah Morgensen
  • Tobias Geerinckx-Rice
  • phodina
Owner
unassigned
Severity
normal
P
P
phodina wrote on 15 Jul 2021 19:01
(name . guix-patches@gnu.org)(address . guix-patches@gnu.org)
OtwZjjiac_X-7rMHJdn-ruFUDl4kpeL7dC6XcQY9FFDArpj5VP9upJYc9ohZfJ73K8AgvrdaG8lE0oji5nmvITzMKgI7gffpzl-oYUWxCl8=@protonmail.com
From dbfbc69932b29dd5b3a6bed2de3f67d89bc50bfa Mon Sep 17 00:00:00 2001
From: Petr Hodina <phodina@protonmail.com>
Date: Thu, 15 Jul 2021 18:58:40 +0200
Subject: [PATCH] gnu: Add git-issues


Toggle diff (36 lines)
diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 7c1dbe8b26..47768fdc05 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -1267,6 +1267,31 @@ subcommands helps automate some parts of the flow to make working with it a
 lot easier.")
     (license license:bsd-2)))

+(define-public git-issues
+(package
+  (name "git-issues")
+  (version "67aacad35888b4c51e2d7be35c86fef137874f12")
+  (source (origin
+            (method git-fetch)
+            (uri
+	      (git-reference
+		(url "https://github.com/dspinellis/git-issue")
+		(commit 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 "This is a minimalist decentralized issue management system based on Git, offering (optional) biderectional integration with GitHub and GitLab issue management. It has the following advantages over other systems.")
+  (home-page "https://github.com/dspinellis/git-issue")
+  (license license:gpl2)))
+
 (define-public stgit
   (package
     (name "stgit")
--
2.31.1
G
G
Giovanni Biscuolo wrote on 17 Jul 2021 11:39
87eebxjn2z.fsf@xelera.eu
Hello phodina,

thank you for your patch!

phodina via Guix-patches via <guix-patches@gnu.org> writes:

[...]

Toggle quote (5 lines)
> +(define-public git-issues
> +(package
> + (name "git-issues")
> + (version "67aacad35888b4c51e2d7be35c86fef137874f12")

Upstream does not publish releases (does not tag branches): could you
please just add a comment, it could be useful to other Guix developers,
also to remember to check if things will change in the future.

[...]

Toggle quote (2 lines)
> + (license license:gpl2)))

The source code of the main script [1] states the license is gpl3+:
«version 3 of the License, or (at your option) any later version.»

Can you please submit an updated version of your patch?

Thanks! Gio'



--
Giovanni Biscuolo

Xelera IT Infrastructures
-----BEGIN PGP SIGNATURE-----

iQJABAEBCgAqFiEERcxjuFJYydVfNLI5030Op87MORIFAmDypWQMHGdAeGVsZXJh
LmV1AAoJENN9DqfOzDkS2KwP/1VZVChnZlDifvnRHF6GNK1oPESKSUhqb8M61WK4
E2oWpFFL0cUxtsePT9zhN2iPV9pcml4xEWdavftLoLMHG/UGRFKXbR7WaNTi3go9
DyUvt+d9pkNnZ59oWj11X2smItjPN0NgN+jd09hlk4HZyoHh5ZLXehWLKR2u2Dsh
PcyQa1JM9d+CVn47ULsspqbBWwNCx6GX/5d915LR7lVKwvmd59cixVJHwV8IoHyZ
u7NKs7F+H/vrl5awyRXaJzo3wWPOT6ubS9RNaySk6Q4/a5PyPbgNXLeGXCGMRiRh
DkEOXXxsSO0OyZEyMwFTAeH8mKgouUtwxZ6GbKxl6viRUWMCahz3vHHJJBrztVIC
a3JFXbFDU1yAOa+2JAGjH1Lmh77gJOYAVigb39lF3VQZYaqQOnU7zDU5w9C2fDrK
1miYe3/z5ZQPxWScjdvHSOO0Jfab3LD8jzd3TLDI/HqqjOY/VhG0cPYcncVrBhQf
Cqk6eH0sCK2aUs2oJ18Tdq+G7UYOqYgkqxdtxMw4lgTSyL6niDCUplQEGAhF3QXd
8op3Iio/pca6BpPHWKRfL4+VRiYJs9W8kkA72Lrrhb0AZpyfgqBCJD7/VDaTpuDC
sPqnpM7vt9VbV4KZ5+Nw05dYzRmr8mOSfHXzQmtuHnU/sM5G+HwdNxsYJL26x1vf
4Ucl
=5uvc
-----END PGP SIGNATURE-----

T
T
Tobias Geerinckx-Rice wrote on 17 Jul 2021 12:23
(name . phodina)(address . phodina@protonmail.com)(address . 49581@debbugs.gnu.org)
d6a03caadfc935d37454760b4cc0bbf9@tobias.gr
Hi Petr,

In addition to what Gio' wrote:

On 2021-07-15 19:01, phodina via Guix-patches via wrote:
Toggle quote (3 lines)
> + (description "This is a minimalist decentralized issue management
> system based on Git, offering (optional) biderectional integration

'optional bidirectional'.

Toggle quote (3 lines)
> with GitHub and GitLab issue management. It has the following
> advantages over other systems.")

If what came next wasn't too promotional, you can write 'features'
instead, and use @enumerate to list [a subset of] them. Otherwise the
description's rather short.

Kind regards,

T G-R

Sent from a Web browser. Excuse or enjoy my brevity.
P
P
phodina wrote on 17 Jul 2021 14:25
(name . Tobias Geerinckx-Rice)(address . me@tobias.gr)(address . 49581@debbugs.gnu.org)
aysPZapTfru6a6ulpivImP4AQF9wM9fZDTd31d7X8wWA2Uht2snXLDvWmfLsn6qhjxAP6xK8-dQJkd5V9vPSDleTVeI2g370fc2OHWWE8xM=@protonmail.com
Hi Tobias & Giovanni,

thanks for the suggestions. Here's the fixed patch

Kind regards
Petr

---
index 7c1dbe8b26..91af0badcb 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -1267,6 +1267,40 @@ subcommands helps automate some parts of the flow to make working with it a
lot easier.")
(license license:bsd-2)))

+(define-public git-issues
+(package
+ (name "git-issues")
+ (version "67aacad35888b4c51e2d7be35c86fef137874f12") ; no tags
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (commit 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 "This is a minimalist decentralized issue management system
+based on Git, offering (optional) biderectional integration with GitHub
+and GitLab issue management.
+It has the following advantages over other systems:
+@enumerate
+@item No backend, no dependencies
+@item Decentralized asynchronous management
+@item Transparent text file format
+@item Git-based
+@end enumerate
+")
+ (license license:gpl3)))
+
(define-public stgit
(package
(name "stgit")
--
2.31.1
P
P
phodina wrote on 18 Sep 2021 10:31
[PATCH v3] gnu: Add git-issues.
(name . Tobias Geerinckx-Rice)(address . me@tobias.gr)(address . 49581@debbugs.gnu.org)
wSNw-jqZU6IDZfx_hFcgQDluwOnvx4UN5JVK3unRNHaq5gW63kYHuTPN1mzC9cA4WuHrdW-b_ldAXbiRPxpS8Wqk6AYHDQhIumqtuqq21hw=@protonmail.com
* gnu/packages/version-control.scm (git-issues): New variable.

Toggle diff (49 lines)
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")
--
2.32.0
S
S
Sarah Morgensen wrote on 23 Sep 2021 00:14
(name . phodina)(address . phodina@protonmail.com)
86v92sw942.fsf@mgsn.dev
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:

Toggle quote (20 lines)
> * 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.

Toggle quote (19 lines)
> + (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.

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

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

Toggle quote (8 lines)
> + #: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:

Toggle snippet (9 lines)
(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.")


Toggle quote (9 lines)
> + (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:

Toggle snippet (22 lines)
(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.

Thank you!

--
Sarah
S
S
Sarah Morgensen wrote on 23 Sep 2021 09:15
(name . phodina)(address . phodina@protonmail.com)
86ilyrwymx.fsf@mgsn.dev
Hi again,

Sarah Morgensen <iskarian@mgsn.dev> writes:

Toggle quote (27 lines)
> 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):

Toggle snippet (14 lines)
(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"))))

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
P
P
phodina wrote on 1 Nov 2021 21:21
Re: [bug#49581] [PATCH v4] gnu: Add git-issues.
(name . Sarah Morgensen)(address . iskarian@mgsn.dev)
wir783gaPHI99iaqoN83Gb_1XkYO9jj_dD5vGi-EeiDKFF6hBEHbK1m7WcQOrD-g2QIsvnCrkWnwvx9IwlUlbmMK0GSjSCEr7lqTXAciXnI=@protonmail.com
Hi,

Thanks Sarah for the feedback and tips on how to wrap the programs in the shell script.

In fact the patch is almost done, but I couldn't figure out the correct procedure for the map on line 1324. I get that the list of strings should be mapped into paths to the binaries, but after struggling I gave up and found book about Scheme to learn first.

So here is the patch with the minor issue.

Hope this utility helps.

Toggle snippet (104 lines)
Subject: [PATCH v4] gnu: Add git-issue.

* gnu/packages/version-control.scm (git-issue): New variable.

diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 064212db9f..c685f2f4b5 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -41,6 +41,7 @@
;;; Copyright © 2021 François J. <francois-oss@avalenn.eu>
;;; Copyright © 2021 Julien Lepiller <julien@lepiller.eu>
;;; Copyright © 2021 jgart <jgart@dismail.de>
+;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -96,6 +97,7 @@ (define-module (gnu packages version-control)
#:use-module (gnu packages groff)
#:use-module (gnu packages guile)
#:use-module (gnu packages guile-xyz)
+ #:use-module (gnu packages haskell-apps)
#:use-module (gnu packages image)
#:use-module (gnu packages linux)
#:use-module (gnu packages mail)
@@ -1277,6 +1279,75 @@ (define-public git-flow
lot easier.")
(license license:bsd-2)))

+(define-public git-issue
+ (let ((commit "67aacad35888b4c51e2d7be35c86fef137874f12")
+ (revision "1"))
+ (package
+ (name "git-issue")
+ (version (git-version "0.0" revision commit))
+ (source (origin
+ (method git-fetch)
+ (uri
+ (git-reference
+ (url "https://github.com/dspinellis/git-issue")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1z6dpwbikmiq5acpbji4kvmxqc2jw995rfk5703k5mvp5ps9a29q"))))
+ (build-system gnu-build-system)
+ (arguments
+ '(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
+ #:phases
+ (modify-phases %standard-phases
+ (delete 'configure)
+ (delete 'build)
+ (add-before 'check 'setup-env
+ (lambda _
+ (setenv "HOME" (getenv "TMPDIR"))
+ (invoke "git" "config" "--global" "user.email" "test")
+ (invoke "git" "config" "--global" "user.name" "Test")
+ (substitute* "test.sh"
+ (("! git diff") "git diff")
+ (("#!/bin/sh") (string-append "#!" (which "bash")))
+ (("gi=.*") (string-append "gi=" (getcwd) "/git-issue.sh\n")))
+ (substitute* "Makefile"
+ (("shellcheck -x") "shellcheck --exclude=SC2001,SC3043,SC3003 -x"))))
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests?
+ (invoke "make" "test"))))
+ (add-before 'install 'patch-paths
+ (lambda* (#:key build-inputs #:allow-other-keys)
+ (let ((out (assoc-ref %outputs "out"))
+ (paths (map
+ (lambda (input)
+ (string-append (assoc-ref build-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"))))))))
+ (native-inputs `(("shellcheck" ,shellcheck)))
+ (inputs `(("bash-minimal" ,bash-minimal)
+ ("git" ,git)
+ ("coreutils" ,coreutils)
+ ("grep" ,grep)
+ ("curl" ,curl)
+ ("findutils" ,findutils)
+ ("sed" ,sed)
+ ("util-linux" ,util-linux)
+ ("jq" ,jq)))
+ (synopsis "Git-based decentralized issue management")
+ (description "Git-issue 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")
--
2.33.1
?