* [bug#27654] [PATCH] base: Report evaluation error.
@ 2017-07-11 17:16 Mathieu Othacehe
2017-07-12 12:15 ` Ludovic Courtès
0 siblings, 1 reply; 5+ messages in thread
From: Mathieu Othacehe @ 2017-07-11 17:16 UTC (permalink / raw)
To: 27654
* src/cuirass/base.scm (evaluate): Report an error in eof-object? is true on
data read from port. Otherwise, suppose that data are correct and keep thins
going.
---
src/cuirass/base.scm | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/cuirass/base.scm b/src/cuirass/base.scm
index f5f80b3..5e0cb0d 100644
--- a/src/cuirass/base.scm
+++ b/src/cuirass/base.scm
@@ -136,7 +136,13 @@ 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?)
+ (error "Could not evaluate specifications.\n"))
+ (data data))))
(close-pipe port)
jobs))
--
2.13.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [bug#27654] [PATCH] base: Report evaluation error.
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
0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2017-07-12 12:15 UTC (permalink / raw)
To: Mathieu Othacehe; +Cc: 27654
Howdy!
Mathieu Othacehe <m.othacehe@gmail.com> skribis:
> * src/cuirass/base.scm (evaluate): Report an error in eof-object? is true on
> data read from port. Otherwise, suppose that data are correct and keep thins
> going.
> ---
> src/cuirass/base.scm | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/src/cuirass/base.scm b/src/cuirass/base.scm
> index f5f80b3..5e0cb0d 100644
> --- a/src/cuirass/base.scm
> +++ b/src/cuirass/base.scm
> @@ -136,7 +136,13 @@ 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?)
> + (error "Could not evaluate specifications.\n"))
> + (data data))))
While we’re at it, let’s avoid ‘error’ altogether (‘error’ raises a
‘misc-error’ exception, which is not very helpful.)
What about declaring a specific SRFI-35 error condition type for
evaluation errors, and then raising it (with SRFI-34) here? (If you’re
not familiar with SRFI-3[45], there are examples of it in the (guix *)
modules.)
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [bug#27654] [PATCH] base: Report evaluation error.
2017-07-12 12:15 ` Ludovic Courtès
@ 2017-07-12 16:32 ` Mathieu Othacehe
2017-07-12 20:54 ` Ludovic Courtès
0 siblings, 1 reply; 5+ messages in thread
From: Mathieu Othacehe @ 2017-07-12 16:32 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 27654
[-- 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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [bug#27654] [PATCH] base: Report evaluation error.
2017-07-12 16:32 ` Mathieu Othacehe
@ 2017-07-12 20:54 ` Ludovic Courtès
2017-07-30 10:47 ` bug#27654: " Mathieu Othacehe
0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2017-07-12 20:54 UTC (permalink / raw)
To: Mathieu Othacehe; +Cc: 27654
[-- Attachment #1: Type: text/plain, Size: 650 bytes --]
Mathieu Othacehe <m.othacehe@gmail.com> skribis:
> 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.
Please mention the new ‘&evaluation-error’ in here.
BTW, shouldn’t ‘process-specs’ protect against it, so that Cuirass
doesn’t stop as soon as it encounters an evaluation error? Like:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 788 bytes --]
diff --git a/src/cuirass/base.scm b/src/cuirass/base.scm
index fc3cc1a..3d19bda 100644
--- a/src/cuirass/base.scm
+++ b/src/cuirass/base.scm
@@ -185,9 +185,12 @@ if required. Return the last commit ID on success, #f otherwise."
#:use-substitutes? (%use-substitutes?)
#:keep-going? #t)
+ (guard (c ((evaluation-error? c)
+ ;; Report the problem in the log...
+ #f))
(let* ((spec* (acons #:current-commit commit spec))
(jobs (evaluate store db spec*)))
- (build-packages store db jobs))))
+ (build-packages store db jobs)))))
(db-add-stamp db spec commit))))
(for-each process jobspecs))
[-- Attachment #3: Type: text/plain, Size: 60 bytes --]
OK with something along these lines, thanks!
Ludo’.
^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#27654: [PATCH] base: Report evaluation error.
2017-07-12 20:54 ` Ludovic Courtès
@ 2017-07-30 10:47 ` Mathieu Othacehe
0 siblings, 0 replies; 5+ messages in thread
From: Mathieu Othacehe @ 2017-07-30 10:47 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 27654-done
Hi Ludo,
> OK with something along these lines, thanks!
Done and pushed, thanks !
Mathieu
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-07-30 10:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2017-07-12 20:54 ` Ludovic Courtès
2017-07-30 10:47 ` bug#27654: " Mathieu Othacehe
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).