contributing.texi 101 KB

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