Oops I messed up the commit message in the patch.
Revised patch is attached.
From 2c6c28334173fff9112c36726d31d6adcebfbf2d Mon Sep 17 00:00:00 2001
From: Maxime Devos <maximede...@telenet.be>
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: <https://issues.guix.gnu.org/47375>.
Reported-By: Léo Le Bouter <lle-b...@zaclys.net>.

* 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.
---
 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 <da...@craven.ch>
 ;;; Copyright © 2017 Tobias Geerinckx-Rice <m...@tobias.gr>
 ;;; Copyright © 2019 Guy Fleury Iteriteka <hoonan...@gmail.com>
+;;; Copyright © 2021 Maxime Devos <maximede...@telenet.be>
 ;;;
 ;;; 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

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to