diff options
Diffstat (limited to 'guix/build/graft.scm')
-rw-r--r-- | guix/build/graft.scm | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/guix/build/graft.scm b/guix/build/graft.scm index e567bff4f4..c119ee71d1 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. @@ -19,6 +19,7 @@ (define-module (guix build graft) #:use-module (guix build utils) + #:use-module (guix build debug-link) #:use-module (rnrs bytevectors) #:use-module (ice-9 vlist) #:use-module (ice-9 match) @@ -27,7 +28,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 +323,29 @@ file name pairs." #:directories? #t)) (rename-matching-files output mapping)) +(define %graft-hooks + ;; Default list of hooks run after grafting. + (list graft-debug-links)) + +(define* (graft old-outputs new-outputs mapping + #:key (log-port (current-output-port)) + (hooks %graft-hooks)) + "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))) + (for-each (lambda (hook) + (hook old-outputs new-outputs mapping + #:log-port log-port)) + hooks)) + ;;; graft.scm ends here |