public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [RFC] Establishing Gentoo patch policy to keep our patches consistent and clean
@ 2013-04-06 18:08 Michał Górny
  2013-04-06 18:20 ` Tony "Chainsaw" Vroon
                   ` (6 more replies)
  0 siblings, 7 replies; 21+ messages in thread
From: Michał Górny @ 2013-04-06 18:08 UTC (permalink / raw
  To: Gentoo Developer Mailing List

[-- Attachment #1: Type: text/plain, Size: 4215 bytes --]

Hello,

As far as I'm aware, we don't really have much of a patch maintenance
policy in Gentoo. There a few loose rules like «don't put awfully big
files into FILESDIR» or the common sense «use unified diff», but no
complete and clear policy.

Especially considering the late discussion related to the needless
and semi-broken functionality in epatch, I'd like to propose
setting the following rules for patches in tree and in Gentoo-sourced
patchsets:

1. Patches have to be either in unified or context diff format. Unified
diff is preferred.

2. Patches have to apply to the top directory of the source tree with
'patch -p1'. If patches are applied to sub-directories, necessary '-p'
argument shall be passed to 'epatch' explicitly. Developers are
encouraged to create patches which are compatible with 'git am'.

3. Patches have to end with either '.patch' or '.diff' suffix.

4. If possible, patches shall be named in a way allowing them to be
applied in lexical order. However, this one isn't necessary if patches
from an older ebuild are applied to a newer one.

5. The patch name shall shortly summarize the changes done by it.

6. Patch files shall start with a brief description of what the patch
does. Developers are encouraged to use git-style tags like 'Fixes:' to
point to the relevant bug URIs.

7. Patch combining is discouraged. Developers shall prefer multiple
patches following either the upstream commits or a logical commit
sequence (if changes are not committed upstream).

The above-listed policy will apply to the patches kept in the gx86 tree
(in FILESDIRs) and patch archives created by Gentoo developers. They
will not apply to the patch archives created upstream.


RATIONALE
---------

The main reason for the whole policy is to let Gentoo supply users with
consistent and friendly patches. That is, patches which can be used
directly on a source tree or submitted upstream without any additional
actions from user.

(1) lists the most common patch formats. The formats shall be generally
both readable and reusable whenever possible. I wanted just 'unified
diff' but ulm suggested that we should also support those upstreams who
use 'context diffs'.


(2) is likely to be a bikeshed point here. Long story short, epatch has
this fragile patchlevel guessing, users don't have it. If we keep our
patches consistent to a single patchlevel, we gain:

* ability for users to apply the patches without having them try all
  patchlevels by hand.

* clean error output if patch stops to apply for some reason.

* no risk that patch will get applied to the wrong file if patch stops
  to apply at expected patchlevel and starts to apply on another.

Also, by creating git-format patches, we gain the ability of rebasing
and updating the patches easily. Even with non-git upstreams, we can
do:

  git init; git add -A; git commit -m 1; git am ...


(3) should be mostly obvious. The main idea is that if we apply a whole
patchdir, we should be able to easily tell between patches
and auxiliary files like 'README' or Debian's 'series'.

I have never seen a patch file named other than '*.patch' or '*.diff'.
Therefore, I think that it's better to just require those rather than
trying to provide a sane list of excludes.


(4) is mostly about friendliness (again). Since shell does filename
expansion in lexical order, it's just great for user to be able apply
patches like:

  git am /usr/portage/foo/bar/files/198-*.patch

The other sentence is not to enforce this rule e.g. when the same patch
is applied to different versions of the same package. Although with
a fair of trickery that could be gotten working, I don't think it will
be user-friendly anymore :).


(5) makes finding a particular patch of interest easier, while (6)
makes sure that the purpose of the patch can be read from patch alone.
In both cases, having described patches is much better than having to
look into ebuilds for explanations.


(7) is because merged patches are usually hard to read and completely
not suitable for submitting anywhere.


What are your thoughts?

-- 
Best regards,
Michał Górny

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 966 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2013-04-30  4:34 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-06 18:08 [gentoo-dev] [RFC] Establishing Gentoo patch policy to keep our patches consistent and clean Michał Górny
2013-04-06 18:20 ` Tony "Chainsaw" Vroon
2013-04-06 18:22 ` Markos Chandras
2013-04-07 13:43   ` [gentoo-dev] " Michael Palimaka
2013-04-06 18:35 ` [gentoo-dev] " Alexandre Rostovtsev
2013-04-06 18:59   ` Michael Mol
2013-04-06 18:59   ` Michał Górny
2013-04-06 19:02 ` "Paweł Hajdan, Jr."
2013-04-06 19:27   ` Alex Xu
2013-04-06 19:41   ` Michał Górny
2013-04-06 20:00     ` "Paweł Hajdan, Jr."
2013-04-06 21:41       ` Michał Górny
2013-04-09 19:31         ` Donnie Berkholz
2013-04-06 20:32   ` [gentoo-dev] " Paul Arthur
2013-04-06 21:01 ` [gentoo-dev] " Robin H. Johnson
2013-04-07 14:36   ` [gentoo-dev] " Michael Palimaka
2013-04-07 19:22     ` Robin H. Johnson
2013-04-07  6:53 ` [gentoo-dev] " Kacper Kowalik
2013-04-07 14:30   ` [gentoo-dev] " Michael Palimaka
2013-04-12 13:51     ` Steven J. Long
2013-04-30  4:44 ` Ryan Hill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox