1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-25 03:17:13 +00:00
nixpkgs/doc/reviewing-contributions.xml

620 lines
18 KiB
XML
Raw Normal View History

2016-09-26 07:36:03 +01: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">
2018-05-02 00:54:21 +01:00
<title>Reviewing contributions</title>
<warning>
<para>
2018-08-28 00:54:41 +01:00
The following section is a draft, and the policy for reviewing is still
being discussed in issues such as
<link
xlink:href="https://github.com/NixOS/nixpkgs/issues/11166">#11166
2018-08-28 00:54:41 +01:00
</link> and
<link
xlink:href="https://github.com/NixOS/nixpkgs/issues/20836">#20836
</link>.
2018-05-02 00:54:21 +01:00
</para>
</warning>
<para>
2018-11-19 05:10:39 +00:00
The Nixpkgs project receives a fairly high number of contributions via GitHub
pull requests. Reviewing and approving these is an important task and a way
2018-08-28 00:54:41 +01:00
to contribute to the project.
2018-05-02 00:54:21 +01:00
</para>
<para>
The high change rate of Nixpkgs makes any pull request that remains open for
too long subject to conflicts that will require extra work from the submitter
2019-03-09 05:07:11 +00:00
or the merger. Reviewing pull requests in a timely manner and being
responsive to the comments is the key to avoid this issue. GitHub provides
sort filters that can be used to see the
<link
2018-11-19 05:10:39 +00:00
xlink:href="https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc">most
2019-03-09 05:07:11 +00:00
recently</link> and the
<link
2018-11-19 05:10:39 +00:00
xlink:href="https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-asc">least
recently</link> updated pull requests. We highly encourage looking at
2018-05-02 00:54:21 +01:00
<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>.
2018-05-02 00:54:21 +01:00
</para>
<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 member and their work.
2018-05-02 00:54:21 +01:00
</para>
<para>
2018-08-28 00:54:41 +01:00
GitHub provides reactions as a simple and quick way to provide feedback to
pull requests or any comments. The thumb-down reaction should be used with
2018-08-28 00:54:41 +01:00
care and if possible accompanied with some explanation so the submitter has
directions to improve their contribution.
2018-05-02 00:54:21 +01:00
</para>
<para>
pull request reviews should include a list of what has been reviewed in a
2018-05-02 00:54:21 +01:00
comment, so other reviewers and mergers can know the state of the review.
</para>
<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 their liking.
2018-05-02 00:54:21 +01:00
</para>
2018-09-01 20:06:38 +01:00
<section xml:id="reviewing-contributions-package-updates">
2018-05-02 00:54:21 +01:00
<title>Package updates</title>
<para>
A package update is the most trivial and common type of pull request. These
pull requests mainly consist of updating the version part of the package
2018-05-02 00:54:21 +01:00
name and the source hash.
</para>
<para>
It can happen that non-trivial updates include patches or more complex
2018-05-02 00:54:21 +01:00
changes.
</para>
<para>
Reviewing process:
</para>
<itemizedlist>
<listitem>
<para>
Add labels to the pull request. (Requires commit rights)
2018-05-02 00:54:21 +01:00
</para>
2016-09-26 07:36:03 +01:00
<itemizedlist>
2018-05-02 00:54:21 +01:00
<listitem>
<para>
<literal>8.has: package (update)</literal> and any topic label that fit
the updated package.
</para>
</listitem>
2016-09-26 07:36:03 +01:00
</itemizedlist>
2018-05-02 00:54:21 +01:00
</listitem>
<listitem>
<para>
Ensure that the package versioning fits the guidelines.
2018-05-02 00:54:21 +01:00
</para>
</listitem>
<listitem>
<para>
Ensure that the commit text fits the guidelines.
2018-05-02 00:54:21 +01:00
</para>
</listitem>
<listitem>
<para>
Ensure that the package maintainers are notified.
</para>
2016-09-26 07:36:03 +01:00
<itemizedlist>
2018-05-02 00:54:21 +01:00
<listitem>
<para>
<link xlink:href="https://help.github.com/articles/about-codeowners/">CODEOWNERS</link>
will make GitHub notify users based on the submitted changes, but it can
happen that it misses some of the package maintainers.
2018-05-02 00:54:21 +01:00
</para>
</listitem>
2016-09-26 16:36:59 +01:00
</itemizedlist>
2018-05-02 00:54:21 +01:00
</listitem>
<listitem>
<para>
Ensure that the meta field information is correct.
2018-05-02 00:54:21 +01:00
</para>
2016-09-26 16:36:59 +01:00
<itemizedlist>
2018-05-02 00:54:21 +01:00
<listitem>
<para>
2018-08-28 00:54:41 +01:00
License can change with version updates, so it should be checked to
match the upstream license.
2018-05-02 00:54:21 +01:00
</para>
</listitem>
<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>
2016-09-26 07:36:03 +01:00
</itemizedlist>
2018-05-02 00:54:21 +01:00
</listitem>
<listitem>
<para>
Ensure that the code contains no typos.
</para>
</listitem>
<listitem>
<para>
Building the package locally.
</para>
2016-09-26 07:36:03 +01:00
<itemizedlist>
2018-05-02 00:54:21 +01:00
<listitem>
<para>
pull requests are often targeted to the master or staging branch, and
building the pull request locally when it is submitted can trigger many
2018-08-28 00:54:41 +01:00
source builds.
2018-05-02 00:54:21 +01:00
</para>
<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.
2016-09-26 07:36:03 +01:00
<screen>
2019-06-17 12:25:50 +01:00
<prompt>$ </prompt>git remote add channels https://github.com/NixOS/nixpkgs-channels.git <co
xml:id='reviewing-rebase-1' />
2019-06-17 12:25:50 +01:00
<prompt>$ </prompt>git fetch channels nixos-unstable <co xml:id='reviewing-rebase-2' />
<prompt>$ </prompt>git fetch origin pull/PRNUMBER/head <co xml:id='reviewing-rebase-3' />
<prompt>$ </prompt>git rebase --onto nixos-unstable BASEBRANCH FETCH_HEAD <co
xml:id='reviewing-rebase-4' />
2016-09-26 16:36:59 +01:00
</screen>
2018-05-02 00:54:21 +01:00
<calloutlist>
<callout arearefs='reviewing-rebase-1'>
<para>
This should be done only once to be able to fetch channel branches
from the nixpkgs-channels repository.
</para>
</callout>
<callout arearefs='reviewing-rebase-2'>
<para>
Fetching the nixos-unstable branch.
</para>
</callout>
<callout arearefs='reviewing-rebase-3'>
<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.
2018-05-02 00:54:21 +01:00
</para>
</callout>
<callout arearefs='reviewing-rebase-4'>
<para>
Rebasing the pull request changes to the nixos-unstable branch.
2018-05-02 00:54:21 +01:00
</para>
</callout>
</calloutlist>
</para>
</listitem>
<listitem>
<para>
2019-03-24 20:33:46 +00:00
The
<link xlink:href="https://github.com/Mic92/nix-review">nix-review</link>
tool can be used to review a pull request content in a single command.
2018-05-02 00:54:21 +01:00
<varname>PRNUMBER</varname> should be replaced by the number at the end
of the pull request title. You can also provide the full github pull
request url.
2018-05-02 00:54:21 +01:00
</para>
2016-09-26 16:36:59 +01:00
<screen>
2019-06-17 12:25:50 +01:00
<prompt>$ </prompt>nix-shell -p nix-review --run "nix-review pr PRNUMBER"
2016-09-26 07:36:03 +01:00
</screen>
2018-05-02 00:54:21 +01:00
</listitem>
2016-09-26 07:36:03 +01:00
</itemizedlist>
2018-05-02 00:54:21 +01:00
</listitem>
<listitem>
<para>
Running every binary.
</para>
</listitem>
</itemizedlist>
2018-09-01 20:20:57 +01:00
<example xml:id="reviewing-contributions-sample-package-update">
2018-05-02 00:54:21 +01:00
<title>Sample template for a package update review</title>
2016-09-26 07:36:03 +01:00
<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
2018-05-02 00:54:21 +01:00
</screen>
</example>
</section>
2018-09-01 20:06:38 +01:00
<section xml:id="reviewing-contributions-new-packages">
2018-05-02 00:54:21 +01:00
<title>New packages</title>
<para>
New packages are a common type of pull requests. These pull requests
2018-05-02 00:54:21 +01:00
consists in adding a new nix-expression for a package.
</para>
<para>
Reviewing process:
</para>
<itemizedlist>
<listitem>
<para>
Add labels to the pull request. (Requires commit rights)
2018-05-02 00:54:21 +01:00
</para>
2016-09-26 07:36:03 +01:00
<itemizedlist>
2018-05-02 00:54:21 +01:00
<listitem>
<para>
<literal>8.has: package (new)</literal> and any topic label that fit the
new package.
</para>
</listitem>
2016-09-26 07:36:03 +01:00
</itemizedlist>
2018-05-02 00:54:21 +01:00
</listitem>
<listitem>
<para>
Ensure that the package versioning is fitting the guidelines.
</para>
</listitem>
<listitem>
<para>
Ensure that the commit name is fitting the guidelines.
</para>
</listitem>
<listitem>
<para>
Ensure that the meta field contains correct information.
</para>
2016-09-26 07:36:03 +01:00
<itemizedlist>
2018-05-02 00:54:21 +01:00
<listitem>
<para>
License must be checked to be fitting upstream license.
</para>
</listitem>
<listitem>
<para>
Platforms should be set or the package will not get binary substitutes.
</para>
</listitem>
<listitem>
<para>
2018-11-19 05:10:39 +00:00
A maintainer must be set. This can be the package submitter or a
2018-05-02 00:54:21 +01:00
community member that accepts to take maintainership of the package.
</para>
</listitem>
2016-09-26 07:36:03 +01:00
</itemizedlist>
2018-05-02 00:54:21 +01:00
</listitem>
<listitem>
<para>
Ensure that the code contains no typos.
</para>
</listitem>
<listitem>
<para>
Ensure the package source.
</para>
2016-09-26 07:36:03 +01:00
<itemizedlist>
2018-05-02 00:54:21 +01:00
<listitem>
<para>
Mirrors urls should be used when available.
</para>
</listitem>
<listitem>
<para>
The most appropriate function should be used (e.g. packages from GitHub
should use <literal>fetchFromGitHub</literal>).
</para>
</listitem>
2016-09-26 07:36:03 +01:00
</itemizedlist>
2018-05-02 00:54:21 +01:00
</listitem>
<listitem>
<para>
Building the package locally.
</para>
</listitem>
<listitem>
<para>
Running every binary.
</para>
</listitem>
</itemizedlist>
2018-09-01 20:20:57 +01:00
<example xml:id="reviewing-contributions-sample-new-package">
2018-05-02 00:54:21 +01:00
<title>Sample template for a new package review</title>
2016-09-26 07:36:03 +01:00
<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 09:40:32 +01:00
- [ ] patches that are remotely available are fetched with `fetchpatch`
2016-09-26 07:36:03 +01:00
##### Possible improvements
##### Comments
2018-05-02 00:54:21 +01:00
</screen>
</example>
</section>
2018-09-01 20:06:38 +01:00
<section xml:id="reviewing-contributions-module-updates">
2018-05-02 00:54:21 +01:00
<title>Module updates</title>
<para>
Module updates are submissions changing modules in some ways. These often
contains changes to the options or introduce new options.
</para>
<para>
Reviewing process
</para>
<itemizedlist>
<listitem>
<para>
Add labels to the pull request. (Requires commit rights)
2018-05-02 00:54:21 +01:00
</para>
2016-09-26 07:36:03 +01:00
<itemizedlist>
2018-05-02 00:54:21 +01:00
<listitem>
<para>
<literal>8.has: module (update)</literal> and any topic label that fit
the module.
</para>
</listitem>
2016-09-26 07:36:03 +01:00
</itemizedlist>
2018-05-02 00:54:21 +01:00
</listitem>
<listitem>
<para>
Ensure that the module maintainers are notified.
</para>
2016-09-26 07:36:03 +01:00
<itemizedlist>
2018-05-02 00:54:21 +01:00
<listitem>
<para>
<link xlink:href="https://help.github.com/articles/about-codeowners/">CODEOWNERS</link>
will make GitHub notify users based on the submitted changes, but it can
happen that it misses some of the package maintainers.
2018-05-02 00:54:21 +01:00
</para>
</listitem>
2016-09-26 07:36:03 +01:00
</itemizedlist>
2018-05-02 00:54:21 +01:00
</listitem>
<listitem>
<para>
Ensure that the module tests, if any, are succeeding.
</para>
</listitem>
<listitem>
<para>
Ensure that the introduced options are correct.
</para>
2016-09-26 07:36:03 +01:00
<itemizedlist>
2018-05-02 00:54:21 +01:00
<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>
<listitem>
<para>
Description, default and example should be provided.
</para>
</listitem>
2016-09-26 07:36:03 +01:00
</itemizedlist>
2018-05-02 00:54:21 +01:00
</listitem>
<listitem>
<para>
Ensure that option changes are backward compatible.
</para>
2016-09-26 07:36:03 +01:00
<itemizedlist>
2018-05-02 00:54:21 +01:00
<listitem>
<para>
<literal>mkRenamedOptionModule</literal> and
<literal>mkAliasOptionModule</literal> functions provide way to make
option changes backward compatible.
</para>
</listitem>
2016-09-26 07:36:03 +01:00
</itemizedlist>
2018-05-02 00:54:21 +01:00
</listitem>
<listitem>
<para>
Ensure that removed options are declared with
<literal>mkRemovedOptionModule</literal>
</para>
</listitem>
<listitem>
<para>
Ensure that changes that are not backward compatible are mentioned in
release notes.
</para>
</listitem>
<listitem>
<para>
Ensure that documentations affected by the change is updated.
</para>
</listitem>
</itemizedlist>
2018-09-01 20:20:57 +01:00
<example xml:id="reviewing-contributions-sample-module-update">
2018-05-02 00:54:21 +01:00
<title>Sample template for a module update review</title>
2016-09-26 07:36:03 +01:00
<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
2018-05-02 00:54:21 +01:00
</screen>
</example>
</section>
2018-09-01 20:06:38 +01:00
<section xml:id="reviewing-contributions-new-modules">
2018-05-02 00:54:21 +01:00
<title>New modules</title>
<para>
New modules submissions introduce a new module to NixOS.
</para>
<itemizedlist>
<listitem>
<para>
Add labels to the pull request. (Requires commit rights)
2018-05-02 00:54:21 +01:00
</para>
2016-09-26 07:36:03 +01:00
<itemizedlist>
2018-05-02 00:54:21 +01:00
<listitem>
<para>
<literal>8.has: module (new)</literal> and any topic label that fit the
module.
</para>
</listitem>
2016-09-26 07:36:03 +01:00
</itemizedlist>
2018-05-02 00:54:21 +01:00
</listitem>
<listitem>
<para>
Ensure that the module tests, if any, are succeeding.
</para>
</listitem>
<listitem>
<para>
Ensure that the introduced options are correct.
</para>
2016-09-26 07:36:03 +01:00
<itemizedlist>
2018-05-02 00:54:21 +01:00
<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>
<listitem>
<para>
Description, default and example should be provided.
</para>
</listitem>
2016-09-26 07:36:03 +01:00
</itemizedlist>
2018-05-02 00:54:21 +01:00
</listitem>
<listitem>
<para>
Ensure that module <literal>meta</literal> field is present
</para>
2016-09-26 07:36:03 +01:00
<itemizedlist>
2018-05-02 00:54:21 +01:00
<listitem>
<para>
Maintainers should be declared in <literal>meta.maintainers</literal>.
</para>
</listitem>
<listitem>
<para>
Module documentation should be declared with
<literal>meta.doc</literal>.
</para>
</listitem>
2016-09-26 07:36:03 +01:00
</itemizedlist>
2018-05-02 00:54:21 +01:00
</listitem>
<listitem>
<para>
Ensure that the module respect other modules functionality.
</para>
2016-09-26 07:36:03 +01:00
<itemizedlist>
2018-05-02 00:54:21 +01:00
<listitem>
<para>
For example, enabling a module should not open firewall ports by
default.
</para>
</listitem>
2016-09-26 07:36:03 +01:00
</itemizedlist>
2018-05-02 00:54:21 +01:00
</listitem>
</itemizedlist>
2016-09-26 07:36:03 +01:00
2018-09-01 20:20:57 +01:00
<example xml:id="reviewing-contributions-sample-new-module">
2018-05-02 00:54:21 +01:00
<title>Sample template for a new module review</title>
2016-09-26 07:36:03 +01:00
<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
- [ ] No unneeded package is added to environment.systemPackages
2016-09-26 07:36:03 +01:00
- [ ] meta.maintainers is set
- [ ] module documentation is declared in meta.doc
##### Possible improvements
##### Comments
2018-05-02 00:54:21 +01:00
</screen>
</example>
</section>
2018-09-01 20:06:38 +01:00
<section xml:id="reviewing-contributions-other-submissions">
2018-05-02 00:54:21 +01:00
<title>Other submissions</title>
<para>
Other type of submissions requires different reviewing steps.
</para>
<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. 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
2018-05-02 00:54:21 +01:00
git-blaming the code to see who committed to that topic can give some hints.
</para>
<para>
Container system, boot system and library changes are some examples of the
pull requests fitting this category.
2018-05-02 00:54:21 +01:00
</para>
</section>
<section xml:id="reviewing-contributions--merging-pull-requests">
<title>Merging pull requests</title>
2018-05-02 00:54:21 +01:00
<para>
It is possible for community members that have enough knowledge and
experience on a special topic to contribute by merging pull requests.
2018-05-02 00:54:21 +01:00
</para>
<para>
TODO: add the procedure to request merging rights.
</para>
2016-09-26 07:36:03 +01:00
2016-10-01 11:02:09 +01: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.
<para>Please note that contributors with commit rights unactive for more than
three months will have their commit rights revoked.</para>
2016-10-01 11:02:09 +01:00
-->
2016-09-26 16:36:59 +01:00
2018-05-02 00:54:21 +01:00
<para>
In a case a contributor definitively leaves the Nix community, they should
2018-08-28 00:54:41 +01:00
create an issue or post on
<link
xlink:href="https://discourse.nixos.org">Discourse</link> with
2019-03-09 05:07:11 +00:00
references of packages and modules they maintain so the maintainership can
be taken over by other contributors.
2018-05-02 00:54:21 +01:00
</para>
</section>
2016-09-26 07:36:03 +01:00
</chapter>