diff options
author | Ludovic Courtès <ludovic.courtes@inria.fr> | 2017-10-17 10:34:03 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2017-10-19 23:21:49 +0200 |
commit | 37ce440dcffa9ff4f5401bacbc9619bd8ea561c1 (patch) | |
tree | 43abe15321bd541a27d04b4b1faf556cf3e5acb0 /guix/git-download.scm | |
parent | 8c3488259ea9e8d18a2c5b947cf9a137a12546a6 (diff) | |
download | patches-37ce440dcffa9ff4f5401bacbc9619bd8ea561c1.tar patches-37ce440dcffa9ff4f5401bacbc9619bd8ea561c1.tar.gz |
download: Download a nar when a VCS checkout fails.
Fixes <https://bugs.gnu.org/28709>.
* guix/build/download-nar.scm: New file.
* Makefile.am (MODULES): Add it.
* guix/cvs-download.scm (cvs-fetch)[zlib, config.scm, modules]: New
variables.
[build]: Use MODULES. Add call to 'download-nar'.
* guix/git-download.scm (git-fetch): Likewise.
* guix/hg-download.scm (hg-fetch): Likewise.
Diffstat (limited to 'guix/git-download.scm')
-rw-r--r-- | guix/git-download.scm | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/guix/git-download.scm b/guix/git-download.scm index 7397cbe7f5..731e549b38 100644 --- a/guix/git-download.scm +++ b/guix/git-download.scm @@ -25,6 +25,7 @@ #:use-module (guix monads) #:use-module (guix records) #:use-module (guix packages) + #:use-module (guix modules) #:autoload (guix build-system gnu) (standard-packages) #:use-module (ice-9 match) #:use-module (ice-9 popen) @@ -77,12 +78,31 @@ HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if #f." (standard-packages) '())) + (define zlib + (module-ref (resolve-interface '(gnu packages compression)) 'zlib)) + + (define config.scm + (scheme-file "config.scm" + #~(begin + (define-module (guix config) + #:export (%libz)) + + (define %libz + #+(file-append zlib "/lib/libz"))))) + + (define modules + (cons `((guix config) => ,config.scm) + (delete '(guix config) + (source-module-closure '((guix build git) + (guix build utils) + (guix build download-nar)))))) + (define build - (with-imported-modules '((guix build git) - (guix build utils)) + (with-imported-modules modules #~(begin (use-modules (guix build git) (guix build utils) + (guix build download-nar) (ice-9 match)) ;; The 'git submodule' commands expects Coreutils, sed, @@ -92,12 +112,13 @@ HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if #f." (((names dirs) ...) dirs))) - (git-fetch (getenv "git url") (getenv "git commit") - #$output - #:recursive? (call-with-input-string - (getenv "git recursive?") - read) - #:git-command (string-append #+git "/bin/git"))))) + (or (git-fetch (getenv "git url") (getenv "git commit") + #$output + #:recursive? (call-with-input-string + (getenv "git recursive?") + read) + #:git-command (string-append #+git "/bin/git")) + (download-nar #$output))))) (mlet %store-monad ((guile (package->derivation guile system))) (gexp->derivation (or name "git-checkout") build |