guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/05: grafts: Add high-level 'graft' procedure on the build side.


From: Ludovic Courtès
Subject: 03/05: grafts: Add high-level 'graft' procedure on the build side.
Date: Fri, 24 Aug 2018 12:06:40 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit e4297aa8b95cefa32e2595ce58886fc03b0561f7
Author: Ludovic Courtès <address@hidden>
Date:   Tue Aug 21 15:09:11 2018 +0200

    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.
---
 guix/build/graft.scm | 21 +++++++++++++++++++--
 guix/grafts.scm      | 13 ++-----------
 2 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/guix/build/graft.scm b/guix/build/graft.scm
index e567bff..8d79e8a 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 <address@hidden>
+;;; Copyright © 2014, 2015, 2016, 2018 Ludovic Courtès <address@hidden>
 ;;; Copyright © 2016 Mark H Weaver <address@hidden>
 ;;;
 ;;; 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
diff --git a/guix/grafts.scm b/guix/grafts.scm
index d6b0e93..4b10b3e 100644
--- a/guix/grafts.scm
+++ b/guix/grafts.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014, 2015, 2016, 2017 Ludovic Courtès <address@hidden>
+;;; Copyright © 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -117,16 +117,7 @@ are not recursively applied to dependencies of DRV."
                                        (cons (assoc-ref old-outputs name)
                                              file)))
                                     %outputs))))
-         (for-each (lambda (input output)
-                     (format #t "grafting '~a' -> '~a'...~%" input output)
-                     (force-output)
-                     (rewrite-directory input output mapping))
-                   (match old-outputs
-                     (((names . files) ...)
-                      files))
-                   (match %outputs
-                     (((names . files) ...)
-                      files))))))
+         (graft old-outputs %outputs mapping))))
 
   (define add-label
     (cut cons "x" <>))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]