Package: guix-patches;
Reported by: Herman Rimm <herman <at> rimm.ee>
Date: Thu, 2 Jan 2025 21:05:02 UTC
Severity: normal
Tags: patch
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Herman Rimm <herman <at> rimm.ee> To: guix-patches <at> gnu.org Subject: [PATCH] packages: Match renamed origin fields. Date: Thu, 2 Jan 2025 22:03:30 +0100
* guix/packages.scm (print-origin, origin->derivation): Use match-record. Change-Id: Ia554dd3264f51e549df51f767c754040b3dc7611 --- Hello, Three tests in (tests packages) fail as before: "package-source-derivation, local-file" "package-source-derivation, origin, sha512" "package-source-derivation, origin, sha3-512" Cheers, Herman guix/packages.scm | 59 ++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/guix/packages.scm b/guix/packages.scm index ff9fbd84709..6088457b20b 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -11,6 +11,7 @@ ;;; Copyright © 2022 jgart <jgart <at> dismail.de> ;;; Copyright © 2023 Simon Tournier <zimon.toutoune <at> gmail.com> ;;; Copyright © 2024 Janneke Nieuwenhuizen <janneke <at> gnu.org> +;;; Copyright © 2025 Herman Rimm <herman <at> rimm.ee> ;;; ;;; This file is part of GNU Guix. ;;; @@ -359,12 +360,10 @@ (define-syntax-rule (origin fields ...) (define (print-origin origin port) "Write a concise representation of ORIGIN to PORT." - (match origin - (($ <origin> uri method hash file-name patches) - (simple-format port "#<origin ~s ~a ~s ~a>" - uri hash - (force patches) - (number->string (object-address origin) 16))))) + (match-record origin <origin> (uri method hash file-name patches) + (simple-format port "#<origin ~s ~a ~s ~a>" + uri hash patches + (number->string (object-address origin) 16)))) (set-record-type-printer! <origin> print-origin) @@ -2151,31 +2150,29 @@ (define-gexp-compiler (package-compiler (package <package>) system target) (define* (origin->derivation origin #:optional (system (%current-system))) "Return the derivation corresponding to ORIGIN." - (match origin - (($ <origin> uri method hash name (= force ()) #f) - ;; No patches, no snippet: this is a fixed-output derivation. - (method uri - (content-hash-algorithm hash) - (content-hash-value hash) - name #:system system)) - (($ <origin> uri method hash name (= force (patches ...)) snippet - flags inputs (modules ...) guile-for-build) - ;; Patches and/or a snippet. - (mlet %store-monad ((source (method uri - (content-hash-algorithm hash) - (content-hash-value hash) - name #:system system)) - (guile (package->derivation (or guile-for-build - (default-guile)) - system - #:graft? #f))) - (patch-and-repack source patches - #:inputs inputs - #:snippet snippet - #:flags flags - #:system system - #:modules modules - #:guile-for-build guile))))) + (match-record origin <origin> + (uri method hash file-name patches patch-flags patch-inputs + patch-guile snippet modules) + (let* ((hash-algo (content-hash-algorithm hash)) + (hash (content-hash-value hash)) + (source (method uri hash-algo hash file-name + #:system system))) + (if (or snippet (pair? patches)) + (mlet %store-monad + ((guile (package->derivation (or patch-guile + (default-guile)) + system + #:graft? #f)) + (source source)) + (patch-and-repack source patches + #:inputs patch-inputs + #:snippet snippet + #:flags patch-flags + #:system system + #:modules modules + #:guile-for-build guile)) + ;; This is a fixed-output derivation. + source)))) (define-gexp-compiler (origin-compiler (origin <origin>) system target) ;; Compile ORIGIN to a derivation for SYSTEM. This is used when referring base-commit: 5d7455bb580eed41a4fa7c20b71eaccad9f49e73 -- 2.45.2
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.