diff options
author | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2023-10-07 18:04:41 -0400 |
---|---|---|
committer | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2023-10-09 15:40:53 -0400 |
commit | 48e528a26f9c019eeaccf5e3de3126aa02c98d3b (patch) | |
tree | 9793dd91063c4ab705a31522dd6befa355714abf | |
parent | 020ff2eedc0657f45921fe6f28bd6276348d46e3 (diff) |
gnu: git-minimal: Add coreutils and sed to PATH.
Fixes <https://issues.guix.gnu.org/65924>.
* gnu/packages/version-control.scm (git-minimal)
[arguments] <imported-modules>: New field.
<modules>: Augment with (ice-9 match), (ice-9 textual-ports) and (guix
search-paths).
<phases>: Add patch-commands phase.
[inputs]: Add coreutils-minimal and sed.
Reviewed-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
Change-Id: I8e3dbbd24ef7f8fa98a392a36617b07fe632cd15
-rw-r--r-- | gnu/packages/version-control.scm | 57 |
1 files changed, 55 insertions, 2 deletions
diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm index bc647d1538..b0997db5da 100644 --- a/gnu/packages/version-control.scm +++ b/gnu/packages/version-control.scm @@ -82,6 +82,7 @@ #:use-module (guix build-system python) #:use-module (guix build-system qt) #:use-module (guix build-system trivial) + #:use-module (guix modules) #:use-module (gnu packages apr) #:use-module (gnu packages autotools) #:use-module (gnu packages documentation) @@ -245,9 +246,14 @@ Python 3.3 and later, rather than on Python 2.") (build-system gnu-build-system) (arguments (list - #:modules `((srfi srfi-1) + #:imported-modules `(,@%gnu-build-system-modules + ,@(source-module-closure '((guix search-paths)))) + #:modules `((ice-9 match) + (ice-9 textual-ports) + (srfi srfi-1) (srfi srfi-26) ((guix build gnu-build-system) #:prefix gnu:) + (guix search-paths) ,@%gnu-build-system-modules) ;; Make sure the full bash does not end up in the final closure. #:disallowed-references (list bash perl) @@ -311,6 +317,51 @@ Python 3.3 and later, rather than on Python 2.") inputs "bin/curl-config")) ":" (getenv "PATH")))))) #~()) + (add-after 'unpack 'patch-commands + (lambda* (#:key inputs #:allow-other-keys) + (define (prepend-string-to-file text file) + "Prepend TEXT to FILE." + (let ((content (call-with-input-file file + (cut get-string-all <>)))) + (call-with-output-file file + (lambda (port) + (display text port) + (display content port))))) + + (define PATH-variable-definition + (let ((value + (match (evaluate-search-paths + (list $PATH) + (list #$(this-package-input "coreutils-minimal") + #$(this-package-input "sed"))) + (((spec . value)) + value)))) + (string-append + (search-path-definition $PATH value + #:kind 'prefix) "\n\n"))) + + ;; Ensure that coreutils (for basename) and sed are on PATH + ;; for any script that sources the 'git-sh-setup.sh' file. + (prepend-string-to-file PATH-variable-definition + "git-sh-setup.sh") + + ;; Avoid depending on util-linux; it's only used to detect + ;; whether the system is MinGW, which we can detect at build + ;; time. + (substitute* "git-sh-setup.sh" + (("\\$\\(uname -s)") + (if #$(target-mingw?) + "MINGW" + "GNU"))) ;matched against '*' + + ;; git-submodule sources 'git-sh-setup.sh', but not before + ;; invoking the basename and sed commands... patch them to their + ;; absolute location. + (substitute* "git-submodule.sh" + (("\\$\\(basename") + (string-append "$(" (search-input-file inputs "bin/basename"))) + (("sed -e") + (string-append (search-input-file inputs "bin/sed") " -e"))))) (add-after 'configure 'patch-makefiles (lambda _ (substitute* "Makefile" @@ -414,10 +465,12 @@ Python 3.3 and later, rather than on Python 2.") gettext-minimal perl)) (inputs - (list curl ;for HTTP(S) access + (list coreutils-minimal + curl ;for HTTP(S) access expat ;for 'git push' over HTTP(S) openssl perl + sed zlib)) (native-search-paths ;; For HTTPS access, Git needs a single-file certificate bundle, specified |