From ab4dc03b675c86695940bb762dc9e1506807052d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sat, 11 Jan 2025 18:18:48 +0100 Subject: [PATCH] =?UTF-8?q?upstream:=20Return=20#f=20when=20=E2=80=98sourc?= =?UTF-8?q?e-urls=E2=80=99=20is=20a=20.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes a type error where ‘find2’ could be passed a instead of a list of strings (URLs). * guix/upstream.scm (preferred-upstream-source-url): Return #f and #f when ‘upstream-source-urls’ does not return a pair. Change-Id: If43a610fac5f3feb871e0900966d65b4971bd053 --- guix/upstream.scm | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/guix/upstream.scm b/guix/upstream.scm index 19c5efc21b..c44afbc677 100644 --- a/guix/upstream.scm +++ b/guix/upstream.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2010-2024 Ludovic Courtès +;;; Copyright © 2010-2025 Ludovic Courtès ;;; Copyright © 2015 Alex Kost ;;; Copyright © 2019, 2022-2024 Ricardo Wurmus ;;; Copyright © 2021 Sarah Morgensen @@ -435,16 +435,18 @@ (define (preferred-upstream-source-url source package) "Return two values: a source URL that matches the archive type of PACKAGE (gz, xz, bz2, etc.) and the corresponding signature URL or #f if there is no signature. Return #f and #f when this is not applicable." - (let ((archive-type (package-archive-type package))) - (find2 (lambda (url sig-url) - ;; Some URIs lack a file extension, like - ;; 'https://crates.io/???/0.1/download'. In that case, pick the - ;; first URL. - (or (not archive-type) - (string-suffix? archive-type url))) - (upstream-source-urls source) - (or (upstream-source-signature-urls source) - (circular-list #f))))) + (if (pair? (upstream-source-urls source)) + (let ((archive-type (package-archive-type package))) + (find2 (lambda (url sig-url) + ;; Some URIs lack a file extension, like + ;; 'https://crates.io/???/0.1/download'. In that case, pick the + ;; first URL. + (or (not archive-type) + (string-suffix? archive-type url))) + (upstream-source-urls source) + (or (upstream-source-signature-urls source) + (circular-list #f)))) + (values #f #f))) ;'source-urls' must be a (define (preferred-upstream-source source package) "Return a variant of SOURCE that uses the same archive type as PACKAGE's