Patchwork using Cuirass to track a guix packages' git

login
register
mail settings
Submitter Jan Nieuwenhuizen
Date Sept. 23, 2016, 1:44 p.m.
Message ID <87wpi2buia.fsf@gnu.org>
Download mbox | patch
Permalink /patch/15953/
State New
Headers show

Comments

Jan Nieuwenhuizen - Sept. 23, 2016, 1:44 p.m.
Jan Nieuwenhuizen writes:

Oops, sent too soon, patch 2 needed this fix


Greetings,
Jan

Patch

From 2ddac2390c42836cb5073ce67466802e2306e1aa Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <janneke@gnu.org>
Date: Thu, 15 Sep 2016 23:15:54 +0200
Subject: [PATCH 2/4] cuirass: 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.
* src/cuirass/base.scm (process-specs): Skip compilation if #:no-compile?.
---
 src/cuirass/base.scm     |  5 +++--
 src/cuirass/database.scm | 12 +++++++-----
 src/schema.sql           |  3 ++-
 3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/cuirass/base.scm b/src/cuirass/base.scm
index 8ad6af4..3d542b1 100644
--- a/src/cuirass/base.scm
+++ b/src/cuirass/base.scm
@@ -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*)))
diff --git a/src/cuirass/database.scm b/src/cuirass/database.scm
index 2d2dfd2..5d3922b 100644
--- a/src/cuirass/database.scm
+++ b/src/cuirass/database.scm
@@ -116,11 +116,12 @@  database object."
   "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');"
+  (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,7 @@  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 +140,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? . ,(not (zero? no-compile?))))
                    specs))))))
 
 (define (db-add-derivation db job)
diff --git a/src/schema.sql b/src/schema.sql
index a545da5..f8042d1 100644
--- a/src/schema.sql
+++ b/src/schema.sql
@@ -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 (
-- 
2.9.3