From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Subject: bug#19973: [PATCH 1/2] grafts: Add high-level 'graft' procedure on the build side. Date: Tue, 21 Aug 2018 22:56:38 +0200 Message-ID: <20180821205639.18759-1-ludo@gnu.org> References: <87pnybmoey.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44659) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsDk3-0001cF-Fk for bug-guix@gnu.org; Tue, 21 Aug 2018 16:59:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fsDj0-0002th-Dk for bug-guix@gnu.org; Tue, 21 Aug 2018 16:58:03 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:52049) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fsDj0-0002tO-89 for bug-guix@gnu.org; Tue, 21 Aug 2018 16:58:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fsDj0-0002wh-6u for bug-guix@gnu.org; Tue, 21 Aug 2018 16:58:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87pnybmoey.fsf@gnu.org> List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: 19973@debbugs.gnu.org * 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 e567bff4f..8d79e8a50 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 +;;; Copyright © 2014, 2015, 2016, 2018 Ludovic Courtès ;;; Copyright © 2016 Mark H Weaver ;;; ;;; 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 d6b0e93e8..4b10b3efd 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 +;;; Copyright © 2014, 2015, 2016, 2017, 2018 Ludovic Courtès ;;; ;;; 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" <>)) -- 2.18.0