unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: 45656@debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Subject: bug#45656: [PATCH] import: texlive: Produce a partial package definition rather than crashing.
Date: Mon,  4 Jan 2021 14:06:45 -0500	[thread overview]
Message-ID: <20210104190645.7693-1-maxim.cournoyer@gmail.com> (raw)
In-Reply-To: <87ft3geifh.fsf@gmail.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=yes, Size: 3042 bytes --]

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.
---
 guix/import/texlive.scm | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

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





  parent reply	other threads:[~2021-01-04 19:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-04 17:11 bug#45656: The TeX Live importer crashes with Wrong type (expecting string): #f Maxim Cournoyer
2021-01-04 18:30 ` Maxim Cournoyer
2021-01-04 18:47 ` Ricardo Wurmus
2021-01-04 19:06 ` Maxim Cournoyer [this message]
2021-01-04 19:13 ` bug#45656: [PATCH v2] import: texlive: Produce a partial package definition rather than crashing Maxim Cournoyer
2021-11-21  8:14 ` bug#45656: The TeX Live importer should use the texlive.tlpdb database as its input Ricardo Wurmus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210104190645.7693-1-maxim.cournoyer@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=45656@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).