Subject: Re: [bug#49581] [PATCH v4] gnu: Add git-issues.

From: phodina <[email-masked]>
Date: Mon, 01 Nov 2021 20:21:43 +0000

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.

--8<---------------cut here---------------start------------->8---

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. <[email-masked]>
 ;;; Copyright © 2021 Julien Lepiller <[email-masked]>
 ;;; Copyright © 2021 jgart <[email-masked]>
+;;; Copyright © 2021 Petr Hodina <[email-masked]>
 ;;;
 ;;; 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