aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/version-control.scm
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-10-07 18:04:41 -0400
committerLudovic Courtès <ludo@gnu.org>2024-08-31 10:42:06 +0200
commitbd20ad3eb2c2742c94e71ec4ba50681c7587a195 (patch)
tree70ff586d89c830f669f8a9de4dda1be6082b0deb /gnu/packages/version-control.scm
parent59505384c325edc24dd958a09e9e8133afe47fd8 (diff)
downloadguix-bd20ad3eb2c2742c94e71ec4ba50681c7587a195.tar.gz
guix-bd20ad3eb2c2742c94e71ec4ba50681c7587a195.zip
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
Diffstat (limited to 'gnu/packages/version-control.scm')
-rw-r--r--gnu/packages/version-control.scm57
1 files changed, 55 insertions, 2 deletions
diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index b84b0c7cad..d64eb19d8a 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -88,6 +88,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)
@@ -257,9 +258,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)
@@ -323,6 +329,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"
@@ -426,10 +477,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