summaryrefslogtreecommitdiff
path: root/guix/build
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-08-21 15:09:11 +0200
committerLudovic Courtès <ludo@gnu.org>2018-08-24 17:57:56 +0200
commite4297aa8b95cefa32e2595ce58886fc03b0561f7 (patch)
tree046d7b6624b660cf0eb5c75514f1e42b74c473a0 /guix/build
parentc1352b4badd2020448eb69e6ae212b43f5dceb15 (diff)
grafts: Add high-level 'graft' procedure on the build side.
* guix/build/graft.scm (graft): New procedure. * guix/grafts.scm (graft-derivation/shallow)[build]: Use it instead of inline code.
Diffstat (limited to 'guix/build')
-rw-r--r--guix/build/graft.scm21
1 files changed, 19 insertions, 2 deletions
diff --git a/guix/build/graft.scm b/guix/build/graft.scm
index e567bff4f4..8d79e8a50e 100644
--- a/guix/build/graft.scm
+++ b/guix/build/graft.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014, 2015, 2016, 2018 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016 Mark H Weaver <mhw@netris.org>
;;;
;;; This file is part of GNU Guix.
@@ -27,7 +27,8 @@
#:use-module (srfi srfi-1) ; list library
#:use-module (srfi srfi-26) ; cut and cute
#:export (replace-store-references
- rewrite-directory))
+ rewrite-directory
+ graft))
;;; Commentary:
;;;
@@ -321,4 +322,20 @@ file name pairs."
#:directories? #t))
(rename-matching-files output mapping))
+(define* (graft old-outputs new-outputs mapping
+ #:key (log-port (current-output-port)))
+ "Apply the grafts described by MAPPING on OLD-OUTPUTS, leading to
+NEW-OUTPUTS. MAPPING must be a list of file name pairs; OLD-OUTPUTS and
+NEW-OUTPUTS are lists of output name/file name pairs."
+ (for-each (lambda (input output)
+ (format log-port "grafting '~a' -> '~a'...~%" input output)
+ (force-output)
+ (rewrite-directory input output mapping))
+ (match old-outputs
+ (((names . files) ...)
+ files))
+ (match new-outputs
+ (((names . files) ...)
+ files))))
+
;;; graft.scm ends here