guix-commits
[Top][All Lists]
Advanced

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

05/05: guix gc: Add '--derivers'.


From: Ludovic Courtès
Subject: 05/05: guix gc: Add '--derivers'.
Date: Tue, 27 Mar 2018 08:51:55 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 8980eea5ab6f89e7649d9abf0be2a9d49156f7d2
Author: Ludovic Courtès <address@hidden>
Date:   Tue Mar 27 14:16:19 2018 +0200

    guix gc: Add '--derivers'.
    
    * guix/scripts/gc.scm (show-help, %options): Add '--derivers'.
    (guix-gc): Handle 'list-derivers'.
    * tests/guix-gc.sh: Add test.
    * doc/guix.texi (Invoking guix gc): Document it.
---
 doc/guix.texi       | 18 ++++++++++++++++++
 guix/scripts/gc.scm | 10 +++++++++-
 tests/guix-gc.sh    |  5 ++++-
 3 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 2204285..c37a87d 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -2642,6 +2642,24 @@ of these, recursively.  In other words, the returned 
list is the
 of an element.  @xref{Invoking guix graph}, for a tool to visualize
 the graph of references.
 
address@hidden --derivers
address@hidden derivation
+Return the derivation(s) leading to the given store items
+(@pxref{Derivations}).
+
+For example, this command:
+
address@hidden
+guix gc --derivers `guix package -I ^emacs$ | cut -f4`
address@hidden example
+
address@hidden
+returns the @file{.drv} file(s) leading to the @code{emacs} package
+installed in your profile.
+
+Note that there may be zero matching @file{.drv} files, for instance
+because these files have been garbage-collected.  There can also be more
+than one matching @file{.drv} due to fixed-output derivations.
 @end table
 
 Lastly, the following options allow you to check the integrity of the
diff --git a/guix/scripts/gc.scm b/guix/scripts/gc.scm
index a31d223..e4ed722 100644
--- a/guix/scripts/gc.scm
+++ b/guix/scripts/gc.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2015, 2016, 2017 Ludovic Courtès <address@hidden>
+;;; Copyright © 2012, 2013, 2015, 2016, 2017, 2018 Ludovic Courtès 
<address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -61,6 +61,8 @@ Invoke the garbage collector.\n"))
   -R, --requisites       list the requisites of PATHS"))
   (display (G_ "
       --referrers        list the referrers of PATHS"))
+  (display (G_ "
+      --derivers         list the derivers of PATHS"))
   (newline)
   (display (G_ "
       --verify[=OPTS]    verify the integrity of the store; OPTS is a
@@ -153,6 +155,10 @@ Invoke the garbage collector.\n"))
                 (lambda (opt name arg result)
                   (alist-cons 'action 'list-referrers
                               (alist-delete 'action result))))
+        (option '("derivers") #f #f
+                (lambda (opt name arg result)
+                  (alist-cons 'action 'list-derivers
+                              (alist-delete 'action result))))
         (option '("list-failures") #f #f
                 (lambda (opt name arg result)
                   (alist-cons 'action 'list-failures
@@ -241,6 +247,8 @@ Invoke the garbage collector.\n"))
                            (requisites store (list item)))))
         ((list-referrers)
          (list-relatives referrers))
+        ((list-derivers)
+         (list-relatives valid-derivers))
         ((optimize)
          (assert-no-extra-arguments)
          (optimize-store store))
diff --git a/tests/guix-gc.sh b/tests/guix-gc.sh
index efbc7e7..ef2d954 100644
--- a/tests/guix-gc.sh
+++ b/tests/guix-gc.sh
@@ -1,5 +1,5 @@
 # GNU Guix --- Functional package management for GNU
-# Copyright © 2013, 2015, 2017 Ludovic Courtès <address@hidden>
+# Copyright © 2013, 2015, 2017, 2018 Ludovic Courtès <address@hidden>
 #
 # This file is part of GNU Guix.
 #
@@ -54,6 +54,9 @@ guix gc --references "$out/bin/guile"
 if guix gc --references /dev/null;
 then false; else true; fi
 
+# Check derivers.
+guix gc --derivers "$out" | grep "$drv"
+
 # Add then reclaim a .drv file.
 drv="`guix build idutils -d`"
 test -f "$drv"



reply via email to

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