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