From mboxrd@z Thu Jan 1 00:00:00 1970 From: iyzsong@member.fsf.org (=?utf-8?B?5a6L5paH5q2m?=) Subject: [WIP][PATCH] profiles: info-dir-file: Don't consider unwanted manifest entries Date: Fri, 15 Dec 2017 23:12:10 +0800 Message-ID: <87ind8ja9h.fsf@member.fsf.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44139) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePrf0-0000Fk-Or for guix-devel@gnu.org; Fri, 15 Dec 2017 10:12:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ePreu-0000Ui-Pu for guix-devel@gnu.org; Fri, 15 Dec 2017 10:12:26 -0500 Received: from rezeros.cc ([2001:19f0:7001:2f3e:5400:ff:fe84:e55d]:35518) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ePreu-0000Np-8Q for guix-devel@gnu.org; Fri, 15 Dec 2017 10:12:20 -0500 Received: from localhost (183.158.178.118 [183.158.178.118]) by rezeros.cc (OpenSMTPD) with ESMTPSA id 613b102d (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for ; Fri, 15 Dec 2017 15:11:58 +0000 (UTC) Received: from gift (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id 9c8cc61e for ; Fri, 15 Dec 2017 15:12:10 +0000 (UTC) List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org --=-=-= Content-Type: text/plain Hello! Currently we run profile hooks for all manifest inputs, so if you install a new package to your profile, all profile hooks will be run again, even if the new package doesn't provide info manuals, man pages, etc. Ideally only interested hooks need to be run, eg: if the new package has info manuals, then the 'info-dir-file' hook will run. I get it works somehow, but breaks the '--dry-run' functionality which I have no idea how to preserve... --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-gexp-Add-eval-gexp.patch >From 3fd19f5f59c28689e55b3a7dede942014f9b7fb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= Date: Fri, 15 Dec 2017 22:20:38 +0800 Subject: [PATCH 1/2] gexp: Add 'eval-gexp'. * guix/gexp.scm (eval-gexp): New procedure. --- guix/gexp.scm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/guix/gexp.scm b/guix/gexp.scm index 1929947d9..678e0c1e6 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -76,6 +76,7 @@ gexp->derivation gexp->file gexp->script + eval-gexp text-file* mixed-text-file file-union @@ -1161,6 +1162,21 @@ and '%load-compiled-path' to honor EXP's imported modules." #:local-build? #t #:substitutable? #f))))) +(define* (eval-gexp exp #:optional (name "value")) + "Return as a monadic value the EXP (a gexp) evaluate to. This is +implemented by building a store file NAME that contains the textual +representation of EXP's value, and then @code{read} from it." + (mlet* %store-monad + ((drv (gexp->derivation + name + (gexp (with-output-to-file (ungexp output) + (lambda () + (write (eval (quote (ungexp exp)) (current-module)))))) + #:local-build? #t + #:substitutable? #t)) + (_ (built-derivations (list drv)))) + (return (call-with-input-file (derivation->output-path drv) read)))) + (define* (text-file* name #:rest text) "Return as a monadic value a derivation that builds a text file containing all of TEXT. TEXT may list, in addition to strings, objects of any type that -- 2.13.3 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0002-profiles-info-dir-file-Don-t-consider-unwanted-manif.patch >From ca6aecb94455c6e009d94bf6a0780a8f876bc85d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= Date: Fri, 15 Dec 2017 22:38:41 +0800 Subject: [PATCH 2/2] profiles: info-dir-file: Don't consider unwanted manifest entries. * guix/profiles.scm (info-dir-file): Use 'eval-gexp' to filter out those manifest inputs that doesn't have info manuals. --- guix/profiles.scm | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/guix/profiles.scm b/guix/profiles.scm index cedf9faa8..14b6c4253 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -683,7 +683,22 @@ MANIFEST." (define gzip ;lazy reference (module-ref (resolve-interface '(gnu packages compression)) 'gzip)) - (define build + ;; We only need to build the 'dir' file for inputs that does containing info + ;; manuals. + ;; + ;; XXX: This breaks '--dry-run', all manifest inputs will be built before + ;; returning the profile derivation... + (define interested + (eval-gexp + #~(filter + (lambda (input) + (file-exists? (string-append input "/share/info"))) + '#$(manifest-inputs manifest)))) + + ;; XXX: We have to pass paths of inputs instead of paths of info files, + ;; because 'gexp-inputs' only adds inputs for strings which satisfies + ;; 'direct-store-path?'. + (define (build inputs) (with-imported-modules '((guix build utils)) #~(begin (use-modules (guix build utils) @@ -707,12 +722,12 @@ MANIFEST." (mkdir-p (string-append #$output "/share/info")) (exit (every install-info - (append-map info-files - '#$(manifest-inputs manifest))))))) + (append-map info-files '#$inputs)))))) - (gexp->derivation "info-dir" build - #:local-build? #t - #:substitutable? #f)) + (mlet* %store-monad ((inputs interested)) + (gexp->derivation "info-dir" (build inputs) + #:local-build? #t + #:substitutable? #f))) (define (ghc-package-cache-file manifest) "Return a derivation that builds the GHC 'package.cache' file for all the -- 2.13.3 --=-=-= Content-Type: text/plain Needing help and directions, thanks! --=-=-=--