| 1 | @node Contributing |
| 2 | @chapter Contributing |
| 3 | |
| 4 | This project is a cooperative effort, and we need your help to make it |
| 5 | grow! Please get in touch with us on @email{guix-devel@@gnu.org} and |
| 6 | @code{#guix} on the Libera Chat IRC network. We welcome ideas, bug |
| 7 | reports, patches, and anything that may be helpful to the project. We |
| 8 | particularly welcome help on packaging (@pxref{Packaging Guidelines}). |
| 9 | |
| 10 | @cindex code of conduct, of contributors |
| 11 | @cindex contributor covenant |
| 12 | We want to provide a warm, friendly, and harassment-free environment, so |
| 13 | that anyone can contribute to the best of their abilities. To this end |
| 14 | our project uses a ``Contributor Covenant'', which was adapted from |
| 15 | @url{https://contributor-covenant.org/}. You can find a local version in |
| 16 | the @file{CODE-OF-CONDUCT} file in the source tree. |
| 17 | |
| 18 | Contributors are not required to use their legal name in patches and |
| 19 | on-line communication; they can use any name or pseudonym of their |
| 20 | choice. |
| 21 | |
| 22 | @menu |
| 23 | * Building from Git:: The latest and greatest. |
| 24 | * Running Guix Before It Is Installed:: Hacker tricks. |
| 25 | * The Perfect Setup:: The right tools. |
| 26 | * Packaging Guidelines:: Growing the distribution. |
| 27 | * Coding Style:: Hygiene of the contributor. |
| 28 | * Submitting Patches:: Share your work. |
| 29 | * Tracking Bugs and Patches:: Keeping it all organized. |
| 30 | * Commit Access:: Pushing to the official repository. |
| 31 | * Updating the Guix Package:: Updating the Guix package definition. |
| 32 | * Writing Documentation:: Improving documentation in GNU Guix. |
| 33 | * Translating Guix:: Make Guix speak your native language. |
| 34 | @end menu |
| 35 | |
| 36 | @node Building from Git |
| 37 | @section Building from Git |
| 38 | |
| 39 | If you want to hack Guix itself, it is recommended to use the latest |
| 40 | version from the Git repository: |
| 41 | |
| 42 | @example |
| 43 | git clone https://git.savannah.gnu.org/git/guix.git |
| 44 | @end example |
| 45 | |
| 46 | @cindex authentication, of a Guix checkout |
| 47 | How do you ensure that you obtained a genuine copy of the repository? |
| 48 | To do that, run @command{guix git authenticate}, passing it the commit |
| 49 | and OpenPGP fingerprint of the @dfn{channel introduction} |
| 50 | (@pxref{Invoking guix git authenticate}): |
| 51 | |
| 52 | @c The commit and fingerprint below must match those of the channel |
| 53 | @c introduction in '%default-channels'. |
| 54 | @example |
| 55 | git fetch origin keyring:keyring |
| 56 | guix git authenticate 9edb3f66fd807b096b48283debdcddccfea34bad \ |
| 57 | "BBB0 2DDF 2CEA F6A8 0D1D E643 A2A0 6DF2 A33A 54FA" |
| 58 | @end example |
| 59 | |
| 60 | @noindent |
| 61 | This command completes with exit code zero on success; it prints an |
| 62 | error message and exits with a non-zero code otherwise. |
| 63 | |
| 64 | As you can see, there is a chicken-and-egg problem: you first need to |
| 65 | have Guix installed. Typically you would install Guix System |
| 66 | (@pxref{System Installation}) or Guix on top of another distro |
| 67 | (@pxref{Binary Installation}); in either case, you would verify the |
| 68 | OpenPGP signature on the installation medium. This ``bootstraps'' the |
| 69 | trust chain. |
| 70 | |
| 71 | The easiest way to set up a development environment for Guix is, of |
| 72 | course, by using Guix! The following command starts a new shell where |
| 73 | all the dependencies and appropriate environment variables are set up to |
| 74 | hack on Guix: |
| 75 | |
| 76 | @example |
| 77 | guix shell -D guix --pure |
| 78 | @end example |
| 79 | |
| 80 | @xref{Invoking guix shell}, for more information on that command. |
| 81 | |
| 82 | If you are unable to use Guix when building Guix from a checkout, the |
| 83 | following are the required packages in addition to those mentioned in the |
| 84 | installation instructions (@pxref{Requirements}). |
| 85 | |
| 86 | @itemize |
| 87 | @item @url{https://gnu.org/software/autoconf/, GNU Autoconf}; |
| 88 | @item @url{https://gnu.org/software/automake/, GNU Automake}; |
| 89 | @item @url{https://gnu.org/software/gettext/, GNU Gettext}; |
| 90 | @item @url{https://gnu.org/software/texinfo/, GNU Texinfo}; |
| 91 | @item @url{https://www.graphviz.org/, Graphviz}; |
| 92 | @item @url{https://www.gnu.org/software/help2man/, GNU Help2man (optional)}. |
| 93 | @end itemize |
| 94 | |
| 95 | On Guix, extra dependencies can be added by instead running @command{guix |
| 96 | shell}: |
| 97 | |
| 98 | @example |
| 99 | guix shell -D guix help2man git strace --pure |
| 100 | @end example |
| 101 | |
| 102 | From there you can generate the build system infrastructure |
| 103 | using Autoconf and Automake: |
| 104 | |
| 105 | @example |
| 106 | ./bootstrap |
| 107 | @end example |
| 108 | |
| 109 | If you get an error like this one: |
| 110 | |
| 111 | @example |
| 112 | configure.ac:46: error: possibly undefined macro: PKG_CHECK_MODULES |
| 113 | @end example |
| 114 | |
| 115 | @noindent |
| 116 | it probably means that Autoconf couldn’t find @file{pkg.m4}, which is |
| 117 | provided by pkg-config. Make sure that @file{pkg.m4} is available. The |
| 118 | same holds for the @file{guile.m4} set of macros provided by Guile. For |
| 119 | instance, if you installed Automake in @file{/usr/local}, it wouldn’t |
| 120 | look for @file{.m4} files in @file{/usr/share}. In that case, you have |
| 121 | to invoke the following command: |
| 122 | |
| 123 | @example |
| 124 | export ACLOCAL_PATH=/usr/share/aclocal |
| 125 | @end example |
| 126 | |
| 127 | @xref{Macro Search Path,,, automake, The GNU Automake Manual}, for |
| 128 | more information. |
| 129 | |
| 130 | Then, run: |
| 131 | |
| 132 | @example |
| 133 | ./configure --localstatedir=/var |
| 134 | @end example |
| 135 | |
| 136 | @noindent |
| 137 | ... where @file{/var} is the normal @code{localstatedir} value |
| 138 | (@pxref{The Store}, for information about this). Note that you will |
| 139 | probably not run @command{make install} at the end (you don't have to) |
| 140 | but it's still important to pass the right @code{localstatedir}. |
| 141 | |
| 142 | Finally, you can build Guix and, if you feel so inclined, run the tests |
| 143 | (@pxref{Running the Test Suite}): |
| 144 | |
| 145 | @example |
| 146 | make |
| 147 | make check |
| 148 | @end example |
| 149 | |
| 150 | @noindent |
| 151 | If anything fails, take a look at installation instructions |
| 152 | (@pxref{Installation}) or send a message to the |
| 153 | @email{guix-devel@@gnu.org, mailing list}. |
| 154 | |
| 155 | From there on, you can authenticate all the commits included in your |
| 156 | checkout by running: |
| 157 | |
| 158 | @example |
| 159 | make authenticate |
| 160 | @end example |
| 161 | |
| 162 | The first run takes a couple of minutes, but subsequent runs are faster. |
| 163 | |
| 164 | Or, when your configuration for your local Git repository doesn't match |
| 165 | the default one, you can provide the reference for the @code{keyring} |
| 166 | branch through the variable @code{GUIX_GIT_KEYRING}. The following |
| 167 | example assumes that you have a Git remote called @samp{myremote} |
| 168 | pointing to the official repository: |
| 169 | |
| 170 | @example |
| 171 | make authenticate GUIX_GIT_KEYRING=myremote/keyring |
| 172 | @end example |
| 173 | |
| 174 | @quotation Note |
| 175 | You are advised to run @command{make authenticate} after every |
| 176 | @command{git pull} invocation. This ensures you keep receiving valid |
| 177 | changes to the repository. |
| 178 | @end quotation |
| 179 | |
| 180 | After updating the repository, @command{make} might fail with an error |
| 181 | similar to the following example: |
| 182 | |
| 183 | @example |
| 184 | error: failed to load 'gnu/packages/dunst.scm': |
| 185 | ice-9/eval.scm:293:34: In procedure abi-check: #<record-type <origin>>: record ABI mismatch; recompilation needed |
| 186 | @end example |
| 187 | |
| 188 | This means that one of the record types that Guix defines (in this |
| 189 | example, the @code{origin} record) has changed, and all of guix needs |
| 190 | to be recompiled to take that change into account. To do so, run |
| 191 | @command{make clean-go} followed by @command{make}. |
| 192 | |
| 193 | @node Running Guix Before It Is Installed |
| 194 | @section Running Guix Before It Is Installed |
| 195 | |
| 196 | In order to keep a sane working environment, you will find it useful to |
| 197 | test the changes made in your local source tree checkout without |
| 198 | actually installing them. So that you can distinguish between your |
| 199 | ``end-user'' hat and your ``motley'' costume. |
| 200 | |
| 201 | To that end, all the command-line tools can be used even if you have not |
| 202 | run @code{make install}. To do that, you first need to have an |
| 203 | environment with all the dependencies available (@pxref{Building from |
| 204 | Git}), and then simply prefix each command with @command{./pre-inst-env} |
| 205 | (the @file{pre-inst-env} script lives in the top build tree of Guix; it |
| 206 | is generated by running @command{./bootstrap} followed by |
| 207 | @command{./configure}). As an example, here is how you would build the |
| 208 | @code{hello} package as defined in your working tree (this assumes |
| 209 | @command{guix-daemon} is already running on your system; it's OK if it's |
| 210 | a different version): |
| 211 | |
| 212 | @example |
| 213 | $ ./pre-inst-env guix build hello |
| 214 | @end example |
| 215 | |
| 216 | @noindent |
| 217 | Similarly, an example for a Guile session using the Guix modules: |
| 218 | |
| 219 | @example |
| 220 | $ ./pre-inst-env guile -c '(use-modules (guix utils)) (pk (%current-system))' |
| 221 | |
| 222 | ;;; ("x86_64-linux") |
| 223 | @end example |
| 224 | |
| 225 | @noindent |
| 226 | @cindex REPL |
| 227 | @cindex read-eval-print loop |
| 228 | @dots{} and for a REPL (@pxref{Using Guix Interactively}): |
| 229 | |
| 230 | @example |
| 231 | $ ./pre-inst-env guile |
| 232 | scheme@@(guile-user)> ,use(guix) |
| 233 | scheme@@(guile-user)> ,use(gnu) |
| 234 | scheme@@(guile-user)> (define snakes |
| 235 | (fold-packages |
| 236 | (lambda (package lst) |
| 237 | (if (string-prefix? "python" |
| 238 | (package-name package)) |
| 239 | (cons package lst) |
| 240 | lst)) |
| 241 | '())) |
| 242 | scheme@@(guile-user)> (length snakes) |
| 243 | $1 = 361 |
| 244 | @end example |
| 245 | |
| 246 | If you are hacking on the daemon and its supporting code or if |
| 247 | @command{guix-daemon} is not already running on your system, you can |
| 248 | launch it straight from the build tree@footnote{The @option{-E} flag to |
| 249 | @command{sudo} guarantees that @code{GUILE_LOAD_PATH} is correctly set |
| 250 | such that @command{guix-daemon} and the tools it uses can find the Guile |
| 251 | modules they need.}: |
| 252 | |
| 253 | @example |
| 254 | $ sudo -E ./pre-inst-env guix-daemon --build-users-group=guixbuild |
| 255 | @end example |
| 256 | |
| 257 | The @command{pre-inst-env} script sets up all the environment variables |
| 258 | necessary to support this, including @env{PATH} and @env{GUILE_LOAD_PATH}. |
| 259 | |
| 260 | Note that @command{./pre-inst-env guix pull} does @emph{not} upgrade the |
| 261 | local source tree; it simply updates the @file{~/.config/guix/current} |
| 262 | symlink (@pxref{Invoking guix pull}). Run @command{git pull} instead if |
| 263 | you want to upgrade your local source tree. |
| 264 | |
| 265 | Sometimes, especially if you have recently updated your repository, |
| 266 | running @command{./pre-inst-env} will print a message similar to the |
| 267 | following example: |
| 268 | |
| 269 | @example |
| 270 | ;;; note: source file /home/user/projects/guix/guix/progress.scm |
| 271 | ;;; newer than compiled /home/user/projects/guix/guix/progress.go |
| 272 | @end example |
| 273 | |
| 274 | This is only a note and you can safely ignore it. You can get rid of |
| 275 | the message by running @command{make -j4}. Until you do, Guile will run |
| 276 | slightly slower because it will interpret the code instead of using |
| 277 | prepared Guile object (@file{.go}) files. |
| 278 | |
| 279 | You can run @command{make} automatically as you work using |
| 280 | @command{watchexec} from the @code{watchexec} package. For example, |
| 281 | to build again each time you update a package file, run |
| 282 | @samp{watchexec -w gnu/packages -- make -j4}. |
| 283 | |
| 284 | @node The Perfect Setup |
| 285 | @section The Perfect Setup |
| 286 | |
| 287 | The Perfect Setup to hack on Guix is basically the perfect setup used |
| 288 | for Guile hacking (@pxref{Using Guile in Emacs,,, guile, Guile Reference |
| 289 | Manual}). First, you need more than an editor, you need |
| 290 | @url{https://www.gnu.org/software/emacs, Emacs}, empowered by the |
| 291 | wonderful @url{https://nongnu.org/geiser/, Geiser}. To set that up, run: |
| 292 | |
| 293 | @example |
| 294 | guix install emacs guile emacs-geiser emacs-geiser-guile |
| 295 | @end example |
| 296 | |
| 297 | Geiser allows for interactive and incremental development from within |
| 298 | Emacs: code compilation and evaluation from within buffers, access to |
| 299 | on-line documentation (docstrings), context-sensitive completion, |
| 300 | @kbd{M-.} to jump to an object definition, a REPL to try out your code, |
| 301 | and more (@pxref{Introduction,,, geiser, Geiser User Manual}). For |
| 302 | convenient Guix development, make sure to augment Guile’s load path so |
| 303 | that it finds source files from your checkout: |
| 304 | |
| 305 | @lisp |
| 306 | ;; @r{Assuming the Guix checkout is in ~/src/guix.} |
| 307 | (with-eval-after-load 'geiser-guile |
| 308 | (add-to-list 'geiser-guile-load-path "~/src/guix")) |
| 309 | @end lisp |
| 310 | |
| 311 | To actually edit the code, Emacs already has a neat Scheme mode. But in |
| 312 | addition to that, you must not miss |
| 313 | @url{https://www.emacswiki.org/emacs/ParEdit, Paredit}. It provides |
| 314 | facilities to directly operate on the syntax tree, such as raising an |
| 315 | s-expression or wrapping it, swallowing or rejecting the following |
| 316 | s-expression, etc. |
| 317 | |
| 318 | @cindex code snippets |
| 319 | @cindex templates |
| 320 | @cindex reducing boilerplate |
| 321 | We also provide templates for common git commit messages and package |
| 322 | definitions in the @file{etc/snippets} directory. These templates can |
| 323 | be used to expand short trigger strings to interactive text snippets. If |
| 324 | you use @url{https://joaotavora.github.io/yasnippet/, YASnippet}, you |
| 325 | may want to add the @file{etc/snippets/yas} snippets directory to the |
| 326 | @var{yas-snippet-dirs} variable. If you use |
| 327 | @url{https://github.com/minad/tempel/, Tempel}, you may want to add the |
| 328 | @file{etc/snippets/tempel/*} path to the @var{tempel-path} variable in |
| 329 | Emacs. |
| 330 | |
| 331 | @lisp |
| 332 | ;; @r{Assuming the Guix checkout is in ~/src/guix.} |
| 333 | ;; @r{Yasnippet configuration} |
| 334 | (with-eval-after-load 'yasnippet |
| 335 | (add-to-list 'yas-snippet-dirs "~/src/guix/etc/snippets/yas")) |
| 336 | ;; @r{Tempel configuration} |
| 337 | (with-eval-after-load 'tempel |
| 338 | ;; Ensure tempel-path is a list -- it may also be a string. |
| 339 | (unless (listp 'tempel-path) |
| 340 | (setq tempel-path (list tempel-path))) |
| 341 | (add-to-list 'tempel-path "~/src/guix/etc/snippets/tempel/*")) |
| 342 | @end lisp |
| 343 | |
| 344 | The commit message snippets depend on @url{https://magit.vc/, Magit} to |
| 345 | display staged files. When editing a commit message type @code{add} |
| 346 | followed by @kbd{TAB} to insert a commit message template for adding a |
| 347 | package; type @code{update} followed by @kbd{TAB} to insert a template |
| 348 | for updating a package; type @code{https} followed by @kbd{TAB} to |
| 349 | insert a template for changing the home page URI of a package to HTTPS. |
| 350 | |
| 351 | The main snippet for @code{scheme-mode} is triggered by typing |
| 352 | @code{package...} followed by @kbd{TAB}. This snippet also inserts the |
| 353 | trigger string @code{origin...}, which can be expanded further. The |
| 354 | @code{origin} snippet in turn may insert other trigger strings ending on |
| 355 | @code{...}, which also can be expanded further. |
| 356 | |
| 357 | @cindex insert or update copyright |
| 358 | @cindex @code{M-x guix-copyright} |
| 359 | @cindex @code{M-x copyright-update} |
| 360 | We additionally provide insertion and automatic update of a copyright in |
| 361 | @file{etc/copyright.el}. You may want to set your full name, mail, and |
| 362 | load a file. |
| 363 | |
| 364 | @lisp |
| 365 | (setq user-full-name "Alice Doe") |
| 366 | (setq user-mail-address "alice@@mail.org") |
| 367 | ;; @r{Assuming the Guix checkout is in ~/src/guix.} |
| 368 | (load-file "~/src/guix/etc/copyright.el") |
| 369 | @end lisp |
| 370 | |
| 371 | To insert a copyright at the current line invoke @code{M-x guix-copyright}. |
| 372 | |
| 373 | To update a copyright you need to specify a @code{copyright-names-regexp}. |
| 374 | |
| 375 | @lisp |
| 376 | (setq copyright-names-regexp |
| 377 | (format "%s <%s>" user-full-name user-mail-address)) |
| 378 | @end lisp |
| 379 | |
| 380 | You can check if your copyright is up to date by evaluating @code{M-x |
| 381 | copyright-update}. If you want to do it automatically after each buffer |
| 382 | save then add @code{(add-hook 'after-save-hook 'copyright-update)} in |
| 383 | Emacs. |
| 384 | |
| 385 | @node Packaging Guidelines |
| 386 | @section Packaging Guidelines |
| 387 | |
| 388 | @cindex packages, creating |
| 389 | The GNU distribution is nascent and may well lack some of your favorite |
| 390 | packages. This section describes how you can help make the distribution |
| 391 | grow. |
| 392 | |
| 393 | Free software packages are usually distributed in the form of |
| 394 | @dfn{source code tarballs}---typically @file{tar.gz} files that contain |
| 395 | all the source files. Adding a package to the distribution means |
| 396 | essentially two things: adding a @dfn{recipe} that describes how to |
| 397 | build the package, including a list of other packages required to build |
| 398 | it, and adding @dfn{package metadata} along with that recipe, such as a |
| 399 | description and licensing information. |
| 400 | |
| 401 | In Guix all this information is embodied in @dfn{package definitions}. |
| 402 | Package definitions provide a high-level view of the package. They are |
| 403 | written using the syntax of the Scheme programming language; in fact, |
| 404 | for each package we define a variable bound to the package definition, |
| 405 | and export that variable from a module (@pxref{Package Modules}). |
| 406 | However, in-depth Scheme knowledge is @emph{not} a prerequisite for |
| 407 | creating packages. For more information on package definitions, |
| 408 | @pxref{Defining Packages}. |
| 409 | |
| 410 | Once a package definition is in place, stored in a file in the Guix |
| 411 | source tree, it can be tested using the @command{guix build} command |
| 412 | (@pxref{Invoking guix build}). For example, assuming the new package is |
| 413 | called @code{gnew}, you may run this command from the Guix build tree |
| 414 | (@pxref{Running Guix Before It Is Installed}): |
| 415 | |
| 416 | @example |
| 417 | ./pre-inst-env guix build gnew --keep-failed |
| 418 | @end example |
| 419 | |
| 420 | Using @code{--keep-failed} makes it easier to debug build failures since |
| 421 | it provides access to the failed build tree. Another useful |
| 422 | command-line option when debugging is @code{--log-file}, to access the |
| 423 | build log. |
| 424 | |
| 425 | If the package is unknown to the @command{guix} command, it may be that |
| 426 | the source file contains a syntax error, or lacks a @code{define-public} |
| 427 | clause to export the package variable. To figure it out, you may load |
| 428 | the module from Guile to get more information about the actual error: |
| 429 | |
| 430 | @example |
| 431 | ./pre-inst-env guile -c '(use-modules (gnu packages gnew))' |
| 432 | @end example |
| 433 | |
| 434 | Once your package builds correctly, please send us a patch |
| 435 | (@pxref{Submitting Patches}). Well, if you need help, we will be happy to |
| 436 | help you too. Once the patch is committed in the Guix repository, the |
| 437 | new package automatically gets built on the supported platforms by |
| 438 | @url{https://@value{SUBSTITUTE-SERVER-1}, our continuous integration system}. |
| 439 | |
| 440 | @cindex substituter |
| 441 | Users can obtain the new package definition simply by running |
| 442 | @command{guix pull} (@pxref{Invoking guix pull}). When |
| 443 | @code{@value{SUBSTITUTE-SERVER-1}} is done building the package, installing the |
| 444 | package automatically downloads binaries from there |
| 445 | (@pxref{Substitutes}). The only place where human intervention is |
| 446 | needed is to review and apply the patch. |
| 447 | |
| 448 | |
| 449 | @menu |
| 450 | * Software Freedom:: What may go into the distribution. |
| 451 | * Package Naming:: What's in a name? |
| 452 | * Version Numbers:: When the name is not enough. |
| 453 | * Synopses and Descriptions:: Helping users find the right package. |
| 454 | * Snippets versus Phases:: Whether to use a snippet, or a build phase. |
| 455 | * Emacs Packages:: Your Elisp fix. |
| 456 | * Python Modules:: A touch of British comedy. |
| 457 | * Perl Modules:: Little pearls. |
| 458 | * Java Packages:: Coffee break. |
| 459 | * Rust Crates:: Beware of oxidation. |
| 460 | * Elm Packages:: Trees of browser code |
| 461 | * Fonts:: Fond of fonts. |
| 462 | @end menu |
| 463 | |
| 464 | @node Software Freedom |
| 465 | @subsection Software Freedom |
| 466 | |
| 467 | @c Adapted from http://www.gnu.org/philosophy/philosophy.html. |
| 468 | @cindex free software |
| 469 | The GNU operating system has been developed so that users can have |
| 470 | freedom in their computing. GNU is @dfn{free software}, meaning that |
| 471 | users have the @url{https://www.gnu.org/philosophy/free-sw.html,four |
| 472 | essential freedoms}: to run the program, to study and change the program |
| 473 | in source code form, to redistribute exact copies, and to distribute |
| 474 | modified versions. Packages found in the GNU distribution provide only |
| 475 | software that conveys these four freedoms. |
| 476 | |
| 477 | In addition, the GNU distribution follow the |
| 478 | @url{https://www.gnu.org/distros/free-system-distribution-guidelines.html,free |
| 479 | software distribution guidelines}. Among other things, these guidelines |
| 480 | reject non-free firmware, recommendations of non-free software, and |
| 481 | discuss ways to deal with trademarks and patents. |
| 482 | |
| 483 | Some otherwise free upstream package sources contain a small and optional |
| 484 | subset that violates the above guidelines, for instance because this subset |
| 485 | is itself non-free code. When that happens, the offending items are removed |
| 486 | with appropriate patches or code snippets in the @code{origin} form of the |
| 487 | package (@pxref{Defining Packages}). This way, @code{guix |
| 488 | build --source} returns the ``freed'' source rather than the unmodified |
| 489 | upstream source. |
| 490 | |
| 491 | |
| 492 | @node Package Naming |
| 493 | @subsection Package Naming |
| 494 | |
| 495 | @cindex package name |
| 496 | A package actually has two names associated with it. |
| 497 | First, there is the name of the @emph{Scheme variable}, the one following |
| 498 | @code{define-public}. By this name, the package can be made known in the |
| 499 | Scheme code, for instance as input to another package. Second, there is |
| 500 | the string in the @code{name} field of a package definition. This name |
| 501 | is used by package management commands such as |
| 502 | @command{guix package} and @command{guix build}. |
| 503 | |
| 504 | Both are usually the same and correspond to the lowercase conversion of |
| 505 | the project name chosen upstream, with underscores replaced with |
| 506 | hyphens. For instance, GNUnet is available as @code{gnunet}, and |
| 507 | SDL_net as @code{sdl-net}. |
| 508 | |
| 509 | A noteworthy exception to this rule is when the project name is only a |
| 510 | single character, or if an older maintained project with the same name |
| 511 | already exists---regardless of whether it has already been packaged for |
| 512 | Guix. Use common sense to make such names unambiguous and meaningful. |
| 513 | For example, Guix's package for the shell called ``s'' upstream is |
| 514 | @code{s-shell} and @emph{not} @code{s}. Feel free to ask your fellow |
| 515 | hackers for inspiration. |
| 516 | |
| 517 | We do not add @code{lib} prefixes for library packages, unless these are |
| 518 | already part of the official project name. But @pxref{Python |
| 519 | Modules} and @ref{Perl Modules} for special rules concerning modules for |
| 520 | the Python and Perl languages. |
| 521 | |
| 522 | Font package names are handled differently, @pxref{Fonts}. |
| 523 | |
| 524 | |
| 525 | @node Version Numbers |
| 526 | @subsection Version Numbers |
| 527 | |
| 528 | @cindex package version |
| 529 | We usually package only the latest version of a given free software |
| 530 | project. But sometimes, for instance for incompatible library versions, |
| 531 | two (or more) versions of the same package are needed. These require |
| 532 | different Scheme variable names. We use the name as defined |
| 533 | in @ref{Package Naming} |
| 534 | for the most recent version; previous versions use the same name, suffixed |
| 535 | by @code{-} and the smallest prefix of the version number that may |
| 536 | distinguish the two versions. |
| 537 | |
| 538 | The name inside the package definition is the same for all versions of a |
| 539 | package and does not contain any version number. |
| 540 | |
| 541 | For instance, the versions 2.24.20 and 3.9.12 of GTK+ may be packaged as follows: |
| 542 | |
| 543 | @lisp |
| 544 | (define-public gtk+ |
| 545 | (package |
| 546 | (name "gtk+") |
| 547 | (version "3.9.12") |
| 548 | ...)) |
| 549 | (define-public gtk+-2 |
| 550 | (package |
| 551 | (name "gtk+") |
| 552 | (version "2.24.20") |
| 553 | ...)) |
| 554 | @end lisp |
| 555 | If we also wanted GTK+ 3.8.2, this would be packaged as |
| 556 | @lisp |
| 557 | (define-public gtk+-3.8 |
| 558 | (package |
| 559 | (name "gtk+") |
| 560 | (version "3.8.2") |
| 561 | ...)) |
| 562 | @end lisp |
| 563 | |
| 564 | @c See <https://lists.gnu.org/archive/html/guix-devel/2016-01/msg00425.html>, |
| 565 | @c for a discussion of what follows. |
| 566 | @cindex version number, for VCS snapshots |
| 567 | Occasionally, we package snapshots of upstream's version control system |
| 568 | (VCS) instead of formal releases. This should remain exceptional, |
| 569 | because it is up to upstream developers to clarify what the stable |
| 570 | release is. Yet, it is sometimes necessary. So, what should we put in |
| 571 | the @code{version} field? |
| 572 | |
| 573 | Clearly, we need to make the commit identifier of the VCS snapshot |
| 574 | visible in the version string, but we also need to make sure that the |
| 575 | version string is monotonically increasing so that @command{guix package |
| 576 | --upgrade} can determine which version is newer. Since commit |
| 577 | identifiers, notably with Git, are not monotonically increasing, we add |
| 578 | a revision number that we increase each time we upgrade to a newer |
| 579 | snapshot. The resulting version string looks like this: |
| 580 | |
| 581 | @example |
| 582 | 2.0.11-3.cabba9e |
| 583 | ^ ^ ^ |
| 584 | | | `-- upstream commit ID |
| 585 | | | |
| 586 | | `--- Guix package revision |
| 587 | | |
| 588 | latest upstream version |
| 589 | @end example |
| 590 | |
| 591 | It is a good idea to strip commit identifiers in the @code{version} |
| 592 | field to, say, 7 digits. It avoids an aesthetic annoyance (assuming |
| 593 | aesthetics have a role to play here) as well as problems related to OS |
| 594 | limits such as the maximum shebang length (127 bytes for the Linux |
| 595 | kernel). There are helper functions for doing this for packages using |
| 596 | @code{git-fetch} or @code{hg-fetch} (see below). It is best to use the |
| 597 | full commit identifiers in @code{origin}s, though, to avoid ambiguities. |
| 598 | A typical package definition may look like this: |
| 599 | |
| 600 | |
| 601 | @lisp |
| 602 | (define my-package |
| 603 | (let ((commit "c3f29bc928d5900971f65965feaae59e1272a3f7") |
| 604 | (revision "1")) ;Guix package revision |
| 605 | (package |
| 606 | (version (git-version "0.9" revision commit)) |
| 607 | (source (origin |
| 608 | (method git-fetch) |
| 609 | (uri (git-reference |
| 610 | (url "git://example.org/my-package.git") |
| 611 | (commit commit))) |
| 612 | (sha256 (base32 "1mbikn@dots{}")) |
| 613 | (file-name (git-file-name name version)))) |
| 614 | ;; @dots{} |
| 615 | ))) |
| 616 | @end lisp |
| 617 | |
| 618 | @deffn {Scheme Procedure} git-version @var{VERSION} @var{REVISION} @var{COMMIT} |
| 619 | Return the version string for packages using @code{git-fetch}. |
| 620 | |
| 621 | @lisp |
| 622 | (git-version "0.2.3" "0" "93818c936ee7e2f1ba1b315578bde363a7d43d05") |
| 623 | @result{} "0.2.3-0.93818c9" |
| 624 | @end lisp |
| 625 | @end deffn |
| 626 | |
| 627 | @deffn {Scheme Procedure} hg-version @var{VERSION} @var{REVISION} @var{CHANGESET} |
| 628 | Return the version string for packages using @code{hg-fetch}. It works |
| 629 | in the same way as @code{git-version}. |
| 630 | @end deffn |
| 631 | |
| 632 | @node Synopses and Descriptions |
| 633 | @subsection Synopses and Descriptions |
| 634 | |
| 635 | @cindex package description |
| 636 | @cindex package synopsis |
| 637 | As we have seen before, each package in GNU@tie{}Guix includes a |
| 638 | synopsis and a description (@pxref{Defining Packages}). Synopses and |
| 639 | descriptions are important: They are what @command{guix package |
| 640 | --search} searches, and a crucial piece of information to help users |
| 641 | determine whether a given package suits their needs. Consequently, |
| 642 | packagers should pay attention to what goes into them. |
| 643 | |
| 644 | Synopses must start with a capital letter and must not end with a |
| 645 | period. They must not start with ``a'' or ``the'', which usually does |
| 646 | not bring anything; for instance, prefer ``File-frobbing tool'' over ``A |
| 647 | tool that frobs files''. The synopsis should say what the package |
| 648 | is---e.g., ``Core GNU utilities (file, text, shell)''---or what it is |
| 649 | used for---e.g., the synopsis for GNU@tie{}grep is ``Print lines |
| 650 | matching a pattern''. |
| 651 | |
| 652 | Keep in mind that the synopsis must be meaningful for a very wide |
| 653 | audience. For example, ``Manipulate alignments in the SAM format'' |
| 654 | might make sense for a seasoned bioinformatics researcher, but might be |
| 655 | fairly unhelpful or even misleading to a non-specialized audience. It |
| 656 | is a good idea to come up with a synopsis that gives an idea of the |
| 657 | application domain of the package. In this example, this might give |
| 658 | something like ``Manipulate nucleotide sequence alignments'', which |
| 659 | hopefully gives the user a better idea of whether this is what they are |
| 660 | looking for. |
| 661 | |
| 662 | Descriptions should take between five and ten lines. Use full |
| 663 | sentences, and avoid using acronyms without first introducing them. |
| 664 | Please avoid marketing phrases such as ``world-leading'', |
| 665 | ``industrial-strength'', and ``next-generation'', and avoid superlatives |
| 666 | like ``the most advanced''---they are not helpful to users looking for a |
| 667 | package and may even sound suspicious. Instead, try to be factual, |
| 668 | mentioning use cases and features. |
| 669 | |
| 670 | @cindex Texinfo markup, in package descriptions |
| 671 | Descriptions can include Texinfo markup, which is useful to introduce |
| 672 | ornaments such as @code{@@code} or @code{@@dfn}, bullet lists, or |
| 673 | hyperlinks (@pxref{Overview,,, texinfo, GNU Texinfo}). However you |
| 674 | should be careful when using some characters for example @samp{@@} and |
| 675 | curly braces which are the basic special characters in Texinfo |
| 676 | (@pxref{Special Characters,,, texinfo, GNU Texinfo}). User interfaces |
| 677 | such as @command{guix show} take care of rendering it |
| 678 | appropriately. |
| 679 | |
| 680 | Synopses and descriptions are translated by volunteers |
| 681 | @uref{https://translate.fedoraproject.org/projects/guix/packages, at |
| 682 | Weblate} so that as many users as possible can read them in |
| 683 | their native language. User interfaces search them and display them in |
| 684 | the language specified by the current locale. |
| 685 | |
| 686 | To allow @command{xgettext} to extract them as translatable strings, |
| 687 | synopses and descriptions @emph{must be literal strings}. This means |
| 688 | that you cannot use @code{string-append} or @code{format} to construct |
| 689 | these strings: |
| 690 | |
| 691 | @lisp |
| 692 | (package |
| 693 | ;; @dots{} |
| 694 | (synopsis "This is translatable") |
| 695 | (description (string-append "This is " "*not*" " translatable."))) |
| 696 | @end lisp |
| 697 | |
| 698 | Translation is a lot of work so, as a packager, please pay even more |
| 699 | attention to your synopses and descriptions as every change may entail |
| 700 | additional work for translators. In order to help them, it is possible |
| 701 | to make recommendations or instructions visible to them by inserting |
| 702 | special comments like this (@pxref{xgettext Invocation,,, gettext, GNU |
| 703 | Gettext}): |
| 704 | |
| 705 | @lisp |
| 706 | ;; TRANSLATORS: "X11 resize-and-rotate" should not be translated. |
| 707 | (description "ARandR is designed to provide a simple visual front end |
| 708 | for the X11 resize-and-rotate (RandR) extension. @dots{}") |
| 709 | @end lisp |
| 710 | |
| 711 | @node Snippets versus Phases |
| 712 | @subsection Snippets versus Phases |
| 713 | |
| 714 | @cindex snippets, when to use |
| 715 | The boundary between using an origin snippet versus a build phase to |
| 716 | modify the sources of a package can be elusive. Origin snippets are |
| 717 | typically used to remove unwanted files such as bundled libraries, |
| 718 | nonfree sources, or to apply simple substitutions. The source derived |
| 719 | from an origin should produce a source that can be used to build the |
| 720 | package on any system that the upstream package supports (i.e., act as |
| 721 | the corresponding source). In particular, origin snippets must not |
| 722 | embed store items in the sources; such patching should rather be done |
| 723 | using build phases. Refer to the @code{origin} record documentation for |
| 724 | more information (@pxref{origin Reference}). |
| 725 | |
| 726 | @node Emacs Packages |
| 727 | @subsection Emacs Packages |
| 728 | |
| 729 | @cindex emacs, packaging |
| 730 | @cindex elisp, packaging |
| 731 | Emacs packages should preferably use the Emacs build system |
| 732 | (@pxref{emacs-build-system}), for uniformity and the benefits provided |
| 733 | by its build phases, such as the auto-generation of the autoloads file |
| 734 | and the byte compilation of the sources. Because there is no |
| 735 | standardized way to run a test suite for Emacs packages, tests are |
| 736 | disabled by default. When a test suite is available, it should be |
| 737 | enabled by setting the @code{#:tests?} argument to @code{#true}. By |
| 738 | default, the command to run the test is @command{make check}, but any |
| 739 | command can be specified via the @code{#:test-command} argument. The |
| 740 | @code{#:test-command} argument expects a list containing a command and |
| 741 | its arguments, to be invoked during the @code{check} phase. |
| 742 | |
| 743 | The Elisp dependencies of Emacs packages are typically provided as |
| 744 | @code{propagated-inputs} when required at run time. As for other |
| 745 | packages, build or test dependencies should be specified as |
| 746 | @code{native-inputs}. |
| 747 | |
| 748 | Emacs packages sometimes depend on resources directories that should be |
| 749 | installed along the Elisp files. The @code{#:include} argument can be |
| 750 | used for that purpose, by specifying a list of regexps to match. The |
| 751 | best practice when using the @code{#:include} argument is to extend |
| 752 | rather than override its default value (accessible via the |
| 753 | @code{%default-include} variable). As an example, a yasnippet extension |
| 754 | package typically include a @file{snippets} directory, which could be |
| 755 | copied to the installation directory using: |
| 756 | |
| 757 | @lisp |
| 758 | #:include (cons "^snippets/" %default-include) |
| 759 | @end lisp |
| 760 | |
| 761 | When encountering problems, it is wise to check for the presence of the |
| 762 | @code{Package-Requires} extension header in the package main source |
| 763 | file, and whether any dependencies and their versions listed therein are |
| 764 | satisfied. |
| 765 | |
| 766 | @node Python Modules |
| 767 | @subsection Python Modules |
| 768 | |
| 769 | @cindex python |
| 770 | We currently package Python 2 and Python 3, under the Scheme variable names |
| 771 | @code{python-2} and @code{python} as explained in @ref{Version Numbers}. |
| 772 | To avoid confusion and naming clashes with other programming languages, it |
| 773 | seems desirable that the name of a package for a Python module contains |
| 774 | the word @code{python}. |
| 775 | |
| 776 | Some modules are compatible with only one version of Python, others with |
| 777 | both. If the package Foo is compiled with Python 3, we name it |
| 778 | @code{python-foo}. If it is compiled with Python 2, we name it |
| 779 | @code{python2-foo}. Packages should be added when they are necessary; |
| 780 | we don't add Python 2 variants of the package unless we are going to use |
| 781 | them. |
| 782 | |
| 783 | If a project already contains the word @code{python}, we drop this; |
| 784 | for instance, the module python-dateutil is packaged under the names |
| 785 | @code{python-dateutil} and @code{python2-dateutil}. If the project name |
| 786 | starts with @code{py} (e.g.@: @code{pytz}), we keep it and prefix it as |
| 787 | described above. |
| 788 | |
| 789 | @subsubsection Specifying Dependencies |
| 790 | @cindex inputs, for Python packages |
| 791 | |
| 792 | Dependency information for Python packages is usually available in the |
| 793 | package source tree, with varying degrees of accuracy: in the |
| 794 | @file{setup.py} file, in @file{requirements.txt}, or in @file{tox.ini}. |
| 795 | |
| 796 | Your mission, when writing a recipe for a Python package, is to map |
| 797 | these dependencies to the appropriate type of ``input'' (@pxref{package |
| 798 | Reference, inputs}). Although the @code{pypi} importer normally does a |
| 799 | good job (@pxref{Invoking guix import}), you may want to check the |
| 800 | following check list to determine which dependency goes where. |
| 801 | |
| 802 | @itemize |
| 803 | |
| 804 | @item |
| 805 | We currently package Python 2 with @code{setuptools} and @code{pip} |
| 806 | installed like Python 3.4 has per default. Thus you don't need to |
| 807 | specify either of these as an input. @command{guix lint} will warn you |
| 808 | if you do. |
| 809 | |
| 810 | @item |
| 811 | Python dependencies required at run time go into |
| 812 | @code{propagated-inputs}. They are typically defined with the |
| 813 | @code{install_requires} keyword in @file{setup.py}, or in the |
| 814 | @file{requirements.txt} file. |
| 815 | |
| 816 | @item |
| 817 | Python packages required only at build time---e.g., those listed with |
| 818 | the @code{setup_requires} keyword in @file{setup.py}---or only for |
| 819 | testing---e.g., those in @code{tests_require}---go into |
| 820 | @code{native-inputs}. The rationale is that (1) they do not need to be |
| 821 | propagated because they are not needed at run time, and (2) in a |
| 822 | cross-compilation context, it's the ``native'' input that we'd want. |
| 823 | |
| 824 | Examples are the @code{pytest}, @code{mock}, and @code{nose} test |
| 825 | frameworks. Of course if any of these packages is also required at |
| 826 | run-time, it needs to go to @code{propagated-inputs}. |
| 827 | |
| 828 | @item |
| 829 | Anything that does not fall in the previous categories goes to |
| 830 | @code{inputs}, for example programs or C libraries required for building |
| 831 | Python packages containing C extensions. |
| 832 | |
| 833 | @item |
| 834 | If a Python package has optional dependencies (@code{extras_require}), |
| 835 | it is up to you to decide whether to add them or not, based on their |
| 836 | usefulness/overhead ratio (@pxref{Submitting Patches, @command{guix |
| 837 | size}}). |
| 838 | |
| 839 | @end itemize |
| 840 | |
| 841 | |
| 842 | @node Perl Modules |
| 843 | @subsection Perl Modules |
| 844 | |
| 845 | @cindex perl |
| 846 | Perl programs standing for themselves are named as any other package, |
| 847 | using the lowercase upstream name. |
| 848 | For Perl packages containing a single class, we use the lowercase class name, |
| 849 | replace all occurrences of @code{::} by dashes and prepend the prefix |
| 850 | @code{perl-}. |
| 851 | So the class @code{XML::Parser} becomes @code{perl-xml-parser}. |
| 852 | Modules containing several classes keep their lowercase upstream name and |
| 853 | are also prepended by @code{perl-}. Such modules tend to have the word |
| 854 | @code{perl} somewhere in their name, which gets dropped in favor of the |
| 855 | prefix. For instance, @code{libwww-perl} becomes @code{perl-libwww}. |
| 856 | |
| 857 | |
| 858 | @node Java Packages |
| 859 | @subsection Java Packages |
| 860 | |
| 861 | @cindex java |
| 862 | Java programs standing for themselves are named as any other package, |
| 863 | using the lowercase upstream name. |
| 864 | |
| 865 | To avoid confusion and naming clashes with other programming languages, |
| 866 | it is desirable that the name of a package for a Java package is |
| 867 | prefixed with @code{java-}. If a project already contains the word |
| 868 | @code{java}, we drop this; for instance, the package @code{ngsjava} is |
| 869 | packaged under the name @code{java-ngs}. |
| 870 | |
| 871 | For Java packages containing a single class or a small class hierarchy, |
| 872 | we use the lowercase class name, replace all occurrences of @code{.} by |
| 873 | dashes and prepend the prefix @code{java-}. So the class |
| 874 | @code{apache.commons.cli} becomes package |
| 875 | @code{java-apache-commons-cli}. |
| 876 | |
| 877 | |
| 878 | @node Rust Crates |
| 879 | @subsection Rust Crates |
| 880 | |
| 881 | @cindex rust |
| 882 | Rust programs standing for themselves are named as any other package, using the |
| 883 | lowercase upstream name. |
| 884 | |
| 885 | To prevent namespace collisions we prefix all other Rust packages with the |
| 886 | @code{rust-} prefix. The name should be changed to lowercase as appropriate and |
| 887 | dashes should remain in place. |
| 888 | |
| 889 | In the rust ecosystem it is common for multiple incompatible versions of a |
| 890 | package to be used at any given time, so all package definitions should have a |
| 891 | versioned suffix. The versioned suffix is the left-most non-zero digit (and |
| 892 | any leading zeros, of course). This follows the ``caret'' version scheme |
| 893 | intended by Cargo. Examples@: @code{rust-clap-2}, @code{rust-rand-0.6}. |
| 894 | |
| 895 | Because of the difficulty in reusing rust packages as pre-compiled inputs for |
| 896 | other packages the Cargo build system (@pxref{Build Systems, |
| 897 | @code{cargo-build-system}}) presents the @code{#:cargo-inputs} and |
| 898 | @code{cargo-development-inputs} keywords as build system arguments. It would be |
| 899 | helpful to think of these as similar to @code{propagated-inputs} and |
| 900 | @code{native-inputs}. Rust @code{dependencies} and @code{build-dependencies} |
| 901 | should go in @code{#:cargo-inputs}, and @code{dev-dependencies} should go in |
| 902 | @code{#:cargo-development-inputs}. If a Rust package links to other libraries |
| 903 | then the standard placement in @code{inputs} and the like should be used. |
| 904 | |
| 905 | Care should be taken to ensure the correct version of dependencies are used; to |
| 906 | this end we try to refrain from skipping the tests or using @code{#:skip-build?} |
| 907 | when possible. Of course this is not always possible, as the package may be |
| 908 | developed for a different Operating System, depend on features from the Nightly |
| 909 | Rust compiler, or the test suite may have atrophied since it was released. |
| 910 | |
| 911 | |
| 912 | @node Elm Packages |
| 913 | @subsection Elm Packages |
| 914 | |
| 915 | @cindex Elm |
| 916 | Elm applications can be named like other software: their names need not |
| 917 | mention Elm. |
| 918 | |
| 919 | Packages in the Elm sense (see @code{elm-build-system} under @ref{Build |
| 920 | Systems}) are required use names of the format |
| 921 | @var{author}@code{/}@var{project}, where both the @var{author} and the |
| 922 | @var{project} may contain hyphens internally, and the @var{author} sometimes |
| 923 | contains uppercase letters. |
| 924 | |
| 925 | To form the Guix package name from the upstream name, we follow a convention |
| 926 | similar to Python packages (@pxref{Python Modules}), adding an @code{elm-} |
| 927 | prefix unless the name would already begin with @code{elm-}. |
| 928 | |
| 929 | In many cases we can reconstruct an Elm package's upstream name heuristically, |
| 930 | but, since conversion to a Guix-style name involves a loss of information, |
| 931 | this is not always possible. Care should be taken to add the |
| 932 | @code{'upstream-name} property when necessary so that @samp{guix import elm} |
| 933 | will work correctly (@pxref{Invoking guix import}). The most notable scenarios |
| 934 | when explicitly specifying the upstream name is necessary are: |
| 935 | |
| 936 | @enumerate |
| 937 | @item |
| 938 | When the @var{author} is @code{elm} and the @var{project} contains one or more |
| 939 | hyphens, as with @code{elm/virtual-dom}; and |
| 940 | |
| 941 | @item |
| 942 | When the @var{author} contains hyphens or uppercase letters, as with |
| 943 | @code{Elm-Canvas/raster-shapes}---unless the @var{author} is |
| 944 | @code{elm-explorations}, which is handled as a special case, so packages like |
| 945 | @code{elm-explorations/markdown} do @emph{not} need to use the |
| 946 | @code{'upstream-name} property. |
| 947 | @end enumerate |
| 948 | |
| 949 | The module @code{(guix build-system elm)} provides the following utilities for |
| 950 | working with names and related conventions: |
| 951 | |
| 952 | @deffn {Scheme procedure} elm-package-origin @var{elm-name} @var{version} @ |
| 953 | @var{hash} |
| 954 | Returns a Git origin using the repository naming and tagging regime required |
| 955 | for a published Elm package with the upstream name @var{elm-name} at version |
| 956 | @var{version} with sha256 checksum @var{hash}. |
| 957 | |
| 958 | For example: |
| 959 | @lisp |
| 960 | (package |
| 961 | (name "elm-html") |
| 962 | (version "1.0.0") |
| 963 | (source |
| 964 | (elm-package-origin |
| 965 | "elm/html" |
| 966 | version |
| 967 | (base32 "15k1679ja57vvlpinpv06znmrxy09lbhzfkzdc89i01qa8c4gb4a"))) |
| 968 | ...) |
| 969 | @end lisp |
| 970 | @end deffn |
| 971 | |
| 972 | @deffn {Scheme procedure} elm->package-name @var{elm-name} |
| 973 | Returns the Guix-style package name for an Elm package with upstream name |
| 974 | @var{elm-name}. |
| 975 | |
| 976 | Note that there is more than one possible @var{elm-name} for which |
| 977 | @code{elm->package-name} will produce a given result. |
| 978 | @end deffn |
| 979 | |
| 980 | @deffn {Scheme procedure} guix-package->elm-name @var{package} |
| 981 | Given an Elm @var{package}, returns the possibly-inferred upstream name, or |
| 982 | @code{#f} the upstream name is not specified via the @code{'upstream-name} |
| 983 | property and can not be inferred by @code{infer-elm-package-name}. |
| 984 | @end deffn |
| 985 | |
| 986 | @deffn {Scheme procedure} infer-elm-package-name @var{guix-name} |
| 987 | Given the @var{guix-name} of an Elm package, returns the inferred upstream |
| 988 | name, or @code{#f} if the upstream name can't be inferred. If the result is |
| 989 | not @code{#f}, supplying it to @code{elm->package-name} would produce |
| 990 | @var{guix-name}. |
| 991 | @end deffn |
| 992 | |
| 993 | @node Fonts |
| 994 | @subsection Fonts |
| 995 | |
| 996 | @cindex fonts |
| 997 | For fonts that are in general not installed by a user for typesetting |
| 998 | purposes, or that are distributed as part of a larger software package, |
| 999 | we rely on the general packaging rules for software; for instance, this |
| 1000 | applies to the fonts delivered as part of the X.Org system or fonts that |
| 1001 | are part of TeX Live. |
| 1002 | |
| 1003 | To make it easier for a user to search for fonts, names for other packages |
| 1004 | containing only fonts are constructed as follows, independently of the |
| 1005 | upstream package name. |
| 1006 | |
| 1007 | The name of a package containing only one font family starts with |
| 1008 | @code{font-}; it is followed by the foundry name and a dash @code{-} |
| 1009 | if the foundry is known, and the font family name, in which spaces are |
| 1010 | replaced by dashes (and as usual, all upper case letters are transformed |
| 1011 | to lower case). |
| 1012 | For example, the Gentium font family by SIL is packaged under the name |
| 1013 | @code{font-sil-gentium}. |
| 1014 | |
| 1015 | For a package containing several font families, the name of the collection |
| 1016 | is used in the place of the font family name. |
| 1017 | For instance, the Liberation fonts consist of three families, |
| 1018 | Liberation Sans, Liberation Serif and Liberation Mono. |
| 1019 | These could be packaged separately under the names |
| 1020 | @code{font-liberation-sans} and so on; but as they are distributed together |
| 1021 | under a common name, we prefer to package them together as |
| 1022 | @code{font-liberation}. |
| 1023 | |
| 1024 | In the case where several formats of the same font family or font collection |
| 1025 | are packaged separately, a short form of the format, prepended by a dash, |
| 1026 | is added to the package name. We use @code{-ttf} for TrueType fonts, |
| 1027 | @code{-otf} for OpenType fonts and @code{-type1} for PostScript Type 1 |
| 1028 | fonts. |
| 1029 | |
| 1030 | |
| 1031 | @node Coding Style |
| 1032 | @section Coding Style |
| 1033 | |
| 1034 | In general our code follows the GNU Coding Standards (@pxref{Top,,, |
| 1035 | standards, GNU Coding Standards}). However, they do not say much about |
| 1036 | Scheme, so here are some additional rules. |
| 1037 | |
| 1038 | @menu |
| 1039 | * Programming Paradigm:: How to compose your elements. |
| 1040 | * Modules:: Where to store your code? |
| 1041 | * Data Types and Pattern Matching:: Implementing data structures. |
| 1042 | * Formatting Code:: Writing conventions. |
| 1043 | @end menu |
| 1044 | |
| 1045 | @node Programming Paradigm |
| 1046 | @subsection Programming Paradigm |
| 1047 | |
| 1048 | Scheme code in Guix is written in a purely functional style. One |
| 1049 | exception is code that involves input/output, and procedures that |
| 1050 | implement low-level concepts, such as the @code{memoize} procedure. |
| 1051 | |
| 1052 | @node Modules |
| 1053 | @subsection Modules |
| 1054 | |
| 1055 | Guile modules that are meant to be used on the builder side must live in |
| 1056 | the @code{(guix build @dots{})} name space. They must not refer to |
| 1057 | other Guix or GNU modules. However, it is OK for a ``host-side'' module |
| 1058 | to use a build-side module. |
| 1059 | |
| 1060 | Modules that deal with the broader GNU system should be in the |
| 1061 | @code{(gnu @dots{})} name space rather than @code{(guix @dots{})}. |
| 1062 | |
| 1063 | @node Data Types and Pattern Matching |
| 1064 | @subsection Data Types and Pattern Matching |
| 1065 | |
| 1066 | The tendency in classical Lisp is to use lists to represent everything, |
| 1067 | and then to browse them ``by hand'' using @code{car}, @code{cdr}, |
| 1068 | @code{cadr}, and co. There are several problems with that style, |
| 1069 | notably the fact that it is hard to read, error-prone, and a hindrance |
| 1070 | to proper type error reports. |
| 1071 | |
| 1072 | Guix code should define appropriate data types (for instance, using |
| 1073 | @code{define-record-type*}) rather than abuse lists. In addition, it |
| 1074 | should use pattern matching, via Guile’s @code{(ice-9 match)} module, |
| 1075 | especially when matching lists (@pxref{Pattern Matching,,, guile, GNU |
| 1076 | Guile Reference Manual}). |
| 1077 | |
| 1078 | @node Formatting Code |
| 1079 | @subsection Formatting Code |
| 1080 | |
| 1081 | @cindex formatting code |
| 1082 | @cindex coding style |
| 1083 | When writing Scheme code, we follow common wisdom among Scheme |
| 1084 | programmers. In general, we follow the |
| 1085 | @url{https://mumble.net/~campbell/scheme/style.txt, Riastradh's Lisp |
| 1086 | Style Rules}. This document happens to describe the conventions mostly |
| 1087 | used in Guile’s code too. It is very thoughtful and well written, so |
| 1088 | please do read it. |
| 1089 | |
| 1090 | Some special forms introduced in Guix, such as the @code{substitute*} |
| 1091 | macro, have special indentation rules. These are defined in the |
| 1092 | @file{.dir-locals.el} file, which Emacs automatically uses. Also note |
| 1093 | that Emacs-Guix provides @code{guix-devel-mode} mode that indents and |
| 1094 | highlights Guix code properly (@pxref{Development,,, emacs-guix, The |
| 1095 | Emacs-Guix Reference Manual}). |
| 1096 | |
| 1097 | @cindex indentation, of code |
| 1098 | @cindex formatting, of code |
| 1099 | If you do not use Emacs, please make sure to let your editor knows these |
| 1100 | rules. To automatically indent a package definition, you can also run: |
| 1101 | |
| 1102 | @example |
| 1103 | ./pre-inst-env guix style @var{package} |
| 1104 | @end example |
| 1105 | |
| 1106 | @noindent |
| 1107 | @xref{Invoking guix style}, for more information. |
| 1108 | |
| 1109 | @cindex Vim, Scheme code editing |
| 1110 | If you are editing code with Vim, we recommend that you run @code{:set |
| 1111 | autoindent} so that your code is automatically indented as you type. |
| 1112 | Additionally, |
| 1113 | @uref{https://www.vim.org/scripts/script.php?script_id=3998, |
| 1114 | @code{paredit.vim}} may help you deal with all these parentheses. |
| 1115 | |
| 1116 | We require all top-level procedures to carry a docstring. This |
| 1117 | requirement can be relaxed for simple private procedures in the |
| 1118 | @code{(guix build @dots{})} name space, though. |
| 1119 | |
| 1120 | Procedures should not have more than four positional parameters. Use |
| 1121 | keyword parameters for procedures that take more than four parameters. |
| 1122 | |
| 1123 | |
| 1124 | @node Submitting Patches |
| 1125 | @section Submitting Patches |
| 1126 | |
| 1127 | Development is done using the Git distributed version control system. |
| 1128 | Thus, access to the repository is not strictly necessary. We welcome |
| 1129 | contributions in the form of patches as produced by @code{git |
| 1130 | format-patch} sent to the @email{guix-patches@@gnu.org} mailing list |
| 1131 | (@pxref{Submitting patches to a project,,, git, Git User Manual}). |
| 1132 | Contributors are encouraged to take a moment to set some Git repository |
| 1133 | options (@pxref{Configuring Git}) first, which can improve the |
| 1134 | readability of patches. Seasoned Guix developers may also want to look |
| 1135 | at the section on commit access (@pxref{Commit Access}). |
| 1136 | |
| 1137 | This mailing list is backed by a Debbugs instance, which allows us to |
| 1138 | keep track of submissions (@pxref{Tracking Bugs and Patches}). Each |
| 1139 | message sent to that mailing list gets a new tracking number assigned; |
| 1140 | people can then follow up on the submission by sending email to |
| 1141 | @code{@var{NNN}@@debbugs.gnu.org}, where @var{NNN} is the tracking |
| 1142 | number (@pxref{Sending a Patch Series}). |
| 1143 | |
| 1144 | Please write commit logs in the ChangeLog format (@pxref{Change Logs,,, |
| 1145 | standards, GNU Coding Standards}); you can check the commit history for |
| 1146 | examples. |
| 1147 | |
| 1148 | Before submitting a patch that adds or modifies a package definition, |
| 1149 | please run through this check list: |
| 1150 | |
| 1151 | @enumerate |
| 1152 | @cindex @code{git format-patch} |
| 1153 | @cindex @code{git-format-patch} |
| 1154 | @item |
| 1155 | When generating your patches with @code{git format-patch} or @code{git |
| 1156 | send-email}, we recommend using the option @code{--base=}, perhaps with |
| 1157 | the value @code{auto}. This option adds a note to the patch stating |
| 1158 | which commit the patch is based on. This helps reviewers understand how |
| 1159 | to apply and review your patches. |
| 1160 | |
| 1161 | @item |
| 1162 | If the authors of the packaged software provide a cryptographic |
| 1163 | signature for the release tarball, make an effort to verify the |
| 1164 | authenticity of the archive. For a detached GPG signature file this |
| 1165 | would be done with the @code{gpg --verify} command. |
| 1166 | |
| 1167 | @item |
| 1168 | Take some time to provide an adequate synopsis and description for the |
| 1169 | package. @xref{Synopses and Descriptions}, for some guidelines. |
| 1170 | |
| 1171 | @item |
| 1172 | Run @code{guix lint @var{package}}, where @var{package} is the |
| 1173 | name of the new or modified package, and fix any errors it reports |
| 1174 | (@pxref{Invoking guix lint}). |
| 1175 | |
| 1176 | @item |
| 1177 | Run @code{guix style @var{package}} to format the new package definition |
| 1178 | according to the project's conventions (@pxref{Invoking guix style}). |
| 1179 | |
| 1180 | @item |
| 1181 | Make sure the package builds on your platform, using @code{guix build |
| 1182 | @var{package}}. |
| 1183 | |
| 1184 | @item |
| 1185 | We recommend you also try building the package on other supported |
| 1186 | platforms. As you may not have access to actual hardware platforms, we |
| 1187 | recommend using the @code{qemu-binfmt-service-type} to emulate them. In |
| 1188 | order to enable it, add the @code{virtualization} service module and the |
| 1189 | following service to the list of services in your @code{operating-system} |
| 1190 | configuration: |
| 1191 | |
| 1192 | @lisp |
| 1193 | (service qemu-binfmt-service-type |
| 1194 | (qemu-binfmt-configuration |
| 1195 | (platforms (lookup-qemu-platforms "arm" "aarch64")))) |
| 1196 | @end lisp |
| 1197 | |
| 1198 | Then reconfigure your system. |
| 1199 | |
| 1200 | You can then build packages for different platforms by specifying the |
| 1201 | @code{--system} option. For example, to build the "hello" package for |
| 1202 | the armhf or aarch64 architectures, you would run the following |
| 1203 | commands, respectively: |
| 1204 | @example |
| 1205 | guix build --system=armhf-linux --rounds=2 hello |
| 1206 | guix build --system=aarch64-linux --rounds=2 hello |
| 1207 | @end example |
| 1208 | |
| 1209 | @item |
| 1210 | @cindex bundling |
| 1211 | Make sure the package does not use bundled copies of software already |
| 1212 | available as separate packages. |
| 1213 | |
| 1214 | Sometimes, packages include copies of the source code of their |
| 1215 | dependencies as a convenience for users. However, as a distribution, we |
| 1216 | want to make sure that such packages end up using the copy we already |
| 1217 | have in the distribution, if there is one. This improves resource usage |
| 1218 | (the dependency is built and stored only once), and allows the |
| 1219 | distribution to make transverse changes such as applying security |
| 1220 | updates for a given software package in a single place and have them |
| 1221 | affect the whole system---something that bundled copies prevent. |
| 1222 | |
| 1223 | @item |
| 1224 | Take a look at the profile reported by @command{guix size} |
| 1225 | (@pxref{Invoking guix size}). This will allow you to notice references |
| 1226 | to other packages unwillingly retained. It may also help determine |
| 1227 | whether to split the package (@pxref{Packages with Multiple Outputs}), |
| 1228 | and which optional dependencies should be used. In particular, avoid adding |
| 1229 | @code{texlive} as a dependency: because of its extreme size, use |
| 1230 | the @code{texlive-tiny} package or @code{texlive-union} procedure instead. |
| 1231 | |
| 1232 | @item |
| 1233 | For important changes, check that dependent packages (if applicable) are |
| 1234 | not affected by the change; @code{guix refresh --list-dependent |
| 1235 | @var{package}} will help you do that (@pxref{Invoking guix refresh}). |
| 1236 | |
| 1237 | @c See <https://lists.gnu.org/archive/html/guix-devel/2016-10/msg00933.html>. |
| 1238 | @cindex branching strategy |
| 1239 | @cindex rebuild scheduling strategy |
| 1240 | Depending on the number of dependent packages and thus the amount of |
| 1241 | rebuilding induced, commits go to different branches, along these lines: |
| 1242 | |
| 1243 | @table @asis |
| 1244 | @item 300 dependent packages or less |
| 1245 | @code{master} branch (non-disruptive changes). |
| 1246 | |
| 1247 | @item between 300 and 1,800 dependent packages |
| 1248 | @code{staging} branch (non-disruptive changes). This branch is intended |
| 1249 | to be merged in @code{master} every 6 weeks or so. Topical changes |
| 1250 | (e.g., an update of the GNOME stack) can instead go to a specific branch |
| 1251 | (say, @code{gnome-updates}). This branch is not expected to be |
| 1252 | buildable or usable until late in its development process. |
| 1253 | |
| 1254 | @item more than 1,800 dependent packages |
| 1255 | @code{core-updates} branch (may include major and potentially disruptive |
| 1256 | changes). This branch is intended to be merged in @code{master} every |
| 1257 | 6 months or so. This branch is not expected to be buildable or usable |
| 1258 | until late in its development process. |
| 1259 | @end table |
| 1260 | |
| 1261 | All these branches are @uref{https://@value{SUBSTITUTE-SERVER-1}, |
| 1262 | tracked by our build farm} and merged into @code{master} once |
| 1263 | everything has been successfully built. This allows us to fix issues |
| 1264 | before they hit users, and to reduce the window during which pre-built |
| 1265 | binaries are not available. |
| 1266 | |
| 1267 | When we decide to start building the @code{staging} or |
| 1268 | @code{core-updates} branches, they will be forked and renamed with the |
| 1269 | suffix @code{-frozen}, at which time only bug fixes may be pushed to the |
| 1270 | frozen branches. The @code{core-updates} and @code{staging} branches |
| 1271 | will remain open to accept patches for the next cycle. Please ask on |
| 1272 | the mailing list or IRC if unsure where to place a patch. |
| 1273 | @c TODO: It would be good with badges on the website that tracks these |
| 1274 | @c branches. Or maybe even a status page. |
| 1275 | |
| 1276 | @item |
| 1277 | @cindex determinism, of build processes |
| 1278 | @cindex reproducible builds, checking |
| 1279 | Check whether the package's build process is deterministic. This |
| 1280 | typically means checking whether an independent build of the package |
| 1281 | yields the exact same result that you obtained, bit for bit. |
| 1282 | |
| 1283 | A simple way to do that is by building the same package several times in |
| 1284 | a row on your machine (@pxref{Invoking guix build}): |
| 1285 | |
| 1286 | @example |
| 1287 | guix build --rounds=2 my-package |
| 1288 | @end example |
| 1289 | |
| 1290 | This is enough to catch a class of common non-determinism issues, such |
| 1291 | as timestamps or randomly-generated output in the build result. |
| 1292 | |
| 1293 | Another option is to use @command{guix challenge} (@pxref{Invoking guix |
| 1294 | challenge}). You may run it once the package has been committed and |
| 1295 | built by @code{@value{SUBSTITUTE-SERVER-1}} to check whether it obtains the same |
| 1296 | result as you did. Better yet: Find another machine that can build it |
| 1297 | and run @command{guix publish}. Since the remote build machine is |
| 1298 | likely different from yours, this can catch non-determinism issues |
| 1299 | related to the hardware---e.g., use of different instruction set |
| 1300 | extensions---or to the operating system kernel---e.g., reliance on |
| 1301 | @code{uname} or @file{/proc} files. |
| 1302 | |
| 1303 | @item |
| 1304 | When writing documentation, please use gender-neutral wording when |
| 1305 | referring to people, such as |
| 1306 | @uref{https://en.wikipedia.org/wiki/Singular_they, singular |
| 1307 | ``they''@comma{} ``their''@comma{} ``them''}, and so forth. |
| 1308 | |
| 1309 | @item |
| 1310 | Verify that your patch contains only one set of related changes. |
| 1311 | Bundling unrelated changes together makes reviewing harder and slower. |
| 1312 | |
| 1313 | Examples of unrelated changes include the addition of several packages, |
| 1314 | or a package update along with fixes to that package. |
| 1315 | |
| 1316 | @item |
| 1317 | Please follow our code formatting rules, possibly running |
| 1318 | @command{guix style} script to do that automatically for you |
| 1319 | (@pxref{Formatting Code}). |
| 1320 | |
| 1321 | @item |
| 1322 | When possible, use mirrors in the source URL (@pxref{Invoking guix download}). |
| 1323 | Use reliable URLs, not generated ones. For instance, GitHub archives are not |
| 1324 | necessarily identical from one generation to the next, so in this case it's |
| 1325 | often better to clone the repository. Don't use the @command{name} field in |
| 1326 | the URL: it is not very useful and if the name changes, the URL will probably |
| 1327 | be wrong. |
| 1328 | |
| 1329 | @item |
| 1330 | Check if Guix builds (@pxref{Building from Git}) and address the |
| 1331 | warnings, especially those about use of undefined symbols. |
| 1332 | |
| 1333 | @item |
| 1334 | Make sure your changes do not break Guix and simulate a @code{guix pull} with: |
| 1335 | @example |
| 1336 | guix pull --url=/path/to/your/checkout --profile=/tmp/guix.master |
| 1337 | @end example |
| 1338 | |
| 1339 | @end enumerate |
| 1340 | |
| 1341 | When posting a patch to the mailing list, use @samp{[PATCH] @dots{}} as |
| 1342 | a subject, if your patch is to be applied on a branch other than |
| 1343 | @code{master}, say @code{core-updates}, specify it in the subject like |
| 1344 | @samp{[PATCH core-updates] @dots{}}. You may use your email client or |
| 1345 | the @command{git send-email} command (@pxref{Sending a Patch Series}). |
| 1346 | We prefer to get patches in plain text messages, either inline or as |
| 1347 | MIME attachments. You are advised to pay attention if your email client |
| 1348 | changes anything like line breaks or indentation which could potentially |
| 1349 | break the patches. |
| 1350 | |
| 1351 | Expect some delay when you submit your very first patch to |
| 1352 | @email{guix-patches@@gnu.org}. You have to wait until you get an |
| 1353 | acknowledgement with the assigned tracking number. Future acknowledgements |
| 1354 | should not be delayed. |
| 1355 | |
| 1356 | When a bug is resolved, please close the thread by sending an email to |
| 1357 | @email{@var{NNN}-done@@debbugs.gnu.org}. |
| 1358 | |
| 1359 | @node Configuring Git |
| 1360 | @subsection Configuring Git |
| 1361 | @cindex git configuration |
| 1362 | @cindex @code{git format-patch} |
| 1363 | @cindex @code{git send-email} |
| 1364 | |
| 1365 | If you have not done so already, you may wish to set a name and email |
| 1366 | that will be associated with your commits (@pxref{telling git your name, |
| 1367 | , Telling Git your name, git, Git User Manual}). If you wish to use a |
| 1368 | different name or email just for commits in this repository, you can |
| 1369 | use @command{git config --local}, or edit @file{.git/config} in the |
| 1370 | repository instead of @file{~/.gitconfig}. |
| 1371 | |
| 1372 | We provide some default settings in @file{etc/git/gitconfig} which |
| 1373 | modify how patches are generated, making them easier to read and apply. |
| 1374 | These settings can be applied by manually copying them to |
| 1375 | @file{.git/config} in your checkout, or by telling Git to include the |
| 1376 | whole file: |
| 1377 | |
| 1378 | @example |
| 1379 | git config --local include.path ../etc/git/gitconfig |
| 1380 | @end example |
| 1381 | |
| 1382 | From then on, any changes to @file{etc/git/gitconfig} would |
| 1383 | automatically take effect. |
| 1384 | |
| 1385 | Since the first patch in a series must be sent separately |
| 1386 | (@pxref{Sending a Patch Series}), it can also be helpful to tell |
| 1387 | @command{git format-patch} to handle the e-mail threading instead of |
| 1388 | @command{git send-email}: |
| 1389 | |
| 1390 | @example |
| 1391 | git config --local format.thread shallow |
| 1392 | git config --local sendemail.thread no |
| 1393 | @end example |
| 1394 | |
| 1395 | @unnumberedsubsec Sending a Patch Series |
| 1396 | @anchor{Sending a Patch Series} |
| 1397 | @cindex patch series |
| 1398 | @cindex @code{git send-email} |
| 1399 | |
| 1400 | When sending a patch series (e.g., using @code{git send-email}), please |
| 1401 | first send one message to @email{guix-patches@@gnu.org}, and then send |
| 1402 | subsequent patches to @email{@var{NNN}@@debbugs.gnu.org} to make sure |
| 1403 | they are kept together. See |
| 1404 | @uref{https://debbugs.gnu.org/Advanced.html, the Debbugs documentation} |
| 1405 | for more information. You can install @command{git send-email} with |
| 1406 | @command{guix install git:send-email}. |
| 1407 | @c Debbugs bug: https://debbugs.gnu.org/db/15/15361.html |
| 1408 | |
| 1409 | @node Tracking Bugs and Patches |
| 1410 | @section Tracking Bugs and Patches |
| 1411 | |
| 1412 | This section describes how the Guix project tracks its bug reports and |
| 1413 | patch submissions. |
| 1414 | |
| 1415 | @menu |
| 1416 | * The Issue Tracker:: The official bug and patch tracker. |
| 1417 | * Debbugs User Interfaces:: Ways to interact with Debbugs. |
| 1418 | * Debbugs Usertags:: Tag reports with custom labels. |
| 1419 | @end menu |
| 1420 | |
| 1421 | @node The Issue Tracker |
| 1422 | @subsection The Issue Tracker |
| 1423 | |
| 1424 | @cindex bug reports, tracking |
| 1425 | @cindex patch submissions, tracking |
| 1426 | @cindex issue tracking |
| 1427 | @cindex Debbugs, issue tracking system |
| 1428 | Bug reports and patch submissions are currently tracked using the |
| 1429 | Debbugs instance at @uref{https://bugs.gnu.org}. Bug reports are filed |
| 1430 | against the @code{guix} ``package'' (in Debbugs parlance), by sending |
| 1431 | email to @email{bug-guix@@gnu.org}, while patch submissions are filed |
| 1432 | against the @code{guix-patches} package by sending email to |
| 1433 | @email{guix-patches@@gnu.org} (@pxref{Submitting Patches}). |
| 1434 | |
| 1435 | @node Debbugs User Interfaces |
| 1436 | @subsection Debbugs User Interfaces |
| 1437 | |
| 1438 | A web interface (actually @emph{two} web interfaces!) are available to |
| 1439 | browse issues: |
| 1440 | |
| 1441 | @itemize |
| 1442 | @item |
| 1443 | @url{https://issues.guix.gnu.org} provides a pleasant |
| 1444 | interface@footnote{The web interface at |
| 1445 | @url{https://issues.guix.gnu.org} is powered by Mumi, a nice piece of |
| 1446 | software written in Guile, and you can help! See |
| 1447 | @url{https://git.elephly.net/gitweb.cgi?p=software/mumi.git}.} to browse |
| 1448 | bug reports and patches, and to participate in discussions; |
| 1449 | @item |
| 1450 | @url{https://bugs.gnu.org/guix} lists bug reports; |
| 1451 | @item |
| 1452 | @url{https://bugs.gnu.org/guix-patches} lists patch submissions. |
| 1453 | @end itemize |
| 1454 | |
| 1455 | To view discussions related to issue number @var{n}, go to |
| 1456 | @indicateurl{https://issues.guix.gnu.org/@var{n}} or |
| 1457 | @indicateurl{https://bugs.gnu.org/@var{n}}. |
| 1458 | |
| 1459 | If you use Emacs, you may find it more convenient to interact with |
| 1460 | issues using @file{debbugs.el}, which you can install with: |
| 1461 | |
| 1462 | @example |
| 1463 | guix install emacs-debbugs |
| 1464 | @end example |
| 1465 | |
| 1466 | For example, to list all open issues on @code{guix-patches}, hit: |
| 1467 | |
| 1468 | @example |
| 1469 | @kbd{C-u} @kbd{M-x} debbugs-gnu @kbd{RET} @kbd{RET} guix-patches @kbd{RET} n y |
| 1470 | @end example |
| 1471 | |
| 1472 | @xref{Top,,, debbugs-ug, Debbugs User Guide}, for more information on |
| 1473 | this nifty tool! |
| 1474 | |
| 1475 | @node Debbugs Usertags |
| 1476 | @subsection Debbugs Usertags |
| 1477 | |
| 1478 | @cindex usertags, for debbugs |
| 1479 | @cindex Debbugs usertags |
| 1480 | Debbugs provides a feature called @dfn{usertags} that allows any user to |
| 1481 | tag any bug with an arbitrary label. Bugs can be searched by usertag, |
| 1482 | so this is a handy way to organize bugs@footnote{The list of usertags is |
| 1483 | public information, and anyone can modify any user's list of usertags, |
| 1484 | so keep that in mind if you choose to use this feature.}. |
| 1485 | |
| 1486 | For example, to view all the bug reports (or patches, in the case of |
| 1487 | @code{guix-patches}) tagged with the usertag @code{powerpc64le-linux} |
| 1488 | for the user @code{guix}, open a URL like the following in a web |
| 1489 | browser: |
| 1490 | @url{https://debbugs.gnu.org/cgi-bin/pkgreport.cgi?tag=powerpc64le-linux;users=guix}. |
| 1491 | |
| 1492 | For more information on how to use usertags, please refer to the |
| 1493 | documentation for Debbugs or the documentation for whatever tool you use |
| 1494 | to interact with Debbugs. |
| 1495 | |
| 1496 | In Guix, we are experimenting with usertags to keep track of |
| 1497 | architecture-specific issues. To facilitate collaboration, all our |
| 1498 | usertags are associated with the single user @code{guix}. The following |
| 1499 | usertags currently exist for that user: |
| 1500 | |
| 1501 | @table @code |
| 1502 | |
| 1503 | @item powerpc64le-linux |
| 1504 | The purpose of this usertag is to make it easy to find the issues that |
| 1505 | matter most for the @code{powerpc64le-linux} system type. Please assign |
| 1506 | this usertag to bugs or patches that affect @code{powerpc64le-linux} but |
| 1507 | not other system types. In addition, you may use it to identify issues |
| 1508 | that for some reason are particularly important for the |
| 1509 | @code{powerpc64le-linux} system type, even if the issue affects other |
| 1510 | system types, too. |
| 1511 | |
| 1512 | @item reproducibility |
| 1513 | For issues related to reproducibility. For example, it would be |
| 1514 | appropriate to assign this usertag to a bug report for a package that |
| 1515 | fails to build reproducibly. |
| 1516 | |
| 1517 | @end table |
| 1518 | |
| 1519 | If you're a committer and you want to add a usertag, just start using it |
| 1520 | with the @code{guix} user. If the usertag proves useful to you, |
| 1521 | consider updating this section of the manual so that others will know |
| 1522 | what your usertag means. |
| 1523 | |
| 1524 | @node Commit Access |
| 1525 | @section Commit Access |
| 1526 | |
| 1527 | @cindex commit access, for developers |
| 1528 | Everyone can contribute to Guix without having commit access |
| 1529 | (@pxref{Submitting Patches}). However, for frequent contributors, |
| 1530 | having write access to the repository can be convenient. As a rule of |
| 1531 | thumb, a contributor should have accumulated fifty (50) reviewed commits |
| 1532 | to be considered as a committer and have sustained their activity in the |
| 1533 | project for at least 6 months. This ensures enough interactions with |
| 1534 | the contributor, which is essential for mentoring and assessing whether |
| 1535 | they are ready to become a committer. Commit access should not be |
| 1536 | thought of as a ``badge of honor'' but rather as a responsibility a |
| 1537 | contributor is willing to take to help the project. |
| 1538 | |
| 1539 | The following sections explain how to get commit access, how to be ready |
| 1540 | to push commits, and the policies and community expectations for commits |
| 1541 | pushed upstream. |
| 1542 | |
| 1543 | @subsection Applying for Commit Access |
| 1544 | |
| 1545 | When you deem it necessary, consider applying for commit |
| 1546 | access by following these steps: |
| 1547 | |
| 1548 | @enumerate |
| 1549 | @item |
| 1550 | Find three committers who would vouch for you. You can view the list of |
| 1551 | committers at |
| 1552 | @url{https://savannah.gnu.org/project/memberlist.php?group=guix}. Each |
| 1553 | of them should email a statement to @email{guix-maintainers@@gnu.org} (a |
| 1554 | private alias for the collective of maintainers), signed with their |
| 1555 | OpenPGP key. |
| 1556 | |
| 1557 | Committers are expected to have had some interactions with you as a |
| 1558 | contributor and to be able to judge whether you are sufficiently |
| 1559 | familiar with the project's practices. It is @emph{not} a judgment on |
| 1560 | the value of your work, so a refusal should rather be interpreted as |
| 1561 | ``let's try again later''. |
| 1562 | |
| 1563 | @item |
| 1564 | Send @email{guix-maintainers@@gnu.org} a message stating your intent, |
| 1565 | listing the three committers who support your application, signed with |
| 1566 | the OpenPGP key you will use to sign commits, and giving its fingerprint |
| 1567 | (see below). See @uref{https://emailselfdefense.fsf.org/en/}, for an |
| 1568 | introduction to public-key cryptography with GnuPG. |
| 1569 | |
| 1570 | @c See <https://sha-mbles.github.io/>. |
| 1571 | Set up GnuPG such that it never uses the SHA1 hash algorithm for digital |
| 1572 | signatures, which is known to be unsafe since 2019, for instance by |
| 1573 | adding the following line to @file{~/.gnupg/gpg.conf} (@pxref{GPG |
| 1574 | Esoteric Options,,, gnupg, The GNU Privacy Guard Manual}): |
| 1575 | |
| 1576 | @example |
| 1577 | digest-algo sha512 |
| 1578 | @end example |
| 1579 | |
| 1580 | @item |
| 1581 | Maintainers ultimately decide whether to grant you commit access, |
| 1582 | usually following your referrals' recommendation. |
| 1583 | |
| 1584 | @item |
| 1585 | @cindex OpenPGP, signed commits |
| 1586 | If and once you've been given access, please send a message to |
| 1587 | @email{guix-devel@@gnu.org} to say so, again signed with the OpenPGP key |
| 1588 | you will use to sign commits (do that before pushing your first commit). |
| 1589 | That way, everyone can notice and ensure you control that OpenPGP key. |
| 1590 | |
| 1591 | @quotation Important |
| 1592 | Before you can push for the first time, maintainers must: |
| 1593 | |
| 1594 | @enumerate |
| 1595 | @item |
| 1596 | add your OpenPGP key to the @code{keyring} branch; |
| 1597 | @item |
| 1598 | add your OpenPGP fingerprint to the @file{.guix-authorizations} file of |
| 1599 | the branch(es) you will commit to. |
| 1600 | @end enumerate |
| 1601 | @end quotation |
| 1602 | |
| 1603 | @item |
| 1604 | Make sure to read the rest of this section and... profit! |
| 1605 | @end enumerate |
| 1606 | |
| 1607 | @quotation Note |
| 1608 | Maintainers are happy to give commit access to people who have been |
| 1609 | contributing for some time and have a track record---don't be shy and |
| 1610 | don't underestimate your work! |
| 1611 | |
| 1612 | However, note that the project is working towards a more automated patch |
| 1613 | review and merging system, which, as a consequence, may lead us to have |
| 1614 | fewer people with commit access to the main repository. Stay tuned! |
| 1615 | @end quotation |
| 1616 | |
| 1617 | All commits that are pushed to the central repository on Savannah must |
| 1618 | be signed with an OpenPGP key, and the public key should be uploaded to |
| 1619 | your user account on Savannah and to public key servers, such as |
| 1620 | @code{keys.openpgp.org}. To configure Git to automatically sign |
| 1621 | commits, run: |
| 1622 | |
| 1623 | @example |
| 1624 | git config commit.gpgsign true |
| 1625 | |
| 1626 | # Substitute the fingerprint of your public PGP key. |
| 1627 | git config user.signingkey CABBA6EA1DC0FF33 |
| 1628 | @end example |
| 1629 | |
| 1630 | To check that commits are signed with correct key, use: |
| 1631 | |
| 1632 | @example |
| 1633 | make authenticate |
| 1634 | @end example |
| 1635 | |
| 1636 | You can prevent yourself from accidentally pushing unsigned or signed |
| 1637 | with the wrong key commits to Savannah by using the pre-push Git hook |
| 1638 | located at @file{etc/git/pre-push}: |
| 1639 | |
| 1640 | @example |
| 1641 | cp etc/git/pre-push .git/hooks/pre-push |
| 1642 | @end example |
| 1643 | |
| 1644 | It additionally calls @code{make check-channel-news} to be sure |
| 1645 | @file{news.scm} file is correct. |
| 1646 | |
| 1647 | @subsection Commit Policy |
| 1648 | |
| 1649 | If you get commit access, please make sure to follow |
| 1650 | the policy below (discussions of the policy can take place on |
| 1651 | @email{guix-devel@@gnu.org}). |
| 1652 | |
| 1653 | Non-trivial patches should always be posted to |
| 1654 | @email{guix-patches@@gnu.org} (trivial patches include fixing typos, |
| 1655 | etc.). This mailing list fills the patch-tracking database |
| 1656 | (@pxref{Tracking Bugs and Patches}). |
| 1657 | |
| 1658 | For patches that just add a new package, and a simple one, it's OK to |
| 1659 | commit, if you're confident (which means you successfully built it in a |
| 1660 | chroot setup, and have done a reasonable copyright and license |
| 1661 | auditing). Likewise for package upgrades, except upgrades that trigger |
| 1662 | a lot of rebuilds (for example, upgrading GnuTLS or GLib). We have a |
| 1663 | mailing list for commit notifications (@email{guix-commits@@gnu.org}), |
| 1664 | so people can notice. Before pushing your changes, make sure to run |
| 1665 | @code{git pull --rebase}. |
| 1666 | |
| 1667 | When pushing a commit on behalf of somebody else, please add a |
| 1668 | @code{Signed-off-by} line at the end of the commit log message---e.g., |
| 1669 | with @command{git am --signoff}. This improves tracking of who did |
| 1670 | what. |
| 1671 | |
| 1672 | When adding channel news entries (@pxref{Channels, Writing Channel |
| 1673 | News}), make sure they are well-formed by running the following command |
| 1674 | right before pushing: |
| 1675 | |
| 1676 | @example |
| 1677 | make check-channel-news |
| 1678 | @end example |
| 1679 | |
| 1680 | For anything else, please post to @email{guix-patches@@gnu.org} and |
| 1681 | leave time for a review, without committing anything (@pxref{Submitting |
| 1682 | Patches}). If you didn’t receive any reply after two weeks, and if |
| 1683 | you're confident, it's OK to commit. |
| 1684 | |
| 1685 | That last part is subject to being adjusted, allowing individuals to commit |
| 1686 | directly on non-controversial changes on parts they’re familiar with. |
| 1687 | |
| 1688 | @subsection Addressing Issues |
| 1689 | |
| 1690 | Peer review (@pxref{Submitting Patches}) and tools such as |
| 1691 | @command{guix lint} (@pxref{Invoking guix lint}) and the test suite |
| 1692 | (@pxref{Running the Test Suite}) should catch issues before they are |
| 1693 | pushed. Yet, commits that ``break'' functionality might occasionally |
| 1694 | go through. When that happens, there are two priorities: mitigating |
| 1695 | the impact, and understanding what happened to reduce the chance of |
| 1696 | similar incidents in the future. The responsibility for both these |
| 1697 | things primarily lies with those involved, but like everything this is |
| 1698 | a group effort. |
| 1699 | |
| 1700 | Some issues can directly affect all users---for instance because they |
| 1701 | make @command{guix pull} fail or break core functionality, because they |
| 1702 | break major packages (at build time or run time), or because they |
| 1703 | introduce known security vulnerabilities. |
| 1704 | |
| 1705 | @cindex reverting commits |
| 1706 | The people involved in authoring, reviewing, and pushing such |
| 1707 | commit(s) should be at the forefront to mitigate their impact in a |
| 1708 | timely fashion: by pushing a followup commit to fix it (if possible), |
| 1709 | or by reverting it to leave time to come up with a proper fix, and by |
| 1710 | communicating with other developers about the problem. |
| 1711 | |
| 1712 | If these persons are unavailable to address the issue in time, other |
| 1713 | committers are entitled to revert the commit(s), explaining in the |
| 1714 | commit log and on the mailing list what the problem was, with the goal |
| 1715 | of leaving time to the original committer, reviewer(s), and author(s) |
| 1716 | to propose a way forward. |
| 1717 | |
| 1718 | Once the problem has been dealt with, it is the responsibility of |
| 1719 | those involved to make sure the situation is understood. If you are |
| 1720 | working to understand what happened, focus on gathering information |
| 1721 | and avoid assigning any blame. Do ask those involved to describe what |
| 1722 | happened, do not ask them to explain the situation---this would |
| 1723 | implicitly blame them, which is unhelpful. Accountability comes from |
| 1724 | a consensus about the problem, learning from it and improving |
| 1725 | processes so that it's less likely to reoccur. |
| 1726 | |
| 1727 | @subsection Commit Revocation |
| 1728 | |
| 1729 | In order to reduce the possibility of mistakes, committers will have |
| 1730 | their Savannah account removed from the Guix Savannah project and their |
| 1731 | key removed from @file{.guix-authorizations} after 12 months of |
| 1732 | inactivity; they can ask to regain commit access by emailing the |
| 1733 | maintainers, without going through the vouching process. |
| 1734 | |
| 1735 | Maintainers@footnote{See @uref{https://guix.gnu.org/en/about} for the |
| 1736 | current list of maintainers. You can email them privately at |
| 1737 | @email{guix-maintainers@@gnu.org}.} may also revoke an individual's |
| 1738 | commit rights, as a last resort, if cooperation with the rest of the |
| 1739 | community has caused too much friction---even within the bounds of the |
| 1740 | project's code of conduct (@pxref{Contributing}). They would only do so |
| 1741 | after public or private discussion with the individual and a clear |
| 1742 | notice. Examples of behavior that hinders cooperation and could lead to |
| 1743 | such a decision include: |
| 1744 | |
| 1745 | @itemize |
| 1746 | @item repeated violation of the commit policy stated above; |
| 1747 | @item repeated failure to take peer criticism into account; |
| 1748 | @item breaching trust through a series of grave incidents. |
| 1749 | @end itemize |
| 1750 | |
| 1751 | When maintainers resort to such a decision, they notify developers on |
| 1752 | @email{guix-devel@@gnu.org}; inquiries may be sent to |
| 1753 | @email{guix-maintainers@@gnu.org}. Depending on the situation, the |
| 1754 | individual may still be welcome to contribute. |
| 1755 | |
| 1756 | @subsection Helping Out |
| 1757 | |
| 1758 | One last thing: the project keeps moving forward because committers not |
| 1759 | only push their own awesome changes, but also offer some of their time |
| 1760 | @emph{reviewing} and pushing other people's changes. As a committer, |
| 1761 | you're welcome to use your expertise and commit rights to help other |
| 1762 | contributors, too! |
| 1763 | |
| 1764 | @node Updating the Guix Package |
| 1765 | @section Updating the Guix Package |
| 1766 | |
| 1767 | @cindex update-guix-package, updating the guix package |
| 1768 | It is sometimes desirable to update the @code{guix} package itself (the |
| 1769 | package defined in @code{(gnu packages package-management)}), for |
| 1770 | example to make new daemon features available for use by the |
| 1771 | @code{guix-service-type} service type. In order to simplify this task, |
| 1772 | the following command can be used: |
| 1773 | |
| 1774 | @example |
| 1775 | make update-guix-package |
| 1776 | @end example |
| 1777 | |
| 1778 | The @code{update-guix-package} make target will use the last known |
| 1779 | @emph{commit} corresponding to @code{HEAD} in your Guix checkout, |
| 1780 | compute the hash of the Guix sources corresponding to that commit and |
| 1781 | update the @code{commit}, @code{revision} and hash of the @code{guix} |
| 1782 | package definition. |
| 1783 | |
| 1784 | To validate that the updated @code{guix} package hashes are correct and |
| 1785 | that it can be built successfully, the following command can be run from |
| 1786 | the directory of your Guix checkout: |
| 1787 | |
| 1788 | @example |
| 1789 | ./pre-inst-env guix build guix |
| 1790 | @end example |
| 1791 | |
| 1792 | To guard against accidentally updating the @code{guix} package to a |
| 1793 | commit that others can't refer to, a check is made that the commit used |
| 1794 | has already been pushed to the Savannah-hosted Guix git repository. |
| 1795 | |
| 1796 | This check can be disabled, @emph{at your own peril}, by setting the |
| 1797 | @code{GUIX_ALLOW_ME_TO_USE_PRIVATE_COMMIT} environment variable. When |
| 1798 | this variable is set, the updated package source is also added to the |
| 1799 | store. This is used as part of the release process of Guix. |
| 1800 | |
| 1801 | @cindex documentation |
| 1802 | @node Writing Documentation |
| 1803 | @section Writing Documentation |
| 1804 | |
| 1805 | Guix is documented using the Texinfo system. If you are not yet |
| 1806 | familiar with it, we accept contributions for documentation in most |
| 1807 | formats. That includes plain text, Markdown, Org, etc. |
| 1808 | |
| 1809 | Documentation contributions can be sent to |
| 1810 | @email{guix-patches@@gnu.org}. Prepend @samp{[DOCUMENTATION]} to the |
| 1811 | subject. |
| 1812 | |
| 1813 | When you need to make more than a simple addition to the documentation, |
| 1814 | we prefer that you send a proper patch as opposed to sending an email |
| 1815 | as described above. @xref{Submitting Patches} for more information on |
| 1816 | how to send your patches. |
| 1817 | |
| 1818 | To modify the documentation, you need to edit @file{doc/guix.texi} and |
| 1819 | @file{doc/contributing.texi} (which contains this documentation |
| 1820 | section), or @file{doc/guix-cookbook.texi} for the cookbook. If |
| 1821 | you compiled the Guix repository before, you will have |
| 1822 | many more @file{.texi} files that are translations of these |
| 1823 | documents. Do not modify them, the translation is managed through |
| 1824 | @uref{https://translate.fedoraproject.org/projects/guix, Weblate}. |
| 1825 | @xref{Translating Guix} for more information. |
| 1826 | |
| 1827 | To render documentation, you must first make sure that you ran |
| 1828 | @command{./configure} in your source tree (@pxref{Running Guix Before |
| 1829 | It Is Installed}). After that you can run one of the following |
| 1830 | commands: |
| 1831 | |
| 1832 | @itemize |
| 1833 | @item @samp{make doc/guix.info} to compile the Info manual. |
| 1834 | You can check it with @command{info doc/guix.info}. |
| 1835 | @item @samp{make doc/guix.html} to compile the HTML version. |
| 1836 | You can point your browser to the relevant file in the |
| 1837 | @file{doc/guix.html} directory. |
| 1838 | @item @samp{make doc/guix-cookbook.info} for the cookbook Info manual. |
| 1839 | @item @samp{make doc/guix-cookbook.html} for the cookbook HTML version. |
| 1840 | @end itemize |
| 1841 | |
| 1842 | @cindex translation |
| 1843 | @cindex l10n |
| 1844 | @cindex i18n |
| 1845 | @cindex native language support |
| 1846 | @node Translating Guix |
| 1847 | @section Translating Guix |
| 1848 | |
| 1849 | Writing code and packages is not the only way to provide a meaningful |
| 1850 | contribution to Guix. Translating to a language you speak is another |
| 1851 | example of a valuable contribution you can make. This section is designed |
| 1852 | to describe the translation process. It gives you advice on how you can |
| 1853 | get involved, what can be translated, what mistakes you should avoid and |
| 1854 | what we can do to help you! |
| 1855 | |
| 1856 | Guix is a big project that has multiple components that can be translated. |
| 1857 | We coordinate the translation effort on a |
| 1858 | @uref{https://translate.fedoraproject.org/projects/guix/,Weblate instance} |
| 1859 | hosted by our friends at Fedora. You will need an account to submit |
| 1860 | translations. |
| 1861 | |
| 1862 | Some of the software packaged in Guix also contain translations. We do not |
| 1863 | host a translation platform for them. If you want to translate a package |
| 1864 | provided by Guix, you should contact their developers or find the information |
| 1865 | on their website. As an example, you can find the homepage of the |
| 1866 | @code{hello} package by typing @code{guix show hello}. On the ``homepage'' |
| 1867 | line, you will see @url{https://www.gnu.org/software/hello/} as the homepage. |
| 1868 | |
| 1869 | Many GNU and non-GNU packages can be translated on the |
| 1870 | @uref{https://translationproject.org,Translation Project}. Some projects |
| 1871 | with multiple components have their own platform. For instance, GNOME has |
| 1872 | its own platform, @uref{https://l10n.gnome.org/,Damned Lies}. |
| 1873 | |
| 1874 | Guix has five components hosted on Weblate. |
| 1875 | |
| 1876 | @itemize |
| 1877 | @item @code{guix} contains all the strings from the Guix software (the |
| 1878 | guided system installer, the package manager, etc), excluding packages. |
| 1879 | @item @code{packages} contains the synopsis (single-sentence description |
| 1880 | of a package) and description (longer description) of packages in Guix. |
| 1881 | @item @code{website} contains the official Guix website, except for |
| 1882 | blog posts and multimedia content. |
| 1883 | @item @code{documentation-manual} corresponds to this manual. |
| 1884 | @item @code{documentation-cookbook} is the component for the cookbook. |
| 1885 | @end itemize |
| 1886 | |
| 1887 | @subsubheading General Directions |
| 1888 | |
| 1889 | Once you get an account, you should be able to select a component from |
| 1890 | @uref{https://translate.fedoraproject.org/projects/guix/,the guix project}, |
| 1891 | and select a language. If your language does not appear in the list, go |
| 1892 | to the bottom and click on the ``Start new translation'' button. Select |
| 1893 | the language you want to translate to from the list, to start your new |
| 1894 | translation. |
| 1895 | |
| 1896 | Like lots of other free software packages, Guix uses |
| 1897 | @uref{https://www.gnu.org/software/gettext,GNU Gettext} for its translations, |
| 1898 | with which translatable strings are extracted from the source code to so-called |
| 1899 | PO files. |
| 1900 | |
| 1901 | Even though PO files are text files, changes should not be made with a text |
| 1902 | editor but with PO editing software. Weblate integrates PO editing |
| 1903 | functionality. Alternatively, translators can use any of various |
| 1904 | free-software tools for filling in translations, of which |
| 1905 | @uref{https://poedit.net/,Poedit} is one example, and (after logging in) |
| 1906 | @uref{https://docs.weblate.org/en/latest/user/files.html,upload} the changed |
| 1907 | file. There is also a special |
| 1908 | @uref{https://www.emacswiki.org/emacs/PoMode,PO editing mode} for users of GNU |
| 1909 | Emacs. Over time translators find out what software they are happy with and |
| 1910 | what features they need. |
| 1911 | |
| 1912 | On Weblate, you will find various links to the editor, that will show various |
| 1913 | subsets (or all) of the strings. Have a look around and at the |
| 1914 | @uref{https://docs.weblate.org/en/latest/,documentation} to familiarize |
| 1915 | yourself with the platform. |
| 1916 | |
| 1917 | @subsubheading Translation Components |
| 1918 | |
| 1919 | In this section, we provide more detailed guidance on the translation |
| 1920 | process, as well as details on what you should or should not do. When in |
| 1921 | doubt, please contact us, we will be happy to help! |
| 1922 | |
| 1923 | @table @asis |
| 1924 | @item guix |
| 1925 | Guix is written in the Guile programming language, and some strings contain |
| 1926 | special formatting that is interpreted by Guile. These special formatting |
| 1927 | should be highlighted by Weblate. They start with @code{~} followed by one |
| 1928 | or more characters. |
| 1929 | |
| 1930 | When printing the string, Guile replaces the special formatting symbols with |
| 1931 | actual values. For instance, the string @samp{ambiguous package specification |
| 1932 | `~a'} would be substituted to contain said package specification instead of |
| 1933 | @code{~a}. To properly translate this string, you must keep the formatting |
| 1934 | code in your translation, although you can place it where it makes sense in |
| 1935 | your language. For instance, the French translation says @samp{spécification |
| 1936 | du paquet « ~a » ambiguë} because the adjective needs to be placed in the |
| 1937 | end of the sentence. |
| 1938 | |
| 1939 | If there are multiple formatting symbols, make sure to respect the order. |
| 1940 | Guile does not know in which order you intended the string to be read, so it |
| 1941 | will substitute the symbols in the same order as the English sentence. |
| 1942 | |
| 1943 | As an example, you cannot translate @samp{package '~a' has been superseded by |
| 1944 | '~a'} by @samp{'~a' superseeds package '~a'}, because the meaning would be |
| 1945 | reversed. If @var{foo} is superseded by @var{bar}, the translation would read |
| 1946 | @samp{'foo' superseeds package 'bar'}. To work around this problem, it |
| 1947 | is possible to use more advanced formatting to select a given piece of data, |
| 1948 | instead of following the default English order. @xref{Formatted Output,,, |
| 1949 | guile, GNU Guile Reference Manual}, for more information on formatting in Guile. |
| 1950 | |
| 1951 | @item packages |
| 1952 | |
| 1953 | Package descriptions occasionally contain Texinfo markup (@pxref{Synopses |
| 1954 | and Descriptions}). Texinfo markup looks like @samp{@@code@{rm -rf@}}, |
| 1955 | @samp{@@emph@{important@}}, etc. When translating, please leave markup as is. |
| 1956 | |
| 1957 | The characters after ``@@'' form the name of the markup, and the text between |
| 1958 | ``@{'' and ``@}'' is its content. In general, you should not translate the |
| 1959 | content of markup like @code{@@code}, as it contains literal code that do not |
| 1960 | change with language. You can translate the content of formatting markup such |
| 1961 | as @code{@@emph}, @code{@@i}, @code{@@itemize}, @code{@@item}. However, do |
| 1962 | not translate the name of the markup, or it will not be recognized. Do |
| 1963 | not translate the word after @code{@@end}, it is the name of the markup that |
| 1964 | is closed at this position (e.g.@: @code{@@itemize ... @@end itemize}). |
| 1965 | |
| 1966 | @item documentation-manual and documentation-cookbook |
| 1967 | |
| 1968 | The first step to ensure a successful translation of the manual is to find |
| 1969 | and translate the following strings @emph{first}: |
| 1970 | |
| 1971 | @itemize |
| 1972 | @item @code{version.texi}: Translate this string as @code{version-xx.texi}, |
| 1973 | where @code{xx} is your language code (the one shown in the URL on |
| 1974 | weblate). |
| 1975 | @item @code{contributing.texi}: Translate this string as |
| 1976 | @code{contributing.xx.texi}, where @code{xx} is the same language code. |
| 1977 | @item @code{Top}: Do not translate this string, it is important for Texinfo. |
| 1978 | If you translate it, the document will be empty (missing a Top node). |
| 1979 | Please look for it, and register @code{Top} as its translation. |
| 1980 | @end itemize |
| 1981 | |
| 1982 | Translating these strings first ensure we can include your translation in |
| 1983 | the guix repository without breaking the make process or the |
| 1984 | @command{guix pull} machinery. |
| 1985 | |
| 1986 | The manual and the cookbook both use Texinfo. As for @code{packages}, please |
| 1987 | keep Texinfo markup as is. There are more possible markup types in the manual |
| 1988 | than in the package descriptions. In general, do not translate the content |
| 1989 | of @code{@@code}, @code{@@file}, @code{@@var}, @code{@@value}, etc. You |
| 1990 | should translate the content of formatting markup such as @code{@@emph}, |
| 1991 | @code{@@i}, etc. |
| 1992 | |
| 1993 | The manual contains sections that can be referred to by name by @code{@@ref}, |
| 1994 | @code{@@xref} and @code{@@pxref}. We have a mechanism in place so you do |
| 1995 | not have to translate their content. If you keep the English title, we will |
| 1996 | automatically replace it with your translation of that title. This ensures |
| 1997 | that Texinfo will always be able to find the node. If you decide to change |
| 1998 | the translation of the title, the references will automatically be updated |
| 1999 | and you will not have to update them all yourself. |
| 2000 | |
| 2001 | When translating references from the cookbook to the manual, you need to |
| 2002 | replace the name of the manual and the name of the section. For instance, |
| 2003 | to translate @code{@@pxref@{Defining Packages,,, guix, GNU Guix Reference |
| 2004 | Manual@}}, you would replace @code{Defining Packages} with the title of that |
| 2005 | section in the translated manual @emph{only} if that title is translated. |
| 2006 | If the title is not translated in your language yet, do not translate it here, |
| 2007 | or the link will be broken. Replace @code{guix} with @code{guix.xx} where |
| 2008 | @code{xx} is your language code. @code{GNU Guix Reference Manual} is the |
| 2009 | text of the link. You can translate it however you wish. |
| 2010 | |
| 2011 | @item website |
| 2012 | |
| 2013 | The website pages are written using SXML, an s-expression version of HTML, |
| 2014 | the basic language of the web. We have a process to extract translatable |
| 2015 | strings from the source, and replace complex s-expressions with a more familiar |
| 2016 | XML markup, where each markup is numbered. Translators can arbitrarily change |
| 2017 | the ordering, as in the following example. |
| 2018 | |
| 2019 | @example |
| 2020 | #. TRANSLATORS: Defining Packages is a section name |
| 2021 | #. in the English (en) manual. |
| 2022 | #: apps/base/templates/about.scm:64 |
| 2023 | msgid "Packages are <1>defined<1.1>en</1.1><1.2>Defining-Packages.html</1.2></1> as native <2>Guile</2> modules." |
| 2024 | msgstr "Pakete werden als reine <2>Guile</2>-Module <1>definiert<1.1>de</1.1><1.2>Pakete-definieren.html</1.2></1>." |
| 2025 | @end example |
| 2026 | |
| 2027 | Note that you need to include the same markups. You cannot skip any. |
| 2028 | @end table |
| 2029 | |
| 2030 | In case you make a mistake, the component might fail to build properly with your |
| 2031 | language, or even make guix pull fail. To prevent that, we have a process |
| 2032 | in place to check the content of the files before pushing to our repository. |
| 2033 | We will not be able to update the translation for your language in Guix, so |
| 2034 | we will notify you (through weblate and/or by email) so you get a chance to |
| 2035 | fix the issue. |
| 2036 | |
| 2037 | @subsubheading Outside of Weblate |
| 2038 | |
| 2039 | Currently, some parts of Guix cannot be translated on Weblate, help wanted! |
| 2040 | |
| 2041 | @itemize |
| 2042 | @item @command{guix pull} news can be translated in @file{news.scm}, but is not |
| 2043 | available from Weblate. If you want to provide a translation, you |
| 2044 | can prepare a patch as described above, or simply send us your |
| 2045 | translation with the name of the news entry you translated and your |
| 2046 | language. @xref{Writing Channel News}, for more information about |
| 2047 | channel news. |
| 2048 | @item Guix blog posts cannot currently be translated. |
| 2049 | @item The installer script (for foreign distributions) is entirely in English. |
| 2050 | @item Some of the libraries Guix uses cannot be translated or are translated |
| 2051 | outside of the Guix project. Guile itself is not internationalized. |
| 2052 | @item Other manuals linked from this manual or the cookbook might not be |
| 2053 | translated. |
| 2054 | @end itemize |
| 2055 | |
| 2056 | @subsubheading Conditions for Inclusion |
| 2057 | |
| 2058 | There are no conditions for adding new translations of the @code{guix} and |
| 2059 | @code{guix-packages} components, other than they need at least one translated |
| 2060 | string. New languages will be added to Guix as soon as possible. The |
| 2061 | files may be removed if they fall out of sync and have no more translated |
| 2062 | strings. |
| 2063 | |
| 2064 | Given that the web site is dedicated to new users, we want its translation |
| 2065 | to be as complete as possible before we include it in the language menu. |
| 2066 | For a new language to be included, it needs to reach at least 80% completion. |
| 2067 | When a language is included, it may be removed in the future if it stays |
| 2068 | out of sync and falls below 60% completion. |
| 2069 | |
| 2070 | The manual and cookbook are automatically added in the default compilation |
| 2071 | target. Every time we synchronize translations, developers need to |
| 2072 | recompile all the translated manuals and cookbooks. This is useless for what |
| 2073 | is essentially the English manual or cookbook. Therefore, we will only |
| 2074 | include a new language when it reaches 10% completion in the component. |
| 2075 | When a language is included, it may be removed in the future if it stays |
| 2076 | out of sync and falls below 5% completion. |
| 2077 | |
| 2078 | @subsubheading Translation Infrastructure |
| 2079 | |
| 2080 | Weblate is backed by a git repository from which it discovers new strings to |
| 2081 | translate and pushes new and updated translations. Normally, it would be |
| 2082 | enough to give it commit access to our repositories. However, we decided |
| 2083 | to use a separate repository for two reasons. First, we would have to give |
| 2084 | Weblate commit access and authorize its signing key, but we do not trust it |
| 2085 | in the same way we trust guix developers, especially since we do not manage |
| 2086 | the instance ourselves. Second, if translators mess something up, it can |
| 2087 | break the generation of the website and/or guix pull for all our users, |
| 2088 | independently of their language. |
| 2089 | |
| 2090 | For these reasons, we use a dedicated repository to host translations, and we |
| 2091 | synchronize it with our guix and artworks repositories after checking no issue |
| 2092 | was introduced in the translation. |
| 2093 | |
| 2094 | Developers can download the latest PO files from weblate in the Guix |
| 2095 | repository by running the @command{make download-po} command. It will |
| 2096 | automatically download the latest files from weblate, reformat them to a |
| 2097 | canonical form, and check they do not contain issues. The manual needs to be |
| 2098 | built again to check for additional issues that might crash Texinfo. |
| 2099 | |
| 2100 | Before pushing new translation files, developers should add them to the |
| 2101 | make machinery so the translations are actually available. The process |
| 2102 | differs for the various components. |
| 2103 | |
| 2104 | @itemize |
| 2105 | @item New po files for the @code{guix} and @code{packages} components must |
| 2106 | be registered by adding the new language to @file{po/guix/LINGUAS} or |
| 2107 | @file{po/packages/LINGUAS}. |
| 2108 | @item New po files for the @code{documentation-manual} component must be |
| 2109 | registered by adding the file name to @code{DOC_PO_FILES} in |
| 2110 | @file{po/doc/local.mk}, the generated @file{%D%/guix.xx.texi} manual to |
| 2111 | @code{info_TEXINFOS} in @file{doc/local.mk} and the generated |
| 2112 | @file{%D%/guix.xx.texi} and @file{%D%/contributing.xx.texi} to |
| 2113 | @code{TRANSLATED_INFO} also in @file{doc/local.mk}. |
| 2114 | @item New po files for the @code{documentation-cookbook} component must be |
| 2115 | registered by adding the file name to @code{DOC_COOKBOOK_PO_FILES} in |
| 2116 | @file{po/doc/local.mk}, the generated @file{%D%/guix-cookbook.xx.texi} |
| 2117 | manual to @code{info_TEXINFOS} in @file{doc/local.mk} and the generated |
| 2118 | @file{%D%/guix-cookbook.xx.texi} to @code{TRANSLATED_INFO} also |
| 2119 | in @file{doc/local.mk}. |
| 2120 | @item New po files for the @code{website} component must be added to the |
| 2121 | @code{guix-artwork} repository, in @file{website/po/}. |
| 2122 | @file{website/po/LINGUAS} and @file{website/po/ietf-tags.scm} must |
| 2123 | be updated accordingly (see @file{website/i18n-howto.txt} for more |
| 2124 | information on the process). |
| 2125 | @end itemize |