contributing.texi 53 KB

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