aboutsummaryrefslogtreecommitdiff
path: root/guix/bzr-download.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2024-02-23 14:17:07 +0100
committerLudovic Courtès <ludo@gnu.org>2024-03-09 18:55:49 +0100
commit8a42fc71401fce2086111f5d319aeeddf202513a (patch)
treeef8e297a55eb2325aa1885c96a2960a7e47698e4 /guix/bzr-download.scm
parent0e73f933b291c7e154c7e019b6de1e2f3a97e4c1 (diff)
downloadguix-8a42fc71401fce2086111f5d319aeeddf202513a.tar
guix-8a42fc71401fce2086111f5d319aeeddf202513a.tar.gz
bzr-download: Implement nar fallback.
* guix/bzr-download.scm (bzr-fetch)[guile-json, guile-lzlib, guile-gnutls]: New variables. [build]: Add ‘with-extensions’ and import more modules. Invoke ‘download-nar’ when ‘bzr-fetch’ returns #f. * guix/build/bzr.scm (bzr-fetch): Actually return #t on success. Change-Id: Id5d4ebd0f9ddc3c44b6456d3b46c0000cc7b9997
Diffstat (limited to 'guix/bzr-download.scm')
-rw-r--r--guix/bzr-download.scm43
1 files changed, 32 insertions, 11 deletions
diff --git a/guix/bzr-download.scm b/guix/bzr-download.scm
index d97f84838e..01c12fd54d 100644
--- a/guix/bzr-download.scm
+++ b/guix/bzr-download.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2024 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -51,20 +52,40 @@
(module-ref distro 'breezy)))
(define* (bzr-fetch ref hash-algo hash
- #:optional name
- #:key (system (%current-system)) (guile (default-guile))
- (bzr (bzr-package)))
+ #:optional name
+ #:key (system (%current-system)) (guile (default-guile))
+ (bzr (bzr-package)))
"Return a fixed-output derivation that fetches REF, a <bzr-reference>
object. The output is expected to have recursive hash HASH of type
HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if #f."
+ (define guile-json
+ (module-ref (resolve-interface '(gnu packages guile)) 'guile-json-4))
+
+ (define guile-lzlib
+ (module-ref (resolve-interface '(gnu packages guile)) 'guile-lzlib))
+
+ (define guile-gnutls
+ (module-ref (resolve-interface '(gnu packages tls)) 'guile-gnutls))
+
(define build
- (with-imported-modules (source-module-closure
- '((guix build bzr)))
- #~(begin
- (use-modules (guix build bzr))
- (bzr-fetch
- (getenv "bzr url") (getenv "bzr reference") #$output
- #:bzr-command (string-append #+bzr "/bin/brz")))))
+ (with-extensions (list guile-gnutls guile-lzlib guile-json)
+ (with-imported-modules (source-module-closure
+ '((guix build bzr)
+ (guix build utils)
+ (guix build download-nar)))
+ #~(begin
+ (use-modules (guix build bzr)
+ (guix build download-nar)
+ (guix build utils)
+ (srfi srfi-34))
+
+ (or (guard (c ((invoke-error? c)
+ (report-invoke-error c)
+ #f))
+ (bzr-fetch (getenv "bzr url") (getenv "bzr reference")
+ #$output
+ #:bzr-command (string-append #+bzr "/bin/brz")))
+ (download-nar #$output))))))
(mlet %store-monad ((guile (package->derivation guile system)))
(gexp->derivation (or name "bzr-branch") build
@@ -79,7 +100,7 @@ HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if #f."
"LC_ALL" "LC_MESSAGES" "LANG"
"COLUMNS")
#:system system
- #:local-build? #t ;don't offload repo branching
+ #:local-build? #t ;don't offload repo branching
#:hash-algo hash-algo
#:hash hash
#:recursive? #t