diff options
| author | Miguel Ángel Arruga Vivas <rosen644835@gmail.com> | 2019-04-23 11:30:32 +0200 |
|---|---|---|
| committer | Julien Lepiller <julien@lepiller.eu> | 2019-04-26 11:21:32 +0200 |
| commit | 9ca5ff882e2ac4eaab02eb0fde545bd784af478b (patch) | |
| tree | d90dbbd89461422e407a9c6974ed046e16ba0617 /doc/contributing.zh_CN.texi | |
| parent | 7342923d98cbefec61c2d67ce916d83d42f4bc3e (diff) | |
bootstrap: Break automake dependency on generated files.
* bootstrap: Generate stub files for the manual translations whose
generated files are not included in the VCS.
* doc/contributing.de.texi: Remove file.
* doc/contributing.es.texi: Remove file.
* doc/contributing.fr.texi: Remove file.
* doc/contributing.zh_CN.texi: Remove file.
* doc/guix.de.texi: Remove file.
* doc/guix.es.texi: Remove file.
* doc/guix.fr.texi: Remove file.
* doc/guix.zh_CN.texi: Remove file.
* .gitignore: Add them.
Signed-off-by: Julien Lepiller <julien@lepiller.eu>
Diffstat (limited to 'doc/contributing.zh_CN.texi')
| -rw-r--r-- | doc/contributing.zh_CN.texi | 897 |
1 files changed, 0 insertions, 897 deletions
diff --git a/doc/contributing.zh_CN.texi b/doc/contributing.zh_CN.texi deleted file mode 100644 index ba8a824cade..00000000000 --- a/doc/contributing.zh_CN.texi +++ /dev/null | |||
| @@ -1,897 +0,0 @@ | |||
| 1 | @node 贡献 | ||
| 2 | @chapter 贡献 | ||
| 3 | |||
| 4 | 这个项目是大家合作的成果,我们需要你的帮助以更好地发展。请通过 | ||
| 5 | @email{guix-devel@@gnu.org} 和 Freenode IRC 上的 @code{#guix} 联系我们。我们欢迎 | ||
| 6 | 您的想法、bug反馈、补丁,以及任何可能对项目有帮助的贡献。我们特别欢迎帮助我们打 | ||
| 7 | 包(@pxref{打包指导})。 | ||
| 8 | |||
| 9 | @cindex 行为准则和贡献者 | ||
| 10 | @cindex 贡献者契约 | ||
| 11 | 我们希望提供一个温暖、友好,并且没有骚扰的的环境,这样每个人都能尽最大努力贡献。 | ||
| 12 | 为了这个目的,我们的项目遵循“贡献者契约”,这个契约是根据 | ||
| 13 | @url{http://contributor-covenant.org/}制定的。你可以在源代码目录里的 | ||
| 14 | @file{CODE-OF-CONDUCT}文件里找到一份本地版。 | ||
| 15 | |||
| 16 | 贡献者在提交补丁和网上交流时不需要使用法律认可的名字。他们可以使用任何名字或者假 | ||
| 17 | 名。 | ||
| 18 | |||
| 19 | @menu | ||
| 20 | * 从Git编译:: 最新的并且最好的. | ||
| 21 | * 在安装之前运行Guix:: 黑客技巧。 | ||
| 22 | * 完美的配置:: 正确的工具。 | ||
| 23 | * 打包指导:: Growing the distribution. | ||
| 24 | * 代码风格:: 开发者的卫生情况 | ||
| 25 | * 提交补丁:: 分享你的工作。 | ||
| 26 | @end menu | ||
| 27 | |||
| 28 | @node 从Git编译 | ||
| 29 | @section 从Git编译 | ||
| 30 | |||
| 31 | 如果你想折腾Guix本身,建议使用Git仓库里最新的版本: | ||
| 32 | |||
| 33 | @example | ||
| 34 | git clone https://git.savannah.gnu.org/git/guix.git | ||
| 35 | @end example | ||
| 36 | |||
| 37 | 当从Git检出构建Guix时,除安装指导(@pxref{Requirements})里提及的软件包之外还需 | ||
| 38 | 要这些包。 | ||
| 39 | |||
| 40 | @itemize | ||
| 41 | @item @url{http://gnu.org/software/autoconf/, GNU Autoconf}; | ||
| 42 | @item @url{http://gnu.org/software/automake/, GNU Automake}; | ||
| 43 | @item @url{http://gnu.org/software/gettext/, GNU Gettext}; | ||
| 44 | @item @url{http://gnu.org/software/texinfo/, GNU Texinfo}; | ||
| 45 | @item @url{http://www.graphviz.org/, Graphviz}; | ||
| 46 | @item @url{http://www.gnu.org/software/help2man/, GNU Help2man (可选)}。 | ||
| 47 | @end itemize | ||
| 48 | |||
| 49 | 设置Guix开发环境的最简单的方式当然是使用Guix!下面这些命令启动一个shell,所有的 | ||
| 50 | 依赖和环境变量都为折腾Guix设置好了: | ||
| 51 | |||
| 52 | @example | ||
| 53 | guix environment guix | ||
| 54 | @end example | ||
| 55 | |||
| 56 | 这个命令更多的信息请参考@xref{Invoking guix environment}。额外的依赖可以通过 | ||
| 57 | @option{--ad-hoc}选项添加: | ||
| 58 | |||
| 59 | @example | ||
| 60 | guix environment guix --ad-hoc help2man git strace | ||
| 61 | @end example | ||
| 62 | |||
| 63 | 运行 @command{./bootstrap} 以使用Autoconf和Automake生成编译系统的基础框架。如果 | ||
| 64 | 你的得到这样的错误: | ||
| 65 | |||
| 66 | @example | ||
| 67 | configure.ac:46: error: possibly undefined macro: PKG_CHECK_MODULES | ||
| 68 | @end example | ||
| 69 | |||
| 70 | @noindent | ||
| 71 | 它可能意味着Autoconf无法找到由pkg-config提供的@file{pkg.m4}。请确保@file{pkg.m4} | ||
| 72 | 可用。由Guile提供的@file{guile.m4}宏也类似。假如你的Automake安装在 | ||
| 73 | @file{/usr/local},那么它不会从@file{/usr/share}里寻找@file{.m4}文件。这种情况下, | ||
| 74 | 你必须执行下面这个命令: | ||
| 75 | |||
| 76 | @example | ||
| 77 | export ACLOCAL_PATH=/usr/share/aclocal | ||
| 78 | @end example | ||
| 79 | |||
| 80 | 参考@xref{Macro Search Path,,, automake, The GNU Automake Manual}. | ||
| 81 | |||
| 82 | 然后,像正常一样运行@command{./configure}。确保提供 | ||
| 83 | @code{--localstatedir=@var{directory}}参数,@var{directory}是你当前系统的 | ||
| 84 | @code{localstatedir}的值。(@pxref{The Store}) | ||
| 85 | |||
| 86 | 最后,用@code{make check}执行测试(@pxref{Running the Test Suite})。如果遇到任 | ||
| 87 | 何错误,请参考“安装指导”(@pxref{Installation})或者给 | ||
| 88 | @email{guix-devel@@gnu.org, 邮件列表}发邮件。 | ||
| 89 | |||
| 90 | |||
| 91 | @node 在安装之前运行Guix | ||
| 92 | @section 在安装之前运行Guix | ||
| 93 | |||
| 94 | 为了保持一个合适的工作环境,你会发现在你的本地代码树里测试修改而不用安装它们会很 | ||
| 95 | 有用。TODO: So that you can distinguish between your ``end-user'' hat and your | ||
| 96 | ``motley'' costume. | ||
| 97 | |||
| 98 | 这样,即使你没有运行@code{make install},所有的命令行工具都可以使用。为此,你先 | ||
| 99 | 要有一个包含全部依赖的环境(@pxref{从Git编译}),然后,为所有的命令添加 | ||
| 100 | 前缀@command{./pre-inst-env}(@file{pre-inst-env}脚本在Guix编译树的最顶层,它由 | ||
| 101 | @command{./configure}生成),如@footnote{@command{sudo}命令的@option{-E}参数 | ||
| 102 | 确保@code{GUILE_LOAD_PATH}被正确设置,从而@command{guix-daemon}和它使用的工具可 | ||
| 103 | 以找到它们需要的Guile模块。}: | ||
| 104 | |||
| 105 | @example | ||
| 106 | $ sudo -E ./pre-inst-env guix-daemon --build-users-group=guixbuild | ||
| 107 | $ ./pre-inst-env guix build hello | ||
| 108 | @end example | ||
| 109 | |||
| 110 | @noindent | ||
| 111 | 类似的,对于使用Guix模块的Guile会话: | ||
| 112 | |||
| 113 | @example | ||
| 114 | $ ./pre-inst-env guile -c '(use-modules (guix utils)) (pk (%current-system))' | ||
| 115 | |||
| 116 | ;;; ("x86_64-linux") | ||
| 117 | @end example | ||
| 118 | |||
| 119 | @noindent | ||
| 120 | @cindex REPL | ||
| 121 | @cindex read-eval-print loop | ||
| 122 | @dots{} and for a REPL (@pxref{Using Guile Interactively,,, guile, Guile | ||
| 123 | Reference Manual}): | ||
| 124 | |||
| 125 | @example | ||
| 126 | $ ./pre-inst-env guile | ||
| 127 | scheme@@(guile-user)> ,use(guix) | ||
| 128 | scheme@@(guile-user)> ,use(gnu) | ||
| 129 | scheme@@(guile-user)> (define snakes | ||
| 130 | (fold-packages | ||
| 131 | (lambda (package lst) | ||
| 132 | (if (string-prefix? "python" | ||
| 133 | (package-name package)) | ||
| 134 | (cons package lst) | ||
| 135 | lst)) | ||
| 136 | '())) | ||
| 137 | scheme@@(guile-user)> (length snakes) | ||
| 138 | $1 = 361 | ||
| 139 | @end example | ||
| 140 | |||
| 141 | @command{pre-inst-env}脚本设置为此好了所有必要的的环境变量,包括@env{PATH}和 | ||
| 142 | @env{GUILE_LOAD_PATH}。 | ||
| 143 | |||
| 144 | @command{./pre-inst-env guix pull} @emph{不} 会更新本地源代码树,它只更新符号链 | ||
| 145 | 接@file{~/.config/guix/current} (@pxref{Invoking guix pull})。如果你想更新本地源 | ||
| 146 | 代码树,请运行@command{git pull}。 | ||
| 147 | |||
| 148 | |||
| 149 | @node 完美的配置 | ||
| 150 | @section 完美的配置 | ||
| 151 | |||
| 152 | 折腾Guix的完美配置也是折腾Guile的完美配置@pxref{Using Guile in Emacs,,, guile, | ||
| 153 | Guile Reference Manual})。首先,你需要的不仅是一个编辑器,你需要 | ||
| 154 | @url{http://www.gnu.org/software/emacs, Emacs},以及美妙的 | ||
| 155 | @url{http://nongnu.org/geiser/, Geiser}。为此,请运行: | ||
| 156 | |||
| 157 | @example | ||
| 158 | guix package -i emacs guile emacs-geiser | ||
| 159 | @end example | ||
| 160 | |||
| 161 | Geiser允许在Emacs里进行交互式的、增长式的开发:buffer里的代码补全和执行,获取一 | ||
| 162 | 行的文档(docstrings),上下文敏感的补全,@kbd{M-.}跳转到对象定义,测试代码的 | ||
| 163 | REPL,及更多(@pxref{Introduction,,, geiser, Geiser User Manual})。为了方便的 | ||
| 164 | Guix开发,请确保修改Guile的加载路径(load path)以使其能从你的项目里找到源代码文 | ||
| 165 | 件。 | ||
| 166 | |||
| 167 | @lisp | ||
| 168 | ;; @r{假设Guix项目在 ~/src/guix.} | ||
| 169 | (with-eval-after-load 'geiser-guile | ||
| 170 | (add-to-list 'geiser-guile-load-path "~/src/guix")) | ||
| 171 | @end lisp | ||
| 172 | |||
| 173 | 真正编辑代码时别忘了Emacs自带了方便的Scheme模式。而且,一定不要错过 | ||
| 174 | @url{http://www.emacswiki.org/emacs/ParEdit, Paredit}。它提供了直接操作语法树的 | ||
| 175 | 的功能,例如,用S-表达式替换父节点,为S-表达式添加、删除前后的括号,删除后面的S- | ||
| 176 | 表达式,等等。 | ||
| 177 | |||
| 178 | @cindex 代码片段 | ||
| 179 | @cindex 模板 | ||
| 180 | @cindex reducing boilerplate | ||
| 181 | 在@file{etc/snippets}文件夹里,我们还为普通的git commit信息和软件包定义提供模板。 | ||
| 182 | 这些模板可以通过@url{http://joaotavora.github.io/yasnippet/, YASnippet}使用,它 | ||
| 183 | 可以把短的触发字符串扩展成交互式的文字片段。你可能希望将这个文件夹添加到Emacs的 | ||
| 184 | @var{yas-snippet-dirs}变量里。 | ||
| 185 | |||
| 186 | @lisp | ||
| 187 | ;; @r{假设Guix项目在 ~/src/guix.} | ||
| 188 | (with-eval-after-load 'yasnippet | ||
| 189 | (add-to-list 'yas-snippet-dirs "~/src/guix/etc/snippets")) | ||
| 190 | @end lisp | ||
| 191 | |||
| 192 | commit信息片段显示staged文件需要依赖@url{https://magit.vc/, Magit}。编辑commit信 | ||
| 193 | 息时,输入@code{add},然后按@kbd{TAB}就可以插入一段用于新增软件包的模板;输入 | ||
| 194 | @code{update},然后按@kbd{TAB}可以插入一段更新软件包的模板;输入@code{https}然后 | ||
| 195 | 按@kbd{TAB}可以插入一段修改主页URI为HTTPS的模板。 | ||
| 196 | |||
| 197 | @code{scheme-mode}最重要的模板可以通过输入@code{package...},然后按@kbd{TAB}触发。 | ||
| 198 | 这个片段还插入了触发字符串@code{origin...},以进一步展开。@code{origin}片段更进 | ||
| 199 | 一步的可能插入其它以@code{...}结尾的触发字符串,它们可以被继续展开。 | ||
| 200 | |||
| 201 | |||
| 202 | @node 打包指导 | ||
| 203 | @section 打包指导 | ||
| 204 | |||
| 205 | @cindex 软件包, 创建 | ||
| 206 | 这个GNU发行版正在开发的早期阶段,可能缺少一些你喜欢的软件。这个章节介绍你可以怎 | ||
| 207 | 样帮助这个发行版成长。 | ||
| 208 | |||
| 209 | 自由软件通常以@dfn{源代码包}的形式分发,通常是包含完整代码的@file{tar.gz}包。添 | ||
| 210 | 加软件包到这个发行版意味着两件事:添加描述如何编译包的@dfn{配方}和一系列依赖软件, | ||
| 211 | 以及添加配方之外的@dfn{软件包元数据},如一段文字描述和证书信息。 | ||
| 212 | |||
| 213 | 在Guix里所有这些信息都包含在@dfn{软件包定义}里。软件包定义提供了软件包的高层视角。 | ||
| 214 | 它们使用Scheme编程语言编写,事实上,对每个软件包我们都定义一个绑定到软件包定义的 | ||
| 215 | 的变量,并且从模块(@pxref{Package Modules})中导出那个变量。然而,深入的Scheme | ||
| 216 | 知识@emph{不}是创建软件包的前提条件。若要了解软件包的更多信息,@pxref{Defining | ||
| 217 | Packages}。 | ||
| 218 | |||
| 219 | 一旦软件包定义准备好了,并且包存在Guix代码树的一个文件里,你可以用@command{guix | ||
| 220 | build} (@pxref{Invoking guix build})命令测试它。假设这个新软件包的名字叫做 | ||
| 221 | @code{gnew},你可以在Guix编译树里运行这个命令(@pxref{在安装之前运行Guix}): | ||
| 222 | |||
| 223 | @example | ||
| 224 | ./pre-inst-env guix build gnew --keep-failed | ||
| 225 | @end example | ||
| 226 | |||
| 227 | 使用@code{--keep-failed}参数会保留失败的编译树,这可以使调试编译错误更容易。 | ||
| 228 | @code{--log-file}也是一个调试时很有用的参数,它可以用来访问编译日志。 | ||
| 229 | |||
| 230 | 如果@command{guix}命令找不到这个软件包,那可能是因为源文件包含语法错误,或者缺少 | ||
| 231 | 导出软件包的@code{define-public}语句。为了查找错误,你可以用Guile导入这个模块以 | ||
| 232 | 了解这个错误的详情: | ||
| 233 | |||
| 234 | @example | ||
| 235 | ./pre-inst-env guile -c '(use-modules (gnu packages gnew))' | ||
| 236 | @end example | ||
| 237 | |||
| 238 | 一旦你的软件包可以正确编译,请给我们发送补丁(@pxref{提交补丁})。当然, | ||
| 239 | 如果你需要帮助,我们也会很乐意帮助你。一旦补丁被提交到Guix仓库里,这个新的软件包 | ||
| 240 | 会被自动地在支持的平台上编译@url{http://hydra.gnu.org/jobset/gnu/master, our | ||
| 241 | continuous integration system}。 | ||
| 242 | |||
| 243 | @cindex substituter | ||
| 244 | 用户可以通过运行@command{guix pull}命令获取最新的软件包定义(@pxref{Invoking | ||
| 245 | guix pull})。当@code{@value{SUBSTITUTE-SERVER}}编译好这些软件包之后,安装这些软 | ||
| 246 | 件包时会自动从服务器(@pxref{Substitutes})上下载编译好的二进制包。唯一需要人工 | ||
| 247 | 干预的地方是评审和应用代码补丁。 | ||
| 248 | |||
| 249 | |||
| 250 | @menu | ||
| 251 | * 软件自由:: 什么可以进入这个发行版。 | ||
| 252 | * 软件包命名:: 名字里包含什么? | ||
| 253 | * 版本号:: 当名字不够时 | ||
| 254 | * 简介和描述:: 帮助用户寻找合适的软件包 | ||
| 255 | * Python模块:: 接触英式的喜剧 | ||
| 256 | * Perl模块:: 小珍珠。 | ||
| 257 | * Java包:: 喝咖啡休息。 | ||
| 258 | * 字体:: 字体的乐趣。 | ||
| 259 | @end menu | ||
| 260 | |||
| 261 | @node 软件自由 | ||
| 262 | @subsection 软件自由 | ||
| 263 | |||
| 264 | @c =========================================================================== | ||
| 265 | @c | ||
| 266 | @c This file was generated with po4a. Translate the source file. | ||
| 267 | @c | ||
| 268 | @c =========================================================================== | ||
| 269 | @c Adapted from http://www.gnu.org/philosophy/philosophy.html. | ||
| 270 | @cindex 自由软件 | ||
| 271 | 开发GNU操作系统是为了用户拥有计算的自由。GNU是@dfn{自由软件},这意味着它有 | ||
| 272 | @url{http://www.gnu.org/philosophy/free-sw.html,四项重要的自由}:运行程序的自由, | ||
| 273 | 以源代码形式学习和修改程序的自由,原样重新分发副本的自由,和分发修改后的版本的自 | ||
| 274 | 由。GNU发行版里包含的软件包只提供遵守这四项自由的软件。 | ||
| 275 | |||
| 276 | 此外,GNU发行版遵循 | ||
| 277 | @url{http://www.gnu.org/distros/free-system-distribution-guidelines.html,自由软 | ||
| 278 | 件发行版准则}。这些准则拒绝非自由的固件和对非自由软件的推荐,并讨论解决商标和专 | ||
| 279 | 利的方法。 | ||
| 280 | |||
| 281 | 某些上游的软件包源代码包含一小部分违反上述准则的可选的子集,比如这个子集本身就是 | ||
| 282 | 非自由代码。这时,这些讨厌的代码需要用合适的补丁或者软件包定义(@pxref{Defining | ||
| 283 | Packages})里的@code{origin}里的代码片段移除。这样,@code{guix build --source}就 | ||
| 284 | 可以返回自由的源代码而不是未经修改的上游源代码。 | ||
| 285 | |||
| 286 | |||
| 287 | @node 软件包命名 | ||
| 288 | @subsection 软件包命名 | ||
| 289 | |||
| 290 | @cindex 软件包名字 | ||
| 291 | 一个软件包事实上有两个名字:第一个是@emph{Scheme变量}的名字,即用 | ||
| 292 | @code{define-public}定义的名字。通过这个名字,软件包可以被Scheme代码找到,如用作 | ||
| 293 | 其它软件包的输入。第二个名字是软件包定义里的@code{name}属性的字符串值。这个名字 | ||
| 294 | 用于软件包管理命令,如:@command{guix package},@command{guix build} | ||
| 295 | |||
| 296 | 两个名字通常是相同的,常是上游项目名字转成小写字母并把下划线替换成连字符的结果。 | ||
| 297 | 比如,GNUnet转成@code{gnunet},SDL_net转成@code{sdl-net}。 | ||
| 298 | |||
| 299 | 我们不给库软件包添加@code{lib}前缀,除非它是项目官方名字的一部分。但是 | ||
| 300 | @pxref{Python模块}和@ref{Perl模块}有关于Python和Perl语言的特殊规则。 | ||
| 301 | |||
| 302 | 字体软件包的名字处理起来不同,@pxref{字体}. | ||
| 303 | |||
| 304 | |||
| 305 | @node 版本号 | ||
| 306 | @subsection 版本号 | ||
| 307 | |||
| 308 | @cindex 软件包版本 | ||
| 309 | 我们通常只为每个自由软件的最新版本打包。但是有时候,比如对于版本不兼容的库,需要 | ||
| 310 | 有同一个软件包的两个或更多版本。它们需要使用不同的Scheme变量名。我们为最新的版本 | ||
| 311 | 使用@ref{软件包命名}里规定的名字,旧的版本使用加上后缀的名字,后缀是@code{-} | ||
| 312 | 和可以区分开版本号的版本号的最小前缀。 | ||
| 313 | |||
| 314 | 软件包定义里的名字对于同一个软件包的所有版本都是相同的,并且不含有版本号。 | ||
| 315 | |||
| 316 | 例如,GTK+的2.24.20和3.9.12两个版本可以这样打包: | ||
| 317 | |||
| 318 | @example | ||
| 319 | (define-public gtk+ | ||
| 320 | (package | ||
| 321 | (name "gtk+") | ||
| 322 | (version "3.9.12") | ||
| 323 | ...)) | ||
| 324 | (define-public gtk+-2 | ||
| 325 | (package | ||
| 326 | (name "gtk+") | ||
| 327 | (version "2.24.20") | ||
| 328 | ...)) | ||
| 329 | @end example | ||
| 330 | 如果我们还需要GTK+ 3.8.2,就这样打包 | ||
| 331 | @example | ||
| 332 | (define-public gtk+-3.8 | ||
| 333 | (package | ||
| 334 | (name "gtk+") | ||
| 335 | (version "3.8.2") | ||
| 336 | ...)) | ||
| 337 | @end example | ||
| 338 | |||
| 339 | @c See <https://lists.gnu.org/archive/html/guix-devel/2016-01/msg00425.html>, | ||
| 340 | @c for a discussion of what follows. | ||
| 341 | @cindex 用于版本控制快照的版本号 | ||
| 342 | 有时候,我们为软件包上游的版本控制系统(VCS)的快照而不是正式发布版打包。这是特 | ||
| 343 | 殊情况,因为决定哪个是稳定版的权力应该属于上游开发者。然而,有时候这是必须的。那 | ||
| 344 | 么,我们该如何决定写在@code{version}里的版本号呢? | ||
| 345 | |||
| 346 | 显然,我们需要让VCS快照的commit ID在版本号中体现出来,但是我们也需要确保版本号单 | ||
| 347 | 调递增,以便@command{guix package --upgrade}决定哪个版本号更新。由于commit ID, | ||
| 348 | 尤其是Git的commit ID,不是单调递增的,我们添加一个每次升级快照时都手动增长的 | ||
| 349 | revision数字。最后的版本号字符串看起来是这样: | ||
| 350 | |||
| 351 | @example | ||
| 352 | 2.0.11-3.cabba9e | ||
| 353 | ^ ^ ^ | ||
| 354 | | | `-- 上游的commit ID | ||
| 355 | | | | ||
| 356 | | `--- Guix软件包的revision | ||
| 357 | | | ||
| 358 | 最新的上游版本号 | ||
| 359 | @end example | ||
| 360 | |||
| 361 | 把@code{版本号}里的commit ID截短,比如只取7个数字,是一个好主意。它避免了美学上 | ||
| 362 | 的烦恼(假设美学在这里很重要),以及操作系统限制引起的问题(比如Linux内核的127字 | ||
| 363 | 节)。尽管如此,在@code{origin}里最好使用完整的commit ID,以避免混淆。 | ||
| 364 | |||
| 365 | @example | ||
| 366 | (define my-package | ||
| 367 | (let ((commit "c3f29bc928d5900971f65965feaae59e1272a3f7") | ||
| 368 | (revision "1")) ;Guix软件包的revision | ||
| 369 | (package | ||
| 370 | (version (git-version "0.9" revision commit)) | ||
| 371 | (source (origin | ||
| 372 | (method git-fetch) | ||
| 373 | (uri (git-reference | ||
| 374 | (url "git://example.org/my-package.git") | ||
| 375 | (commit commit))) | ||
| 376 | (sha256 (base32 "1mbikn@dots{}")) | ||
| 377 | (file-name (git-file-name name version)))) | ||
| 378 | ;; @dots{} | ||
| 379 | ))) | ||
| 380 | @end example | ||
| 381 | |||
| 382 | @node 简介和描述 | ||
| 383 | @subsection 简介和描述 | ||
| 384 | |||
| 385 | @cindex 软件包描述 | ||
| 386 | @cindex 软件包简介 | ||
| 387 | 我们已经看到,GNU@tie{}Guix里的每个软件包都包含一个简介(synopsis)和一个描述 | ||
| 388 | (description)(@pxref{Defining Packages})。简介和描述很重要:它们是 | ||
| 389 | @command{guix package --search}搜索的信息,并且是帮助用户决定一个软件包是否符合 | ||
| 390 | 自己需求的重要信息。因此,打包的人应该关注怎样写它们的内容。 | ||
| 391 | |||
| 392 | 简介必须以大写字母开头,并且不能以句号结尾。它们不能以 ``a'' 或者 ``the'' 等没有 | ||
| 393 | 意义的词开头。例如 ``File-frobbing tool'' 要比 ``A tool that frobs files'' 更好。 | ||
| 394 | 简介需要说明软件包是什么--如 ``Core GNU utilities (file, text, shell)'',或者 | ||
| 395 | 它的用途--如 GNU@tie{}grep 的简介是 ``Print lines matching a pattern''。 | ||
| 396 | |||
| 397 | Keep in mind that the synopsis must be meaningful for a very wide audience. | ||
| 398 | For example, ``Manipulate alignments in the SAM format'' might make sense | ||
| 399 | for a seasoned bioinformatics researcher, but might be fairly unhelpful or | ||
| 400 | even misleading to a non-specialized audience. It is a good idea to come up | ||
| 401 | with a synopsis that gives an idea of the application domain of the | ||
| 402 | package. In this example, this might give something like ``Manipulate | ||
| 403 | nucleotide sequence alignments'', which hopefully gives the user a better | ||
| 404 | idea of whether this is what they are looking for. | ||
| 405 | |||
| 406 | Descriptions should take between five and ten lines. Use full sentences, | ||
| 407 | and avoid using acronyms without first introducing them. Please avoid | ||
| 408 | marketing phrases such as ``world-leading'', ``industrial-strength'', and | ||
| 409 | ``next-generation'', and avoid superlatives like ``the most | ||
| 410 | advanced''---they are not helpful to users looking for a package and may | ||
| 411 | even sound suspicious. Instead, try to be factual, mentioning use cases and | ||
| 412 | features. | ||
| 413 | |||
| 414 | @cindex Texinfo markup, in package descriptions | ||
| 415 | Descriptions can include Texinfo markup, which is useful to introduce | ||
| 416 | ornaments such as @code{@@code} or @code{@@dfn}, bullet lists, or hyperlinks | ||
| 417 | (@pxref{Overview,,, texinfo, GNU Texinfo}). However you should be careful | ||
| 418 | when using some characters for example @samp{@@} and curly braces which are | ||
| 419 | the basic special characters in Texinfo (@pxref{Special Characters,,, | ||
| 420 | texinfo, GNU Texinfo}). User interfaces such as @command{guix package | ||
| 421 | --show} take care of rendering it appropriately. | ||
| 422 | |||
| 423 | Synopses and descriptions are translated by volunteers | ||
| 424 | @uref{http://translationproject.org/domain/guix-packages.html, at the | ||
| 425 | Translation Project} so that as many users as possible can read them in | ||
| 426 | their native language. User interfaces search them and display them in the | ||
| 427 | language specified by the current locale. | ||
| 428 | |||
| 429 | To allow @command{xgettext} to extract them as translatable strings, | ||
| 430 | synopses and descriptions @emph{must be literal strings}. This means that | ||
| 431 | you cannot use @code{string-append} or @code{format} to construct these | ||
| 432 | strings: | ||
| 433 | |||
| 434 | @lisp | ||
| 435 | (package | ||
| 436 | ;; @dots{} | ||
| 437 | (synopsis "This is translatable") | ||
| 438 | (description (string-append "This is " "*not*" " translatable."))) | ||
| 439 | @end lisp | ||
| 440 | |||
| 441 | Translation is a lot of work so, as a packager, please pay even more | ||
| 442 | attention to your synopses and descriptions as every change may entail | ||
| 443 | additional work for translators. In order to help them, it is possible to | ||
| 444 | make recommendations or instructions visible to them by inserting special | ||
| 445 | comments like this (@pxref{xgettext Invocation,,, gettext, GNU Gettext}): | ||
| 446 | |||
| 447 | @example | ||
| 448 | ;; TRANSLATORS: "X11 resize-and-rotate" should not be translated. | ||
| 449 | (description "ARandR is designed to provide a simple visual front end | ||
| 450 | for the X11 resize-and-rotate (RandR) extension. @dots{}") | ||
| 451 | @end example | ||
| 452 | |||
| 453 | |||
| 454 | @node Python模块 | ||
| 455 | @subsection Python模块 | ||
| 456 | |||
| 457 | @cindex python | ||
| 458 | We currently package Python 2 and Python 3, under the Scheme variable names | ||
| 459 | @code{python-2} and @code{python} as explained in @ref{版本号}. To | ||
| 460 | avoid confusion and naming clashes with other programming languages, it | ||
| 461 | seems desirable that the name of a package for a Python module contains the | ||
| 462 | word @code{python}. | ||
| 463 | |||
| 464 | Some modules are compatible with only one version of Python, others with | ||
| 465 | both. If the package Foo compiles only with Python 3, we name it | ||
| 466 | @code{python-foo}; if it compiles only with Python 2, we name it | ||
| 467 | @code{python2-foo}. If it is compatible with both versions, we create two | ||
| 468 | packages with the corresponding names. | ||
| 469 | |||
| 470 | If a project already contains the word @code{python}, we drop this; for | ||
| 471 | instance, the module python-dateutil is packaged under the names | ||
| 472 | @code{python-dateutil} and @code{python2-dateutil}. If the project name | ||
| 473 | starts with @code{py} (e.g.@: @code{pytz}), we keep it and prefix it as | ||
| 474 | described above. | ||
| 475 | |||
| 476 | @subsubsection Specifying Dependencies | ||
| 477 | @cindex inputs, for Python packages | ||
| 478 | |||
| 479 | Dependency information for Python packages is usually available in the | ||
| 480 | package source tree, with varying degrees of accuracy: in the | ||
| 481 | @file{setup.py} file, in @file{requirements.txt}, or in @file{tox.ini}. | ||
| 482 | |||
| 483 | Your mission, when writing a recipe for a Python package, is to map these | ||
| 484 | dependencies to the appropriate type of ``input'' (@pxref{package Reference, | ||
| 485 | inputs}). Although the @code{pypi} importer normally does a good job | ||
| 486 | (@pxref{Invoking guix import}), you may want to check the following check | ||
| 487 | list to determine which dependency goes where. | ||
| 488 | |||
| 489 | @itemize | ||
| 490 | |||
| 491 | @item | ||
| 492 | We currently package Python 2 with @code{setuptools} and @code{pip} | ||
| 493 | installed like Python 3.4 has per default. Thus you don't need to specify | ||
| 494 | either of these as an input. @command{guix lint} will warn you if you do. | ||
| 495 | |||
| 496 | @item | ||
| 497 | Python dependencies required at run time go into @code{propagated-inputs}. | ||
| 498 | They are typically defined with the @code{install_requires} keyword in | ||
| 499 | @file{setup.py}, or in the @file{requirements.txt} file. | ||
| 500 | |||
| 501 | @item | ||
| 502 | Python packages required only at build time---e.g., those listed with the | ||
| 503 | @code{setup_requires} keyword in @file{setup.py}---or only for | ||
| 504 | testing---e.g., those in @code{tests_require}---go into | ||
| 505 | @code{native-inputs}. The rationale is that (1) they do not need to be | ||
| 506 | propagated because they are not needed at run time, and (2) in a | ||
| 507 | cross-compilation context, it's the ``native'' input that we'd want. | ||
| 508 | |||
| 509 | Examples are the @code{pytest}, @code{mock}, and @code{nose} test | ||
| 510 | frameworks. Of course if any of these packages is also required at | ||
| 511 | run-time, it needs to go to @code{propagated-inputs}. | ||
| 512 | |||
| 513 | @item | ||
| 514 | Anything that does not fall in the previous categories goes to | ||
| 515 | @code{inputs}, for example programs or C libraries required for building | ||
| 516 | Python packages containing C extensions. | ||
| 517 | |||
| 518 | @item | ||
| 519 | If a Python package has optional dependencies (@code{extras_require}), it is | ||
| 520 | up to you to decide whether to add them or not, based on their | ||
| 521 | usefulness/overhead ratio (@pxref{提交补丁, @command{guix size}}). | ||
| 522 | |||
| 523 | @end itemize | ||
| 524 | |||
| 525 | |||
| 526 | @node Perl模块 | ||
| 527 | @subsection Perl模块 | ||
| 528 | |||
| 529 | @cindex perl | ||
| 530 | Perl programs standing for themselves are named as any other package, using | ||
| 531 | the lowercase upstream name. For Perl packages containing a single class, | ||
| 532 | we use the lowercase class name, replace all occurrences of @code{::} by | ||
| 533 | dashes and prepend the prefix @code{perl-}. So the class @code{XML::Parser} | ||
| 534 | becomes @code{perl-xml-parser}. Modules containing several classes keep | ||
| 535 | their lowercase upstream name and are also prepended by @code{perl-}. Such | ||
| 536 | modules tend to have the word @code{perl} somewhere in their name, which | ||
| 537 | gets dropped in favor of the prefix. For instance, @code{libwww-perl} | ||
| 538 | becomes @code{perl-libwww}. | ||
| 539 | |||
| 540 | |||
| 541 | @node Java包 | ||
| 542 | @subsection Java包 | ||
| 543 | |||
| 544 | @cindex java | ||
| 545 | Java programs standing for themselves are named as any other package, using | ||
| 546 | the lowercase upstream name. | ||
| 547 | |||
| 548 | To avoid confusion and naming clashes with other programming languages, it | ||
| 549 | is desirable that the name of a package for a Java package is prefixed with | ||
| 550 | @code{java-}. If a project already contains the word @code{java}, we drop | ||
| 551 | this; for instance, the package @code{ngsjava} is packaged under the name | ||
| 552 | @code{java-ngs}. | ||
| 553 | |||
| 554 | For Java packages containing a single class or a small class hierarchy, we | ||
| 555 | use the lowercase class name, replace all occurrences of @code{.} by dashes | ||
| 556 | and prepend the prefix @code{java-}. So the class @code{apache.commons.cli} | ||
| 557 | becomes package @code{java-apache-commons-cli}. | ||
| 558 | |||
| 559 | |||
| 560 | @node 字体 | ||
| 561 | @subsection 字体 | ||
| 562 | |||
| 563 | @cindex fonts | ||
| 564 | For fonts that are in general not installed by a user for typesetting | ||
| 565 | purposes, or that are distributed as part of a larger software package, we | ||
| 566 | rely on the general packaging rules for software; for instance, this applies | ||
| 567 | to the fonts delivered as part of the X.Org system or fonts that are part of | ||
| 568 | TeX Live. | ||
| 569 | |||
| 570 | To make it easier for a user to search for fonts, names for other packages | ||
| 571 | containing only fonts are constructed as follows, independently of the | ||
| 572 | upstream package name. | ||
| 573 | |||
| 574 | The name of a package containing only one font family starts with | ||
| 575 | @code{font-}; it is followed by the foundry name and a dash @code{-} if the | ||
| 576 | foundry is known, and the font family name, in which spaces are replaced by | ||
| 577 | dashes (and as usual, all upper case letters are transformed to lower | ||
| 578 | case). For example, the Gentium font family by SIL is packaged under the | ||
| 579 | name @code{font-sil-gentium}. | ||
| 580 | |||
| 581 | For a package containing several font families, the name of the collection | ||
| 582 | is used in the place of the font family name. For instance, the Liberation | ||
| 583 | fonts consist of three families, Liberation Sans, Liberation Serif and | ||
| 584 | Liberation Mono. These could be packaged separately under the names | ||
| 585 | @code{font-liberation-sans} and so on; but as they are distributed together | ||
| 586 | under a common name, we prefer to package them together as | ||
| 587 | @code{font-liberation}. | ||
| 588 | |||
| 589 | In the case where several formats of the same font family or font collection | ||
| 590 | are packaged separately, a short form of the format, prepended by a dash, is | ||
| 591 | added to the package name. We use @code{-ttf} for TrueType fonts, | ||
| 592 | @code{-otf} for OpenType fonts and @code{-type1} for PostScript Type 1 | ||
| 593 | fonts. | ||
| 594 | |||
| 595 | |||
| 596 | @node 代码风格 | ||
| 597 | @section 代码风格 | ||
| 598 | |||
| 599 | In general our code follows the GNU Coding Standards (@pxref{Top,,, | ||
| 600 | standards, GNU Coding Standards}). However, they do not say much about | ||
| 601 | Scheme, so here are some additional rules. | ||
| 602 | |||
| 603 | @menu | ||
| 604 | * Programming Paradigm:: How to compose your elements. | ||
| 605 | * Modules:: Where to store your code? | ||
| 606 | * Data Types and Pattern Matching:: Implementing data structures. | ||
| 607 | * Formatting Code:: Writing conventions. | ||
| 608 | @end menu | ||
| 609 | |||
| 610 | @node Programming Paradigm | ||
| 611 | @subsection Programming Paradigm | ||
| 612 | |||
| 613 | Scheme code in Guix is written in a purely functional style. One exception | ||
| 614 | is code that involves input/output, and procedures that implement low-level | ||
| 615 | concepts, such as the @code{memoize} procedure. | ||
| 616 | |||
| 617 | @node Modules | ||
| 618 | @subsection Modules | ||
| 619 | |||
| 620 | Guile modules that are meant to be used on the builder side must live in the | ||
| 621 | @code{(guix build @dots{})} name space. They must not refer to other Guix | ||
| 622 | or GNU modules. However, it is OK for a ``host-side'' module to use a | ||
| 623 | build-side module. | ||
| 624 | |||
| 625 | Modules that deal with the broader GNU system should be in the @code{(gnu | ||
| 626 | @dots{})} name space rather than @code{(guix @dots{})}. | ||
| 627 | |||
| 628 | @node Data Types and Pattern Matching | ||
| 629 | @subsection Data Types and Pattern Matching | ||
| 630 | |||
| 631 | The tendency in classical Lisp is to use lists to represent everything, and | ||
| 632 | then to browse them ``by hand'' using @code{car}, @code{cdr}, @code{cadr}, | ||
| 633 | and co. There are several problems with that style, notably the fact that | ||
| 634 | it is hard to read, error-prone, and a hindrance to proper type error | ||
| 635 | reports. | ||
| 636 | |||
| 637 | Guix code should define appropriate data types (for instance, using | ||
| 638 | @code{define-record-type*}) rather than abuse lists. In addition, it should | ||
| 639 | use pattern matching, via Guile’s @code{(ice-9 match)} module, especially | ||
| 640 | when matching lists. | ||
| 641 | |||
| 642 | @node Formatting Code | ||
| 643 | @subsection Formatting Code | ||
| 644 | |||
| 645 | @cindex formatting code | ||
| 646 | @cindex coding style | ||
| 647 | When writing Scheme code, we follow common wisdom among Scheme programmers. | ||
| 648 | In general, we follow the @url{http://mumble.net/~campbell/scheme/style.txt, | ||
| 649 | Riastradh's Lisp Style Rules}. This document happens to describe the | ||
| 650 | conventions mostly used in Guile’s code too. It is very thoughtful and well | ||
| 651 | written, so please do read it. | ||
| 652 | |||
| 653 | Some special forms introduced in Guix, such as the @code{substitute*} macro, | ||
| 654 | have special indentation rules. These are defined in the | ||
| 655 | @file{.dir-locals.el} file, which Emacs automatically uses. Also note that | ||
| 656 | Emacs-Guix provides @code{guix-devel-mode} mode that indents and highlights | ||
| 657 | Guix code properly (@pxref{Development,,, emacs-guix, The Emacs-Guix | ||
| 658 | Reference Manual}). | ||
| 659 | |||
| 660 | @cindex indentation, of code | ||
| 661 | @cindex formatting, of code | ||
| 662 | If you do not use Emacs, please make sure to let your editor knows these | ||
| 663 | rules. To automatically indent a package definition, you can also run: | ||
| 664 | |||
| 665 | @example | ||
| 666 | ./etc/indent-code.el gnu/packages/@var{file}.scm @var{package} | ||
| 667 | @end example | ||
| 668 | |||
| 669 | @noindent | ||
| 670 | This automatically indents the definition of @var{package} in | ||
| 671 | @file{gnu/packages/@var{file}.scm} by running Emacs in batch mode. To | ||
| 672 | indent a whole file, omit the second argument: | ||
| 673 | |||
| 674 | @example | ||
| 675 | ./etc/indent-code.el gnu/services/@var{file}.scm | ||
| 676 | @end example | ||
| 677 | |||
| 678 | @cindex Vim, Scheme code editing | ||
| 679 | If you are editing code with Vim, we recommend that you run @code{:set | ||
| 680 | autoindent} so that your code is automatically indented as you type. | ||
| 681 | Additionally, @uref{https://www.vim.org/scripts/script.php?script_id=3998, | ||
| 682 | @code{paredit.vim}} may help you deal with all these parentheses. | ||
| 683 | |||
| 684 | We require all top-level procedures to carry a docstring. This requirement | ||
| 685 | can be relaxed for simple private procedures in the @code{(guix build | ||
| 686 | @dots{})} name space, though. | ||
| 687 | |||
| 688 | Procedures should not have more than four positional parameters. Use | ||
| 689 | keyword parameters for procedures that take more than four parameters. | ||
| 690 | |||
| 691 | |||
| 692 | @node 提交补丁 | ||
| 693 | @section 提交补丁 | ||
| 694 | |||
| 695 | Development is done using the Git distributed version control system. Thus, | ||
| 696 | access to the repository is not strictly necessary. We welcome | ||
| 697 | contributions in the form of patches as produced by @code{git format-patch} | ||
| 698 | sent to the @email{guix-patches@@gnu.org} mailing list. | ||
| 699 | |||
| 700 | This mailing list is backed by a Debbugs instance accessible at | ||
| 701 | @uref{https://bugs.gnu.org/guix-patches}, which allows us to keep track of | ||
| 702 | submissions. Each message sent to that mailing list gets a new tracking | ||
| 703 | number assigned; people can then follow up on the submission by sending | ||
| 704 | email to @code{@var{NNN}@@debbugs.gnu.org}, where @var{NNN} is the tracking | ||
| 705 | number (@pxref{Sending a Patch Series}). | ||
| 706 | |||
| 707 | Please write commit logs in the ChangeLog format (@pxref{Change Logs,,, | ||
| 708 | standards, GNU Coding Standards}); you can check the commit history for | ||
| 709 | examples. | ||
| 710 | |||
| 711 | Before submitting a patch that adds or modifies a package definition, please | ||
| 712 | run through this check list: | ||
| 713 | |||
| 714 | @enumerate | ||
| 715 | @item | ||
| 716 | If the authors of the packaged software provide a cryptographic signature | ||
| 717 | for the release tarball, make an effort to verify the authenticity of the | ||
| 718 | archive. For a detached GPG signature file this would be done with the | ||
| 719 | @code{gpg --verify} command. | ||
| 720 | |||
| 721 | @item | ||
| 722 | Take some time to provide an adequate synopsis and description for the | ||
| 723 | package. @xref{简介和描述}, for some guidelines. | ||
| 724 | |||
| 725 | @item | ||
| 726 | Run @code{guix lint @var{package}}, where @var{package} is the name of the | ||
| 727 | new or modified package, and fix any errors it reports (@pxref{Invoking guix | ||
| 728 | lint}). | ||
| 729 | |||
| 730 | @item | ||
| 731 | Make sure the package builds on your platform, using @code{guix build | ||
| 732 | @var{package}}. | ||
| 733 | |||
| 734 | @item | ||
| 735 | We recommend you also try building the package on other supported | ||
| 736 | platforms. As you may not have access to actual hardware platforms, we | ||
| 737 | recommend using the @code{qemu-binfmt-service-type} to emulate them. In | ||
| 738 | order to enable it, add the following service to the list of services in | ||
| 739 | your @code{operating-system} configuration: | ||
| 740 | |||
| 741 | @example | ||
| 742 | (service qemu-binfmt-service-type | ||
| 743 | (qemu-binfmt-configuration | ||
| 744 | (platforms (lookup-qemu-platforms "arm" "aarch64" "mips64el")) | ||
| 745 | (guix-support? #t))) | ||
| 746 | @end example | ||
| 747 | |||
| 748 | Then reconfigure your system. | ||
| 749 | |||
| 750 | You can then build packages for different platforms by specifying the | ||
| 751 | @code{--system} option. For example, to build the "hello" package for the | ||
| 752 | armhf, aarch64, or mips64 architectures, you would run the following | ||
| 753 | commands, respectively: | ||
| 754 | @example | ||
| 755 | guix build --system=armhf-linux --rounds=2 hello | ||
| 756 | guix build --system=aarch64-linux --rounds=2 hello | ||
| 757 | guix build --system=mips64el-linux --rounds=2 hello | ||
| 758 | @end example | ||
| 759 | |||
| 760 | @item | ||
| 761 | @cindex bundling | ||
| 762 | Make sure the package does not use bundled copies of software already | ||
| 763 | available as separate packages. | ||
| 764 | |||
| 765 | Sometimes, packages include copies of the source code of their dependencies | ||
| 766 | as a convenience for users. However, as a distribution, we want to make | ||
| 767 | sure that such packages end up using the copy we already have in the | ||
| 768 | distribution, if there is one. This improves resource usage (the dependency | ||
| 769 | is built and stored only once), and allows the distribution to make | ||
| 770 | transverse changes such as applying security updates for a given software | ||
| 771 | package in a single place and have them affect the whole system---something | ||
| 772 | that bundled copies prevent. | ||
| 773 | |||
| 774 | @item | ||
| 775 | Take a look at the profile reported by @command{guix size} (@pxref{Invoking | ||
| 776 | guix size}). This will allow you to notice references to other packages | ||
| 777 | unwillingly retained. It may also help determine whether to split the | ||
| 778 | package (@pxref{Packages with Multiple Outputs}), and which optional | ||
| 779 | dependencies should be used. In particular, avoid adding @code{texlive} as | ||
| 780 | a dependency: because of its extreme size, use @code{texlive-tiny} or | ||
| 781 | @code{texlive-union} instead. | ||
| 782 | |||
| 783 | @item | ||
| 784 | For important changes, check that dependent package (if applicable) are not | ||
| 785 | affected by the change; @code{guix refresh --list-dependent @var{package}} | ||
| 786 | will help you do that (@pxref{Invoking guix refresh}). | ||
| 787 | |||
| 788 | @c See <https://lists.gnu.org/archive/html/guix-devel/2016-10/msg00933.html>. | ||
| 789 | @cindex branching strategy | ||
| 790 | @cindex rebuild scheduling strategy | ||
| 791 | Depending on the number of dependent packages and thus the amount of | ||
| 792 | rebuilding induced, commits go to different branches, along these lines: | ||
| 793 | |||
| 794 | @table @asis | ||
| 795 | @item 300 dependent packages or less | ||
| 796 | @code{master} branch (non-disruptive changes). | ||
| 797 | |||
| 798 | @item between 300 and 1,200 dependent packages | ||
| 799 | @code{staging} branch (non-disruptive changes). This branch is intended to | ||
| 800 | be merged in @code{master} every 3 weeks or so. Topical changes (e.g., an | ||
| 801 | update of the GNOME stack) can instead go to a specific branch (say, | ||
| 802 | @code{gnome-updates}). | ||
| 803 | |||
| 804 | @item more than 1,200 dependent packages | ||
| 805 | @code{core-updates} branch (may include major and potentially disruptive | ||
| 806 | changes). This branch is intended to be merged in @code{master} every 2.5 | ||
| 807 | months or so. | ||
| 808 | @end table | ||
| 809 | |||
| 810 | All these branches are @uref{https://hydra.gnu.org/project/gnu, tracked by | ||
| 811 | our build farm} and merged into @code{master} once everything has been | ||
| 812 | successfully built. This allows us to fix issues before they hit users, and | ||
| 813 | to reduce the window during which pre-built binaries are not available. | ||
| 814 | |||
| 815 | @c TODO: It would be good with badges on the website that tracks these | ||
| 816 | @c branches. Or maybe even a status page. | ||
| 817 | Generally, branches other than @code{master} are considered @emph{frozen} if | ||
| 818 | there has been a recent evaluation, or there is a corresponding @code{-next} | ||
| 819 | branch. Please ask on the mailing list or IRC if unsure where to place a | ||
| 820 | patch. | ||
| 821 | |||
| 822 | @item | ||
| 823 | @cindex determinism, of build processes | ||
| 824 | @cindex reproducible builds, checking | ||
| 825 | Check whether the package's build process is deterministic. This typically | ||
| 826 | means checking whether an independent build of the package yields the exact | ||
| 827 | same result that you obtained, bit for bit. | ||
| 828 | |||
| 829 | A simple way to do that is by building the same package several times in a | ||
| 830 | row on your machine (@pxref{Invoking guix build}): | ||
| 831 | |||
| 832 | @example | ||
| 833 | guix build --rounds=2 my-package | ||
| 834 | @end example | ||
| 835 | |||
| 836 | This is enough to catch a class of common non-determinism issues, such as | ||
| 837 | timestamps or randomly-generated output in the build result. | ||
| 838 | |||
| 839 | Another option is to use @command{guix challenge} (@pxref{Invoking guix | ||
| 840 | challenge}). You may run it once the package has been committed and built | ||
| 841 | by @code{@value{SUBSTITUTE-SERVER}} to check whether it obtains the same | ||
| 842 | result as you did. Better yet: Find another machine that can build it and | ||
| 843 | run @command{guix publish}. Since the remote build machine is likely | ||
| 844 | different from yours, this can catch non-determinism issues related to the | ||
| 845 | hardware---e.g., use of different instruction set extensions---or to the | ||
| 846 | operating system kernel---e.g., reliance on @code{uname} or @file{/proc} | ||
| 847 | files. | ||
| 848 | |||
| 849 | @item | ||
| 850 | When writing documentation, please use gender-neutral wording when referring | ||
| 851 | to people, such as @uref{https://en.wikipedia.org/wiki/Singular_they, | ||
| 852 | singular ``they''@comma{} ``their''@comma{} ``them''}, and so forth. | ||
| 853 | |||
| 854 | @item | ||
| 855 | Verify that your patch contains only one set of related changes. Bundling | ||
| 856 | unrelated changes together makes reviewing harder and slower. | ||
| 857 | |||
| 858 | Examples of unrelated changes include the addition of several packages, or a | ||
| 859 | package update along with fixes to that package. | ||
| 860 | |||
| 861 | @item | ||
| 862 | Please follow our code formatting rules, possibly running the | ||
| 863 | @command{etc/indent-code.el} script to do that automatically for you | ||
| 864 | (@pxref{Formatting Code}). | ||
| 865 | |||
| 866 | @item | ||
| 867 | When possible, use mirrors in the source URL (@pxref{Invoking guix | ||
| 868 | download}). Use reliable URLs, not generated ones. For instance, GitHub | ||
| 869 | archives are not necessarily identical from one generation to the next, so | ||
| 870 | in this case it's often better to clone the repository. Don't use the | ||
| 871 | @command{name} field in the URL: it is not very useful and if the name | ||
| 872 | changes, the URL will probably be wrong. | ||
| 873 | |||
| 874 | @end enumerate | ||
| 875 | |||
| 876 | When posting a patch to the mailing list, use @samp{[PATCH] @dots{}} as a | ||
| 877 | subject. You may use your email client or the @command{git send-email} | ||
| 878 | command (@pxref{Sending a Patch Series}). We prefer to get patches in plain | ||
| 879 | text messages, either inline or as MIME attachments. You are advised to pay | ||
| 880 | attention if your email client changes anything like line breaks or | ||
| 881 | indentation which could potentially break the patches. | ||
| 882 | |||
| 883 | When a bug is resolved, please close the thread by sending an email to | ||
| 884 | @email{@var{NNN}-done@@debbugs.gnu.org}. | ||
| 885 | |||
| 886 | @unnumberedsubsec Sending a Patch Series | ||
| 887 | @anchor{Sending a Patch Series} | ||
| 888 | @cindex patch series | ||
| 889 | @cindex @code{git send-email} | ||
| 890 | @cindex @code{git-send-email} | ||
| 891 | |||
| 892 | @c Debbugs bug: https://debbugs.gnu.org/db/15/15361.html | ||
| 893 | When sending a patch series (e.g., using @code{git send-email}), please | ||
| 894 | first send one message to @email{guix-patches@@gnu.org}, and then send | ||
| 895 | subsequent patches to @email{@var{NNN}@@debbugs.gnu.org} to make sure they | ||
| 896 | are kept together. See @uref{https://debbugs.gnu.org/Advanced.html, the | ||
| 897 | Debbugs documentation} for more information. | ||
