From: "Ludovic Courtès" <ludo@gnu.org>
To: 44321@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#44321] [PATCH 1/6] guix build: 'package-with-source' no longer takes a 'store' parameter.
Date: Fri, 30 Oct 2020 00:09:55 +0100 [thread overview]
Message-ID: <20201029231000.14568-1-ludo@gnu.org> (raw)
In-Reply-To: <20201029230831.14456-1-ludo@gnu.org>
* guix/scripts/build.scm (<downloaded-file>): New record type.
(download-to-store*): New variable.
(compile-downloaded-file): New procedure.
(package-with-source): Remove 'store' parameter. Use 'downloaded-file'
instead of 'download-to-store'.
(transform-package-source): Adjust accordingly.
---
guix/scripts/build.scm | 26 ++++++++++++++++++++++----
1 file changed, 22 insertions(+), 4 deletions(-)
diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm
index f4a8af035b..831ac8f798 100644
--- a/guix/scripts/build.scm
+++ b/guix/scripts/build.scm
@@ -45,6 +45,7 @@
#:use-module (ice-9 match)
#:use-module (ice-9 vlist)
#:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-9)
#:use-module (srfi srfi-11)
#:use-module (srfi srfi-26)
#:use-module (srfi srfi-34)
@@ -172,7 +173,25 @@ extensions."
(else
file-name)))
-(define* (package-with-source store p uri #:optional version)
+
+;; Files to be downloaded.
+(define-record-type <downloaded-file>
+ (downloaded-file uri recursive?)
+ downloaded-file?
+ (uri downloaded-file-uri)
+ (recursive? downloaded-file-recursive?))
+
+(define download-to-store*
+ (store-lift download-to-store))
+
+(define-gexp-compiler (compile-downloaded-file (file <downloaded-file>)
+ system target)
+ "Download FILE and return the result as a store item."
+ (match file
+ (($ <downloaded-file> uri recursive?)
+ (download-to-store* uri #:recursive? recursive?))))
+
+(define* (package-with-source p uri #:optional version)
"Return a package based on P but with its source taken from URI. Extract
the new package's version number from URI."
(let ((base (tarball-base-name (basename uri))))
@@ -183,8 +202,7 @@ the new package's version number from URI."
(package-version p)))
;; Use #:recursive? #t to allow for directories.
- (source (download-to-store store uri
- #:recursive? #t))
+ (source (downloaded-file uri #t))
;; Override the replacement, otherwise '--with-source' would
;; have no effect.
@@ -226,7 +244,7 @@ matching URIs given in SOURCES."
((? package? p)
(match (assoc-ref sources (package-name p))
((version source)
- (package-with-source store p source version))
+ (package-with-source p source version))
(#f
p)))
(_
--
2.28.0
next prev parent reply other threads:[~2020-10-29 23:11 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-29 23:08 [bug#44321] [PATCH 0/6] Adding a (guix transformations) module Ludovic Courtès
2020-10-29 23:09 ` Ludovic Courtès [this message]
2020-10-29 23:09 ` [bug#44321] [PATCH 2/6] guix build: Remove unnecessary (replacement #f) Ludovic Courtès
2020-10-29 23:09 ` [bug#44321] [PATCH 3/6] guix build: 'options->transformation' no longer takes a 'store' parameter Ludovic Courtès
2020-10-30 22:27 ` Miguel Ángel Arruga Vivas
2020-10-31 10:03 ` Ludovic Courtès
2020-10-29 23:09 ` [bug#44321] [PATCH 4/6] guix build: Move transformation options to (guix transformations) Ludovic Courtès
2020-10-30 23:03 ` Miguel Ángel Arruga Vivas
2020-10-31 10:04 ` Ludovic Courtès
2020-10-29 23:09 ` [bug#44321] [PATCH 5/6] transformations: Raise '&formatted-message' exceptions instead of 'leave' Ludovic Courtès
2020-10-30 10:59 ` zimoun
2020-10-30 22:39 ` Miguel Ángel Arruga Vivas
2020-10-31 10:06 ` Ludovic Courtès
2020-10-31 22:18 ` bug#44321: " Ludovic Courtès
2020-11-02 12:25 ` [bug#44321] " zimoun
2020-11-02 15:48 ` Ludovic Courtès
2020-10-29 23:10 ` [bug#44321] [PATCH 6/6] doc: Add "Defining Package Variants" section Ludovic Courtès
2020-10-30 11:20 ` zimoun
2020-10-31 10:14 ` Ludovic Courtès
2020-10-30 23:27 ` [bug#44321] [PATCH 1/6] guix build: 'package-with-source' no longer takes a 'store' parameter Miguel Ángel Arruga Vivas
2020-10-31 10:17 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201029231000.14568-1-ludo@gnu.org \
--to=ludo@gnu.org \
--cc=44321@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.