database: db-add-derivation: Don't try to add a derivation twice.

This fixes the issue of having multiple identical derivations associated with
an evaluation as reported by Ludovic Courtès <ludo@gnu.org> at
<https://lists.gnu.org/archive/html/guix-devel/2017-01/msg00109.html>.

* src/cuirass/database.scm (db-add-derivation): Ignore if JOB is already
present in DB.
pull/3/head
Mathieu Lirzin 2017-01-09 01:29:48 +01:00
parent 8988070725
commit d0a5801e39
No known key found for this signature in database
GPG Key ID: 0ADEE10094604D37
1 changed files with 2 additions and 2 deletions

View File

@ -1,5 +1,5 @@
;;; database.scm -- store evaluation and build results
;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
;;; Copyright © 2016, 2017 Mathieu Lirzin <mthl@gnu.org>
;;;
;;; This file is part of Cuirass.
;;;
@ -147,7 +147,7 @@ INSERT OR IGNORE INTO Specifications (repo_name, url, load_path, file, \
(define (db-add-derivation db job)
"Store a derivation result in database DB and return its ID."
(sqlite-exec db "\
INSERT INTO Derivations (derivation, job_name, evaluation)\
INSERT OR IGNORE INTO Derivations (derivation, job_name, evaluation)\
VALUES ('~A', '~A', '~A');"
(assq-ref job #:derivation)
(assq-ref job #:job-name)