me
/
guix
Archived
1
0
Fork 0

import: texlive: Produce a partial package definition rather than crashing.

This is a small improvement awaiting a definitive fix for
<https://issues.guix.gnu.org/45656>.

* guix/import/texlive.scm (sxml->package): Produce a warning when the SVN
checkout failed.  Rather than crashing on the unexpected #f value, return a
partial package definition with the source field set to #f.
master
Maxim Cournoyer 2021-01-04 13:59:58 -05:00
parent 432cb80309
commit 3049097ac2
No known key found for this signature in database
GPG Key ID: 1260E46482E63562
1 changed files with 18 additions and 10 deletions

View File

@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net> ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -25,6 +26,8 @@
#:use-module (srfi srfi-26) #:use-module (srfi srfi-26)
#:use-module (srfi srfi-34) #:use-module (srfi srfi-34)
#:use-module (web uri) #:use-module (web uri)
#:use-module (guix diagnostics)
#:use-module (guix i18n)
#:use-module (guix http-client) #:use-module (guix http-client)
#:use-module (gcrypt hash) #:use-module (gcrypt hash)
#:use-module (guix memoization) #:use-module (guix memoization)
@ -149,19 +152,24 @@ expression describing it."
(home-page (string-append "http://www.ctan.org/pkg/" id)) (home-page (string-append "http://www.ctan.org/pkg/" id))
(ref (texlive-ref component id)) (ref (texlive-ref component id))
(checkout (download-svn-to-store store ref))) (checkout (download-svn-to-store store ref)))
(unless checkout
(warning (G_ "Could not determine source location. \
Please manually specify the source field.~%")))
`(package `(package
(name ,(guix-name component id)) (name ,(guix-name component id))
(version ,version) (version ,version)
(source (origin (source ,(if checkout
(method svn-fetch) `(origin
(uri (texlive-ref ,component ,id)) (method svn-fetch)
(sha256 (uri (texlive-ref ,component ,id))
(base32 (sha256
,(bytevector->nix-base32-string (base32
(let-values (((port get-hash) (open-sha256-port))) ,(bytevector->nix-base32-string
(write-file checkout port) (let-values (((port get-hash) (open-sha256-port)))
(force-output port) (write-file checkout port)
(get-hash))))))) (force-output port)
(get-hash))))))
#f))
(build-system texlive-build-system) (build-system texlive-build-system)
(arguments ,`(,'quote (#:tex-directory ,(string-join (list component id) "/")))) (arguments ,`(,'quote (#:tex-directory ,(string-join (list component id) "/"))))
(home-page ,home-page) (home-page ,home-page)