Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH 08/18] Add tentative support for EAPI6 eapply_user function
Date: Fri, 10 Feb 2017 16:57:33
Message-Id: e2744a7c-13b0-a6b8-1656-19be5e820f5f@gentoo.org
In Reply to: Re: [gentoo-portage-dev] [PATCH 08/18] Add tentative support for EAPI6 eapply_user function by "Michał Górny"
1 On 02/10/2017 05:57 AM, Michał Górny wrote:
2 > W dniu 09.02.2017, czw o godzinie 14∶39 -0800, użytkownik Zac Medico
3 > napisał:
4 >> On 12/01/2014 01:28 PM, Michał Górny wrote:
5 >>> Add support for the user patch applying function.
6 >>> ---
7 >>> bin/eapi.sh | 4 ++++
8 >>> bin/phase-helpers.sh | 22 ++++++++++++++++++++++
9 >>> 2 files changed, 26 insertions(+)
10 >>>
11 >>> diff --git a/bin/eapi.sh b/bin/eapi.sh
12 >>> index 8ffffbb..6e78750 100644
13 >>> --- a/bin/eapi.sh
14 >>> +++ b/bin/eapi.sh
15 >>> @@ -76,6 +76,10 @@ ___eapi_has_eapply() {
16 >>> [[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
17 >>> }
18 >>>
19 >>> +___eapi_has_eapply_user() {
20 >>> + [[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
21 >>> +}
22 >>> +
23 >>> ___eapi_has_master_repositories() {
24 >>> [[ ${1-${EAPI}} =~ ^(5-progress)$ ]]
25 >>> }
26 >>> diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
27 >>> index e9fbbb4..f4b64ee 100644
28 >>> --- a/bin/phase-helpers.sh
29 >>> +++ b/bin/phase-helpers.sh
30 >>> @@ -986,6 +986,28 @@ if ___eapi_has_eapply; then
31 >>> }
32 >>> fi
33 >>>
34 >>> +if ___eapi_has_eapply_user; then
35 >>> + eapply_user() {
36 >>> + local basedir=${PORTAGE_CONFIGROOT%/}/etc/portage/patches
37 >>> +
38 >>> + local d applied
39 >>> + # possibilities:
40 >>> + # 1. ${CATEGORY}/${P}-${PR} (note: -r0 desired to avoid applying
41 >>> + # ${P} twice)
42 >>> + # 2. ${CATEGORY}/${P}
43 >>> + # 3. ${CATEGORY}/${PN}
44 >>> + # all of the above may be optionally followed by a slot
45 >>> + for d in "${basedir}"/${CATEGORY}/{${P}-${PR},${P},${PN}}{,:${SLOT%/*}}; do
46 >>> + if [[ -d ${d} ]]; then
47 >>> + eapply "${d}"
48 >>> + applied=1
49 >>
50 >> I think it should break out of the loop here, like epatch_user does.
51 >
52 > As the comment above suggests, it was intentional that all directories
53 > are used.
54 >
55 >> It doesn't make sense to apply more-specific patches before
56 >> less-specific patches, does it?
57 >
58 > Maybe. It would probably be most reasonable to sort them all by
59 > filename, and apply in that order. Also allowing patch with the same
60 > filename to override/skip patch from less specific directory.
61
62 Yeah that sounds good. If we do that then it will be roughly compatible
63 with the existing behavior, so if we're lucky then nobody will complain.
64 I've filed a corresponding feature request bug:
65
66 https://bugs.gentoo.org/show_bug.cgi?id=608880
67
68 >> Maybe we can just treat this as a bug fix? Is anyone relying on the
69 >> multiple directory usage?
70 >
71 > That sounds like a major behavior change for a 'fix'. I'm using multiple
72 > directories though it's all pretty much a workaround solution, so I
73 > guess it doesn't matter if we keep it stable.
74
75 If we wanted to disable the multi directory support, I guess we could
76 make it trigger an ewarn message before we really change the behavior,
77 but I think I like the sorting/override/skip idea better.
78
79 >>
80 >>> + fi
81 >>> + done
82 >>> +
83 >>> + [[ -n ${applied} ]] && ewarn "User patches applied."
84 >>> + }
85 >>> +fi
86 >>> +
87 >>> if ___eapi_has_master_repositories; then
88 >>> master_repositories() {
89 >>> local output repository=$1 retval
90 >>>
91 >>
92 >>
93 >
94
95
96 --
97 Thanks,
98 Zac