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