[PATCH] gnu: git-sizer: Pin git version.

  • Open
  • quality assurance status badge
Details
3 participants
  • Greg Hogan
  • Liliana Marie Prikler
  • Ludovic Courtès
Owner
unassigned
Submitted by
Greg Hogan
Severity
normal
G
G
Greg Hogan wrote on 24 Oct 21:05 +0200
(address . guix-patches@gnu.org)(name . Greg Hogan)(address . code@greghogan.com)
12475749a8d371488d9ae1fa331ad10dd24aa644.1729796653.git.code@greghogan.com
When I submitted this package the placement of git in native-inputs was
incorrect. This patch switches that dependency to the pinned version of
git in inputs and therefore hard-codes the path.

* gnu/packages/version-control.scm (git-sizer)
[arguments]<#:phases>: Use gexps and hard-code git path in 'fix-paths.
[propagated-inputs]: Remove git.
[native-inputs]: Add git-minimal/pinned.

Change-Id: Ide0c5a3df7c0cf0ecdaa5446b5d13970dae96560
---
gnu/packages/version-control.scm | 44 +++++++++++++++++---------------
1 file changed, 24 insertions(+), 20 deletions(-)

Toggle diff (59 lines)
diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 6bd37fee82..78342fbe31 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -4364,26 +4364,30 @@ (define-public git-sizer
"1b4sl4djnfaxwph41y4bh9yal4bpd1nz4403ryp7nzna7h2x0zis"))))
(build-system go-build-system)
(arguments
- '(#:import-path "github.com/github/git-sizer"
- #:install-source? #f
- #:phases
- (modify-phases %standard-phases
- (add-after 'unpack 'fix-paths
- (lambda* (#:key outputs #:allow-other-keys)
- (substitute* '("src/github.com/github/git-sizer/git_sizer_test.go")
- (("bin/git-sizer")
- (string-append (assoc-ref outputs "out")
- "/bin/git-sizer")))))
- (replace 'check
- (lambda* (#:key tests? import-path #:allow-other-keys)
- (when tests?
- (for-each (lambda (test)
- (invoke "go" "test" "-v" "-run" test import-path))
- ;; TestExec and TestSubmodule require a copy of the
- ;; Git repository.
- '("TestBomb" "TestFromSubdir" "TestRefgroups"
- "TestRefSelections" "TestTaggedTags"))))))))
- (native-inputs (list git))
+ (list
+ #:import-path "github.com/github/git-sizer"
+ #:install-source? #f
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'fix-paths
+ (lambda _
+ (let ((git #$git-minimal/pinned))
+ (substitute* '("src/github.com/github/git-sizer/git_sizer_test.go")
+ (("bin/git-sizer")
+ (string-append #$output "/bin/git-sizer")))
+ (substitute* '("src/github.com/github/git-sizer/git/git.go")
+ (("gitBin, err := findGitBin\\(\\)")
+ (string-append "gitBin := \"" git "/bin/git\"\n\tvar err error"))))))
+ (replace 'check
+ (lambda* (#:key tests? import-path #:allow-other-keys)
+ (when tests?
+ (for-each (lambda (test)
+ (invoke "go" "test" "-v" "-run" test import-path))
+ ;; TestExec and TestSubmodule require a copy of the
+ ;; Git repository.
+ '("TestBomb" "TestFromSubdir" "TestRefgroups"
+ "TestRefSelections" "TestTaggedTags"))))))))
+ (inputs (list git-minimal/pinned))
(propagated-inputs
(list go-github-com-cli-safeexec
go-github-com-davecgh-go-spew

base-commit: ac19ae37b5000c224c4cd167b239cc3027d01b30
--
2.46.1
L
L
Liliana Marie Prikler wrote on 29 Nov 10:40 +0100
48353def5b5c7b3eae7fd7101a42a36ef1e13225.camel@gmail.com
Am Donnerstag, dem 24.10.2024 um 19:05 +0000 schrieb Greg Hogan:
Toggle quote (9 lines)
> When I submitted this package the placement of git in native-inputs
> was incorrect. This patch switches that dependency to the pinned
> version of git in inputs and therefore hard-codes the path.
>
> * gnu/packages/version-control.scm (git-sizer)
> [arguments]<#:phases>: Use gexps and hard-code git path in 'fix-
> paths.
> [propagated-inputs]: Remove git.
> [native-inputs]: Add git-minimal/pinned.
The ChangeLog here is wrong. git is removed from native-inputs and
git-minimal/pinned added to inputs.

I would suggest making the change to G-Expressions in a separate patch
for easier review.


Cheers
G
G
Greg Hogan wrote on 5 Dec 22:04 +0100
[PATCH v2 3/3] gnu: git-sizer: Pin git version.
(address . 73993@debbugs.gnu.org)(name . Greg Hogan)(address . code@greghogan.com)
8ab694342d0e9668dec24cf24170ce89276d440d.1733430615.git.code@greghogan.com
* gnu/packages/version-control.scm (git-sizer)
[arguments]<#:phases>: Hard-code git path in 'fix-paths.
[propagated-inputs]: Remove git.
[inputs]: Add git-minimal/pinned.

Change-Id: Icc21f92e0261ff05f3411970e6f4792763a94f80
---
gnu/packages/version-control.scm | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

Toggle diff (34 lines)
diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 37ee819688..8c7d817523 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -4468,10 +4468,13 @@ (define-public git-sizer
#~(modify-phases %standard-phases
(add-after 'unpack 'fix-paths
(lambda _
- (let ((git #$git))
+ (let ((git #$git-minimal/pinned))
(substitute* '("src/github.com/github/git-sizer/git_sizer_test.go")
(("bin/git-sizer")
- (string-append #$output "/bin/git-sizer"))))))
+ (string-append #$output "/bin/git-sizer")))
+ (substitute* '("src/github.com/github/git-sizer/git/git.go")
+ (("gitBin, err := findGitBin\\(\\)")
+ (string-append "gitBin := \"" git "/bin/git\"\n\tvar err error"))))))
(replace 'check
(lambda* (#:key tests? import-path #:allow-other-keys)
(when tests?
@@ -4481,9 +4484,9 @@ (define-public git-sizer
;; Git repository.
'("TestBomb" "TestFromSubdir" "TestRefgroups"
"TestRefSelections" "TestTaggedTags"))))))))
+ (inputs (list git-minimal/pinned))
(propagated-inputs
- (list git
- go-github-com-cli-safeexec
+ (list go-github-com-cli-safeexec
go-github-com-davecgh-go-spew
go-github-com-pmezard-go-difflib
go-github-com-spf13-pflag
--
2.47.1
G
G
Greg Hogan wrote on 5 Dec 22:04 +0100
[PATCH v2 0/3] Pin git for git-sizer.
(address . 73993@debbugs.gnu.org)(name . Greg Hogan)(address . code@greghogan.com)
cover.1733430615.git.code@greghogan.com
The git package can be updated more readily if we reduce the number of
dependent packages. As in this patchset, we can depend on the pinned
version of git if we hard-code the location of the git executable and
do not propagate the dependency, which could cause profile conflicts.

The first patch fixes the issue where git was neither hard-coded nor
propagated and only worked because git is typically available in a user
profile. This can be tested with "guix shell --container git-sizer".

Greg Hogan (3):
gnu: git-sizer: Propagate git.
gnu: git-sizer: Use gexps.
gnu: git-sizer: Pin git version.

gnu/packages/version-control.scm | 44 +++++++++++++++++---------------
1 file changed, 24 insertions(+), 20 deletions(-)


base-commit: 006679d1e6ca7acea0629b4f019c8cf89cde08be
--
2.47.1
G
G
Greg Hogan wrote on 5 Dec 22:04 +0100
[PATCH v2 1/3] gnu: git-sizer: Propagate git.
(address . 73993@debbugs.gnu.org)(name . Greg Hogan)(address . code@greghogan.com)
c4a50b440369b365dc0ec42a56ced65b04d91ec1.1733430615.git.code@greghogan.com
Fix the current version of this package, which depends on git from PATH.

* gnu/packages/version-control.scm (git-sizer)
[native-inputs]: Move git ...
[propagated-inputs]: ... to here.

Change-Id: Iea70a16845e93f5c3740da5596e61cc2d7fd17b9
---
gnu/packages/version-control.scm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Toggle diff (18 lines)
diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 289b981911..86e241ad27 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -4480,9 +4480,9 @@ (define-public git-sizer
;; Git repository.
'("TestBomb" "TestFromSubdir" "TestRefgroups"
"TestRefSelections" "TestTaggedTags"))))))))
- (native-inputs (list git))
(propagated-inputs
- (list go-github-com-cli-safeexec
+ (list git
+ go-github-com-cli-safeexec
go-github-com-davecgh-go-spew
go-github-com-pmezard-go-difflib
go-github-com-spf13-pflag
--
2.47.1
G
G
Greg Hogan wrote on 5 Dec 22:04 +0100
[PATCH v2 2/3] gnu: git-sizer: Use gexps.
(address . 73993@debbugs.gnu.org)(name . Greg Hogan)(address . code@greghogan.com)
5fb143fe5d3b981106d71d9d029d026a732982c2.1733430615.git.code@greghogan.com
* gnu/packages/version-control.scm (git-sizer)
[arguments]<#:phases>: Use gexps.

Change-Id: Ic2c797c59b7f5f0d30b4b799eb293be4973f7e13
---
gnu/packages/version-control.scm | 39 ++++++++++++++++----------------
1 file changed, 20 insertions(+), 19 deletions(-)

Toggle diff (52 lines)
diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 86e241ad27..37ee819688 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -4461,25 +4461,26 @@ (define-public git-sizer
"1b4sl4djnfaxwph41y4bh9yal4bpd1nz4403ryp7nzna7h2x0zis"))))
(build-system go-build-system)
(arguments
- '(#:import-path "github.com/github/git-sizer"
- #:install-source? #f
- #:phases
- (modify-phases %standard-phases
- (add-after 'unpack 'fix-paths
- (lambda* (#:key outputs #:allow-other-keys)
- (substitute* '("src/github.com/github/git-sizer/git_sizer_test.go")
- (("bin/git-sizer")
- (string-append (assoc-ref outputs "out")
- "/bin/git-sizer")))))
- (replace 'check
- (lambda* (#:key tests? import-path #:allow-other-keys)
- (when tests?
- (for-each (lambda (test)
- (invoke "go" "test" "-v" "-run" test import-path))
- ;; TestExec and TestSubmodule require a copy of the
- ;; Git repository.
- '("TestBomb" "TestFromSubdir" "TestRefgroups"
- "TestRefSelections" "TestTaggedTags"))))))))
+ (list
+ #:import-path "github.com/github/git-sizer"
+ #:install-source? #f
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'fix-paths
+ (lambda _
+ (let ((git #$git))
+ (substitute* '("src/github.com/github/git-sizer/git_sizer_test.go")
+ (("bin/git-sizer")
+ (string-append #$output "/bin/git-sizer"))))))
+ (replace 'check
+ (lambda* (#:key tests? import-path #:allow-other-keys)
+ (when tests?
+ (for-each (lambda (test)
+ (invoke "go" "test" "-v" "-run" test import-path))
+ ;; TestExec and TestSubmodule require a copy of the
+ ;; Git repository.
+ '("TestBomb" "TestFromSubdir" "TestRefgroups"
+ "TestRefSelections" "TestTaggedTags"))))))))
(propagated-inputs
(list git
go-github-com-cli-safeexec
--
2.47.1
G
G
Greg Hogan wrote on 5 Dec 22:06 +0100
Re: [PATCH] gnu: git-sizer: Pin git version.
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)(address . 73993@debbugs.gnu.org)
CA+3U0Zn7qhzKsuCBEpH3zVZCu=L2wbzxKQk6CoyLOGYRyumCAA@mail.gmail.com
On Fri, Nov 29, 2024 at 4:40?AM Liliana Marie Prikler
<liliana.prikler@gmail.com> wrote:
Toggle quote (19 lines)
>
> Am Donnerstag, dem 24.10.2024 um 19:05 +0000 schrieb Greg Hogan:
> > When I submitted this package the placement of git in native-inputs
> > was incorrect. This patch switches that dependency to the pinned
> > version of git in inputs and therefore hard-codes the path.
> >
> > * gnu/packages/version-control.scm (git-sizer)
> > [arguments]<#:phases>: Use gexps and hard-code git path in 'fix-
> > paths.
> > [propagated-inputs]: Remove git.
> > [native-inputs]: Add git-minimal/pinned.
> The ChangeLog here is wrong. git is removed from native-inputs and
> git-minimal/pinned added to inputs.
>
> I would suggest making the change to G-Expressions in a separate patch
> for easier review.
>
> Cheers

Thanks for reviewing and catching the errors in the commit message. I
have split v2 into three commits because the current package is broken
as git needs to be either propagated or hard-coded. The git dependency
should have been in propagated-inputs, and is now in inputs.
L
L
Liliana Marie Prikler wrote on 6 Dec 22:19 +0100
Re: [PATCH v2 3/3] gnu: git-sizer: Pin git version.
7aa919a4b5bdcd5a6c855ab4e6dcafa732dfedb9.camel@gmail.com
Am Donnerstag, dem 05.12.2024 um 21:04 +0000 schrieb Greg Hogan:
Toggle quote (7 lines)
> * gnu/packages/version-control.scm (git-sizer)
> [arguments]<#:phases>: Hard-code git path in 'fix-paths.
> [propagated-inputs]: Remove git.
> [inputs]: Add git-minimal/pinned.
>
> Change-Id: Icc21f92e0261ff05f3411970e6f4792763a94f80
> ---
General note: when someone comments on your patch, don't forget to CC
them in upcoming revisions :)

Toggle quote (14 lines)
>  gnu/packages/version-control.scm | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-
> control.scm
> index 37ee819688..8c7d817523 100644
> --- a/gnu/packages/version-control.scm
> +++ b/gnu/packages/version-control.scm
> @@ -4468,10 +4468,13 @@ (define-public git-sizer
>        #~(modify-phases %standard-phases
>            (add-after 'unpack 'fix-paths
>              (lambda _
> -              (let ((git #$git))
> +              (let ((git #$git-minimal/pinned))
I'd rather avoid binding git per gexp here.
Toggle quote (10 lines)
>                 (substitute* '("src/github.com/github/git-
> sizer/git_sizer_test.go")
>                   (("bin/git-sizer")
> -                  (string-append #$output "/bin/git-sizer"))))))
> +                  (string-append #$output "/bin/git-sizer")))
> +               (substitute* '("src/github.com/github/git-
> sizer/git/git.go")
> +                 (("gitBin, err := findGitBin\\(\\)")
> +                  (string-append "gitBin := \"" git
> "/bin/git\"\n\tvar err error"))))))
You can use (search-input-file …) instead.
Toggle quote (17 lines)
>            (replace 'check
>              (lambda* (#:key tests? import-path #:allow-other-keys)
>                (when tests?
> @@ -4481,9 +4484,9 @@ (define-public git-sizer
>                            ;; Git repository.
>                            '("TestBomb" "TestFromSubdir"
> "TestRefgroups"
>                              "TestRefSelections"
> "TestTaggedTags"))))))))
> +    (inputs (list git-minimal/pinned))
>      (propagated-inputs
> -     (list git
> -           go-github-com-cli-safeexec
> +     (list go-github-com-cli-safeexec
>             go-github-com-davecgh-go-spew
>             go-github-com-pmezard-go-difflib
>             go-github-com-spf13-pflag
I don't see a good reason to move git first to propagated-inputs and
then to inputs. I would squash this and 1/3 into one patch that
doesn't necessarily rely on G-Expressions in the middle :)

Cheers
G
G
Greg Hogan wrote on 9 Dec 16:30 +0100
[PATCH v3] gnu: git-sizer: Pin git version.
(address . 73993@debbugs.gnu.org)
98c9da16b8fe18f553d46262e2292fcca7bf4699.1733758114.git.code@greghogan.com
* gnu/packages/version-control.scm (git-sizer)
[arguments]<#:phases>: Hard-code git path in 'fix-paths.
[native-inputs]: Remove git.
[inputs]: Add git-minimal/pinned.

Change-Id: If6178a0e1c453ea47a1f70cd507639b5be2142b0
---
gnu/packages/version-control.scm | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

Toggle diff (31 lines)
diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 3339e79390..eb9dcfa198 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -4479,7 +4479,12 @@ (define-public git-sizer
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'fix-paths
- (lambda* (#:key outputs #:allow-other-keys)
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (substitute* '("src/github.com/github/git-sizer/git/git.go")
+ (("gitBin, err := findGitBin\\(\\)")
+ (string-append "gitBin := \""
+ (search-input-file inputs "bin/git")
+ "\"\n\tvar err error")))
(substitute* '("src/github.com/github/git-sizer/git_sizer_test.go")
(("bin/git-sizer")
(string-append (assoc-ref outputs "out")
@@ -4493,7 +4498,7 @@ (define-public git-sizer
;; Git repository.
'("TestBomb" "TestFromSubdir" "TestRefgroups"
"TestRefSelections" "TestTaggedTags"))))))))
- (native-inputs (list git))
+ (inputs (list git-minimal/pinned))
(propagated-inputs
(list go-github-com-cli-safeexec
go-github-com-davecgh-go-spew

base-commit: 9d09b0cf841fb657a1aec12e9bab68e00c2b493c
--
2.46.0
L
L
Ludovic Courtès wrote 7 days ago
Re: [bug#73993] [PATCH v2 1/3] gnu: git-sizer: Propagate git.
(name . Greg Hogan)(address . code@greghogan.com)(address . 73993@debbugs.gnu.org)
87a5ctmeyl.fsf@gnu.org
Greg Hogan <code@greghogan.com> skribis:

Toggle quote (8 lines)
> Fix the current version of this package, which depends on git from PATH.
>
> * gnu/packages/version-control.scm (git-sizer)
> [native-inputs]: Move git ...
> [propagated-inputs]: ... to here.
>
> Change-Id: Iea70a16845e93f5c3740da5596e61cc2d7fd17b9

[...]

Toggle quote (4 lines)
> (propagated-inputs
> - (list go-github-com-cli-safeexec
> + (list git

Instead of propagating, it would be nice to record the absolute file
name in the source.
L
L
Ludovic Courtès wrote 7 days ago
Re: [bug#73993] [PATCH v2 2/3] gnu: git-sizer: Use gexps.
(name . Greg Hogan)(address . code@greghogan.com)(address . 73993@debbugs.gnu.org)
875xnhmexa.fsf@gnu.org
Greg Hogan <code@greghogan.com> skribis:

Toggle quote (5 lines)
> * gnu/packages/version-control.scm (git-sizer)
> [arguments]<#:phases>: Use gexps.
>
> Change-Id: Ic2c797c59b7f5f0d30b4b799eb293be4973f7e13

[...]

Toggle quote (4 lines)
> + (add-after 'unpack 'fix-paths
> + (lambda _
> + (let ((git #$git))

This variable is unused. If it were used, it should instead be:

(let ((git #$(this-package-input "git")))
…)

Ludo’.
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 73993@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 73993
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch