From 04f36da115e2cb60835561f461899bb0d67bb927 Mon Sep 17 00:00:00 2001 From: Maxime Devos Date: Thu, 25 Mar 2021 08:48:24 +0100 Subject: [PATCH] guix: Let the procedure name of "url-fetch*" be what "guix import" expects. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: . Reported-By: Léo Le Bouter . * guix/download.scm (define*-visible-name): Define a syntax for overriding the procedure name of a procedure returned by "procedure-name". (url-fetch*): Use this syntax to change the procedure name to "url-fetch" as "guix import" expects. +++ b/guix/download.scm @@ -6,6 +6,7 @@ ;;; Copyright © 2016 David Craven ;;; Copyright © 2017 Tobias Geerinckx-Rice ;;; Copyright © 2019 Guy Fleury Iteriteka +;;; Copyright © 2021 Maxime Devos ;;; ;;; This file is part of GNU Guix. ;;; (1/2) Stage this hunk [y,n,q,a,d,j,J,g,/,e,?]? y @@ -449,11 +450,19 @@ download by itself using its own dependencies." ;; for that built-in is widespread. #:local-build? #t))) -(define* (url-fetch* url hash-algo hash - #:optional name - #:key (system (%current-system)) - (guile (default-guile)) - executable?) +;; In guix/import/print.scm, the procedure package->code uses procedure-name +;; and expects to see the user-visible procedure name. +(define-syntax-rule (define*-with-name (name . args) procedure-name . code) + "Define a procedure as with 'define*', but in such a matter that +'procedure-name' on NAME will return PROCEDURE-NAME instead of NAME." + (define name (let ((procedure-name (lambda* args . code))) procedure-name))) + +(define*-with-name (url-fetch* url hash-algo hash + #:optional name + #:key (system (%current-system)) + (guile (default-guile)) + executable?) + url-fetch --- guix/download.scm | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/guix/download.scm b/guix/download.scm index 30f69c0325..25c26a2ebb 100644 --- a/guix/download.scm +++ b/guix/download.scm @@ -6,6 +6,7 @@ ;;; Copyright © 2016 David Craven ;;; Copyright © 2017 Tobias Geerinckx-Rice ;;; Copyright © 2019 Guy Fleury Iteriteka +;;; Copyright © 2021 Maxime Devos ;;; ;;; This file is part of GNU Guix. ;;; @@ -449,11 +450,19 @@ download by itself using its own dependencies." ;; for that built-in is widespread. #:local-build? #t))) -(define* (url-fetch* url hash-algo hash - #:optional name - #:key (system (%current-system)) - (guile (default-guile)) - executable?) +;; In guix/import/print.scm, the procedure package->code uses procedure-name +;; and expects to see the user-visible procedure name. +(define-syntax-rule (define*-with-name (name . args) procedure-name . code) + "Define a procedure as with 'define*', but in such a matter that +'procedure-name' on NAME will return PROCEDURE-NAME instead of NAME." + (define name (let ((procedure-name (lambda* args . code))) procedure-name))) + +(define*-with-name (url-fetch* url hash-algo hash + #:optional name + #:key (system (%current-system)) + (guile (default-guile)) + executable?) + url-fetch "Return a fixed-output derivation that fetches data from URL (a string, or a list of strings denoting alternate URLs), which is expected to have hash HASH of type HASH-ALGO (a symbol). By default, the file name is the base name of -- 2.31.0