[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#69328] [PATCH 09/12] bzr-download: Implement nar fallback.
From: |
Ludovic Courtès |
Subject: |
[bug#69328] [PATCH 09/12] bzr-download: Implement nar fallback. |
Date: |
Fri, 23 Feb 2024 16:48:13 +0100 |
* 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
---
guix/build/bzr.scm | 3 ++-
guix/bzr-download.scm | 43 ++++++++++++++++++++++++++++++++-----------
2 files changed, 34 insertions(+), 12 deletions(-)
diff --git a/guix/build/bzr.scm b/guix/build/bzr.scm
index a0f5e15880..dede5e031a 100644
--- a/guix/build/bzr.scm
+++ b/guix/build/bzr.scm
@@ -37,6 +37,7 @@ (define* (bzr-fetch url revision directory
(invoke bzr-command "-Ossl.cert_reqs=none" "checkout"
"--lightweight" "-r" revision url directory)
(with-directory-excursion directory
- (delete-file-recursively ".bzr")))
+ (delete-file-recursively ".bzr"))
+ #t)
;;; bzr.scm ends here
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 @@ (define (bzr-package)
(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 @@ (define* (bzr-fetch ref hash-algo hash
"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
--
2.41.0
- [bug#69328] [PATCH 00/12] Better source code recovery from SWH, Ludovic Courtès, 2024/02/23
- [bug#69328] [PATCH 05/12] swh: ‘origin-visits’ takes an optional ‘max’ parameter., Ludovic Courtès, 2024/02/23
- [bug#69328] [PATCH 09/12] bzr-download: Implement nar fallback.,
Ludovic Courtès <=
- [bug#69328] [PATCH 11/12] perform-download: Allow use of ‘download-nar’ for ‘--check’ builds., Ludovic Courtès, 2024/02/23
- [bug#69328] [PATCH 08/12] svn-download: Use ‘swh-download-directory-by-nar-hash’., Ludovic Courtès, 2024/02/23
- [bug#69328] [PATCH 12/12] download: Honor ‘GUIX_DOWNLOAD_SEQUENCE’ environment variable., Ludovic Courtès, 2024/02/23
- [bug#69328] [PATCH 06/12] swh: ‘lookup-origin-revision’ handles branches pointing to directories., Ludovic Courtès, 2024/02/23
- [bug#69328] [PATCH 04/12] swh: Add ‘type’ field to <visit>., Ludovic Courtès, 2024/02/23
- [bug#69328] [PATCH 01/12] lint: Switch to SRFI-71., Ludovic Courtès, 2024/02/23
- [bug#69328] [PATCH 02/12] lint: archival: Fix crash in non-Git case., Ludovic Courtès, 2024/02/23
- [bug#69328] [PATCH 10/12] download-nar: Distinguish ‘output’ and ‘item’ parameter., Ludovic Courtès, 2024/02/23
- [bug#69328] [PATCH 03/12] lint: archival: Trigger “Save Code Now” for VCSes other than Git., Ludovic Courtès, 2024/02/23
- [bug#69328] [PATCH 07/12] hg-download: Use ‘swh-download-directory-by-nar-hash’., Ludovic Courtès, 2024/02/23