From accdba77be815bbe00868145dd66d68056eecf7a Mon Sep 17 00:00:00 2001 From: Tomas Volf <~@wolfsden.cz> Date: Fri, 28 Aug 2026 22:41:03 +0200 Subject: nongnu: corrupt-linux: Fix locating the source hash. Guix changed how the linux-libre's origin is constructed. Now there is one more layer that needed to be unwrapped to get to the hash. I modified the code to recursively find all string URIs together with their hashes and look up the hash by the known URI (already stored in `url', acquired by `linux-url'). Additionally, if no hash is found, we end with an explicit error, major improvement over the original: guix/ui.scm:1033:18: In procedure struct-vtable: Wrong type argument in position 1 (expecting struct): #f * nongnu/packages/linux.scm (corrupt-linux) [find-source-hash]: Delete procedure. [origin->input-things, extract-sources]: New procedures. [sources, hash]: Use them to find the hash for the `url'. Signed-off-by: Jelle Licht --- nongnu/packages/linux.scm | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/nongnu/packages/linux.scm b/nongnu/packages/linux.scm index 0fd2153..5c0c890 100644 --- a/nongnu/packages/linux.scm +++ b/nongnu/packages/linux.scm @@ -24,7 +24,7 @@ ;;; Copyright © 2023 Adam Kandur ;;; Copyright © 2023 Hilton Chain ;;; Copyright © 2023, 2024, 2025 Ada Stevenson -;;; Copyright © 2023 Tomas Volf <~@wolfsden.cz> +;;; Copyright © 2023, 2026 Tomas Volf <~@wolfsden.cz> ;;; Copyright © 2023 PRESFIL ;;; Copyright © 2024-2026 Maxim Cournoyer ;;; Copyright © 2025 David Wilson @@ -126,21 +126,27 @@ some freedo package or an output of package-version procedure." (define extract-gexp-inputs (compose gexp-inputs force origin-uri)) - (define (find-source-hash sources url) - (let ((versioned-origin - (find (lambda (source) - (let ((uri (origin-uri source))) - (and (string? uri) (string=? uri url)))) sources))) - (if versioned-origin - (origin-hash versioned-origin) - #f))) + (define (origin->input-things origin) + (map gexp-input-thing (extract-gexp-inputs origin))) + + (define (extract-sources inputs) + (fold (λ (input sources) + (if (origin? input) + (if (string? (origin-uri input)) + (acons (origin-uri input) (origin-hash input) sources) + (append sources + (extract-sources (origin->input-things input)))) + sources)) + '() + inputs)) (let* ((version (package-version freedo)) (url (linux-url version)) (pristine-source (package-source freedo)) (inputs (map gexp-input-thing (extract-gexp-inputs pristine-source))) - (sources (filter origin? inputs)) - (hash (find-source-hash sources url)) + (sources (extract-sources inputs)) + (hash (or (assoc-ref sources url) + (error "fail to find hash for" freedo))) (patches (delete (@@ (gnu packages linux) %boot-logo-patch) (origin-patches pristine-source)))) -- cgit v1.2.3