git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #18972 from ericsagnes/doc/reviewing-contributions

[WIP] nixos-doc: add reviewing contributions chapter

commit0e3e7a6bcd96405ddc257b93d57cda09b558cbdb authorzimbatm <zimbatm@zimbatm.com> dateSat 1 Oct 2016, 15:09 (10 years ago) parent230512fbf86f9f
3 files changed+296
.github/CONTRIBUTING.md+3 nixos/doc/manual/development/development.xml+1 nixos/doc/manual/development/reviewing-contributions.xml+292
.github/CONTRIBUTING.md+3
@@ -30,3 +30,6 @@ under the terms of [COPYING](../COPYING), which is an MIT-like license.
3030
3131See the nixpkgs manual for more details on how to [Submit changes to nixpkgs](https://nixos.org/nixpkgs/manual/#chap-submitting-changes).
3232
33+## Reviewing contributions
34+
35+See the nixpkgs manual for more details on how to [Review contributions](http://hydra.nixos.org/job/nixpkgs/trunk/manual/latest/download-by-type/doc/manual#chap-reviewing-contributions).
nixos/doc/manual/development/development.xml+1
@@ -17,5 +17,6 @@ NixOS.</para>
1717<xi:include href="building-nixos.xml" />
1818<xi:include href="nixos-tests.xml" />
1919<xi:include href="testing-installer.xml" />
20+<xi:include href="reviewing-contributions.xml" />
2021
2122</part>
nixos/doc/manual/development/reviewing-contributions.xmlnew file+292
@@ -0,0 +1,292 @@
1+<chapter xmlns="http://docbook.org/ns/docbook"
2+ xmlns:xlink="http://www.w3.org/1999/xlink"
3+ xmlns:xi="http://www.w3.org/2001/XInclude"
4+ version="5.0"
5+ xml:id="sec-reviewing-contributions">
6+
7+<title>Reviewing contributions</title>
8+
9+<para>The nixpkgs projects receives a fairly high number of contributions via GitHub pull-requests. Reviewing and approving these is an important task and a way to contribute to the project.</para>
10+
11+<para>The high change rate of nixpkgs make any pull request that is open for long enough subject to conflicts that will require extra work from the submitter or the merger. Reviewing pull requests in a timely manner and being responsive to the comments is the key to avoid these. Github provides sort filters that can be used to see the <link xlink:href="https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc">most recently</link> and the <link xlink:href="https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-asc">least recently</link> updated pull-requests.</para>
12+
13+<para>When reviewing a pull request, please always be nice and polite. Controversial changes can lead to controversial opinions, but it is important to respect every community members and their work.</para>
14+
15+<para>GitHub provides reactions, they are a simple and quick way to provide feedback to pull-requests or any comments. The thumb-down reaction should be used with care and if possible accompanied with some explanations so the submitter has directions to improve his contribution.</para>
16+
17+<para>Pull-requests reviews should include a list of what has been reviewed in a comment, so other reviewers and mergers can know the state of the review.</para>
18+
19+<para>All the review template samples provided in this section are generic and meant as examples. Their usage is optional and the reviewer is free to adapt them to his liking.</para>
20+
21+<section><title>Package updates</title>
22+
23+<para>A package update is the most trivial and common type of pull-request. These pull-requests mainly consist in updating the version part of the package name and the source hash.</para>
24+<para>It can happen that non trivial updates include patches or more complex changes.</para>
25+
26+<para>Reviewing process:</para>
27+
28+<itemizedlist>
29+ <listitem><para>Add labels to the pull-request. (Requires commit rights)</para>
30+ <itemizedlist>
31+ <listitem><para><literal>8.has: package (update)</literal> and any topic label that fit the updated package.</para></listitem>
32+ </itemizedlist>
33+ </listitem>
34+ <listitem><para>Ensure that the package versioning is fitting the guidelines.</para></listitem>
35+ <listitem><para>Ensure that the commit text is fitting the guidelines.</para></listitem>
36+ <listitem><para>Ensure that the package maintainers are notified.</para>
37+ <itemizedlist>
38+ <listitem><para>mention-bot usually notify GitHub users based on the submitted changes, but it can happen that it misses some of the package maintainers.</para></listitem>
39+ </itemizedlist>
40+ </listitem>
41+ <listitem><para>Ensure that the meta field contains correct information.</para>
42+ <itemizedlist>
43+ <listitem><para>License can change with version updates, so it should be checked to be fitting upstream license.</para></listitem>
44+ <listitem><para>If the package has no maintainer, a maintainer must be set. This can be the update submitter or a community member that accepts to take maintainership of the package.</para></listitem>
45+ </itemizedlist>
46+ </listitem>
47+ <listitem><para>Ensure that the code contains no typos.</para></listitem>
48+ <listitem><para>Building the package locally.</para>
49+ <itemizedlist>
50+ <listitem><para>Pull-requests are often targeted to the master or staging branch so building the pull-request locally as it is submitted can trigger a large amount of source builds.</para>
51+ <para>It is possible to rebase the changes on nixos-unstable or nixpkgs-unstable for easier review by running the following commands from a nixpkgs clone.
52+<screen>
53+$ git remote add channels https://github.com/NixOS/nixpkgs-channels.git <co xml:id='reviewing-rebase-1' />
54+$ git fetch channels nixos-unstable <co xml:id='reviewing-rebase-2' />
55+$ git fetch origin pull/PRNUMBER/head <co xml:id='reviewing-rebase-3' />
56+$ git rebase --onto nixos-unstable BASEBRANCH FETCH_HEAD <co xml:id='reviewing-rebase-4' />
57+</screen>
58+ <calloutlist>
59+ <callout arearefs='reviewing-rebase-1'>
60+ <para>This should be done only once to be able to fetch channel branches from the nixpkgs-channels repository.</para>
61+ </callout>
62+ <callout arearefs='reviewing-rebase-2'>
63+ <para>Fetching the nixos-unstable branch.</para>
64+ </callout>
65+ <callout arearefs='reviewing-rebase-3'>
66+ <para>Fetching the pull-request changes, <varname>PRNUMBER</varname> is the number at the end of the pull-request title and <varname>BASEBRANCH</varname> the base branch of the pull-request.</para>
67+ </callout>
68+ <callout arearefs='reviewing-rebase-3'>
69+ <para>Rebasing the pull-request changes to the nixos-unstable branch.</para>
70+ </callout>
71+ </calloutlist>
72+ </para>
73+ </listitem>
74+ <listitem>
75+ <para>The <link xlink:href="https://github.com/madjar/nox">nox</link> tool can be used to review a pull-request content in a single command. It doesn't rebase on a channel branch so it might trigger multiple source builds. <varname>PRNUMBER</varname> should be replaced by the number at the end of the pull-request title.</para>
76+<screen>
77+$ nix-shell -p nox --run "nox-review -k pr PRNUMBER"
78+</screen>
79+ </listitem>
80+ </itemizedlist>
81+ </listitem>
82+ <listitem><para>Running every binary.</para></listitem>
83+</itemizedlist>
84+
85+<example><title>Sample template for a package update review</title>
86+<screen>
87+##### Reviewed points
88+
89+- [ ] package name fits guidelines
90+- [ ] package version fits guidelines
91+- [ ] package build on ARCHITECTURE
92+- [ ] executables tested on ARCHITECTURE
93+- [ ] all depending packages build
94+
95+##### Possible improvements
96+
97+##### Comments
98+
99+</screen></example>
100+</section>
101+
102+<section><title>New packages</title>
103+
104+<para>New packages are a common type of pull-requests. These pull requests consists in adding a new nix-expression for a package.</para>
105+
106+<para>Reviewing process:</para>
107+
108+<itemizedlist>
109+ <listitem><para>Add labels to the pull-request. (Requires commit rights)</para>
110+ <itemizedlist>
111+ <listitem><para><literal>8.has: package (new)</literal> and any topic label that fit the new package.</para></listitem>
112+ </itemizedlist>
113+ </listitem>
114+ <listitem><para>Ensure that the package versioning is fitting the guidelines.</para></listitem>
115+ <listitem><para>Ensure that the commit name is fitting the guidelines.</para></listitem>
116+ <listitem><para>Ensure that the meta field contains correct information.</para>
117+ <itemizedlist>
118+ <listitem><para>License must be checked to be fitting upstream license.</para></listitem>
119+ <listitem><para>Platforms should be set or the package will not get binary substitutes.</para></listitem>
120+ <listitem><para>A maintainer must be set, this can be the package submitter or a community member that accepts to take maintainership of the package.</para></listitem>
121+ </itemizedlist>
122+ </listitem>
123+ <listitem><para>Ensure that the code contains no typos.</para></listitem>
124+ <listitem><para>Ensure the package source.</para>
125+ <itemizedlist>
126+ <listitem><para>Mirrors urls should be used when available.</para></listitem>
127+ <listitem><para>The most appropriate function should be used (e.g. packages from GitHub should use <literal>fetchFromGitHub</literal>).</para></listitem>
128+ </itemizedlist>
129+ </listitem>
130+ <listitem><para>Building the package locally.</para></listitem>
131+ <listitem><para>Running every binary.</para></listitem>
132+</itemizedlist>
133+
134+<example><title>Sample template for a new package review</title>
135+<screen>
136+##### Reviewed points
137+
138+- [ ] package path fits guidelines
139+- [ ] package name fits guidelines
140+- [ ] package version fits guidelines
141+- [ ] package build on ARCHITECTURE
142+- [ ] executables tested on ARCHITECTURE
143+- [ ] `meta.description` is set and fits guidelines
144+- [ ] `meta.license` fits upstream license
145+- [ ] `meta.platforms` is set
146+- [ ] `meta.maintainers` is set
147+- [ ] build time only dependencies are declared in `nativeBuildInputs`
148+- [ ] source is fetched using the appropriate function
149+- [ ] phases are respected
150+- [ ] patches that are remotely available are fetched with `fetchPatch`
151+
152+##### Possible improvements
153+
154+##### Comments
155+
156+</screen></example>
157+</section>
158+
159+<section><title>Module updates</title>
160+
161+<para>Module updates are submissions changing modules in some ways. These often contains changes to the options or introduce new options.</para>
162+
163+<para>Reviewing process</para>
164+
165+<itemizedlist>
166+ <listitem><para>Add labels to the pull-request. (Requires commit rights)</para>
167+ <itemizedlist>
168+ <listitem><para><literal>8.has: module (update)</literal> and any topic label that fit the module.</para></listitem>
169+ </itemizedlist>
170+ </listitem>
171+ <listitem><para>Ensure that the module maintainers are notified.</para>
172+ <itemizedlist>
173+ <listitem><para>Mention-bot notify GitHub users based on the submitted changes, but it can happen that it miss some of the package maintainers.</para></listitem>
174+ </itemizedlist>
175+ </listitem>
176+ <listitem><para>Ensure that the module tests, if any, are succeeding.</para></listitem>
177+ <listitem><para>Ensure that the introduced options are correct.</para>
178+ <itemizedlist>
179+ <listitem><para>Type should be appropriate (string related types differs in their merging capabilities, <literal>optionSet</literal> and <literal>string</literal> types are deprecated).</para></listitem>
180+ <listitem><para>Description, default and example should be provided.</para></listitem>
181+ </itemizedlist>
182+ </listitem>
183+ <listitem><para>Ensure that option changes are backward compatible.</para>
184+ <itemizedlist>
185+ <listitem><para><literal>mkRenamedOptionModule</literal> and <literal>mkAliasOptionModule</literal> functions provide way to make option changes backward compatible.</para></listitem>
186+ </itemizedlist>
187+ </listitem>
188+ <listitem><para>Ensure that removed options are declared with <literal>mkRemovedOptionModule</literal></para></listitem>
189+ <listitem><para>Ensure that changes that are not backward compatible are mentioned in release notes.</para></listitem>
190+ <listitem><para>Ensure that documentations affected by the change is updated.</para></listitem>
191+</itemizedlist>
192+
193+<example><title>Sample template for a module update review</title>
194+<screen>
195+##### Reviewed points
196+
197+- [ ] changes are backward compatible
198+- [ ] removed options are declared with `mkRemovedOptionModule`
199+- [ ] changes that are not backward compatible are documented in release notes
200+- [ ] module tests succeed on ARCHITECTURE
201+- [ ] options types are appropriate
202+- [ ] options description is set
203+- [ ] options example is provided
204+- [ ] documentation affected by the changes is updated
205+
206+##### Possible improvements
207+
208+##### Comments
209+
210+</screen></example>
211+</section>
212+
213+<section><title>New modules</title>
214+
215+<para>New modules submissions introduce a new module to NixOS.</para>
216+
217+<itemizedlist>
218+ <listitem><para>Add labels to the pull-request. (Requires commit rights)</para>
219+ <itemizedlist>
220+ <listitem><para><literal>8.has: module (new)</literal> and any topic label that fit the module.</para></listitem>
221+ </itemizedlist>
222+ </listitem>
223+ <listitem><para>Ensure that the module tests, if any, are succeeding.</para></listitem>
224+ <listitem><para>Ensure that the introduced options are correct.</para>
225+ <itemizedlist>
226+ <listitem><para>Type should be appropriate (string related types differs in their merging capabilities, <literal>optionSet</literal> and <literal>string</literal> types are deprecated).</para></listitem>
227+ <listitem><para>Description, default and example should be provided.</para></listitem>
228+ </itemizedlist>
229+ </listitem>
230+ <listitem><para>Ensure that module <literal>meta</literal> field is present</para>
231+ <itemizedlist>
232+ <listitem><para>Maintainers should be declared in <literal>meta.maintainers</literal>.</para></listitem>
233+ <listitem><para>Module documentation should be declared with <literal>meta.doc</literal>.</para></listitem>
234+ </itemizedlist>
235+ </listitem>
236+ <listitem><para>Ensure that the module respect other modules functionality.</para>
237+ <itemizedlist>
238+ <listitem><para>For example, enabling a module should not open firewall ports by default.</para></listitem>
239+ </itemizedlist>
240+ </listitem>
241+</itemizedlist>
242+
243+<example><title>Sample template for a new module review</title>
244+<screen>
245+##### Reviewed points
246+
247+- [ ] module path fits the guidelines
248+- [ ] module tests succeed on ARCHITECTURE
249+- [ ] options have appropriate types
250+- [ ] options have default
251+- [ ] options have example
252+- [ ] options have descriptions
253+- [ ] No unneeded package is added to system.environmentPackages
254+- [ ] meta.maintainers is set
255+- [ ] module documentation is declared in meta.doc
256+
257+##### Possible improvements
258+
259+##### Comments
260+
261+</screen></example>
262+</section>
263+
264+<section><title>Other submissions</title>
265+
266+<para>Other type of submissions requires different reviewing steps.</para>
267+
268+<para>If you consider having enough knowledge and experience in a topic and would like to be a long-term reviewer for related submissions, please contact the current reviewers for that topic. They will give you information about the reviewing process.
269+The main reviewers for a topic can be hard to find as there is no list, but checking past pull-requests to see who reviewed or git-blaming the code to see who committed to that topic can give some hints.</para>
270+
271+<para>Container system, boot system and library changes are some examples of the pull requests fitting this category.</para>
272+
273+</section>
274+
275+<section><title>Merging pull-requests</title>
276+
277+<para>It is possible for community members that have enough knowledge and experience on a special topic to contribute by merging pull requests.</para>
278+
279+<para>TODO: add the procedure to request merging rights.</para>
280+
281+<!--
282+The following paragraph about how to deal with unactive contributors is just a
283+proposition and should be modified to what the community agrees to be the right
284+policy.
285+
286+<para>Please note that contributors with commit rights unactive for more than three months will have their commit rights revoked.</para>
287+-->
288+
289+<para>In a case a contributor leaves definitively the Nix community, he should create an issue or notify the mailing list with references of packages and modules he maintains so the maintainership can be taken over by other contributors.</para>
290+
291+</section>
292+</chapter>