gnu: roffit: Adjust install phase.
[jackhill/guix/guix.git] / doc / contributing.texi
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 Freenode 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:: Using Debbugs.
30 * Commit Access:: Pushing to the official repository.
31 @end menu
32
33 @node Building from Git
34 @section Building from Git
35
36 If you want to hack Guix itself, it is recommended to use the latest
37 version from the Git repository:
38
39 @example
40 git clone https://git.savannah.gnu.org/git/guix.git
41 @end example
42
43 @cindex authentication, of a Guix checkout
44 How do you ensure that you obtained a genuine copy of the repository?
45 To do that, run @command{guix git authenticate}, passing it the commit
46 and OpenPGP fingerprint of the @dfn{channel introduction}
47 (@pxref{Invoking guix git authenticate}):
48
49 @c The commit and fingerprint below must match those of the channel
50 @c introduction in '%default-channels'.
51 @example
52 git fetch origin keyring:keyring
53 guix git authenticate 9edb3f66fd807b096b48283debdcddccfea34bad \
54 "BBB0 2DDF 2CEA F6A8 0D1D E643 A2A0 6DF2 A33A 54FA"
55 @end example
56
57 @noindent
58 This command completes with exit code zero on success; it prints an
59 error message and exits with a non-zero code otherwise.
60
61 As you can see, there is a chicken-and-egg problem: you first need to
62 have Guix installed. Typically you would install Guix System
63 (@pxref{System Installation}) or Guix on top of another distro
64 (@pxref{Binary Installation}); in either case, you would verify the
65 OpenPGP signature on the installation medium. This ``bootstraps'' the
66 trust chain.
67
68 The easiest way to set up a development environment for Guix is, of
69 course, by using Guix! The following command starts a new shell where
70 all the dependencies and appropriate environment variables are set up to
71 hack on Guix:
72
73 @example
74 guix environment guix --pure
75 @end example
76
77 @xref{Invoking guix environment}, for more information on that command.
78
79 If you are unable to use Guix when building Guix from a checkout, the
80 following are the required packages in addition to those mentioned in the
81 installation instructions (@pxref{Requirements}).
82
83 @itemize
84 @item @url{https://gnu.org/software/autoconf/, GNU Autoconf};
85 @item @url{https://gnu.org/software/automake/, GNU Automake};
86 @item @url{https://gnu.org/software/gettext/, GNU Gettext};
87 @item @url{https://gnu.org/software/texinfo/, GNU Texinfo};
88 @item @url{https://www.graphviz.org/, Graphviz};
89 @item @url{https://www.gnu.org/software/help2man/, GNU Help2man (optional)}.
90 @end itemize
91
92 On Guix, extra dependencies can be added by instead running @command{guix
93 environment} with @option{--ad-hoc}:
94
95 @example
96 guix environment guix --pure --ad-hoc help2man git strace
97 @end example
98
99 Run @command{./bootstrap} to generate the build system infrastructure
100 using Autoconf and Automake. If you get an error like this one:
101
102 @example
103 configure.ac:46: error: possibly undefined macro: PKG_CHECK_MODULES
104 @end example
105
106 @noindent
107 it probably means that Autoconf couldn’t find @file{pkg.m4}, which is
108 provided by pkg-config. Make sure that @file{pkg.m4} is available. The
109 same holds for the @file{guile.m4} set of macros provided by Guile. For
110 instance, if you installed Automake in @file{/usr/local}, it wouldn’t
111 look for @file{.m4} files in @file{/usr/share}. In that case, you have
112 to invoke the following command:
113
114 @example
115 export ACLOCAL_PATH=/usr/share/aclocal
116 @end example
117
118 @xref{Macro Search Path,,, automake, The GNU Automake Manual}, for
119 more information.
120
121 Then, run @command{./configure} as usual. Make sure to pass
122 @code{--localstatedir=@var{directory}} where @var{directory} is the
123 @code{localstatedir} value used by your current installation (@pxref{The
124 Store}, for information about this). We recommend to use the value
125 @code{/var}.
126
127 Finally, you have to invoke @code{make check} to run tests
128 (@pxref{Running the Test Suite}). If anything
129 fails, take a look at installation instructions (@pxref{Installation})
130 or send a message to the @email{guix-devel@@gnu.org, mailing list}.
131
132 From there on, you can authenticate all the commits included in your
133 checkout by running:
134
135 @example
136 make authenticate
137 @end example
138
139 The first run takes a couple of minutes, but subsequent runs are faster.
140
141 @quotation Note
142 You are advised to run @command{make authenticate} after every
143 @command{git pull} invocation. This ensures you keep receiving valid
144 changes to the repository.
145 @end quotation
146
147
148 @node Running Guix Before It Is Installed
149 @section Running Guix Before It Is Installed
150
151 In order to keep a sane working environment, you will find it useful to
152 test the changes made in your local source tree checkout without
153 actually installing them. So that you can distinguish between your
154 ``end-user'' hat and your ``motley'' costume.
155
156 To that end, all the command-line tools can be used even if you have not
157 run @code{make install}. To do that, you first need to have an environment
158 with all the dependencies available (@pxref{Building from Git}), and then
159 simply prefix each command with
160 @command{./pre-inst-env} (the @file{pre-inst-env} script lives in the
161 top build tree of Guix; it is generated by @command{./configure}).
162 An example@footnote{The @option{-E} flag to
163 @command{sudo} guarantees that @code{GUILE_LOAD_PATH} is correctly set
164 such that @command{guix-daemon} and the tools it uses can find the Guile
165 modules they need.}:
166
167 @example
168 $ sudo -E ./pre-inst-env guix-daemon --build-users-group=guixbuild
169 $ ./pre-inst-env guix build hello
170 @end example
171
172 @noindent
173 Similarly, an example for a Guile session using the Guix modules:
174
175 @example
176 $ ./pre-inst-env guile -c '(use-modules (guix utils)) (pk (%current-system))'
177
178 ;;; ("x86_64-linux")
179 @end example
180
181 @noindent
182 @cindex REPL
183 @cindex read-eval-print loop
184 @dots{} and for a REPL (@pxref{Using Guile Interactively,,, guile, Guile
185 Reference Manual}):
186
187 @example
188 $ ./pre-inst-env guile
189 scheme@@(guile-user)> ,use(guix)
190 scheme@@(guile-user)> ,use(gnu)
191 scheme@@(guile-user)> (define snakes
192 (fold-packages
193 (lambda (package lst)
194 (if (string-prefix? "python"
195 (package-name package))
196 (cons package lst)
197 lst))
198 '()))
199 scheme@@(guile-user)> (length snakes)
200 $1 = 361
201 @end example
202
203 The @command{pre-inst-env} script sets up all the environment variables
204 necessary to support this, including @env{PATH} and @env{GUILE_LOAD_PATH}.
205
206 Note that @command{./pre-inst-env guix pull} does @emph{not} upgrade the
207 local source tree; it simply updates the @file{~/.config/guix/current}
208 symlink (@pxref{Invoking guix pull}). Run @command{git pull} instead if
209 you want to upgrade your local source tree.
210
211
212 @node The Perfect Setup
213 @section The Perfect Setup
214
215 The Perfect Setup to hack on Guix is basically the perfect setup used
216 for Guile hacking (@pxref{Using Guile in Emacs,,, guile, Guile Reference
217 Manual}). First, you need more than an editor, you need
218 @url{https://www.gnu.org/software/emacs, Emacs}, empowered by the
219 wonderful @url{https://nongnu.org/geiser/, Geiser}. To set that up, run:
220
221 @example
222 guix package -i emacs guile emacs-geiser
223 @end example
224
225 Geiser allows for interactive and incremental development from within
226 Emacs: code compilation and evaluation from within buffers, access to
227 on-line documentation (docstrings), context-sensitive completion,
228 @kbd{M-.} to jump to an object definition, a REPL to try out your code,
229 and more (@pxref{Introduction,,, geiser, Geiser User Manual}). For
230 convenient Guix development, make sure to augment Guile’s load path so
231 that it finds source files from your checkout:
232
233 @lisp
234 ;; @r{Assuming the Guix checkout is in ~/src/guix.}
235 (with-eval-after-load 'geiser-guile
236 (add-to-list 'geiser-guile-load-path "~/src/guix"))
237 @end lisp
238
239 To actually edit the code, Emacs already has a neat Scheme mode. But in
240 addition to that, you must not miss
241 @url{https://www.emacswiki.org/emacs/ParEdit, Paredit}. It provides
242 facilities to directly operate on the syntax tree, such as raising an
243 s-expression or wrapping it, swallowing or rejecting the following
244 s-expression, etc.
245
246 @cindex code snippets
247 @cindex templates
248 @cindex reducing boilerplate
249 We also provide templates for common git commit messages and package
250 definitions in the @file{etc/snippets} directory. These templates can
251 be used with @url{https://joaotavora.github.io/yasnippet/, YASnippet} to
252 expand short trigger strings to interactive text snippets. You may want
253 to add the snippets directory to the @var{yas-snippet-dirs} variable in
254 Emacs.
255
256 @lisp
257 ;; @r{Assuming the Guix checkout is in ~/src/guix.}
258 (with-eval-after-load 'yasnippet
259 (add-to-list 'yas-snippet-dirs "~/src/guix/etc/snippets"))
260 @end lisp
261
262 The commit message snippets depend on @url{https://magit.vc/, Magit} to
263 display staged files. When editing a commit message type @code{add}
264 followed by @kbd{TAB} to insert a commit message template for adding a
265 package; type @code{update} followed by @kbd{TAB} to insert a template
266 for updating a package; type @code{https} followed by @kbd{TAB} to
267 insert a template for changing the home page URI of a package to HTTPS.
268
269 The main snippet for @code{scheme-mode} is triggered by typing
270 @code{package...} followed by @kbd{TAB}. This snippet also inserts the
271 trigger string @code{origin...}, which can be expanded further. The
272 @code{origin} snippet in turn may insert other trigger strings ending on
273 @code{...}, which also can be expanded further.
274
275 @cindex insert or update copyright
276 @cindex @code{M-x guix-copyright}
277 @cindex @code{M-x copyright-update}
278 We additionally provide insertion and automatic update of a copyright in
279 @file{etc/copyright.el}. You may want to set your full name, mail, and
280 load a file.
281
282 @lisp
283 (setq user-full-name "Alice Doe")
284 (setq user-mail-address "alice@@mail.org")
285 ;; @r{Assuming the Guix checkout is in ~/src/guix.}
286 (load-file "~/src/guix/etc/copyright.el")
287 @end lisp
288
289 To insert a copyright at the current line invoke @code{M-x guix-copyright}.
290
291 To update a copyright you need to specify a @code{copyright-names-regexp}.
292
293 @lisp
294 (setq copyright-names-regexp
295 (format "%s <%s>" user-full-name user-mail-address))
296 @end lisp
297
298 You can check if your copyright is up to date by evaluating @code{M-x
299 copyright-update}. If you want to do it automatically after each buffer
300 save then add @code{(add-hook 'after-save-hook 'copyright-update)} in
301 Emacs.
302
303 @node Packaging Guidelines
304 @section Packaging Guidelines
305
306 @cindex packages, creating
307 The GNU distribution is nascent and may well lack some of your favorite
308 packages. This section describes how you can help make the distribution
309 grow.
310
311 Free software packages are usually distributed in the form of
312 @dfn{source code tarballs}---typically @file{tar.gz} files that contain
313 all the source files. Adding a package to the distribution means
314 essentially two things: adding a @dfn{recipe} that describes how to
315 build the package, including a list of other packages required to build
316 it, and adding @dfn{package metadata} along with that recipe, such as a
317 description and licensing information.
318
319 In Guix all this information is embodied in @dfn{package definitions}.
320 Package definitions provide a high-level view of the package. They are
321 written using the syntax of the Scheme programming language; in fact,
322 for each package we define a variable bound to the package definition,
323 and export that variable from a module (@pxref{Package Modules}).
324 However, in-depth Scheme knowledge is @emph{not} a prerequisite for
325 creating packages. For more information on package definitions,
326 @pxref{Defining Packages}.
327
328 Once a package definition is in place, stored in a file in the Guix
329 source tree, it can be tested using the @command{guix build} command
330 (@pxref{Invoking guix build}). For example, assuming the new package is
331 called @code{gnew}, you may run this command from the Guix build tree
332 (@pxref{Running Guix Before It Is Installed}):
333
334 @example
335 ./pre-inst-env guix build gnew --keep-failed
336 @end example
337
338 Using @code{--keep-failed} makes it easier to debug build failures since
339 it provides access to the failed build tree. Another useful
340 command-line option when debugging is @code{--log-file}, to access the
341 build log.
342
343 If the package is unknown to the @command{guix} command, it may be that
344 the source file contains a syntax error, or lacks a @code{define-public}
345 clause to export the package variable. To figure it out, you may load
346 the module from Guile to get more information about the actual error:
347
348 @example
349 ./pre-inst-env guile -c '(use-modules (gnu packages gnew))'
350 @end example
351
352 Once your package builds correctly, please send us a patch
353 (@pxref{Submitting Patches}). Well, if you need help, we will be happy to
354 help you too. Once the patch is committed in the Guix repository, the
355 new package automatically gets built on the supported platforms by
356 @url{@value{SUBSTITUTE-SERVER}, our continuous integration system}.
357
358 @cindex substituter
359 Users can obtain the new package definition simply by running
360 @command{guix pull} (@pxref{Invoking guix pull}). When
361 @code{@value{SUBSTITUTE-SERVER}} is done building the package, installing the
362 package automatically downloads binaries from there
363 (@pxref{Substitutes}). The only place where human intervention is
364 needed is to review and apply the patch.
365
366
367 @menu
368 * Software Freedom:: What may go into the distribution.
369 * Package Naming:: What's in a name?
370 * Version Numbers:: When the name is not enough.
371 * Synopses and Descriptions:: Helping users find the right package.
372 * Snippets versus Phases:: Whether to use a snippet, or a build phase.
373 * Python Modules:: A touch of British comedy.
374 * Perl Modules:: Little pearls.
375 * Java Packages:: Coffee break.
376 * Rust Crates:: Beware of oxidation.
377 * Fonts:: Fond of fonts.
378 @end menu
379
380 @node Software Freedom
381 @subsection Software Freedom
382
383 @c Adapted from http://www.gnu.org/philosophy/philosophy.html.
384 @cindex free software
385 The GNU operating system has been developed so that users can have
386 freedom in their computing. GNU is @dfn{free software}, meaning that
387 users have the @url{https://www.gnu.org/philosophy/free-sw.html,four
388 essential freedoms}: to run the program, to study and change the program
389 in source code form, to redistribute exact copies, and to distribute
390 modified versions. Packages found in the GNU distribution provide only
391 software that conveys these four freedoms.
392
393 In addition, the GNU distribution follow the
394 @url{https://www.gnu.org/distros/free-system-distribution-guidelines.html,free
395 software distribution guidelines}. Among other things, these guidelines
396 reject non-free firmware, recommendations of non-free software, and
397 discuss ways to deal with trademarks and patents.
398
399 Some otherwise free upstream package sources contain a small and optional
400 subset that violates the above guidelines, for instance because this subset
401 is itself non-free code. When that happens, the offending items are removed
402 with appropriate patches or code snippets in the @code{origin} form of the
403 package (@pxref{Defining Packages}). This way, @code{guix
404 build --source} returns the ``freed'' source rather than the unmodified
405 upstream source.
406
407
408 @node Package Naming
409 @subsection Package Naming
410
411 @cindex package name
412 A package has actually two names associated with it:
413 First, there is the name of the @emph{Scheme variable}, the one following
414 @code{define-public}. By this name, the package can be made known in the
415 Scheme code, for instance as input to another package. Second, there is
416 the string in the @code{name} field of a package definition. This name
417 is used by package management commands such as
418 @command{guix package} and @command{guix build}.
419
420 Both are usually the same and correspond to the lowercase conversion of
421 the project name chosen upstream, with underscores replaced with
422 hyphens. For instance, GNUnet is available as @code{gnunet}, and
423 SDL_net as @code{sdl-net}.
424
425 We do not add @code{lib} prefixes for library packages, unless these are
426 already part of the official project name. But @pxref{Python
427 Modules} and @ref{Perl Modules} for special rules concerning modules for
428 the Python and Perl languages.
429
430 Font package names are handled differently, @pxref{Fonts}.
431
432
433 @node Version Numbers
434 @subsection Version Numbers
435
436 @cindex package version
437 We usually package only the latest version of a given free software
438 project. But sometimes, for instance for incompatible library versions,
439 two (or more) versions of the same package are needed. These require
440 different Scheme variable names. We use the name as defined
441 in @ref{Package Naming}
442 for the most recent version; previous versions use the same name, suffixed
443 by @code{-} and the smallest prefix of the version number that may
444 distinguish the two versions.
445
446 The name inside the package definition is the same for all versions of a
447 package and does not contain any version number.
448
449 For instance, the versions 2.24.20 and 3.9.12 of GTK+ may be packaged as follows:
450
451 @lisp
452 (define-public gtk+
453 (package
454 (name "gtk+")
455 (version "3.9.12")
456 ...))
457 (define-public gtk+-2
458 (package
459 (name "gtk+")
460 (version "2.24.20")
461 ...))
462 @end lisp
463 If we also wanted GTK+ 3.8.2, this would be packaged as
464 @lisp
465 (define-public gtk+-3.8
466 (package
467 (name "gtk+")
468 (version "3.8.2")
469 ...))
470 @end lisp
471
472 @c See <https://lists.gnu.org/archive/html/guix-devel/2016-01/msg00425.html>,
473 @c for a discussion of what follows.
474 @cindex version number, for VCS snapshots
475 Occasionally, we package snapshots of upstream's version control system
476 (VCS) instead of formal releases. This should remain exceptional,
477 because it is up to upstream developers to clarify what the stable
478 release is. Yet, it is sometimes necessary. So, what should we put in
479 the @code{version} field?
480
481 Clearly, we need to make the commit identifier of the VCS snapshot
482 visible in the version string, but we also need to make sure that the
483 version string is monotonically increasing so that @command{guix package
484 --upgrade} can determine which version is newer. Since commit
485 identifiers, notably with Git, are not monotonically increasing, we add
486 a revision number that we increase each time we upgrade to a newer
487 snapshot. The resulting version string looks like this:
488
489 @example
490 2.0.11-3.cabba9e
491 ^ ^ ^
492 | | `-- upstream commit ID
493 | |
494 | `--- Guix package revision
495 |
496 latest upstream version
497 @end example
498
499 It is a good idea to strip commit identifiers in the @code{version}
500 field to, say, 7 digits. It avoids an aesthetic annoyance (assuming
501 aesthetics have a role to play here) as well as problems related to OS
502 limits such as the maximum shebang length (127 bytes for the Linux
503 kernel). It is best to use the full commit identifiers in
504 @code{origin}s, though, to avoid ambiguities. A typical package
505 definition may look like this:
506
507 @lisp
508 (define my-package
509 (let ((commit "c3f29bc928d5900971f65965feaae59e1272a3f7")
510 (revision "1")) ;Guix package revision
511 (package
512 (version (git-version "0.9" revision commit))
513 (source (origin
514 (method git-fetch)
515 (uri (git-reference
516 (url "git://example.org/my-package.git")
517 (commit commit)))
518 (sha256 (base32 "1mbikn@dots{}"))
519 (file-name (git-file-name name version))))
520 ;; @dots{}
521 )))
522 @end lisp
523
524 @node Synopses and Descriptions
525 @subsection Synopses and Descriptions
526
527 @cindex package description
528 @cindex package synopsis
529 As we have seen before, each package in GNU@tie{}Guix includes a
530 synopsis and a description (@pxref{Defining Packages}). Synopses and
531 descriptions are important: They are what @command{guix package
532 --search} searches, and a crucial piece of information to help users
533 determine whether a given package suits their needs. Consequently,
534 packagers should pay attention to what goes into them.
535
536 Synopses must start with a capital letter and must not end with a
537 period. They must not start with ``a'' or ``the'', which usually does
538 not bring anything; for instance, prefer ``File-frobbing tool'' over ``A
539 tool that frobs files''. The synopsis should say what the package
540 is---e.g., ``Core GNU utilities (file, text, shell)''---or what it is
541 used for---e.g., the synopsis for GNU@tie{}grep is ``Print lines
542 matching a pattern''.
543
544 Keep in mind that the synopsis must be meaningful for a very wide
545 audience. For example, ``Manipulate alignments in the SAM format''
546 might make sense for a seasoned bioinformatics researcher, but might be
547 fairly unhelpful or even misleading to a non-specialized audience. It
548 is a good idea to come up with a synopsis that gives an idea of the
549 application domain of the package. In this example, this might give
550 something like ``Manipulate nucleotide sequence alignments'', which
551 hopefully gives the user a better idea of whether this is what they are
552 looking for.
553
554 Descriptions should take between five and ten lines. Use full
555 sentences, and avoid using acronyms without first introducing them.
556 Please avoid marketing phrases such as ``world-leading'',
557 ``industrial-strength'', and ``next-generation'', and avoid superlatives
558 like ``the most advanced''---they are not helpful to users looking for a
559 package and may even sound suspicious. Instead, try to be factual,
560 mentioning use cases and features.
561
562 @cindex Texinfo markup, in package descriptions
563 Descriptions can include Texinfo markup, which is useful to introduce
564 ornaments such as @code{@@code} or @code{@@dfn}, bullet lists, or
565 hyperlinks (@pxref{Overview,,, texinfo, GNU Texinfo}). However you
566 should be careful when using some characters for example @samp{@@} and
567 curly braces which are the basic special characters in Texinfo
568 (@pxref{Special Characters,,, texinfo, GNU Texinfo}). User interfaces
569 such as @command{guix package --show} take care of rendering it
570 appropriately.
571
572 Synopses and descriptions are translated by volunteers
573 @uref{https://translationproject.org/domain/guix-packages.html, at the
574 Translation Project} so that as many users as possible can read them in
575 their native language. User interfaces search them and display them in
576 the language specified by the current locale.
577
578 To allow @command{xgettext} to extract them as translatable strings,
579 synopses and descriptions @emph{must be literal strings}. This means
580 that you cannot use @code{string-append} or @code{format} to construct
581 these strings:
582
583 @lisp
584 (package
585 ;; @dots{}
586 (synopsis "This is translatable")
587 (description (string-append "This is " "*not*" " translatable.")))
588 @end lisp
589
590 Translation is a lot of work so, as a packager, please pay even more
591 attention to your synopses and descriptions as every change may entail
592 additional work for translators. In order to help them, it is possible
593 to make recommendations or instructions visible to them by inserting
594 special comments like this (@pxref{xgettext Invocation,,, gettext, GNU
595 Gettext}):
596
597 @example
598 ;; TRANSLATORS: "X11 resize-and-rotate" should not be translated.
599 (description "ARandR is designed to provide a simple visual front end
600 for the X11 resize-and-rotate (RandR) extension. @dots{}")
601 @end example
602
603 @node Snippets versus Phases
604 @subsection Snippets versus Phases
605
606 @cindex snippets, when to use
607 The boundary between using an origin snippet versus a build phase to
608 modify the sources of a package can be elusive. Origin snippets are
609 typically used to remove unwanted files such as bundled libraries,
610 nonfree sources, or to apply simple substitutions. The source derived
611 from an origin should produce a source that can be used to build the
612 package on any system that the upstream package supports (i.e., act as
613 the corresponding source). In particular, origin snippets must not
614 embed store items in the sources; such patching should rather be done
615 using build phases. Refer to the @code{origin} record documentation for
616 more information (@pxref{origin Reference}).
617
618 @node Python Modules
619 @subsection Python Modules
620
621 @cindex python
622 We currently package Python 2 and Python 3, under the Scheme variable names
623 @code{python-2} and @code{python} as explained in @ref{Version Numbers}.
624 To avoid confusion and naming clashes with other programming languages, it
625 seems desirable that the name of a package for a Python module contains
626 the word @code{python}.
627
628 Some modules are compatible with only one version of Python, others with
629 both. If the package Foo is compiled with Python 3, we name it
630 @code{python-foo}. If it is compiled with Python 2, we name it
631 @code{python2-foo}. Packages should be added when they are necessary;
632 we don't add Python 2 variants of the package unless we are going to use
633 them.
634
635 If a project already contains the word @code{python}, we drop this;
636 for instance, the module python-dateutil is packaged under the names
637 @code{python-dateutil} and @code{python2-dateutil}. If the project name
638 starts with @code{py} (e.g.@: @code{pytz}), we keep it and prefix it as
639 described above.
640
641 @subsubsection Specifying Dependencies
642 @cindex inputs, for Python packages
643
644 Dependency information for Python packages is usually available in the
645 package source tree, with varying degrees of accuracy: in the
646 @file{setup.py} file, in @file{requirements.txt}, or in @file{tox.ini}.
647
648 Your mission, when writing a recipe for a Python package, is to map
649 these dependencies to the appropriate type of ``input'' (@pxref{package
650 Reference, inputs}). Although the @code{pypi} importer normally does a
651 good job (@pxref{Invoking guix import}), you may want to check the
652 following check list to determine which dependency goes where.
653
654 @itemize
655
656 @item
657 We currently package Python 2 with @code{setuptools} and @code{pip}
658 installed like Python 3.4 has per default. Thus you don't need to
659 specify either of these as an input. @command{guix lint} will warn you
660 if you do.
661
662 @item
663 Python dependencies required at run time go into
664 @code{propagated-inputs}. They are typically defined with the
665 @code{install_requires} keyword in @file{setup.py}, or in the
666 @file{requirements.txt} file.
667
668 @item
669 Python packages required only at build time---e.g., those listed with
670 the @code{setup_requires} keyword in @file{setup.py}---or only for
671 testing---e.g., those in @code{tests_require}---go into
672 @code{native-inputs}. The rationale is that (1) they do not need to be
673 propagated because they are not needed at run time, and (2) in a
674 cross-compilation context, it's the ``native'' input that we'd want.
675
676 Examples are the @code{pytest}, @code{mock}, and @code{nose} test
677 frameworks. Of course if any of these packages is also required at
678 run-time, it needs to go to @code{propagated-inputs}.
679
680 @item
681 Anything that does not fall in the previous categories goes to
682 @code{inputs}, for example programs or C libraries required for building
683 Python packages containing C extensions.
684
685 @item
686 If a Python package has optional dependencies (@code{extras_require}),
687 it is up to you to decide whether to add them or not, based on their
688 usefulness/overhead ratio (@pxref{Submitting Patches, @command{guix
689 size}}).
690
691 @end itemize
692
693
694 @node Perl Modules
695 @subsection Perl Modules
696
697 @cindex perl
698 Perl programs standing for themselves are named as any other package,
699 using the lowercase upstream name.
700 For Perl packages containing a single class, we use the lowercase class name,
701 replace all occurrences of @code{::} by dashes and prepend the prefix
702 @code{perl-}.
703 So the class @code{XML::Parser} becomes @code{perl-xml-parser}.
704 Modules containing several classes keep their lowercase upstream name and
705 are also prepended by @code{perl-}. Such modules tend to have the word
706 @code{perl} somewhere in their name, which gets dropped in favor of the
707 prefix. For instance, @code{libwww-perl} becomes @code{perl-libwww}.
708
709
710 @node Java Packages
711 @subsection Java Packages
712
713 @cindex java
714 Java programs standing for themselves are named as any other package,
715 using the lowercase upstream name.
716
717 To avoid confusion and naming clashes with other programming languages,
718 it is desirable that the name of a package for a Java package is
719 prefixed with @code{java-}. If a project already contains the word
720 @code{java}, we drop this; for instance, the package @code{ngsjava} is
721 packaged under the name @code{java-ngs}.
722
723 For Java packages containing a single class or a small class hierarchy,
724 we use the lowercase class name, replace all occurrences of @code{.} by
725 dashes and prepend the prefix @code{java-}. So the class
726 @code{apache.commons.cli} becomes package
727 @code{java-apache-commons-cli}.
728
729
730 @node Rust Crates
731 @subsection Rust Crates
732
733 @cindex rust
734 Rust programs standing for themselves are named as any other package, using the
735 lowercase upstream name.
736
737 To prevent namespace collisions we prefix all other Rust packages with the
738 @code{rust-} prefix. The name should be changed to lowercase as appropriate and
739 dashes should remain in place.
740
741 In the rust ecosystem it is common for multiple incompatible versions of a
742 package to be used at any given time, so all packages should have a versioned
743 suffix. If a package has passed version 1.0.0 then just the major version
744 number is sufficient (e.g.@: @code{rust-clap-2}), otherwise the version suffix
745 should contain both the major and minor version (e.g.@: @code{rust-rand-0.6}).
746
747 Because of the difficulty in reusing rust packages as pre-compiled inputs for
748 other packages the Cargo build system (@pxref{Build Systems,
749 @code{cargo-build-system}}) presents the @code{#:cargo-inputs} and
750 @code{cargo-development-inputs} keywords as build system arguments. It would be
751 helpful to think of these as similar to @code{propagated-inputs} and
752 @code{native-inputs}. Rust @code{dependencies} and @code{build-dependencies}
753 should go in @code{#:cargo-inputs}, and @code{dev-dependencies} should go in
754 @code{#:cargo-development-inputs}. If a Rust package links to other libraries
755 then the standard placement in @code{inputs} and the like should be used.
756
757 Care should be taken to ensure the correct version of dependencies are used; to
758 this end we try to refrain from skipping the tests or using @code{#:skip-build?}
759 when possible. Of course this is not always possible, as the package may be
760 developed for a different Operating System, depend on features from the Nightly
761 Rust compiler, or the test suite may have atrophied since it was released.
762
763
764 @node Fonts
765 @subsection Fonts
766
767 @cindex fonts
768 For fonts that are in general not installed by a user for typesetting
769 purposes, or that are distributed as part of a larger software package,
770 we rely on the general packaging rules for software; for instance, this
771 applies to the fonts delivered as part of the X.Org system or fonts that
772 are part of TeX Live.
773
774 To make it easier for a user to search for fonts, names for other packages
775 containing only fonts are constructed as follows, independently of the
776 upstream package name.
777
778 The name of a package containing only one font family starts with
779 @code{font-}; it is followed by the foundry name and a dash @code{-}
780 if the foundry is known, and the font family name, in which spaces are
781 replaced by dashes (and as usual, all upper case letters are transformed
782 to lower case).
783 For example, the Gentium font family by SIL is packaged under the name
784 @code{font-sil-gentium}.
785
786 For a package containing several font families, the name of the collection
787 is used in the place of the font family name.
788 For instance, the Liberation fonts consist of three families,
789 Liberation Sans, Liberation Serif and Liberation Mono.
790 These could be packaged separately under the names
791 @code{font-liberation-sans} and so on; but as they are distributed together
792 under a common name, we prefer to package them together as
793 @code{font-liberation}.
794
795 In the case where several formats of the same font family or font collection
796 are packaged separately, a short form of the format, prepended by a dash,
797 is added to the package name. We use @code{-ttf} for TrueType fonts,
798 @code{-otf} for OpenType fonts and @code{-type1} for PostScript Type 1
799 fonts.
800
801
802 @node Coding Style
803 @section Coding Style
804
805 In general our code follows the GNU Coding Standards (@pxref{Top,,,
806 standards, GNU Coding Standards}). However, they do not say much about
807 Scheme, so here are some additional rules.
808
809 @menu
810 * Programming Paradigm:: How to compose your elements.
811 * Modules:: Where to store your code?
812 * Data Types and Pattern Matching:: Implementing data structures.
813 * Formatting Code:: Writing conventions.
814 @end menu
815
816 @node Programming Paradigm
817 @subsection Programming Paradigm
818
819 Scheme code in Guix is written in a purely functional style. One
820 exception is code that involves input/output, and procedures that
821 implement low-level concepts, such as the @code{memoize} procedure.
822
823 @node Modules
824 @subsection Modules
825
826 Guile modules that are meant to be used on the builder side must live in
827 the @code{(guix build @dots{})} name space. They must not refer to
828 other Guix or GNU modules. However, it is OK for a ``host-side'' module
829 to use a build-side module.
830
831 Modules that deal with the broader GNU system should be in the
832 @code{(gnu @dots{})} name space rather than @code{(guix @dots{})}.
833
834 @node Data Types and Pattern Matching
835 @subsection Data Types and Pattern Matching
836
837 The tendency in classical Lisp is to use lists to represent everything,
838 and then to browse them ``by hand'' using @code{car}, @code{cdr},
839 @code{cadr}, and co. There are several problems with that style,
840 notably the fact that it is hard to read, error-prone, and a hindrance
841 to proper type error reports.
842
843 Guix code should define appropriate data types (for instance, using
844 @code{define-record-type*}) rather than abuse lists. In addition, it
845 should use pattern matching, via Guile’s @code{(ice-9 match)} module,
846 especially when matching lists.
847
848 @node Formatting Code
849 @subsection Formatting Code
850
851 @cindex formatting code
852 @cindex coding style
853 When writing Scheme code, we follow common wisdom among Scheme
854 programmers. In general, we follow the
855 @url{https://mumble.net/~campbell/scheme/style.txt, Riastradh's Lisp
856 Style Rules}. This document happens to describe the conventions mostly
857 used in Guile’s code too. It is very thoughtful and well written, so
858 please do read it.
859
860 Some special forms introduced in Guix, such as the @code{substitute*}
861 macro, have special indentation rules. These are defined in the
862 @file{.dir-locals.el} file, which Emacs automatically uses. Also note
863 that Emacs-Guix provides @code{guix-devel-mode} mode that indents and
864 highlights Guix code properly (@pxref{Development,,, emacs-guix, The
865 Emacs-Guix Reference Manual}).
866
867 @cindex indentation, of code
868 @cindex formatting, of code
869 If you do not use Emacs, please make sure to let your editor knows these
870 rules. To automatically indent a package definition, you can also run:
871
872 @example
873 ./etc/indent-code.el gnu/packages/@var{file}.scm @var{package}
874 @end example
875
876 @noindent
877 This automatically indents the definition of @var{package} in
878 @file{gnu/packages/@var{file}.scm} by running Emacs in batch mode. To
879 indent a whole file, omit the second argument:
880
881 @example
882 ./etc/indent-code.el gnu/services/@var{file}.scm
883 @end example
884
885 @cindex Vim, Scheme code editing
886 If you are editing code with Vim, we recommend that you run @code{:set
887 autoindent} so that your code is automatically indented as you type.
888 Additionally,
889 @uref{https://www.vim.org/scripts/script.php?script_id=3998,
890 @code{paredit.vim}} may help you deal with all these parentheses.
891
892 We require all top-level procedures to carry a docstring. This
893 requirement can be relaxed for simple private procedures in the
894 @code{(guix build @dots{})} name space, though.
895
896 Procedures should not have more than four positional parameters. Use
897 keyword parameters for procedures that take more than four parameters.
898
899
900 @node Submitting Patches
901 @section Submitting Patches
902
903 Development is done using the Git distributed version control system.
904 Thus, access to the repository is not strictly necessary. We welcome
905 contributions in the form of patches as produced by @code{git
906 format-patch} sent to the @email{guix-patches@@gnu.org} mailing list.
907 Seasoned Guix developers may also want to look at the section on commit
908 access (@pxref{Commit Access}).
909
910 This mailing list is backed by a Debbugs instance, which allows us to
911 keep track of submissions (@pxref{Tracking Bugs and Patches}). Each
912 message sent to that mailing list gets a new tracking number assigned;
913 people can then follow up on the submission by sending email to
914 @code{@var{NNN}@@debbugs.gnu.org}, where @var{NNN} is the tracking
915 number (@pxref{Sending a Patch Series}).
916
917 Please write commit logs in the ChangeLog format (@pxref{Change Logs,,,
918 standards, GNU Coding Standards}); you can check the commit history for
919 examples.
920
921 Before submitting a patch that adds or modifies a package definition,
922 please run through this check list:
923
924 @enumerate
925 @item
926 If the authors of the packaged software provide a cryptographic
927 signature for the release tarball, make an effort to verify the
928 authenticity of the archive. For a detached GPG signature file this
929 would be done with the @code{gpg --verify} command.
930
931 @item
932 Take some time to provide an adequate synopsis and description for the
933 package. @xref{Synopses and Descriptions}, for some guidelines.
934
935 @item
936 Run @code{guix lint @var{package}}, where @var{package} is the
937 name of the new or modified package, and fix any errors it reports
938 (@pxref{Invoking guix lint}).
939
940 @item
941 Make sure the package builds on your platform, using @code{guix build
942 @var{package}}.
943
944 @item
945 We recommend you also try building the package on other supported
946 platforms. As you may not have access to actual hardware platforms, we
947 recommend using the @code{qemu-binfmt-service-type} to emulate them. In
948 order to enable it, add the following service to the list of services in
949 your @code{operating-system} configuration:
950
951 @lisp
952 (service qemu-binfmt-service-type
953 (qemu-binfmt-configuration
954 (platforms (lookup-qemu-platforms "arm" "aarch64"))
955 (guix-support? #t)))
956 @end lisp
957
958 Then reconfigure your system.
959
960 You can then build packages for different platforms by specifying the
961 @code{--system} option. For example, to build the "hello" package for
962 the armhf, aarch64, or mips64 architectures, you would run the following
963 commands, respectively:
964 @example
965 guix build --system=armhf-linux --rounds=2 hello
966 guix build --system=aarch64-linux --rounds=2 hello
967 @end example
968
969 @item
970 @cindex bundling
971 Make sure the package does not use bundled copies of software already
972 available as separate packages.
973
974 Sometimes, packages include copies of the source code of their
975 dependencies as a convenience for users. However, as a distribution, we
976 want to make sure that such packages end up using the copy we already
977 have in the distribution, if there is one. This improves resource usage
978 (the dependency is built and stored only once), and allows the
979 distribution to make transverse changes such as applying security
980 updates for a given software package in a single place and have them
981 affect the whole system---something that bundled copies prevent.
982
983 @item
984 Take a look at the profile reported by @command{guix size}
985 (@pxref{Invoking guix size}). This will allow you to notice references
986 to other packages unwillingly retained. It may also help determine
987 whether to split the package (@pxref{Packages with Multiple Outputs}),
988 and which optional dependencies should be used. In particular, avoid adding
989 @code{texlive} as a dependency: because of its extreme size, use
990 @code{texlive-tiny} or @code{texlive-union} instead.
991
992 @item
993 For important changes, check that dependent package (if applicable) are
994 not affected by the change; @code{guix refresh --list-dependent
995 @var{package}} will help you do that (@pxref{Invoking guix refresh}).
996
997 @c See <https://lists.gnu.org/archive/html/guix-devel/2016-10/msg00933.html>.
998 @cindex branching strategy
999 @cindex rebuild scheduling strategy
1000 Depending on the number of dependent packages and thus the amount of
1001 rebuilding induced, commits go to different branches, along these lines:
1002
1003 @table @asis
1004 @item 300 dependent packages or less
1005 @code{master} branch (non-disruptive changes).
1006
1007 @item between 300 and 1,800 dependent packages
1008 @code{staging} branch (non-disruptive changes). This branch is intended
1009 to be merged in @code{master} every 6 weeks or so. Topical changes
1010 (e.g., an update of the GNOME stack) can instead go to a specific branch
1011 (say, @code{gnome-updates}).
1012
1013 @item more than 1,800 dependent packages
1014 @code{core-updates} branch (may include major and potentially disruptive
1015 changes). This branch is intended to be merged in @code{master} every
1016 6 months or so.
1017 @end table
1018
1019 All these branches are @uref{@value{SUBSTITUTE-SERVER},
1020 tracked by our build farm} and merged into @code{master} once
1021 everything has been successfully built. This allows us to fix issues
1022 before they hit users, and to reduce the window during which pre-built
1023 binaries are not available.
1024
1025 Generally, branches other than @code{master} are considered
1026 @emph{frozen} if there has been a recent evaluation, or there is a
1027 corresponding @code{-next} branch. Please ask on the mailing list or
1028 IRC if unsure where to place a patch.
1029 @c TODO: It would be good with badges on the website that tracks these
1030 @c branches. Or maybe even a status page.
1031
1032 @item
1033 @cindex determinism, of build processes
1034 @cindex reproducible builds, checking
1035 Check whether the package's build process is deterministic. This
1036 typically means checking whether an independent build of the package
1037 yields the exact same result that you obtained, bit for bit.
1038
1039 A simple way to do that is by building the same package several times in
1040 a row on your machine (@pxref{Invoking guix build}):
1041
1042 @example
1043 guix build --rounds=2 my-package
1044 @end example
1045
1046 This is enough to catch a class of common non-determinism issues, such
1047 as timestamps or randomly-generated output in the build result.
1048
1049 Another option is to use @command{guix challenge} (@pxref{Invoking guix
1050 challenge}). You may run it once the package has been committed and
1051 built by @code{@value{SUBSTITUTE-SERVER}} to check whether it obtains the same
1052 result as you did. Better yet: Find another machine that can build it
1053 and run @command{guix publish}. Since the remote build machine is
1054 likely different from yours, this can catch non-determinism issues
1055 related to the hardware---e.g., use of different instruction set
1056 extensions---or to the operating system kernel---e.g., reliance on
1057 @code{uname} or @file{/proc} files.
1058
1059 @item
1060 When writing documentation, please use gender-neutral wording when
1061 referring to people, such as
1062 @uref{https://en.wikipedia.org/wiki/Singular_they, singular
1063 ``they''@comma{} ``their''@comma{} ``them''}, and so forth.
1064
1065 @item
1066 Verify that your patch contains only one set of related changes.
1067 Bundling unrelated changes together makes reviewing harder and slower.
1068
1069 Examples of unrelated changes include the addition of several packages,
1070 or a package update along with fixes to that package.
1071
1072 @item
1073 Please follow our code formatting rules, possibly running the
1074 @command{etc/indent-code.el} script to do that automatically for you
1075 (@pxref{Formatting Code}).
1076
1077 @item
1078 When possible, use mirrors in the source URL (@pxref{Invoking guix download}).
1079 Use reliable URLs, not generated ones. For instance, GitHub archives are not
1080 necessarily identical from one generation to the next, so in this case it's
1081 often better to clone the repository. Don't use the @command{name} field in
1082 the URL: it is not very useful and if the name changes, the URL will probably
1083 be wrong.
1084
1085 @item
1086 Check if Guix builds (@pxref{Building from Git}) and address the
1087 warnings, especially those about use of undefined symbols.
1088
1089 @item
1090 Make sure your changes do not break Guix and simulate a @code{guix pull} with:
1091 @example
1092 guix pull --url=/path/to/your/checkout --profile=/tmp/guix.master
1093 @end example
1094
1095 @end enumerate
1096
1097 When posting a patch to the mailing list, use @samp{[PATCH] @dots{}} as
1098 a subject, if your patch is to be applied on a branch other than
1099 @code{master}, say @code{core-updates}, specify it in the subject like
1100 @samp{[PATCH core-updates] @dots{}}. You may use your email client or
1101 the @command{git send-email} command (@pxref{Sending a Patch Series}).
1102 We prefer to get patches in plain text messages, either inline or as
1103 MIME attachments. You are advised to pay attention if your email client
1104 changes anything like line breaks or indentation which could potentially
1105 break the patches.
1106
1107 When a bug is resolved, please close the thread by sending an email to
1108 @email{@var{NNN}-done@@debbugs.gnu.org}.
1109
1110 @unnumberedsubsec Sending a Patch Series
1111 @anchor{Sending a Patch Series}
1112 @cindex patch series
1113 @cindex @code{git send-email}
1114 @cindex @code{git-send-email}
1115
1116 When sending a patch series (e.g., using @code{git send-email}), please
1117 first send one message to @email{guix-patches@@gnu.org}, and then send
1118 subsequent patches to @email{@var{NNN}@@debbugs.gnu.org} to make sure
1119 they are kept together. See
1120 @uref{https://debbugs.gnu.org/Advanced.html, the Debbugs documentation}
1121 for more information. You can install @command{git send-email} with
1122 @command{guix install git:send-email}.
1123 @c Debbugs bug: https://debbugs.gnu.org/db/15/15361.html
1124
1125 @node Tracking Bugs and Patches
1126 @section Tracking Bugs and Patches
1127
1128 @cindex bug reports, tracking
1129 @cindex patch submissions, tracking
1130 @cindex issue tracking
1131 @cindex Debbugs, issue tracking system
1132 Bug reports and patch submissions are currently tracked using the
1133 Debbugs instance at @uref{https://bugs.gnu.org}. Bug reports are filed
1134 against the @code{guix} ``package'' (in Debbugs parlance), by sending
1135 email to @email{bug-guix@@gnu.org}, while patch submissions are filed
1136 against the @code{guix-patches} package by sending email to
1137 @email{guix-patches@@gnu.org} (@pxref{Submitting Patches}).
1138
1139 A web interface (actually @emph{two} web interfaces!) are available to
1140 browse issues:
1141
1142 @itemize
1143 @item
1144 @url{https://issues.guix.gnu.org} provides a pleasant
1145 interface@footnote{The web interface at
1146 @url{https://issues.guix.gnu.org} is powered by Mumi, a nice piece of
1147 software written in Guile, and you can help! See
1148 @url{https://git.elephly.net/gitweb.cgi?p=software/mumi.git}.} to browse
1149 bug reports and patches, and to participate in discussions;
1150 @item
1151 @url{https://bugs.gnu.org/guix} lists bug reports;
1152 @item
1153 @url{https://bugs.gnu.org/guix-patches} lists patch submissions.
1154 @end itemize
1155
1156 To view discussions related to issue number @var{n}, go to
1157 @indicateurl{https://issues.guix.gnu.org/@var{n}} or
1158 @indicateurl{https://bugs.gnu.org/@var{n}}.
1159
1160 If you use Emacs, you may find it more convenient to interact with
1161 issues using @file{debbugs.el}, which you can install with:
1162
1163 @example
1164 guix install emacs-debbugs
1165 @end example
1166
1167 For example, to list all open issues on @code{guix-patches}, hit:
1168
1169 @example
1170 @kbd{C-u} @kbd{M-x} debbugs-gnu @kbd{RET} @kbd{RET} guix-patches @kbd{RET} n y
1171 @end example
1172
1173 @xref{Top,,, debbugs-ug, Debbugs User Guide}, for more information on
1174 this nifty tool!
1175
1176 @node Commit Access
1177 @section Commit Access
1178
1179 @cindex commit access, for developers
1180 For frequent contributors, having write access to the repository is
1181 convenient. When you deem it necessary, consider applying for commit
1182 access by following these steps:
1183
1184 @enumerate
1185 @item
1186 Find three committers who would vouch for you. You can view the list of
1187 committers at
1188 @url{https://savannah.gnu.org/project/memberlist.php?group=guix}. Each
1189 of them should email a statement to @email{guix-maintainers@@gnu.org} (a
1190 private alias for the collective of maintainers), signed with their
1191 OpenPGP key.
1192
1193 Committers are expected to have had some interactions with you as a
1194 contributor and to be able to judge whether you are sufficiently
1195 familiar with the project's practices. It is @emph{not} a judgment on
1196 the value of your work, so a refusal should rather be interpreted as
1197 ``let's try again later''.
1198
1199 @item
1200 Send @email{guix-maintainers@@gnu.org} a message stating your intent,
1201 listing the three committers who support your application, signed with
1202 the OpenPGP key you will use to sign commits, and giving its fingerprint
1203 (see below). See @uref{https://emailselfdefense.fsf.org/en/}, for an
1204 introduction to public-key cryptography with GnuPG.
1205
1206 @c See <https://sha-mbles.github.io/>.
1207 Set up GnuPG such that it never uses the SHA1 hash algorithm for digital
1208 signatures, which is known to be unsafe since 2019, for instance by
1209 adding the following line to @file{~/.gnupg/gpg.conf} (@pxref{GPG
1210 Esoteric Options,,, gnupg, The GNU Privacy Guard Manual}):
1211
1212 @example
1213 digest-algo sha512
1214 @end example
1215
1216 @item
1217 Maintainers ultimately decide whether to grant you commit access,
1218 usually following your referrals' recommendation.
1219
1220 @item
1221 @cindex OpenPGP, signed commits
1222 If and once you've been given access, please send a message to
1223 @email{guix-devel@@gnu.org} to say so, again signed with the OpenPGP key
1224 you will use to sign commits (do that before pushing your first commit).
1225 That way, everyone can notice and ensure you control that OpenPGP key.
1226
1227 @quotation Important
1228 Before you can push for the first time, maintainers must:
1229
1230 @enumerate
1231 @item
1232 add your OpenPGP key to the @code{keyring} branch;
1233 @item
1234 add your OpenPGP fingerprint to the @file{.guix-authorizations} file of
1235 the branch(es) you will commit to.
1236 @end enumerate
1237 @end quotation
1238
1239 @item
1240 Make sure to read the rest of this section and... profit!
1241 @end enumerate
1242
1243 @quotation Note
1244 Maintainers are happy to give commit access to people who have been
1245 contributing for some time and have a track record---don't be shy and
1246 don't underestimate your work!
1247
1248 However, note that the project is working towards a more automated patch
1249 review and merging system, which, as a consequence, may lead us to have
1250 fewer people with commit access to the main repository. Stay tuned!
1251 @end quotation
1252
1253 If you get commit access, please make sure to follow
1254 the policy below (discussions of the policy can take place on
1255 @email{guix-devel@@gnu.org}).
1256
1257 Non-trivial patches should always be posted to
1258 @email{guix-patches@@gnu.org} (trivial patches include fixing typos,
1259 etc.). This mailing list fills the patch-tracking database
1260 (@pxref{Tracking Bugs and Patches}).
1261
1262 For patches that just add a new package, and a simple one, it's OK to
1263 commit, if you're confident (which means you successfully built it in a
1264 chroot setup, and have done a reasonable copyright and license
1265 auditing). Likewise for package upgrades, except upgrades that trigger
1266 a lot of rebuilds (for example, upgrading GnuTLS or GLib). We have a
1267 mailing list for commit notifications (@email{guix-commits@@gnu.org}),
1268 so people can notice. Before pushing your changes, make sure to run
1269 @code{git pull --rebase}.
1270
1271 All commits that are pushed to the central repository on Savannah must
1272 be signed with an OpenPGP key, and the public key should be uploaded to
1273 your user account on Savannah and to public key servers, such as
1274 @code{keys.openpgp.org}. To configure Git to automatically sign
1275 commits, run:
1276
1277 @example
1278 git config commit.gpgsign true
1279 git config user.signingkey CABBA6EA1DC0FF33
1280 @end example
1281
1282 You can prevent yourself from accidentally pushing unsigned commits to
1283 Savannah by using the pre-push Git hook called located at
1284 @file{etc/git/pre-push}:
1285
1286 @example
1287 cp etc/git/pre-push .git/hooks/pre-push
1288 @end example
1289
1290 When pushing a commit on behalf of somebody else, please add a
1291 @code{Signed-off-by} line at the end of the commit log message---e.g.,
1292 with @command{git am --signoff}. This improves tracking of who did
1293 what.
1294
1295 When adding channel news entries (@pxref{Channels, Writing Channel
1296 News}), make sure they are well-formed by running the following command
1297 right before pushing:
1298
1299 @example
1300 make check-channel-news
1301 @end example
1302
1303 For anything else, please post to @email{guix-patches@@gnu.org} and
1304 leave time for a review, without committing anything (@pxref{Submitting
1305 Patches}). If you didn’t receive any reply after two weeks, and if
1306 you're confident, it's OK to commit.
1307
1308 That last part is subject to being adjusted, allowing individuals to commit
1309 directly on non-controversial changes on parts they’re familiar with.
1310
1311 One last thing: the project keeps moving forward because committers not
1312 only push their own awesome changes, but also offer some of their time
1313 @emph{reviewing} and pushing other people's changes. As a committer,
1314 you're welcome to use your expertise and commit rights to help other
1315 contributors, too!