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) | |
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 19c5efc21be..c44afbc6777 100644 --- a/guix/upstream.scm +++ b/guix/upstream.scm | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2010-2024 Ludovic Courtès <ludo@gnu.org> | 2 | ;;; Copyright © 2010-2025 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; Copyright © 2015 Alex Kost <alezost@gmail.com> | 3 | ;;; Copyright © 2015 Alex Kost <alezost@gmail.com> |
| 4 | ;;; Copyright © 2019, 2022-2024 Ricardo Wurmus <rekado@elephly.net> | 4 | ;;; Copyright © 2019, 2022-2024 Ricardo Wurmus <rekado@elephly.net> |
| 5 | ;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev> | 5 | ;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev> |
| @@ -435,16 +435,18 @@ string such as \"xz\". Otherwise return #f." | |||
| 435 | "Return two values: a source URL that matches the archive type of | 435 | "Return two values: a source URL that matches the archive type of |
| 436 | PACKAGE (gz, xz, bz2, etc.) and the corresponding signature URL or #f if there | 436 | PACKAGE (gz, xz, bz2, etc.) and the corresponding signature URL or #f if there |
| 437 | is no signature. Return #f and #f when this is not applicable." | 437 | is no signature. Return #f and #f when this is not applicable." |
| 438 | (let ((archive-type (package-archive-type package))) | 438 | (if (pair? (upstream-source-urls source)) |
| 439 | (find2 (lambda (url sig-url) | 439 | (let ((archive-type (package-archive-type package))) |
| 440 | ;; Some URIs lack a file extension, like | 440 | (find2 (lambda (url sig-url) |
| 441 | ;; 'https://crates.io/???/0.1/download'. In that case, pick the | 441 | ;; Some URIs lack a file extension, like |
| 442 | ;; first URL. | 442 | ;; 'https://crates.io/???/0.1/download'. In that case, pick the |
| 443 | (or (not archive-type) | 443 | ;; first URL. |
| 444 | (string-suffix? archive-type url))) | 444 | (or (not archive-type) |
| 445 | (upstream-source-urls source) | 445 | (string-suffix? archive-type url))) |
| 446 | (or (upstream-source-signature-urls source) | 446 | (upstream-source-urls source) |
| 447 | (circular-list #f))))) | 447 | (or (upstream-source-signature-urls source) |
| 448 | (circular-list #f)))) | ||
| 449 | (values #f #f))) ;'source-urls' must be a <git-reference> | ||
| 448 | 450 | ||
| 449 | (define (preferred-upstream-source source package) | 451 | (define (preferred-upstream-source source package) |
| 450 | "Return a variant of SOURCE that uses the same archive type as PACKAGE's | 452 | "Return a variant of SOURCE that uses the same archive type as PACKAGE's |
