contributing.texi 95 KB

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