From patchwork Wed Dec 19 12:56:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ricardo Wurmus X-Patchwork-Id: 489 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 00B9316999; Wed, 19 Dec 2018 12:57:15 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) by mira.cbaines.net (Postfix) with ESMTP id 3B2581694F for ; Wed, 19 Dec 2018 12:57:15 +0000 (GMT) Received: from localhost ([::1]:59867 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZbPW-0006S7-PH for patchwork@mira.cbaines.net; Wed, 19 Dec 2018 07:57:14 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34294) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZbPQ-0006Rv-8u for guix-patches@gnu.org; Wed, 19 Dec 2018 07:57:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZbPM-0007Xc-BS for guix-patches@gnu.org; Wed, 19 Dec 2018 07:57:08 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:49785) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gZbPK-0007WY-7v for guix-patches@gnu.org; Wed, 19 Dec 2018 07:57:04 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gZbPK-0001wG-3y for guix-patches@gnu.org; Wed, 19 Dec 2018 07:57:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#33802] [PATCH] ui: Report profile hooks separately. Resent-From: Ricardo Wurmus Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 19 Dec 2018 12:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 33802 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 33802@debbugs.gnu.org X-Debbugs-Original-To: Received: via spool by submit@debbugs.gnu.org id=B.15452242157438 (code B ref -1); Wed, 19 Dec 2018 12:57:01 +0000 Received: (at submit) by debbugs.gnu.org; 19 Dec 2018 12:56:55 +0000 Received: from localhost ([127.0.0.1]:54043 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gZbP9-0001vq-Jg for submit@debbugs.gnu.org; Wed, 19 Dec 2018 07:56:55 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52808) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gZbP7-0001vd-P9 for submit@debbugs.gnu.org; Wed, 19 Dec 2018 07:56:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZbP0-0007Ku-U7 for submit@debbugs.gnu.org; Wed, 19 Dec 2018 07:56:44 -0500 Received: from lists.gnu.org ([2001:4830:134:3::11]:49897) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZbP0-0007Jx-Mn for submit@debbugs.gnu.org; Wed, 19 Dec 2018 07:56:42 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34133) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZbOy-0006Js-PS for guix-patches@gnu.org; Wed, 19 Dec 2018 07:56:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZbOv-0007Gb-HK for guix-patches@gnu.org; Wed, 19 Dec 2018 07:56:40 -0500 Received: from venus.bbbm.mdc-berlin.de ([141.80.25.30]:33214) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZbOv-0007FS-1J for guix-patches@gnu.org; Wed, 19 Dec 2018 07:56:37 -0500 Received: from localhost (localhost [127.0.0.1]) by venus.bbbm.mdc-berlin.de (Postfix) with ESMTP id 00C5D380738 for ; Wed, 19 Dec 2018 13:56:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mdc-berlin.de; h= content-transfer-encoding:content-type:content-type:mime-version :x-mailer:message-id:date:date:subject:subject:from:from :received:received:received; s=mdc; t=1545224194; x=1547038595; bh=4XZvCGK1JQzdmV5Uz0ZarS0/GH+4oejiVEaGBiimrZ0=; b=qiwy4po/0fPp yTfZHbNDB2QDUaKvSaTZmAOekQ6yLMyVL1/zNLOAgg3PjPRR1aevbTt0N0fJqSGW /f0vhat81ZC96pRBZhnyU8LRZgz+HGcQ1f8e4tiZ5SGnui0Q+HqL5vLTLmyrQT+a VzsXTZaNRh4WE9uJh9pa0025ZcntySU= X-Virus-Scanned: amavisd-new at mdc-berlin.de Received: from venus.bbbm.mdc-berlin.de ([127.0.0.1]) by localhost (venus.bbbm.mdc-berlin.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qsUQ2uVs2njJ for ; Wed, 19 Dec 2018 13:56:34 +0100 (CET) Received: from SW-IT-P-CAS3.mdc-berlin.net (puck.citx.mdc-berlin.de [141.80.36.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by venus.bbbm.mdc-berlin.de (Postfix) with ESMTPS for ; Wed, 19 Dec 2018 13:56:34 +0100 (CET) Received: from localhost (141.80.113.103) by SW-IT-P-CAS3.mdc-berlin.net (141.80.113.58) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 19 Dec 2018 13:56:34 +0100 From: Ricardo Wurmus Date: Wed, 19 Dec 2018 13:56:32 +0100 Message-ID: <20181219125632.17532-1-ricardo.wurmus@mdc-berlin.de> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-Originating-IP: [141.80.113.103] X-TM-AS-Product-Ver: SMEX-12.5.0.1684-8.5.1010-24298.005 X-TM-AS-Result: No-14.354700-8.000000-10 X-TMASE-MatchedRID: SWUBxxlZlUcL1ikn99eM18IMxCGh6u6X/qxRV3rLqo2rgjO7XC1RTfft 33R5lvyhXCL/XVBNT2NtrQLvnvZ+INbms8wOrodvA9lly13c/gFflOpBqBHTt8kigQB2Dpq11wf 12AI3J+mZR7/lKAV17eTvG/XWhTGRnU4Y8605XznU3m2KoscyC0rh/hn4JkBn5UPrgOqZFHpjLO Ro1y6rxlkabE6HiylBy5ydlJ4UKnrHOkf2+KMD/Mu00lnG8+PW75oFMklhrnjQqI16NtHf0D49i 2GL8RSmO4adQ8gZNR2yIeCE9qLInjRn2xdwrsXp7spMO3HwKCBReWnUUdhI9WcBhsdB2L6la0IE kYOsokVeQaZPICOa+O31SlZljZNPyO17Z2gPUCtIcJTn2HkqsX0tCKdnhB58GtkvK5L7RXEXvQk Gi3tjz/cUt5lc1lLgZON9R+uSfQA= X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--14.354700-8.000000 X-TMASE-Version: SMEX-12.5.0.1684-8.5.1010-24298.005 X-TM-SNTS-SMTP: E0198577E50A225AF44B80185361048B15C6854D83BE0420785D723177C300142000:9 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ricardo Wurmus Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * guix/ui.scm (profile-hook-derivation?): New procedure. (show-what-to-build): Distinguish among BUILD derivations that match 'profile-hook-derivation?'. Report them separately. * guix/status.scm (print-build-event): Display profile hooks with readable hook name. * guix/profiles.scm (info-dir-file, ghc-package-cache-file, ca-certificate-bundle, glib-schemas, gtk-icon-themes, gtk-im-modules, xdg-desktop-database, xdg-mime-database, fonts-dir-file, manual-database): Augment derivation with "type" and "hook" properties. --- guix/profiles.scm | 52 +++++++++++++++++++++++++++++++++++++---------- guix/status.scm | 4 ++++ guix/ui.scm | 46 +++++++++++++++++++++++++++++++++++------ 3 files changed, 85 insertions(+), 17 deletions(-) diff --git a/guix/profiles.scm b/guix/profiles.scm index ba4446bc2..4739d28a9 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -4,7 +4,7 @@ ;;; Copyright © 2014, 2016 Alex Kost ;;; Copyright © 2015 Mark H Weaver ;;; Copyright © 2015 Sou Bunnbu -;;; Copyright © 2016 Ricardo Wurmus +;;; Copyright © 2016, 2018 Ricardo Wurmus ;;; Copyright © 2016 Chris Marusich ;;; Copyright © 2017 Huang Ying ;;; Copyright © 2017 Maxim Cournoyer @@ -788,7 +788,10 @@ MANIFEST." (gexp->derivation "info-dir" build #:local-build? #t - #:substitutable? #f)) + #:substitutable? #f + #:properties + `((type . profile-hook) + (hook . "info manuals directory")))) (define (ghc-package-cache-file manifest) "Return a derivation that builds the GHC 'package.cache' file for all the @@ -842,7 +845,10 @@ entries of MANIFEST, or #f if MANIFEST does not have any GHC packages." (map manifest-entry-name (manifest-entries manifest))) (gexp->derivation "ghc-package-cache" build #:local-build? #t - #:substitutable? #f) + #:substitutable? #f + #:properties + `((type . profile-hook) + (hook . "GHC package cache"))) (return #f)))) (define (ca-certificate-bundle manifest) @@ -910,7 +916,10 @@ MANIFEST. Single-file bundles are required by programs such as Git and Lynx." (gexp->derivation "ca-certificate-bundle" build #:local-build? #t - #:substitutable? #f)) + #:substitutable? #f + #:properties + `((type . profile-hook) + (hook . "CA certificate bundle")))) (define (glib-schemas manifest) "Return a derivation that unions all schemas from manifest entries and @@ -960,7 +969,10 @@ creates the Glib 'gschemas.compiled' file." (if %glib (gexp->derivation "glib-schemas" build #:local-build? #t - #:substitutable? #f) + #:substitutable? #f + #:properties + `((type . profile-hook) + (hook . "Glib schemas"))) (return #f)))) (define (gtk-icon-themes manifest) @@ -1016,7 +1028,10 @@ creates the GTK+ 'icon-theme.cache' file for each theme." (if %gtk+ (gexp->derivation "gtk-icon-themes" build #:local-build? #t - #:substitutable? #f) + #:substitutable? #f + #:properties + `((type . profile-hook) + (hook . "GTK icon themes"))) (return #f)))) (define (gtk-im-modules manifest) @@ -1088,7 +1103,10 @@ for both major versions of GTK+." (if (or gtk+ gtk+-2) (gexp->derivation "gtk-im-modules" gexp #:local-build? #t - #:substitutable? #f) + #:substitutable? #f + #:properties + `((type . profile-hook) + (hook . "GTK inputs method modules"))) (return #f))))) (define (xdg-desktop-database manifest) @@ -1126,7 +1144,10 @@ MIME type." (if glib (gexp->derivation "xdg-desktop-database" build #:local-build? #t - #:substitutable? #f) + #:substitutable? #f + #:properties + `((type . profile-hook) + (hook . "XDG desktop database"))) (return #f)))) (define (xdg-mime-database manifest) @@ -1165,7 +1186,10 @@ entries. It's used to query the MIME type of a given file." (if glib (gexp->derivation "xdg-mime-database" build #:local-build? #t - #:substitutable? #f) + #:substitutable? #f + #:properties + `((type . profile-hook) + (hook . "XDG MIME database"))) (return #f)))) ;; Several font packages may install font files into same directory, so @@ -1236,7 +1260,10 @@ files for the fonts of the @var{manifest} entries." (guix build union) (srfi srfi-26)) #:local-build? #t - #:substitutable? #f)) + #:substitutable? #f + #:properties + `((type . profile-hook) + (hook . "fonts directory")))) (define (manual-database manifest) "Return a derivation that builds the manual page database (\"mandb\") for @@ -1306,7 +1333,10 @@ the entries in MANIFEST." ;; . #:env-vars `(("MALLOC_PERTURB_" . "1")) - #:local-build? #t)) + #:local-build? #t + #:properties + `((type . profile-hook) + (hook . "manual page database")))) (define %default-profile-hooks ;; This is the list of derivation-returning procedures that are called by diff --git a/guix/status.scm b/guix/status.scm index 868bfdca2..070c1d132 100644 --- a/guix/status.scm +++ b/guix/status.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017, 2018 Ludovic Courtès +;;; Copyright © 2018 Ricardo Wurmus ;;; ;;; This file is part of GNU Guix. ;;; @@ -336,6 +337,9 @@ addition to build events." "applying ~a grafts for ~a..." count)) count drv))) + ('profile-hook + (format port (info (G_ "building profile hook for ~a...")) + (assq-ref properties 'hook))) (_ (format port (info (G_ "building ~a...")) drv)))) (newline port)) diff --git a/guix/ui.scm b/guix/ui.scm index 60636edac..bf70fc134 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -822,6 +822,12 @@ warning." ('graft #t) (_ #f))) +(define (profile-hook-derivation? drv) + "Return true if DRV is definitely a profile hook derivation, false otherwise." + (match (assq-ref (derivation-properties drv) 'type) + ('profile-hook #t) + (_ #f))) + (define* (show-what-to-build store drv #:key dry-run? (use-substitutes? #t) (mode (build-mode normal))) @@ -872,10 +878,28 @@ report what is prerequisites are available for download." substitutable-references download)))) download)) - ((graft build) - (partition (compose graft-derivation? - read-derivation-from-file) - build))) + ((graft hook build) + (match (fold (lambda (file acc) + (let ((drv (read-derivation-from-file file))) + (match acc + ((#:graft graft #:hook hook #:build build) + (cond + ((graft-derivation? drv) + `(#:graft ,(cons file graft) + #:hook ,hook + #:build ,build)) + ((profile-hook-derivation? drv) + `(#:graft ,graft + #:hook ,(cons file hook) + #:build ,build)) + (else + `(#:graft ,graft + #:hook ,hook + #:build ,(cons file build)))))))) + '(#:graft () #:hook () #:build ()) + build) + ((#:graft graft #:hook hook #:build build) + (values graft hook build))))) (define installed-size (reduce + 0 (map substitutable-nar-size download))) @@ -913,7 +937,12 @@ report what is prerequisites are available for download." (N_ "~:[The following graft would be made:~%~{ ~a~%~}~;~]" "~:[The following grafts would be made:~%~{ ~a~%~}~;~]" (length graft)) - (null? graft) graft)) + (null? graft) graft) + (format (current-error-port) + (N_ "~:[The following profile hook would be built:~%~{ ~a~%~}~;~]" + "~:[The following profile hooks would be built:~%~{ ~a~%~}~;~]" + (length hook)) + (null? hook) hook)) (begin (format (current-error-port) (N_ "~:[The following derivation will be built:~%~{ ~a~%~}~;~]" @@ -938,7 +967,12 @@ report what is prerequisites are available for download." (N_ "~:[The following graft will be made:~%~{ ~a~%~}~;~]" "~:[The following grafts will be made:~%~{ ~a~%~}~;~]" (length graft)) - (null? graft) graft))) + (null? graft) graft) + (format (current-error-port) + (N_ "~:[The following profile hook will be built:~%~{ ~a~%~}~;~]" + "~:[The following profile hooks will be built:~%~{ ~a~%~}~;~]" + (length hook)) + (null? hook) hook))) (check-available-space installed-size)