summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-06-18 00:22:13 +0200
committerLudovic Courtès <ludo@gnu.org>2015-06-18 00:36:09 +0200
commitfcc58db68b2af59dea0cae41bc1e2df47911d588 (patch)
tree1ef2ec63a3b7043de50716e651a49f2ae18dbccc /doc
parent39bee8a2937ea28e74b5c807962fb8bc87fe6887 (diff)
Add 'guix size'.
* guix/scripts/size.scm: New file. * Makefile.am (MODULES): Add it. (SCM_TESTS): Add tests/size.scm. * doc.am (SUBCOMMANDS): Add 'size'. * po/guix/POTFILES.in: Add guix/scripts/size.scm. * tests/size.scm: New file. * doc/guix.texi (Packages with Multiple Outputs): Add xref to "Invoking guix size". (Invoking guix size): New node. (Invoking guix gc): Add index for "closure" and xref to the above. * doc/contributing.texi (Submitting Patches): Use @enumerate for the check list. Add item about 'guix size'.
Diffstat (limited to 'doc')
-rw-r--r--doc/contributing.texi28
-rw-r--r--doc/guix.texi78
2 files changed, 99 insertions, 7 deletions
diff --git a/doc/contributing.texi b/doc/contributing.texi
index 536f223da4b..7b16ea35392 100644
--- a/doc/contributing.texi
+++ b/doc/contributing.texi
@@ -203,14 +203,32 @@ standards, GNU Coding Standards}); you can check the commit history for
203examples. 203examples.
204 204
205Before submitting a patch that adds or modifies a package definition, 205Before submitting a patch that adds or modifies a package definition,
206please run @code{guix lint @var{package}}, where @var{package} is the 206please run through this check list:
207
208@enumerate
209@item
210Run @code{guix lint @var{package}}, where @var{package} is the
207name of the new or modified package, and fix any errors it reports 211name of the new or modified package, and fix any errors it reports
208(@pxref{Invoking guix lint}). In addition, please make sure the package 212(@pxref{Invoking guix lint}).
209builds on your platform, using @code{guix build @var{package}}. You may 213
210also want to check that dependent package (if applicable) are not 214@item
211affected by the change; @code{guix refresh --list-dependent 215Make sure the package builds on your platform, using @code{guix build
216@var{package}}.
217
218@item
219Take a look at the profile reported by @command{guix size}
220(@pxref{Invoking guix size}). This will allow you to notice references
221to other packages unwillingly retained. It may also help determine
222whether to split the package (@pxref{Packages with Multiple Outputs}),
223and which optional dependencies should be used.
224
225@item
226For important changes, check that dependent package (if applicable) are
227not affected by the change; @code{guix refresh --list-dependent
212@var{package}} will help you do that (@pxref{Invoking guix refresh}). 228@var{package}} will help you do that (@pxref{Invoking guix refresh}).
213 229
230@end enumerate
231
214When posting a patch to the mailing list, use @samp{[PATCH] @dots{}} as a 232When posting a patch to the mailing list, use @samp{[PATCH] @dots{}} as a
215subject. You may use your email client or the @command{git send-mail} 233subject. You may use your email client or the @command{git send-mail}
216command. 234command.
diff --git a/doc/guix.texi b/doc/guix.texi
index a93003d625b..a669464feb4 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -124,12 +124,13 @@ Defining Packages
124Utilities 124Utilities
125 125
126* Invoking guix build:: Building packages from the command line. 126* Invoking guix build:: Building packages from the command line.
127* Invoking guix edit:: 127* Invoking guix edit:: Editing package definitions.
128* Invoking guix download:: Downloading a file and printing its hash. 128* Invoking guix download:: Downloading a file and printing its hash.
129* Invoking guix hash:: Computing the cryptographic hash of a file. 129* Invoking guix hash:: Computing the cryptographic hash of a file.
130* Invoking guix import:: Importing package definitions. 130* Invoking guix import:: Importing package definitions.
131* Invoking guix refresh:: Updating package definitions. 131* Invoking guix refresh:: Updating package definitions.
132* Invoking guix lint:: Finding errors in package definitions. 132* Invoking guix lint:: Finding errors in package definitions.
133* Invoking guix size:: Profiling disk usage.
133* Invoking guix environment:: Setting up development environments. 134* Invoking guix environment:: Setting up development environments.
134* Invoking guix publish:: Sharing substitutes. 135* Invoking guix publish:: Sharing substitutes.
135 136
@@ -1495,7 +1496,8 @@ graphical user interfaces (GUIs). The former depend solely on the C
1495library, whereas the latter depend on Tcl/Tk and the underlying X 1496library, whereas the latter depend on Tcl/Tk and the underlying X
1496libraries. In this case, we leave the command-line tools in the default 1497libraries. In this case, we leave the command-line tools in the default
1497output, whereas the GUIs are in a separate output. This allows users 1498output, whereas the GUIs are in a separate output. This allows users
1498who do not need the GUIs to save space. 1499who do not need the GUIs to save space. The @command{guix size} command
1500can help find out about such situations (@pxref{Invoking guix size}).
1499 1501
1500There are several such multiple-output packages in the GNU distribution. 1502There are several such multiple-output packages in the GNU distribution.
1501Other conventional output names include @code{lib} for libraries and 1503Other conventional output names include @code{lib} for libraries and
@@ -1575,11 +1577,15 @@ as arguments.
1575 1577
1576@item --requisites 1578@item --requisites
1577@itemx -R 1579@itemx -R
1580@cindex closure
1578List the requisites of the store files passed as arguments. Requisites 1581List the requisites of the store files passed as arguments. Requisites
1579include the store files themselves, their references, and the references 1582include the store files themselves, their references, and the references
1580of these, recursively. In other words, the returned list is the 1583of these, recursively. In other words, the returned list is the
1581@dfn{transitive closure} of the store files. 1584@dfn{transitive closure} of the store files.
1582 1585
1586@xref{Invoking guix size}, for a tool to profile the size of an
1587element's closure.
1588
1583@end table 1589@end table
1584 1590
1585Lastly, the following options allow you to check the integrity of the 1591Lastly, the following options allow you to check the integrity of the
@@ -3271,6 +3277,7 @@ programming interface of Guix in a convenient way.
3271* Invoking guix import:: Importing package definitions. 3277* Invoking guix import:: Importing package definitions.
3272* Invoking guix refresh:: Updating package definitions. 3278* Invoking guix refresh:: Updating package definitions.
3273* Invoking guix lint:: Finding errors in package definitions. 3279* Invoking guix lint:: Finding errors in package definitions.
3280* Invoking guix size:: Profiling disk usage.
3274* Invoking guix environment:: Setting up development environments. 3281* Invoking guix environment:: Setting up development environments.
3275* Invoking guix publish:: Sharing substitutes. 3282* Invoking guix publish:: Sharing substitutes.
3276@end menu 3283@end menu
@@ -3974,6 +3981,73 @@ and exit.
3974 3981
3975@end table 3982@end table
3976 3983
3984@node Invoking guix size
3985@section Invoking @command{guix size}
3986
3987The @command{guix size} command helps package developers profile the
3988disk usage of packages. It is easy to overlook the impact of an
3989additional dependency added to a package, or the impact of using a
3990single output for a package that could easily be split (@pxref{Packages
3991with Multiple Outputs}). These are the typical issues that
3992@command{guix size} can highlight.
3993
3994The command can be passed a package specification such as @code{gcc-4.8}
3995or @code{guile:debug}, or a file name in the store. Consider this
3996example:
3997
3998@example
3999$ guix size coreutils
4000store item total self
4001/gnu/store/@dots{}-coreutils-8.23 70.0 13.9 19.8%
4002/gnu/store/@dots{}-gmp-6.0.0a 55.3 2.5 3.6%
4003/gnu/store/@dots{}-acl-2.2.52 53.7 0.5 0.7%
4004/gnu/store/@dots{}-attr-2.4.46 53.2 0.3 0.5%
4005/gnu/store/@dots{}-gcc-4.8.4-lib 52.9 15.7 22.4%
4006/gnu/store/@dots{}-glibc-2.21 37.2 37.2 53.1%
4007@end example
4008
4009@cindex closure
4010The store items listed here constitute the @dfn{transitive closure} of
4011Coreutils---i.e., Coreutils and all its dependencies, recursively---as
4012would be returned by:
4013
4014@example
4015$ guix gc -R /gnu/store/@dots{}-coreutils-8.23
4016@end example
4017
4018Here the output shows 3 columns next to store items. The first column,
4019labeled ``total'', shows the size in mebibytes (MiB) of the closure of
4020the store item---that is, its own size plus the size of all its
4021dependencies. The next column, labeled ``self'', shows the size of the
4022item itself. The last column shows the ratio of the item's size to the
4023space occupied by all the items listed here.
4024
4025In this example, we see that the closure of Coreutils weighs in at
402670@tie{}MiB, half of which is taken by libc. (That libc represents a
4027large fraction of the closure is not a problem @i{per se} because it is
4028always available on the system anyway.)
4029
4030When the package passed to @command{guix size} is available in the
4031store, @command{guix size} queries the daemon to determine its
4032dependencies, and measures its size in the store, similar to @command{du
4033-ms --apparent-size} (@pxref{du invocation,,, coreutils, GNU
4034Coreutils}).
4035
4036When the given package is @emph{not} in the store, @command{guix size}
4037reports information based on information about the available substitutes
4038(@pxref{Substitutes}). This allows it to profile disk usage of store
4039items that are not even on disk, only available remotely.
4040
4041A single option is available:
4042
4043@table @option
4044
4045@item --system=@var{system}
4046@itemx -s @var{system}
4047Consider packages for @var{system}---e.g., @code{x86_64-linux}.
4048
4049@end table
4050
3977@node Invoking guix environment 4051@node Invoking guix environment
3978@section Invoking @command{guix environment} 4052@section Invoking @command{guix environment}
3979 4053