diff options
author | Ludovic Courtès <ludo@gnu.org> | 2025-01-11 18:18:48 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2025-01-11 23:36:57 +0100 |
commit | ab4dc03b675c86695940bb762dc9e1506807052d (patch) | |
tree | 208c5667d217408eade46d98d799d8767dab61d1 | |
parent | 5d288cdeaf5e0a94d2f43be7a441de7dbf21767a (diff) | |
download | guix-ab4dc03b675c86695940bb762dc9e1506807052d.tar.gz guix-ab4dc03b675c86695940bb762dc9e1506807052d.zip |
upstream: Return #f when ‘source-urls’ is a <git-reference>.
Fixes a type error where ‘find2’ could be passed a <git-reference>
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
-rw-r--r-- | guix/upstream.scm | 24 |
1 files 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 <ludo@gnu.org> +;;; Copyright © 2010-2025 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2015 Alex Kost <alezost@gmail.com> ;;; Copyright © 2019, 2022-2024 Ricardo Wurmus <rekado@elephly.net> ;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev> @@ -435,16 +435,18 @@ string such as \"xz\". Otherwise return #f." "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 <git-reference> (define (preferred-upstream-source source package) "Return a variant of SOURCE that uses the same archive type as PACKAGE's |