From a8e24a5258aa05689bcafa70af071da5296f63a4 Mon Sep 17 00:00:00 2001 From: Maxime Devos Date: Sat, 4 Sep 2021 20:09:03 +0200 Subject: [PATCH v2 1/9] build-self: Implement basic 'hash-algorithm'. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The module (guix hash) used from 'search-patch' in a future patch needs it to be properly defined when (guix hash) is being compiled. 'search-patch' is used when the derivation of Guix is being computed, so it is important to avoid the ‘wrong type to apply: #’ error. * build-aux/build-self.scm (build-program)[fake-gcrypt-hash]: Define hash-algorithm for sha1 and sha256. --- build-aux/build-self.scm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/build-aux/build-self.scm b/build-aux/build-self.scm index 3a2d13cc09..2c13d9d530 100644 --- a/build-aux/build-self.scm +++ b/build-aux/build-self.scm @@ -259,8 +259,17 @@ interface (FFI) of Guile.") (define fake-gcrypt-hash ;; Fake (gcrypt hash) module; see below. (scheme-file "hash.scm" - #~(define-module (gcrypt hash) - #:export (sha1 sha256)))) + #~(begin + (define-module (gcrypt hash) + #:export (sha1 sha256 hash-algorithm)) + ;; Avoid ‘Wrong type to apply: + ;; #’ errors. + (define sha1) + (define sha256) + (define-syntax hash-algorithm + (syntax-rules (sha1 sha256) + ((_ sha1) 2) + ((_ sha256) 8)))))) (define fake-git (scheme-file "git.scm" #~(define-module (git)))) -- 2.33.0