diff mbox series

[bug#55693,2/2] gnu: Add gitlint.

Message ID 20220528235521.xvgu7x2qt3oitx7c@peregrine
State Accepted
Headers show
Series gnu: Add gitlint. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Brian Kubisiak May 28, 2022, 11:55 p.m. UTC
* gnu/packages/version-control.scm (gitlint): New variable.
---
 gnu/packages/version-control.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

Comments

M May 29, 2022, 10:51 a.m. UTC | #1
Brian Kubisiak schreef op za 28-05-2022 om 16:55 [-0700]:
> +    (propagated-inputs (list git))

Propagtion is not required, a regular input + substitute* 'git' by
(search-input-file inputs "bin/git") in  gitlint-core/gitlint/shell.py
should be sufficient.

Greetings,
Maxime
Brian Kubisiak May 29, 2022, 9:37 p.m. UTC | #2
> > +    (propagated-inputs (list git))
>
> Propagtion is not required, a regular input + substitute* 'git' by
> (search-input-file inputs "bin/git") in  gitlint-core/gitlint/shell.py
> should be sufficient.

shell.py only uses the 'subprocess' code path on windows (or if the
GITLINT_USE_SH_LIB environment variable is set, for testing). On
linux, git is called through 'from sh import git' (through the
python-sh library), which will look for git on $PATH and requires this
to be a propagated input.

Thanks,
Brian
M May 29, 2022, 9:43 p.m. UTC | #3
Brian Kubisiak schreef op zo 29-05-2022 om 14:37 [-0700]:
> > > +    (propagated-inputs (list git))
> > 
> > Propagtion is not required, a regular input + substitute* 'git' by
> > (search-input-file inputs "bin/git") in  gitlint-
> > core/gitlint/shell.py
> > should be sufficient.
> 
> shell.py only uses the 'subprocess' code path on windows (or if the
> GITLINT_USE_SH_LIB environment variable is set, for testing). On
> linux, git is called through 'from sh import git' (through the
> python-sh library), which will look for git on $PATH and requires
> this to be a propagated input.

Then we can patch python-sh or disable GITLINT_USE_SH_LIB instead, to
avoid propagation.

Greetings,
Maxime.
diff mbox series

Patch

diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 9d0786d2d9..a4766d5853 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -3371,3 +3371,29 @@  (define-public git-filter-repo
 Git project instead of @command{git filter-branch}.")
     (license (list license:expat ;; Main license.
                    license:gpl2)))) ;; For test harness.
+
+(define-public gitlint
+  (package
+    (name "gitlint")
+    (version "0.17.0")
+    (source (origin
+              (method url-fetch)
+              ;; the gitlint-core pypi package contains the actual gitlint
+              ;; code; the gitlint package only pulls in gitlint-core with
+              ;; stricter dependency versioning
+              (uri (pypi-uri "gitlint-core" version))
+              (sha256
+               (base32
+                "14cn89biys8r7mwcdgllv371k34km9k1941ylxf53a7sxwrzsbbp"))))
+    (build-system python-build-system)
+    (inputs
+     `(("python-arrow" ,python-arrow)
+       ("python-click" ,python-click)
+       ("python-sh" ,python-sh)))
+    (propagated-inputs (list git))
+    (home-page "https://jorisroovers.com/gitlint/")
+    (synopsis "Linting for your git commit messages")
+    (description
+     "Gitlint is a git commit message linter written in python: it checks your
+commit messages for style.")
+    (license license:expat)))