import: gnu: Fix the detection of non-GNU packages.

* guix/import/gnu.scm (gnu->guix-package): Move the 'find-package' call before
the 'latest-release' call, which would fail when the package did not have an
entry on the FTP server.
This commit is contained in:
Maxim Cournoyer 2021-02-02 13:45:59 -05:00
parent 2c9d481c90
commit 889f425b35
No known key found for this signature in database
GPG key ID: 1260E46482E63562

View file

@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com> ;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -111,19 +112,17 @@ (define* (gnu->guix-package name
"Return the package declaration for NAME as an s-expression. Use "Return the package declaration for NAME as an s-expression. Use
KEY-DOWNLOAD as the OpenPGP key download policy (see 'download-tarball' for KEY-DOWNLOAD as the OpenPGP key download policy (see 'download-tarball' for
details.)" details.)"
(let ((package (find-package name)))
(unless package
(raise (formatted-message (G_ "no GNU package found for ~a") name)))
(match (latest-release name) (match (latest-release name)
((? upstream-source? release) ((? upstream-source? release)
(let ((version (upstream-source-version release))) (let ((version (upstream-source-version release)))
(match (find-package name) (gnu-package->sexp package release #:key-download key-download)))
(#f
(raise (formatted-message
(G_ "couldn't find meta-data for GNU ~a")
name)))
(info
(gnu-package->sexp info release #:key-download key-download)))))
(_ (_
(raise (formatted-message (raise (formatted-message
(G_ "failed to determine latest release of GNU ~a") (G_ "failed to determine latest release of GNU ~a")
name))))) name))))))
;;; gnu.scm ends here ;;; gnu.scm ends here