Gentoo Archives: gentoo-dev

From: Thomas Bracht Laumann Jespersen <t@×××××××.xyz>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Policy on conditional patching
Date: Mon, 28 Mar 2022 11:05:26
Message-Id: 20220328110503.vbhtmrm3kprtvmeo@sofaking
1 Hi!
2
3 I've been working on a new section in the devmanual regarding conditional
4 patching. In a PR [0] Sam suggested adding a section to clarify that conditional
5 patching should be avoided, because it can quickly become a maintenance and
6 testing burden.
7
8 The devmanual PR is here: [1]
9
10 Ulrich points out that conditional patching is actually suggested elsewhere, and
11 that actively discouraging conditional patching is a policy change, which should
12 be brought up on this list. So this is what I'm doing now. He also pointed out a
13 comment in eutils.eclass re [2] (the comment now lives in epatch.eclass).
14
15 The overall policy (proposal, I guess) is something like:
16
17 * Patches should be written such that they affect behaviour correctly based on
18 e.g. build time definitions or config options, rather than USE flags
19 directly.
20
21 * They should be applied unconditionally, so that, for version bumps and other
22 development happening with a package, any failure to apply the patch will be
23 caught by the developer.
24
25 * Patching is ideally only done to make the package in question build properly,
26 and should not be done to modify the runtime behaviour of the package. (This
27 is what USE flags and configuration options of the package are for.)
28
29 Sam made a specific point re musl: "for e.g. musl patches, we want a portable
30 fix, not a hack which is only applied for musl"
31
32 Feedback on this very welcome. I'm grappling a bit with the exact wording to go
33 for, so input on that is also appreciated.
34
35 I think my question to this list is: Should it be policy that conditional
36 patching is to be avoided?
37
38 All the best,
39 -- Thomas
40
41 [0]: https://github.com/gentoo/gentoo/pull/24709#discussion_r832361402
42 [1]: https://github.com/gentoo/devmanual/pull/281
43 [2]: https://gitweb.gentoo.org/archive/repo/gentoo-2.git/tree/eclass/eutils.eclass?id=50e8beda904760c773e5c67fdfe8242255e13495#n175

Replies

Subject Author
Re: [gentoo-dev] Policy on conditional patching Fabian Groffen <grobian@g.o>
Re: [gentoo-dev] Policy on conditional patching Sam James <sam@g.o>