unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Mathieu Othacehe <m.othacehe@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 27654@debbugs.gnu.org
Subject: [bug#27654] [PATCH] base: Report evaluation error.
Date: Wed, 12 Jul 2017 18:32:37 +0200	[thread overview]
Message-ID: <868tjtmx96.fsf@gmail.com> (raw)
In-Reply-To: <87lgntetr1.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 207 bytes --]


Hi Ludo,

> While we’re at it, let’s avoid ‘error’ altogether (‘error’ raises a
> ‘misc-error’ exception, which is not very helpful.)

Ok, would the attached patch be ok ?

Thanks,

Mathieu

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-base-Report-evaluation-error.patch --]
[-- Type: text/x-diff, Size: 2076 bytes --]

From c9a3325c1c021564edc689ff2421b04c9e794052 Mon Sep 17 00:00:00 2001
From: Mathieu Othacehe <m.othacehe@gmail.com>
Date: Tue, 11 Jul 2017 19:15:08 +0200
Subject: [PATCH] base: Report evaluation error.

* src/cuirass/base.scm (evaluate): Report an error if eof-object? is true on
  data read from port. Otherwise, suppose that data are correct and keep thins
  going.
---
 src/cuirass/base.scm | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/cuirass/base.scm b/src/cuirass/base.scm
index 326a530..3506916 100644
--- a/src/cuirass/base.scm
+++ b/src/cuirass/base.scm
@@ -32,6 +32,7 @@
   #:use-module (ice-9 receive)
   #:use-module (srfi srfi-19)
   #:use-module (srfi srfi-34)
+  #:use-module (srfi srfi-35)
   #:export (;; Procedures.
             call-with-time-display
             fetch-repository
@@ -137,6 +138,10 @@ directory and the sha1 of the top level commit in this directory."
         (system* "./configure" "--localstatedir=/var"))
     (zero? (system* "make" "-j" (number->string (current-processor-count))))))
 
+(define-condition-type &evaluation-error &error
+  evaluation-error?
+  (name evaluation-error-spec-name))
+
 (define (evaluate store db spec)
   "Evaluate and build package derivations.  Return a list of jobs."
   (let* ((port (open-pipe* OPEN_READ
@@ -148,7 +153,15 @@ directory and the sha1 of the top level commit in this directory."
                            (%package-cachedir)
                            (object->string spec)
                            (%package-database)))
-         (jobs (read port)))
+         (jobs (match (read port)
+                 ;; If an error occured during evaluation report it,
+                 ;; otherwise, suppose that data read from port are
+                 ;; correct and keep things going.
+                 ((? eof-object?)
+                  (raise (condition
+                          (&evaluation-error
+                           (name (assq-ref spec #:name))))))
+                 (data data))))
     (close-pipe port)
     jobs))
 
-- 
2.13.2


  reply	other threads:[~2017-07-12 16:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-11 17:16 [bug#27654] [PATCH] base: Report evaluation error Mathieu Othacehe
2017-07-12 12:15 ` Ludovic Courtès
2017-07-12 16:32   ` Mathieu Othacehe [this message]
2017-07-12 20:54     ` Ludovic Courtès
2017-07-30 10:47       ` bug#27654: " Mathieu Othacehe

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=868tjtmx96.fsf@gmail.com \
    --to=m.othacehe@gmail.com \
    --cc=27654@debbugs.gnu.org \
    --cc=ludo@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).