diff mbox series

[bug#49581,v5] gnu: Add git-issue.

Message ID 051ea586df11c135a2a535b6bfad3ab0b73b0e8e.1685370938.git.jlicht@fsfe.org
State New
Headers show
Series [bug#49581,v5] gnu: Add git-issue. | expand

Commit Message

Jelle Licht May 29, 2023, 2:35 p.m. UTC
From: phodina <phodina@protonmail.com>

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

Co-authored-by: Jelle Licht <jlicht@fsfe.org>

---

Changes in v5:
- Update to latest commit of upstream
- Use gexp-style inputs
- Pass custom #:test-target instead of replacing check phase
- Use search-input-file where possible
- Autoload shellcheck to prevent module import cycle
- Use user-installed git, instead of hardcoding reference

 gnu/packages/version-control.scm | 68 ++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)


base-commit: cf78f5b54975679df97c3015a541114d8278f417
diff mbox series

Patch

diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 1db0931ac3..4eff59e516 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -42,6 +42,7 @@ 
 ;;; Copyright © 2021 Julien Lepiller <julien@lepiller.eu>
 ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
 ;;; Copyright © 2021 jgart <jgart@dismail.de>
+;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
 ;;; Copyright © 2021 Foo Chuan Wei <chuanwei.foo@hotmail.com>
 ;;; Copyright © 2022 Jai Vetrivelan <jaivetrivelan@gmail.com>
 ;;; Copyright © 2022 Maxime Devos <maximedevos@telenet.be>
@@ -140,6 +141,8 @@  (define-module (gnu packages version-control)
   #:use-module (gnu packages textutils)
   #:use-module (gnu packages time)
   #:use-module (gnu packages tls)
+  ;; Using autoload to avoid a cycle.
+  #:autoload   (gnu packages haskell-apps) (shellcheck)
   #:use-module (gnu packages)
   #:use-module (ice-9 match)
   #:use-module (srfi srfi-1)
@@ -1365,6 +1368,71 @@  (define-public git-flow
 lot easier.")
     (license license:bsd-2)))
 
+(define-public git-issue
+  (let ((commit "4d2bc4173bf803d74bf2ae54f892bd08754f1b48")
+        (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
+                  "0jmx8wjvvxkd3y5im2h96d13dnbpds66djf96b6s23jwfbr7dlsz"))))
+      (build-system gnu-build-system)
+      (arguments
+       (list
+        #:make-flags #~(list (string-append "PREFIX=" #$output))
+        #:test-target "test"
+        #:phases
+        #~(modify-phases %standard-phases
+           (delete 'configure)
+           (delete 'build)
+           (add-before 'check 'setup-env
+             (lambda* (#:key inputs native-inputs #:allow-other-keys)
+               (setenv "HOME" (getenv "TMPDIR"))
+               (invoke "git" "config" "--global" "user.email" "test")
+               (invoke "git" "config" "--global" "user.name" "Test")
+               (substitute* "test.sh"
+                 (("! git diff") "false")
+                 (("#!/bin/sh")
+                  (string-append
+                   "#!"
+                   (search-input-file (or native-inputs inputs) "/bin/sh"))))
+               (substitute* "Makefile"
+                 (("shellcheck -x")
+                  "shellcheck --exclude=SC2001,SC2294,SC3043,SC3003 -x"))))
+           (add-after 'install 'patch-paths
+             (lambda* (#:key inputs outputs #:allow-other-keys)
+               (let ((path (map
+                            (lambda (program)
+                              (dirname
+                               (search-input-file inputs
+                                                  (string-append "/bin/" program))))
+                            '("jq" "curl" "grep" "cat" "find"))))
+                 (wrap-program (search-input-file outputs "bin/git-issue")
+                   `("PATH" prefix ,path))))))))
+      (native-inputs (list shellcheck git-minimal bash-minimal util-linux))
+      (inputs (list bash-minimal
+                    coreutils
+                    curl
+                    findutils
+                    grep
+                    jq
+                    sed))
+      (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")