diff options
author | Marius Bakke <mbakke@fastmail.com> | 2018-08-25 16:44:07 +0200 |
---|---|---|
committer | Marius Bakke <mbakke@fastmail.com> | 2018-08-25 16:44:07 +0200 |
commit | 839167ff9d74fc490b32f6a197591964f73b65e5 (patch) | |
tree | d193bfad7c9ef5597c5cd7d2ea25fd007d01f88a /guix/build/graft.scm | |
parent | 27c1df05a866b639a61e16d48b3f2da8fa5eb767 (diff) | |
parent | 030c912616c8ee1595218e304460041bcb4f1ceb (diff) |
Merge branch 'staging' into core-updates
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 |