aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMathieu Lirzin <mthl@gnu.org>2016-07-27 13:21:11 +0200
committerMathieu Lirzin <mthl@gnu.org>2016-07-27 14:17:10 +0200
commit24bfb61e8e5a0a65ec54d8a3c2aaa78876a01efb (patch)
tree60f47deb643885196d50d40829acfb7aa451715c /src
parent5c0a2b57798dd059806851205a3f16d19d9ecf12 (diff)
downloadcuirass-24bfb61e8e5a0a65ec54d8a3c2aaa78876a01efb.tar
cuirass-24bfb61e8e5a0a65ec54d8a3c2aaa78876a01efb.tar.gz
schema: Builds: Add 'evaluation' column.
* src/schema.sql (Builds): Add 'evaluation' column. * src/cuirass/database.scm (db-add-build): Adapt. * src/cuirass/base.scm (build-packages): Likewise.
Diffstat (limited to 'src')
-rw-r--r--src/cuirass/base.scm12
-rw-r--r--src/cuirass/database.scm4
-rw-r--r--src/schema.sql14
3 files changed, 19 insertions, 11 deletions
diff --git a/src/cuirass/base.scm b/src/cuirass/base.scm
index d642b9f..baf8909 100644
--- a/src/cuirass/base.scm
+++ b/src/cuirass/base.scm
@@ -121,19 +121,21 @@ if required."
(map (λ (job)
(let ((log-port (%make-void-port "w0"))
(name (assq-ref job #:job-name))
- (drv (assq-ref job #:derivation)))
+ (drv (assq-ref job #:derivation))
+ (eval-id (assq-ref job #:eval-id)))
(simple-format #t "building ~A...\n" drv)
(parameterize ((current-build-output-port log-port))
(build-derivations store (list drv))
(let* ((output (derivation-path->output-path drv))
(log (log-file store output))
(build `((#:derivation . ,drv)
+ (#:eval-id . ,eval-id)
(#:log . ,log)
- (#:output . ,output)))
- (id (db-add-build db build)))
- (close-port log-port)
+ (#:output . ,output))))
+ (db-add-build db build)
(simple-format #t "~A\n" output)
- (acons #:id id build)))))
+ (close-port log-port)
+ build))))
jobs))
(define (process-specs db jobspecs)
diff --git a/src/cuirass/database.scm b/src/cuirass/database.scm
index a314704..b831833 100644
--- a/src/cuirass/database.scm
+++ b/src/cuirass/database.scm
@@ -180,8 +180,10 @@ string."
(define (db-add-build db build)
"Store BUILD in database DB."
(sqlite-exec db "\
-INSERT INTO Builds (derivation, log, output) VALUES ('~A', '~A', '~A');"
+INSERT INTO Builds (derivation, evaluation, log, output)\
+ VALUES ('~A', '~A', '~A', '~A');"
(assq-ref build #:derivation)
+ (assq-ref build #:eval-id)
(assq-ref build #:log)
(assq-ref build #:output))
(last-insert-rowid db))
diff --git a/src/schema.sql b/src/schema.sql
index 248f9d2..725d145 100644
--- a/src/schema.sql
+++ b/src/schema.sql
@@ -34,12 +34,16 @@ CREATE TABLE Derivations (
FOREIGN KEY (evaluation) REFERENCES Evaluations (id)
);
+-- Builds are not in a one to one relationship with derivations in order to
+-- keep track of non deterministic compilations.
CREATE TABLE Builds (
- id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
- derivation TEXT NOT NULL,
- log TEXT NOT NULL,
- output TEXT, -- NULL if build failed
- FOREIGN KEY (derivation) REFERENCES Evaluations (derivation)
+ derivation TEXT NOT NULL,
+ evaluation INTEGER NOT NULL,
+ log TEXT NOT NULL,
+ output TEXT, -- NULL if build failed
+ PRIMARY KEY (derivation, evaluation),
+ FOREIGN KEY (derivation) REFERENCES Derivations (derivation),
+ FOREIGN KEY (evaluation) REFERENCES Evaluations (id)
);
COMMIT;