aboutsummaryrefslogtreecommitdiff
path: root/guix/git-download.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2023-09-11 11:26:12 +0200
committerLudovic Courtès <ludo@gnu.org>2023-09-26 17:36:57 +0200
commit811b249397bd805596d8c09e0d7513a30fbe55dd (patch)
tree9cb320119bd88a835605201a00f727d6da88694c /guix/git-download.scm
parent7f3ebd6dbcae830e60b78d6bab8f1dbad90ba3a8 (diff)
downloadguix-811b249397bd805596d8c09e0d7513a30fbe55dd.tar
guix-811b249397bd805596d8c09e0d7513a30fbe55dd.tar.gz
git-download: Move fallback code to (guix build git).
* guix/build/git.scm (git-fetch-with-fallback): New procedure, with code taken from… * guix/git-download.scm (git-fetch): … here. [modules]: Remove modules that are no longer directly used in ‘build’. [build]: Use ‘git-fetch-with-fallback’.
Diffstat (limited to 'guix/git-download.scm')
-rw-r--r--guix/git-download.scm47
1 files changed, 8 insertions, 39 deletions
diff --git a/guix/git-download.scm b/guix/git-download.scm
index d88f4c40ee..8989b1b463 100644
--- a/guix/git-download.scm
+++ b/guix/git-download.scm
@@ -116,19 +116,16 @@ HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if #f."
(define modules
(delete '(guix config)
(source-module-closure '((guix build git)
- (guix build utils)
- (guix build download-nar)
- (guix swh)))))
+ (guix build utils)))))
(define build
(with-imported-modules modules
- (with-extensions (list guile-json gnutls ;for (guix swh)
+ (with-extensions (list guile-json gnutls ;for (guix swh)
guile-lzlib)
#~(begin
(use-modules (guix build git)
- (guix build utils)
- (guix build download-nar)
- (guix swh)
+ ((guix build utils)
+ #:select (set-path-environment-variable))
(ice-9 match))
(define recursive?
@@ -151,38 +148,10 @@ HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if #f."
(setvbuf (current-output-port) 'line)
(setvbuf (current-error-port) 'line)
- (or (git-fetch (getenv "git url") (getenv "git commit")
- #$output
- #:recursive? recursive?
- #:git-command "git")
- (download-nar #$output)
-
- ;; As a last resort, attempt to download from Software Heritage.
- ;; Disable X.509 certificate verification to avoid depending
- ;; on nss-certs--we're authenticating the checkout anyway.
- ;; XXX: Currently recursive checkouts are not supported.
- (and (not recursive?)
- (parameterize ((%verify-swh-certificate? #f))
- (format (current-error-port)
- "Trying to download from Software Heritage...~%")
-
- (swh-download (getenv "git url") (getenv "git commit")
- #$output)
- (when (file-exists?
- (string-append #$output "/.gitattributes"))
- ;; Perform CR/LF conversion and other changes
- ;; specificied by '.gitattributes'.
- (invoke "git" "-C" #$output "init")
- (invoke "git" "-C" #$output "config" "--local"
- "user.email" "you@example.org")
- (invoke "git" "-C" #$output "config" "--local"
- "user.name" "Your Name")
- (invoke "git" "-C" #$output "add" ".")
- (invoke "git" "-C" #$output "commit" "-am" "init")
- (invoke "git" "-C" #$output "read-tree" "--empty")
- (invoke "git" "-C" #$output "reset" "--hard")
- (delete-file-recursively
- (string-append #$output "/.git"))))))))))
+ (git-fetch-with-fallback (getenv "git url") (getenv "git commit")
+ #$output
+ #:recursive? recursive?
+ #:git-command "git")))))
(mlet %store-monad ((guile (package->derivation guile system)))
(gexp->derivation (or name "git-checkout") build