2016-09-26 08:36:03 +02:00
<chapter xmlns= "http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude"
version="5.0"
xml:id="sec-reviewing-contributions">
<title > Reviewing contributions</title>
2016-10-01 17:50:16 +02:00
<warning >
2017-12-20 02:16:08 +01:00
<para > The following section is a draft and reviewing policy is still being
2016-10-01 17:50:16 +02:00
discussed.</para>
</warning>
2017-12-20 02:16:08 +01:00
<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
2016-10-01 17:50:16 +02:00
way to contribute to the project.</para>
2017-12-20 02:16:08 +01:00
<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
2018-04-24 00:07:53 +02:00
recently</link> updated pull-requests.
We highly encourage looking at <link xlink:href= "https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+review%3Anone+status%3Asuccess+-label%3A%222.status%3A+work-in-progress%22+no%3Aproject+no%3Aassignee+no%3Amilestone" >
this list of ready to merge, unreviewed pull requests</link> .</para>
2016-10-01 17:50:16 +02:00
2017-12-20 02:16:08 +01:00
<para > When reviewing a pull request, please always be nice and polite.
Controversial changes can lead to controversial opinions, but it is important
2016-10-01 17:50:16 +02:00
to respect every community members and their work.</para>
2017-12-20 02:16:08 +01:00
<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
2016-10-01 17:50:16 +02:00
submitter has directions to improve his contribution.</para>
2017-12-20 02:16:08 +01:00
<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
2016-10-01 17:50:16 +02:00
review.</para>
2017-12-20 02:16:08 +01:00
<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
2016-10-01 17:50:16 +02:00
them to his liking.</para>
2016-09-26 08:36:03 +02:00
<section > <title > Package updates</title>
2017-12-20 02:16:08 +01:00
<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
2016-10-01 17:50:16 +02:00
name and the source hash.</para>
2017-12-20 02:16:08 +01:00
<para > It can happen that non trivial updates include patches or more complex
2016-10-01 17:50:16 +02:00
changes.</para>
2016-09-26 08:36:03 +02:00
<para > Reviewing process:</para>
<itemizedlist >
2017-12-20 02:16:08 +01:00
<listitem > <para > Add labels to the pull-request. (Requires commit
2016-10-01 17:50:16 +02:00
rights)</para>
2016-09-26 08:36:03 +02:00
<itemizedlist >
2017-12-20 02:16:08 +01:00
<listitem > <para > <literal > 8.has: package (update)</literal> and any topic
2016-10-01 17:50:16 +02:00
label that fit the updated package.</para> </listitem>
2016-09-26 08:36:03 +02:00
</itemizedlist>
</listitem>
2017-12-20 02:16:08 +01:00
<listitem > <para > Ensure that the package versioning is fitting the
2016-10-01 17:50:16 +02:00
guidelines.</para> </listitem>
2017-12-20 02:16:08 +01:00
<listitem > <para > Ensure that the commit text is fitting the
2016-10-01 17:50:16 +02:00
guidelines.</para> </listitem>
2016-09-28 04:05:22 +02:00
<listitem > <para > Ensure that the package maintainers are notified.</para>
2016-09-26 08:36:03 +02:00
<itemizedlist >
2017-12-20 02:16:08 +01:00
<listitem > <para > mention-bot usually notify GitHub users based on the
submitted changes, but it can happen that it misses some of the
2016-10-01 17:50:16 +02:00
package maintainers.</para> </listitem>
2016-09-26 17:36:59 +02:00
</itemizedlist>
</listitem>
2017-12-20 02:16:08 +01:00
<listitem > <para > Ensure that the meta field contains correct
2016-10-01 17:50:16 +02:00
information.</para>
2016-09-26 17:36:59 +02:00
<itemizedlist >
2017-12-20 02:16:08 +01:00
<listitem > <para > License can change with version updates, so it should be
2016-10-01 17:50:16 +02:00
checked to be fitting upstream license.</para> </listitem>
2017-12-20 02:16:08 +01:00
<listitem > <para > If the package has no maintainer, a maintainer must be
set. This can be the update submitter or a community member that
2016-10-01 17:50:16 +02:00
accepts to take maintainership of the package.</para> </listitem>
2016-09-26 08:36:03 +02:00
</itemizedlist>
</listitem>
2016-09-28 04:05:22 +02:00
<listitem > <para > Ensure that the code contains no typos.</para> </listitem>
2016-09-26 08:36:03 +02:00
<listitem > <para > Building the package locally.</para>
<itemizedlist >
2017-12-20 02:16:08 +01:00
<listitem > <para > Pull-requests are often targeted to the master or staging
branch so building the pull-request locally as it is submitted can
2016-10-01 17:50:16 +02:00
trigger a large amount of source builds.</para>
2017-12-20 02:16:08 +01:00
<para > It is possible to rebase the changes on nixos-unstable or
nixpkgs-unstable for easier review by running the following commands
2016-10-01 17:50:16 +02:00
from a nixpkgs clone.
2016-09-26 08:36:03 +02:00
<screen >
2017-12-20 02:16:08 +01:00
$ git remote add channels https://github.com/NixOS/nixpkgs-channels.git <co
2016-10-01 17:50:16 +02:00
xml:id='reviewing-rebase-1' />
2016-09-28 04:05:22 +02:00
$ git fetch channels nixos-unstable <co xml:id= 'reviewing-rebase-2' />
2016-10-01 12:02:09 +02:00
$ git fetch origin pull/PRNUMBER/head <co xml:id= 'reviewing-rebase-3' />
2017-12-20 02:16:08 +01:00
$ git rebase --onto nixos-unstable BASEBRANCH FETCH_HEAD <co
2016-10-01 17:50:16 +02:00
xml:id='reviewing-rebase-4' />
2016-09-26 17:36:59 +02:00
</screen>
2016-09-28 04:05:22 +02:00
<calloutlist >
<callout arearefs= 'reviewing-rebase-1' >
2017-12-20 02:16:08 +01:00
<para > This should be done only once to be able to fetch channel
2016-10-01 17:50:16 +02:00
branches from the nixpkgs-channels repository.</para>
2016-09-28 04:05:22 +02:00
</callout>
<callout arearefs= 'reviewing-rebase-2' >
<para > Fetching the nixos-unstable branch.</para>
</callout>
<callout arearefs= 'reviewing-rebase-3' >
2017-12-20 02:16:08 +01:00
<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
2016-10-01 17:50:16 +02:00
pull-request.</para>
2016-09-28 04:05:22 +02:00
</callout>
2018-04-07 21:50:18 +02:00
<callout arearefs= 'reviewing-rebase-4' >
2017-12-20 02:16:08 +01:00
<para > Rebasing the pull-request changes to the nixos-unstable
2016-10-01 17:50:16 +02:00
branch.</para>
2016-09-28 04:05:22 +02:00
</callout>
</calloutlist>
</para>
2016-09-26 17:36:59 +02:00
</listitem>
<listitem >
2017-12-20 02:16:08 +01:00
<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
2016-10-01 17:50:16 +02:00
number at the end of the pull-request title.</para>
2016-09-26 17:36:59 +02:00
<screen >
2016-09-28 04:05:22 +02:00
$ nix-shell -p nox --run "nox-review -k pr PRNUMBER"
2016-09-26 08:36:03 +02:00
</screen>
</listitem>
</itemizedlist>
</listitem>
<listitem > <para > Running every binary.</para> </listitem>
</itemizedlist>
<example > <title > Sample template for a package update review</title>
<screen >
##### Reviewed points
- [ ] package name fits guidelines
- [ ] package version fits guidelines
- [ ] package build on ARCHITECTURE
- [ ] executables tested on ARCHITECTURE
- [ ] all depending packages build
##### Possible improvements
##### Comments
</screen> </example>
</section>
<section > <title > New packages</title>
2017-12-20 02:16:08 +01:00
<para > New packages are a common type of pull-requests. These pull requests
2016-10-01 17:50:16 +02:00
consists in adding a new nix-expression for a package.</para>
2016-09-26 08:36:03 +02:00
<para > Reviewing process:</para>
<itemizedlist >
2017-12-20 02:16:08 +01:00
<listitem > <para > Add labels to the pull-request. (Requires commit
2016-10-01 17:50:16 +02:00
rights)</para>
2016-09-26 08:36:03 +02:00
<itemizedlist >
2017-12-20 02:16:08 +01:00
<listitem > <para > <literal > 8.has: package (new)</literal> and any topic
2016-10-01 17:50:16 +02:00
label that fit the new package.</para> </listitem>
2016-09-26 08:36:03 +02:00
</itemizedlist>
</listitem>
2017-12-20 02:16:08 +01:00
<listitem > <para > Ensure that the package versioning is fitting the
2016-10-01 17:50:16 +02:00
guidelines.</para> </listitem>
2017-12-20 02:16:08 +01:00
<listitem > <para > Ensure that the commit name is fitting the
2016-10-01 17:50:16 +02:00
guidelines.</para> </listitem>
2017-12-20 02:16:08 +01:00
<listitem > <para > Ensure that the meta field contains correct
2016-10-01 17:50:16 +02:00
information.</para>
2016-09-26 08:36:03 +02:00
<itemizedlist >
2017-12-20 02:16:08 +01:00
<listitem > <para > License must be checked to be fitting upstream
2016-10-01 17:50:16 +02:00
license.</para> </listitem>
2017-12-20 02:16:08 +01:00
<listitem > <para > Platforms should be set or the package will not get binary
2016-10-01 17:50:16 +02:00
substitutes.</para> </listitem>
2017-12-20 02:16:08 +01:00
<listitem > <para > A maintainer must be set, this can be the package
submitter or a community member that accepts to take maintainership of
2016-10-01 17:50:16 +02:00
the package.</para> </listitem>
2016-09-26 08:36:03 +02:00
</itemizedlist>
</listitem>
2016-09-28 04:05:22 +02:00
<listitem > <para > Ensure that the code contains no typos.</para> </listitem>
<listitem > <para > Ensure the package source.</para>
2016-09-26 08:36:03 +02:00
<itemizedlist >
2017-12-20 02:16:08 +01:00
<listitem > <para > Mirrors urls should be used when
2016-10-01 17:50:16 +02:00
available.</para> </listitem>
2017-12-20 02:16:08 +01:00
<listitem > <para > The most appropriate function should be used (e.g.
packages from GitHub should use
2016-10-01 17:50:16 +02:00
<literal > fetchFromGitHub</literal> ).</para> </listitem>
2016-09-26 08:36:03 +02:00
</itemizedlist>
</listitem>
<listitem > <para > Building the package locally.</para> </listitem>
<listitem > <para > Running every binary.</para> </listitem>
</itemizedlist>
<example > <title > Sample template for a new package review</title>
<screen >
##### Reviewed points
- [ ] package path fits guidelines
- [ ] package name fits guidelines
- [ ] package version fits guidelines
- [ ] package build on ARCHITECTURE
- [ ] executables tested on ARCHITECTURE
- [ ] `meta.description` is set and fits guidelines
- [ ] `meta.license` fits upstream license
- [ ] `meta.platforms` is set
- [ ] `meta.maintainers` is set
- [ ] build time only dependencies are declared in `nativeBuildInputs`
- [ ] source is fetched using the appropriate function
- [ ] phases are respected
2016-10-05 10:40:32 +02:00
- [ ] patches that are remotely available are fetched with `fetchpatch`
2016-09-26 08:36:03 +02:00
##### Possible improvements
##### Comments
</screen> </example>
</section>
<section > <title > Module updates</title>
2017-12-20 02:16:08 +01:00
<para > Module updates are submissions changing modules in some ways. These often
2016-10-01 17:50:16 +02:00
contains changes to the options or introduce new options.</para>
2016-09-26 08:36:03 +02:00
<para > Reviewing process</para>
<itemizedlist >
2017-12-20 02:16:08 +01:00
<listitem > <para > Add labels to the pull-request. (Requires commit
2016-10-01 17:50:16 +02:00
rights)</para>
2016-09-26 08:36:03 +02:00
<itemizedlist >
2017-12-20 02:16:08 +01:00
<listitem > <para > <literal > 8.has: module (update)</literal> and any topic
2016-10-01 17:50:16 +02:00
label that fit the module.</para> </listitem>
2016-09-26 08:36:03 +02:00
</itemizedlist>
</listitem>
2016-09-28 04:05:22 +02:00
<listitem > <para > Ensure that the module maintainers are notified.</para>
2016-09-26 08:36:03 +02:00
<itemizedlist >
2017-12-20 02:16:08 +01:00
<listitem > <para > Mention-bot notify GitHub users based on the submitted
changes, but it can happen that it miss some of the package
2016-10-01 17:50:16 +02:00
maintainers.</para> </listitem>
2016-09-26 08:36:03 +02:00
</itemizedlist>
</listitem>
2017-12-20 02:16:08 +01:00
<listitem > <para > Ensure that the module tests, if any, are
2016-10-01 17:50:16 +02:00
succeeding.</para> </listitem>
2016-09-28 04:05:22 +02:00
<listitem > <para > Ensure that the introduced options are correct.</para>
2016-09-26 08:36:03 +02:00
<itemizedlist >
2017-12-20 02:16:08 +01:00
<listitem > <para > Type should be appropriate (string related types differs
in their merging capabilities, <literal > optionSet</literal> and
2016-10-01 17:50:16 +02:00
<literal > string</literal> types are deprecated).</para> </listitem>
2017-12-20 02:16:08 +01:00
<listitem > <para > Description, default and example should be
2016-10-01 17:50:16 +02:00
provided.</para> </listitem>
2016-09-26 08:36:03 +02:00
</itemizedlist>
</listitem>
2016-09-28 04:05:22 +02:00
<listitem > <para > Ensure that option changes are backward compatible.</para>
2016-09-26 08:36:03 +02:00
<itemizedlist >
2017-12-20 02:16:08 +01:00
<listitem > <para > <literal > mkRenamedOptionModule</literal> and
<literal > mkAliasOptionModule</literal> functions provide way to make
2016-10-01 17:50:16 +02:00
option changes backward compatible.</para> </listitem>
2016-09-26 08:36:03 +02:00
</itemizedlist>
</listitem>
2017-12-20 02:16:08 +01:00
<listitem > <para > Ensure that removed options are declared with
2016-10-01 17:50:16 +02:00
<literal > mkRemovedOptionModule</literal> </para> </listitem>
2017-12-20 02:16:08 +01:00
<listitem > <para > Ensure that changes that are not backward compatible are
2016-10-01 17:50:16 +02:00
mentioned in release notes.</para> </listitem>
2017-12-20 02:16:08 +01:00
<listitem > <para > Ensure that documentations affected by the change is
2016-10-01 17:50:16 +02:00
updated.</para> </listitem>
2016-09-26 08:36:03 +02:00
</itemizedlist>
<example > <title > Sample template for a module update review</title>
<screen >
##### Reviewed points
- [ ] changes are backward compatible
- [ ] removed options are declared with `mkRemovedOptionModule`
- [ ] changes that are not backward compatible are documented in release notes
- [ ] module tests succeed on ARCHITECTURE
- [ ] options types are appropriate
- [ ] options description is set
- [ ] options example is provided
- [ ] documentation affected by the changes is updated
##### Possible improvements
##### Comments
</screen> </example>
</section>
<section > <title > New modules</title>
<para > New modules submissions introduce a new module to NixOS.</para>
<itemizedlist >
2017-12-20 02:16:08 +01:00
<listitem > <para > Add labels to the pull-request. (Requires commit
2016-10-01 17:50:16 +02:00
rights)</para>
2016-09-26 08:36:03 +02:00
<itemizedlist >
2017-12-20 02:16:08 +01:00
<listitem > <para > <literal > 8.has: module (new)</literal> and any topic label
2016-10-01 17:50:16 +02:00
that fit the module.</para> </listitem>
2016-09-26 08:36:03 +02:00
</itemizedlist>
</listitem>
2017-12-20 02:16:08 +01:00
<listitem > <para > Ensure that the module tests, if any, are
2016-10-01 17:50:16 +02:00
succeeding.</para> </listitem>
2016-09-28 04:05:22 +02:00
<listitem > <para > Ensure that the introduced options are correct.</para>
2016-09-26 08:36:03 +02:00
<itemizedlist >
2017-12-20 02:16:08 +01:00
<listitem > <para > Type should be appropriate (string related types differs
in their merging capabilities, <literal > optionSet</literal> and
2016-10-01 17:50:16 +02:00
<literal > string</literal> types are deprecated).</para> </listitem>
2017-12-20 02:16:08 +01:00
<listitem > <para > Description, default and example should be
2016-10-01 17:50:16 +02:00
provided.</para> </listitem>
2016-09-26 08:36:03 +02:00
</itemizedlist>
</listitem>
2017-12-20 02:16:08 +01:00
<listitem > <para > Ensure that module <literal > meta</literal> field is
2016-10-01 17:50:16 +02:00
present</para>
2016-09-26 08:36:03 +02:00
<itemizedlist >
2017-12-20 02:16:08 +01:00
<listitem > <para > Maintainers should be declared in
2016-10-01 17:50:16 +02:00
<literal > meta.maintainers</literal> .</para> </listitem>
2017-12-20 02:16:08 +01:00
<listitem > <para > Module documentation should be declared with
2016-10-01 17:50:16 +02:00
<literal > meta.doc</literal> .</para> </listitem>
2016-09-26 08:36:03 +02:00
</itemizedlist>
</listitem>
2017-12-20 02:16:08 +01:00
<listitem > <para > Ensure that the module respect other modules
2016-10-01 17:50:16 +02:00
functionality.</para>
2016-09-26 08:36:03 +02:00
<itemizedlist >
2017-12-20 02:16:08 +01:00
<listitem > <para > For example, enabling a module should not open firewall
2016-10-01 17:50:16 +02:00
ports by default.</para> </listitem>
2016-09-26 08:36:03 +02:00
</itemizedlist>
</listitem>
</itemizedlist>
<example > <title > Sample template for a new module review</title>
<screen >
##### Reviewed points
- [ ] module path fits the guidelines
- [ ] module tests succeed on ARCHITECTURE
- [ ] options have appropriate types
- [ ] options have default
- [ ] options have example
- [ ] options have descriptions
2017-12-20 02:16:08 +01:00
- [ ] No unneeded package is added to environment.systemPackages
2016-09-26 08:36:03 +02:00
- [ ] meta.maintainers is set
- [ ] module documentation is declared in meta.doc
##### Possible improvements
##### Comments
</screen> </example>
</section>
<section > <title > Other submissions</title>
<para > Other type of submissions requires different reviewing steps.</para>
2017-12-20 02:16:08 +01:00
<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
2016-10-01 17:50:16 +02:00
reviewing process.
2017-12-20 02:16:08 +01:00
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
2016-10-01 17:50:16 +02:00
who committed to that topic can give some hints.</para>
2016-09-26 08:36:03 +02:00
2017-12-20 02:16:08 +01:00
<para > Container system, boot system and library changes are some examples of the
2016-10-01 17:50:16 +02:00
pull requests fitting this category.</para>
2016-09-26 08:36:03 +02:00
</section>
<section > <title > Merging pull-requests</title>
2017-12-20 02:16:08 +01:00
<para > It is possible for community members that have enough knowledge and
2016-10-01 17:50:16 +02:00
experience on a special topic to contribute by merging pull requests.</para>
2016-09-26 08:36:03 +02:00
<para > TODO: add the procedure to request merging rights.</para>
2016-10-01 12:02:09 +02:00
<!--
The following paragraph about how to deal with unactive contributors is just a
proposition and should be modified to what the community agrees to be the right
policy.
2017-12-20 02:16:08 +01:00
<para > Please note that contributors with commit rights unactive for more than
2016-10-01 17:50:16 +02:00
three months will have their commit rights revoked.</para>
2016-10-01 12:02:09 +02:00
-->
2016-09-26 17:36:59 +02:00
2017-12-20 02:16:08 +01:00
<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
2016-10-01 17:50:16 +02:00
contributors.</para>
2016-09-26 17:36:59 +02:00
2016-09-26 08:36:03 +02:00
</section>
</chapter>