mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 21:38:07 -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
|
of an element. @xref{Invoking guix graph}, for a tool to visualize
|
||||||
the graph of references.
|
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
|
@end table
|
||||||
|
|
||||||
Lastly, the following options allow you to check the integrity of the
|
Lastly, the following options allow you to check the integrity of the
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; 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.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -61,6 +61,8 @@ (define (show-help)
|
||||||
-R, --requisites list the requisites of PATHS"))
|
-R, --requisites list the requisites of PATHS"))
|
||||||
(display (G_ "
|
(display (G_ "
|
||||||
--referrers list the referrers of PATHS"))
|
--referrers list the referrers of PATHS"))
|
||||||
|
(display (G_ "
|
||||||
|
--derivers list the derivers of PATHS"))
|
||||||
(newline)
|
(newline)
|
||||||
(display (G_ "
|
(display (G_ "
|
||||||
--verify[=OPTS] verify the integrity of the store; OPTS is a
|
--verify[=OPTS] verify the integrity of the store; OPTS is a
|
||||||
|
@ -153,6 +155,10 @@ (define %options
|
||||||
(lambda (opt name arg result)
|
(lambda (opt name arg result)
|
||||||
(alist-cons 'action 'list-referrers
|
(alist-cons 'action 'list-referrers
|
||||||
(alist-delete 'action result))))
|
(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
|
(option '("list-failures") #f #f
|
||||||
(lambda (opt name arg result)
|
(lambda (opt name arg result)
|
||||||
(alist-cons 'action 'list-failures
|
(alist-cons 'action 'list-failures
|
||||||
|
@ -241,6 +247,8 @@ (define (list-relatives relatives)
|
||||||
(requisites store (list item)))))
|
(requisites store (list item)))))
|
||||||
((list-referrers)
|
((list-referrers)
|
||||||
(list-relatives referrers))
|
(list-relatives referrers))
|
||||||
|
((list-derivers)
|
||||||
|
(list-relatives valid-derivers))
|
||||||
((optimize)
|
((optimize)
|
||||||
(assert-no-extra-arguments)
|
(assert-no-extra-arguments)
|
||||||
(optimize-store store))
|
(optimize-store store))
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# GNU Guix --- Functional package management for GNU
|
# 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.
|
# This file is part of GNU Guix.
|
||||||
#
|
#
|
||||||
|
@ -54,6 +54,9 @@ guix gc --references "$out/bin/guile"
|
||||||
if guix gc --references /dev/null;
|
if guix gc --references /dev/null;
|
||||||
then false; else true; fi
|
then false; else true; fi
|
||||||
|
|
||||||
|
# Check derivers.
|
||||||
|
guix gc --derivers "$out" | grep "$drv"
|
||||||
|
|
||||||
# Add then reclaim a .drv file.
|
# Add then reclaim a .drv file.
|
||||||
drv="`guix build idutils -d`"
|
drv="`guix build idutils -d`"
|
||||||
test -f "$drv"
|
test -f "$drv"
|
||||||
|
|
Loading…
Reference in a new issue