diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2015-06-18 00:22:13 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2015-06-18 00:36:09 +0200 |
| commit | fcc58db68b2af59dea0cae41bc1e2df47911d588 (patch) | |
| tree | 1ef2ec63a3b7043de50716e651a49f2ae18dbccc /doc | |
| parent | 39bee8a2937ea28e74b5c807962fb8bc87fe6887 (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.texi | 28 | ||||
| -rw-r--r-- | doc/guix.texi | 78 |
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 | |||
| 203 | examples. | 203 | examples. |
| 204 | 204 | ||
| 205 | Before submitting a patch that adds or modifies a package definition, | 205 | Before submitting a patch that adds or modifies a package definition, |
| 206 | please run @code{guix lint @var{package}}, where @var{package} is the | 206 | please run through this check list: |
| 207 | |||
| 208 | @enumerate | ||
| 209 | @item | ||
| 210 | Run @code{guix lint @var{package}}, where @var{package} is the | ||
| 207 | name of the new or modified package, and fix any errors it reports | 211 | name 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}). |
| 209 | builds on your platform, using @code{guix build @var{package}}. You may | 213 | |
| 210 | also want to check that dependent package (if applicable) are not | 214 | @item |
| 211 | affected by the change; @code{guix refresh --list-dependent | 215 | Make sure the package builds on your platform, using @code{guix build |
| 216 | @var{package}}. | ||
| 217 | |||
| 218 | @item | ||
| 219 | Take a look at the profile reported by @command{guix size} | ||
| 220 | (@pxref{Invoking guix size}). This will allow you to notice references | ||
| 221 | to other packages unwillingly retained. It may also help determine | ||
| 222 | whether to split the package (@pxref{Packages with Multiple Outputs}), | ||
| 223 | and which optional dependencies should be used. | ||
| 224 | |||
| 225 | @item | ||
| 226 | For important changes, check that dependent package (if applicable) are | ||
| 227 | not 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 | |||
| 214 | When posting a patch to the mailing list, use @samp{[PATCH] @dots{}} as a | 232 | When posting a patch to the mailing list, use @samp{[PATCH] @dots{}} as a |
| 215 | subject. You may use your email client or the @command{git send-mail} | 233 | subject. You may use your email client or the @command{git send-mail} |
| 216 | command. | 234 | command. |
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 | |||
| 124 | Utilities | 124 | Utilities |
| 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 | |||
| 1495 | library, whereas the latter depend on Tcl/Tk and the underlying X | 1496 | library, whereas the latter depend on Tcl/Tk and the underlying X |
| 1496 | libraries. In this case, we leave the command-line tools in the default | 1497 | libraries. In this case, we leave the command-line tools in the default |
| 1497 | output, whereas the GUIs are in a separate output. This allows users | 1498 | output, whereas the GUIs are in a separate output. This allows users |
| 1498 | who do not need the GUIs to save space. | 1499 | who do not need the GUIs to save space. The @command{guix size} command |
| 1500 | can help find out about such situations (@pxref{Invoking guix size}). | ||
| 1499 | 1501 | ||
| 1500 | There are several such multiple-output packages in the GNU distribution. | 1502 | There are several such multiple-output packages in the GNU distribution. |
| 1501 | Other conventional output names include @code{lib} for libraries and | 1503 | Other 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 | ||
| 1578 | List the requisites of the store files passed as arguments. Requisites | 1581 | List the requisites of the store files passed as arguments. Requisites |
| 1579 | include the store files themselves, their references, and the references | 1582 | include the store files themselves, their references, and the references |
| 1580 | of these, recursively. In other words, the returned list is the | 1583 | of 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 | ||
| 1587 | element's closure. | ||
| 1588 | |||
| 1583 | @end table | 1589 | @end table |
| 1584 | 1590 | ||
| 1585 | Lastly, the following options allow you to check the integrity of the | 1591 | Lastly, 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 | |||
| 3987 | The @command{guix size} command helps package developers profile the | ||
| 3988 | disk usage of packages. It is easy to overlook the impact of an | ||
| 3989 | additional dependency added to a package, or the impact of using a | ||
| 3990 | single output for a package that could easily be split (@pxref{Packages | ||
| 3991 | with Multiple Outputs}). These are the typical issues that | ||
| 3992 | @command{guix size} can highlight. | ||
| 3993 | |||
| 3994 | The command can be passed a package specification such as @code{gcc-4.8} | ||
| 3995 | or @code{guile:debug}, or a file name in the store. Consider this | ||
| 3996 | example: | ||
| 3997 | |||
| 3998 | @example | ||
| 3999 | $ guix size coreutils | ||
| 4000 | store 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 | ||
| 4010 | The store items listed here constitute the @dfn{transitive closure} of | ||
| 4011 | Coreutils---i.e., Coreutils and all its dependencies, recursively---as | ||
| 4012 | would be returned by: | ||
| 4013 | |||
| 4014 | @example | ||
| 4015 | $ guix gc -R /gnu/store/@dots{}-coreutils-8.23 | ||
| 4016 | @end example | ||
| 4017 | |||
| 4018 | Here the output shows 3 columns next to store items. The first column, | ||
| 4019 | labeled ``total'', shows the size in mebibytes (MiB) of the closure of | ||
| 4020 | the store item---that is, its own size plus the size of all its | ||
| 4021 | dependencies. The next column, labeled ``self'', shows the size of the | ||
| 4022 | item itself. The last column shows the ratio of the item's size to the | ||
| 4023 | space occupied by all the items listed here. | ||
| 4024 | |||
| 4025 | In this example, we see that the closure of Coreutils weighs in at | ||
| 4026 | 70@tie{}MiB, half of which is taken by libc. (That libc represents a | ||
| 4027 | large fraction of the closure is not a problem @i{per se} because it is | ||
| 4028 | always available on the system anyway.) | ||
| 4029 | |||
| 4030 | When the package passed to @command{guix size} is available in the | ||
| 4031 | store, @command{guix size} queries the daemon to determine its | ||
| 4032 | dependencies, and measures its size in the store, similar to @command{du | ||
| 4033 | -ms --apparent-size} (@pxref{du invocation,,, coreutils, GNU | ||
| 4034 | Coreutils}). | ||
| 4035 | |||
| 4036 | When the given package is @emph{not} in the store, @command{guix size} | ||
| 4037 | reports information based on information about the available substitutes | ||
| 4038 | (@pxref{Substitutes}). This allows it to profile disk usage of store | ||
| 4039 | items that are not even on disk, only available remotely. | ||
| 4040 | |||
| 4041 | A single option is available: | ||
| 4042 | |||
| 4043 | @table @option | ||
| 4044 | |||
| 4045 | @item --system=@var{system} | ||
| 4046 | @itemx -s @var{system} | ||
| 4047 | Consider 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 | ||
