summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2018-12-03 17:17:39 +0100
committerFlorian Dold <florian.dold@gmail.com>2018-12-03 17:17:39 +0100
commitd5ae3410042f138a382d337a8c409caccfdd7849 (patch)
treefcbdef3fa656ff18bf5b194eca4b3fa15d43b1c9 /guix
parentc2ea3cc99b845f168ed32d3ed1a8b5bb6bbc5933 (diff)
downloaddeployment-d5ae3410042f138a382d337a8c409caccfdd7849.tar.gz
deployment-d5ae3410042f138a382d337a8c409caccfdd7849.tar.bz2
deployment-d5ae3410042f138a382d337a8c409caccfdd7849.zip
missing file
Diffstat (limited to 'guix')
-rw-r--r--guix/taler-helpers.scm38
1 files changed, 38 insertions, 0 deletions
diff --git a/guix/taler-helpers.scm b/guix/taler-helpers.scm
new file mode 100644
index 0000000..e980308
--- /dev/null
+++ b/guix/taler-helpers.scm
@@ -0,0 +1,38 @@
+(define-module taler-helpers
+ #:use-module (guix)
+ #:use-module (guix utils)
+ #:export (concat-local-files))
+
+;;;
+;;; Helpers
+;;;
+
+(define (absolute-file-name file directory)
+ "Return the canonical absolute file name for FILE, which lives in the
+vicinity of DIRECTORY."
+ (canonicalize-path
+ (cond ((string-prefix? "/" file) file)
+ ((not directory) file)
+ ((string-prefix? "/" directory)
+ (string-append directory "/" file))
+ (else file))))
+
+(define (%%concat-local-files srcdir outname files)
+ (define (slurp f)
+ (call-with-input-file (absolute-file-name f srcdir) get-string-all))
+ (define (file-concat files)
+ (string-concatenate (map slurp files)))
+ (plain-file outname (file-concat files)))
+
+
+(define-syntax concat-local-files
+ (lambda (s)
+ (syntax-case s ()
+ ((_ outname rest ...)
+ #'(%%concat-local-files (current-source-directory) outname rest ...))
+ ((_)
+ #'(syntax-error "missing arguments"))
+ (id
+ (identifier? #'id)
+ #'(syntax-error
+ "'concat-local-files' is a macro and cannot be used like this")))))