unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#74639] [PATCH] gnu: make-gitolite: Fix inputs references
@ 2024-12-01 23:15 ashish.is--- via Guix-patches via
  2024-12-02  0:31 ` Hilton Chain
  0 siblings, 1 reply; 4+ messages in thread
From: ashish.is--- via Guix-patches via @ 2024-12-01 23:15 UTC (permalink / raw)
  To: 74639; +Cc: Ashish SHUKLA

From: Ashish SHUKLA <ashish.is@lostca.se>

* gnu/packages/version-control.scm (make-gitolite)[arguments]<phases>
{patch-scripts,patch-source,wrap-scripts}: Update functions to reference
inputs from the inputs alist, instead of hardcoding.

Change-Id: Ia2468235b43c257ee1816d19325671d373ed2870
---
Hi,

When trying to override inputs of "gitolite", I noticed it's hardcoding them instead of referencing the "inputs" alist parameter which is passed to the phases, which makes overriding the inputs useless. This patches fixes that behaviour.

Thanks!

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

diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index c54833a8ec..eac3487cf1 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -2070,23 +2070,23 @@ (define* (make-gitolite #:optional (extra-inputs '()))
                (delete 'configure)
                (delete 'build)
                (add-before 'install 'patch-scripts
-                 (lambda* _
+                 (lambda* (#:key inputs #:allow-other-keys)
                    ;; This seems to take care of every shell script that
                    ;; invokes Perl.
                    (substitute* (find-files ".")
                      ((" perl -")
-                      (string-append " " #$perl "/bin/perl" " -")))
+                      (string-append " " (assoc-ref inputs "perl") "/bin/perl" " -")))
 
                    (substitute* (find-files "src/triggers" ".*")
                      ((" sed ")
-                      (string-append " " #$sed "/bin/sed" " ")))
+                      (string-append " " (assoc-ref inputs "sed") "/bin/sed" " ")))
 
                    (substitute*
                        '("src/triggers/post-compile/update-gitweb-access-list"
                          "src/triggers/post-compile/ssh-authkeys-split"
                          "src/triggers/upstream")
                      ((" grep ")
-                      (string-append " " #$grep "/bin/grep" " ")))
+                      (string-append " " (assoc-ref inputs "grep") "/bin/grep" " ")))
 
                    ;; Avoid references to the store in authorized_keys.
                    ;; This works because gitolite-shell is in the PATH.
@@ -2094,25 +2094,25 @@ (define* (make-gitolite #:optional (extra-inputs '()))
                      (("\\$glshell \\$user")
                       "gitolite-shell $user"))))
                (add-before 'install 'patch-source
-                 (lambda* _
+                 (lambda* (#:key inputs #:allow-other-keys)
                    ;; Gitolite uses cat to test the readability of the
                    ;; pubkey
                    (substitute* "src/lib/Gitolite/Setup.pm"
                      (("\"cat ")
-                      (string-append "\"" #$coreutils "/bin/cat" " "))
+                      (string-append "\"" (assoc-ref inputs "coreutils") "/bin/cat" " "))
                      (("\"ssh-keygen")
-                      (string-append "\"" #$openssh "/bin/ssh-keygen")))
+                      (string-append "\"" (assoc-ref inputs "openssh") "/bin/ssh-keygen")))
 
                    (substitute* '("src/lib/Gitolite/Hooks/PostUpdate.pm"
                                   "src/lib/Gitolite/Hooks/Update.pm")
                      (("/usr/bin/perl")
-                      (string-append #$perl "/bin/perl")))
+                      (string-append (assoc-ref inputs "perl") "/bin/perl")))
 
                    (substitute* "src/lib/Gitolite/Common.pm"
                      (("\"ssh-keygen")
-                      (string-append "\"" #$openssh "/bin/ssh-keygen"))
+                      (string-append "\"" (assoc-ref inputs "openssh") "/bin/ssh-keygen"))
                      (("\"logger\"")
-                      (string-append "\"" #$inetutils "/bin/logger\"")))
+                      (string-append "\"" (assoc-ref inputs "inetutils") "/bin/logger\"")))
 
                    (substitute* "src/lib/Gitolite/Cache.pm"
                      (("/usr/sbin/redis-server") "redis-server"))
@@ -2132,16 +2132,16 @@ (define* (make-gitolite #:optional (extra-inputs '()))
                                           (string-append bindir "/" script)))
                                '("gitolite" "gitolite-shell")))))
                (add-after 'install 'wrap-scripts
-                 (lambda* _
+                 (lambda* (#:key inputs #:allow-other-keys)
                    (for-each (lambda (file-name)
                                (wrap-program (string-append #$output file-name)
                                  `("PATH" ":" prefix
                                    ,(map (lambda (dir)
                                            (string-append dir "/bin"))
                                          (list #$output
-                                               #$coreutils
-                                               #$findutils
-                                               #$git
+                                               (assoc-ref inputs "coreutils")
+                                               (assoc-ref inputs "findutils")
+                                               (assoc-ref inputs "git")
                                                #$@extra-inputs)))))
                              '("/bin/gitolite" "/bin/gitolite-shell")))))))
     (inputs

base-commit: 858dd7e721d69a6087375395037a86640418f1fb
-- 
2.47.1





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [bug#74639] [PATCH] gnu: make-gitolite: Fix inputs references
  2024-12-01 23:15 [bug#74639] [PATCH] gnu: make-gitolite: Fix inputs references ashish.is--- via Guix-patches via
@ 2024-12-02  0:31 ` Hilton Chain
  2024-12-02  9:48   ` [bug#74639] [PATCH v2] " ashish.is--- via Guix-patches via
  0 siblings, 1 reply; 4+ messages in thread
From: Hilton Chain @ 2024-12-02  0:31 UTC (permalink / raw)
  To: Ashish SHUKLA; +Cc: 74639

Hi Ashish,

On Mon, 02 Dec 2024 07:15:07 +0800,
ashish.is--- via Guix-patches via wrote:
>
> From: Ashish SHUKLA <ashish.is@lostca.se>
>
> * gnu/packages/version-control.scm (make-gitolite)[arguments]<phases>
> {patch-scripts,patch-source,wrap-scripts}: Update functions to reference
> inputs from the inputs alist, instead of hardcoding.

The commit message format we use doesn't have this ("{...}") level I think?  You
can use "[#:phases]<...>" here instead.

> Change-Id: Ia2468235b43c257ee1816d19325671d373ed2870
> ---
> Hi,
>
> When trying to override inputs of "gitolite", I noticed it's hardcoding them
> instead of referencing the "inputs" alist parameter which is passed to the
> phases, which makes overriding the inputs useless. This patches fixes that
> behaviour.
>
> Thanks!
>
>  gnu/packages/version-control.scm | 28 ++++++++++++++--------------
>  1 file changed, 14 insertions(+), 14 deletions(-)

Please avoid operating on input labels directly when possible, in this case you
can use ‘search-input-file’.

Thanks




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [bug#74639] [PATCH v2] gnu: make-gitolite: Fix inputs references
  2024-12-02  0:31 ` Hilton Chain
@ 2024-12-02  9:48   ` ashish.is--- via Guix-patches via
  2024-12-08  7:45     ` bug#74639: " Hilton Chain
  0 siblings, 1 reply; 4+ messages in thread
From: ashish.is--- via Guix-patches via @ 2024-12-02  9:48 UTC (permalink / raw)
  To: 74639; +Cc: Hilton Chain, Ashish SHUKLA

From: Ashish SHUKLA <ashish.is@lostca.se>

* gnu/packages/version-control.scm (make-gitolite)[#:phases]
<patch-scripts,patch-source,wrap-scripts>: Update functions to reference
inputs from the inputs alist, instead of hardcoding.

Change-Id: Ia2468235b43c257ee1816d19325671d373ed2870
---
Hi Hilton,

Thanks for your comments. The patch is amended to incorporate your suggestions.

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

diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index c54833a8ec..ed19d481c9 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -2070,23 +2070,23 @@ (define* (make-gitolite #:optional (extra-inputs '()))
                (delete 'configure)
                (delete 'build)
                (add-before 'install 'patch-scripts
-                 (lambda* _
+                 (lambda* (#:key inputs #:allow-other-keys)
                    ;; This seems to take care of every shell script that
                    ;; invokes Perl.
                    (substitute* (find-files ".")
                      ((" perl -")
-                      (string-append " " #$perl "/bin/perl" " -")))
+                      (string-append " " (search-input-file inputs "/bin/perl") " -")))
 
                    (substitute* (find-files "src/triggers" ".*")
                      ((" sed ")
-                      (string-append " " #$sed "/bin/sed" " ")))
+                      (string-append " " (search-input-file inputs "/bin/sed") " ")))
 
                    (substitute*
                        '("src/triggers/post-compile/update-gitweb-access-list"
                          "src/triggers/post-compile/ssh-authkeys-split"
                          "src/triggers/upstream")
                      ((" grep ")
-                      (string-append " " #$grep "/bin/grep" " ")))
+                      (string-append " " (search-input-file inputs "/bin/grep") " ")))
 
                    ;; Avoid references to the store in authorized_keys.
                    ;; This works because gitolite-shell is in the PATH.
@@ -2094,25 +2094,25 @@ (define* (make-gitolite #:optional (extra-inputs '()))
                      (("\\$glshell \\$user")
                       "gitolite-shell $user"))))
                (add-before 'install 'patch-source
-                 (lambda* _
+                 (lambda* (#:key inputs #:allow-other-keys)
                    ;; Gitolite uses cat to test the readability of the
                    ;; pubkey
                    (substitute* "src/lib/Gitolite/Setup.pm"
                      (("\"cat ")
-                      (string-append "\"" #$coreutils "/bin/cat" " "))
+                      (string-append "\"" (search-input-file inputs "/bin/cat") " "))
                      (("\"ssh-keygen")
-                      (string-append "\"" #$openssh "/bin/ssh-keygen")))
+                      (string-append "\"" (search-input-file inputs "/bin/ssh-keygen"))))
 
                    (substitute* '("src/lib/Gitolite/Hooks/PostUpdate.pm"
                                   "src/lib/Gitolite/Hooks/Update.pm")
                      (("/usr/bin/perl")
-                      (string-append #$perl "/bin/perl")))
+                      (search-input-file inputs "/bin/perl")))
 
                    (substitute* "src/lib/Gitolite/Common.pm"
                      (("\"ssh-keygen")
-                      (string-append "\"" #$openssh "/bin/ssh-keygen"))
+                      (string-append "\"" (search-input-file inputs "/bin/ssh-keygen")))
                      (("\"logger\"")
-                      (string-append "\"" #$inetutils "/bin/logger\"")))
+                      (string-append "\"" (search-input-file inputs "/bin/logger") "\"")))
 
                    (substitute* "src/lib/Gitolite/Cache.pm"
                      (("/usr/sbin/redis-server") "redis-server"))
@@ -2132,16 +2132,16 @@ (define* (make-gitolite #:optional (extra-inputs '()))
                                           (string-append bindir "/" script)))
                                '("gitolite" "gitolite-shell")))))
                (add-after 'install 'wrap-scripts
-                 (lambda* _
+                 (lambda* (#:key inputs #:allow-other-keys)
                    (for-each (lambda (file-name)
                                (wrap-program (string-append #$output file-name)
                                  `("PATH" ":" prefix
                                    ,(map (lambda (dir)
                                            (string-append dir "/bin"))
                                          (list #$output
-                                               #$coreutils
-                                               #$findutils
-                                               #$git
+                                               (assoc-ref inputs "coreutils")
+                                               (assoc-ref inputs "findutils")
+                                               (assoc-ref inputs "git")
                                                #$@extra-inputs)))))
                              '("/bin/gitolite" "/bin/gitolite-shell")))))))
     (inputs

base-commit: 858dd7e721d69a6087375395037a86640418f1fb
prerequisite-patch-id: be2a7e1cff0d66ce722708694eced7289a0001bf
prerequisite-patch-id: 2b0ad6deed9f2ccb23385848c5f053d40c455f5f
prerequisite-patch-id: 906fe7cd5820d5117eb25e8336bea24bae006354
prerequisite-patch-id: 7f561f1954df967f31eef3fca1dc8cc8aeefdc83
prerequisite-patch-id: 7e5b81441f3522eaaba1d0f00339ce4e0dd6b58e
prerequisite-patch-id: c5a0c62290f2e8266d7a93c997396a158a8385ab
prerequisite-patch-id: 5b582114a923c594a599d28cedba4dda6795d326
prerequisite-patch-id: 22498d84439b2bf9f2d6f5935f8d1f3293b1de5d
-- 
2.47.1





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#74639: [PATCH v2] gnu: make-gitolite: Fix inputs references
  2024-12-02  9:48   ` [bug#74639] [PATCH v2] " ashish.is--- via Guix-patches via
@ 2024-12-08  7:45     ` Hilton Chain
  0 siblings, 0 replies; 4+ messages in thread
From: Hilton Chain @ 2024-12-08  7:45 UTC (permalink / raw)
  To: ashish.is; +Cc: 74639-done

Hi Ashish,

On Mon, 02 Dec 2024 17:48:23 +0800,
ashish.is@lostca.se wrote:
>
> From: Ashish SHUKLA <ashish.is@lostca.se>
>
> * gnu/packages/version-control.scm (make-gitolite)[#:phases]
> <patch-scripts,patch-source,wrap-scripts>: Update functions to reference
> inputs from the inputs alist, instead of hardcoding.
>
> Change-Id: Ia2468235b43c257ee1816d19325671d373ed2870
> ---
> Hi Hilton,
>
> Thanks for your comments. The patch is amended to incorporate your suggestions.
>
>  gnu/packages/version-control.scm | 28 ++++++++++++++--------------
>  1 file changed, 14 insertions(+), 14 deletions(-)

Applied v2 as 810cc4764a27ddac3e15f325b02a4f665067f4ac with following change:

--8<---------------cut here---------------start------------->8---
diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 3987a6e3dc..b4863698e5 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -2078,18 +2078,21 @@ (define* (make-gitolite #:optional (extra-inputs '()))
                    ;; invokes Perl.
                    (substitute* (find-files ".")
                      ((" perl -")
-                      (string-append " " (search-input-file inputs "/bin/perl") " -")))
+                      (string-append
+                       " " (search-input-file inputs "bin/perl") " -")))

                    (substitute* (find-files "src/triggers" ".*")
                      ((" sed ")
-                      (string-append " " (search-input-file inputs "/bin/sed") " ")))
+                      (string-append
+                       " " (search-input-file inputs "bin/sed") " ")))

                    (substitute*
                        '("src/triggers/post-compile/update-gitweb-access-list"
                          "src/triggers/post-compile/ssh-authkeys-split"
                          "src/triggers/upstream")
                      ((" grep ")
-                      (string-append " " (search-input-file inputs "/bin/grep") " ")))
+                      (string-append
+                       " " (search-input-file inputs "bin/grep") " ")))

                    ;; Avoid references to the store in authorized_keys.
                    ;; This works because gitolite-shell is in the PATH.
@@ -2102,20 +2105,24 @@ (define* (make-gitolite #:optional (extra-inputs '()))
                    ;; pubkey
                    (substitute* "src/lib/Gitolite/Setup.pm"
                      (("\"cat ")
-                      (string-append "\"" (search-input-file inputs "/bin/cat") " "))
+                      (string-append
+                       "\"" (search-input-file inputs "bin/cat") " "))
                      (("\"ssh-keygen")
-                      (string-append "\"" (search-input-file inputs "/bin/ssh-keygen"))))
+                      (string-append
+                       "\"" (search-input-file inputs "bin/ssh-keygen"))))

                    (substitute* '("src/lib/Gitolite/Hooks/PostUpdate.pm"
                                   "src/lib/Gitolite/Hooks/Update.pm")
                      (("/usr/bin/perl")
-                      (search-input-file inputs "/bin/perl")))
+                      (search-input-file inputs "bin/perl")))

                    (substitute* "src/lib/Gitolite/Common.pm"
                      (("\"ssh-keygen")
-                      (string-append "\"" (search-input-file inputs "/bin/ssh-keygen")))
+                      (string-append
+                       "\"" (search-input-file inputs "bin/ssh-keygen")))
                      (("\"logger\"")
-                      (string-append "\"" (search-input-file inputs "/bin/logger") "\"")))
+                      (string-append
+                       "\"" (search-input-file inputs "bin/logger") "\"")))

                    (substitute* "src/lib/Gitolite/Cache.pm"
                      (("/usr/sbin/redis-server") "redis-server"))
@@ -2139,13 +2146,17 @@ (define* (make-gitolite #:optional (extra-inputs '()))
                    (for-each (lambda (file-name)
                                (wrap-program (string-append #$output file-name)
                                  `("PATH" ":" prefix
-                                   ,(map (lambda (dir)
+                                   ,(append
+                                     (map (lambda (command)
+                                            (dirname
+                                             (search-input-file
+                                              inputs
+                                              (string-append "bin/" command))))
+                                          '("chmod" "find" "git"))
+                                     (map (lambda (dir)
                                            (string-append dir "/bin"))
                                          (list #$output
-                                               (assoc-ref inputs "coreutils")
-                                               (assoc-ref inputs "findutils")
-                                               (assoc-ref inputs "git")
-                                               #$@extra-inputs)))))
+                                               #$@extra-inputs))))))
                              '("/bin/gitolite" "/bin/gitolite-shell")))))))
     (inputs
      (append (list bash-minimal coreutils findutils git inetutils openssh perl)
--8<---------------cut here---------------end--------------->8---

Thanks




^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-12-08  7:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-01 23:15 [bug#74639] [PATCH] gnu: make-gitolite: Fix inputs references ashish.is--- via Guix-patches via
2024-12-02  0:31 ` Hilton Chain
2024-12-02  9:48   ` [bug#74639] [PATCH v2] " ashish.is--- via Guix-patches via
2024-12-08  7:45     ` bug#74639: " Hilton Chain

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).