mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-23 21:17:11 -05:00
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.
This commit is contained in:
parent
b06a70e05d
commit
8980eea5ab
3 changed files with 31 additions and 2 deletions
|
@ -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.
|
||||
|
||||
@item --derivers
|
||||
@cindex derivation
|
||||
Return the derivation(s) leading to the given store items
|
||||
(@pxref{Derivations}).
|
||||
|
||||
For example, this command:
|
||||
|
||||
@example
|
||||
guix gc --derivers `guix package -I ^emacs$ | cut -f4`
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
;;; GNU Guix --- Functional package management for GNU
|
||||
;;; Copyright © 2012, 2013, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
|
||||
;;; Copyright © 2012, 2013, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
|
||||
;;;
|
||||
;;; This file is part of GNU Guix.
|
||||
;;;
|
||||
|
@ -61,6 +61,8 @@ (define (show-help)
|
|||
-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 @@ (define %options
|
|||
(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 @@ (define (list-relatives relatives)
|
|||
(requisites store (list item)))))
|
||||
((list-referrers)
|
||||
(list-relatives referrers))
|
||||
((list-derivers)
|
||||
(list-relatives valid-derivers))
|
||||
((optimize)
|
||||
(assert-no-extra-arguments)
|
||||
(optimize-store store))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# GNU Guix --- Functional package management for GNU
|
||||
# Copyright © 2013, 2015, 2017 Ludovic Courtès <ludo@gnu.org>
|
||||
# Copyright © 2013, 2015, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
|
||||
#
|
||||
# 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"
|
||||
|
|
Loading…
Reference in a new issue