summary refs log tree commit diff
path: root/guix/serialization.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-03-09 23:01:18 +0100
committerLudovic Courtès <ludo@gnu.org>2014-03-09 23:01:18 +0100
commit6c20d1d0c3822c0332f3cca963121365133e6412 (patch)
treefdb2c7c0d1c68376541e2d507bf98a72031fa9c1 /guix/serialization.scm
parent02c86a5e365f59fb09c32cfaaef2c02db17e8770 (diff)
downloadguix-6c20d1d0c3822c0332f3cca963121365133e6412.tar.gz
store: Add #:timeout build option.
* guix/serialization.scm (write-string-pairs): New procedure.
* guix/store.scm (write-arg): Add 'string-pairs' case.
  (set-build-options): Add 'timeout' keyword parameter.  Honor it.
* tests/derivations.scm ("build-expression->derivation and timeout"):
  New test.
Diffstat (limited to 'guix/serialization.scm')
-rw-r--r--guix/serialization.scm12
1 files changed, 11 insertions, 1 deletions
diff --git a/guix/serialization.scm b/guix/serialization.scm
index 474dc69de5..284b174794 100644
--- a/guix/serialization.scm
+++ b/guix/serialization.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -22,11 +22,13 @@
   #:use-module (rnrs io ports)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
+  #:use-module (ice-9 match)
   #:export (write-int read-int
             write-long-long read-long-long
             write-padding
             write-string read-string read-latin1-string
             write-string-list read-string-list
+            write-string-pairs
             write-store-path read-store-path
             write-store-path-list read-store-path-list))
 
@@ -94,6 +96,14 @@
   (write-int (length l) p)
   (for-each (cut write-string <> p) l))
 
+(define (write-string-pairs l p)
+  (write-int (length l) p)
+  (for-each (match-lambda
+             ((first . second)
+              (write-string first p)
+              (write-string second p)))
+            l))
+
 (define (read-string-list p)
   (let ((len (read-int p)))
     (unfold (cut >= <> len)