base: Support tracking of a Guix package's git.

* src/schema.sql (Specifications): Add no_compile_p column.
* src/cuirass/database.scm (db-add-specification)
(db-get-specifications): Handle #:no-compile? property.
* tests/database.scm (example-spec): Adapt.
* src/cuirass/base.scm (process-specs): Skip compilation if #:no-compile?.

Signed-off-by: Mathieu Lirzin <mthl@gnu.org>
pull/3/head
Jan Nieuwenhuizen 2016-09-15 23:15:54 +02:00 committed by Mathieu Lirzin
parent fca42b010e
commit 5ef0701f54
No known key found for this signature in database
GPG Key ID: 0ADEE10094604D37
4 changed files with 16 additions and 10 deletions

View File

@ -149,8 +149,9 @@ if required."
(let ((commit (fetch-repository spec))
(stamp (db-get-stamp db spec)))
(unless (string=? commit stamp)
(compile (string-append (%package-cachedir) "/"
(assq-ref spec #:name)))
(unless (assq-ref spec #:no-compile?)
(compile (string-append (%package-cachedir) "/"
(assq-ref spec #:name))))
(with-store store
(let* ((spec* (acons #:current-commit commit spec))
(jobs (evaluate store db spec*)))

View File

@ -115,12 +115,13 @@ database object."
(define (db-add-specification db spec)
"Store specification SPEC in database DB and return its ID."
(apply sqlite-exec db "\
INSERT INTO Specifications\
(repo_name, url, load_path, file, proc, arguments, branch, tag, revision)\
VALUES ('~A', '~A', '~A', '~A', '~S', '~S', '~A', '~A', '~A');"
INSERT INTO Specifications (repo_name, url, load_path, file, proc, arguments, \
branch, tag, revision, no_compile_p) \
VALUES ('~A', '~A', '~A', '~A', '~S', '~S', '~A', '~A', '~A', ~A);"
(append
(assq-refs spec '(#:name #:url #:load-path #:file #:proc #:arguments))
(assq-refs spec '(#:branch #:tag #:commit) "NULL")))
(assq-refs spec '(#:branch #:tag #:commit) "NULL")
(list (if (assq-ref spec #:no-compile?) "1" "0"))))
(last-insert-rowid db))
(define (db-get-specifications db)
@ -128,7 +129,8 @@ INSERT INTO Specifications\
(specs '()))
(match rows
(() specs)
((#(id name url load-path file proc args branch tag rev) . rest)
((#(id name url load-path file proc args branch tag rev no-compile?)
. rest)
(loop rest
(cons `((#:id . ,id)
(#:name . ,name)
@ -139,7 +141,8 @@ INSERT INTO Specifications\
(#:arguments . ,(with-input-from-string args read))
(#:branch . ,branch)
(#:tag . ,(if (string=? tag "NULL") #f tag))
(#:commit . ,(if (string=? rev "NULL") #f rev)))
(#:commit . ,(if (string=? rev "NULL") #f rev))
(#:no-compile? . ,(positive? no-compile?)))
specs))))))
(define (db-add-derivation db job)

View File

@ -11,7 +11,8 @@ CREATE TABLE Specifications (
-- The following columns are optional.
branch TEXT,
tag TEXT,
revision TEXT
revision TEXT,
no_compile_p INTEGER
);
CREATE TABLE Stamps (

View File

@ -30,7 +30,8 @@
(#:arguments (subset . "hello"))
(#:branch . "master")
(#:tag . #f)
(#:commit . #f)))
(#:commit . #f)
(#:no-compile? . #f)))
(define* (make-dummy-job #:optional (name "foo"))
`((#:name . ,name)