1 |
On 04/01/18 11:36, M. J. Everitt wrote: |
2 |
> On 04/01/18 11:21, David Seifert wrote: |
3 |
>> On Thu, 2018-01-04 at 10:43 +0000, M. J. Everitt wrote: |
4 |
>>> On 04/01/18 10:23, Pacho Ramos wrote: |
5 |
>>>> El mié, 03-01-2018 a las 17:13 +0100, Ulrich Müller escribió: |
6 |
>>>>> Split off functions preserve_old_lib and preserve_old_lib_notify |
7 |
>>>>> from |
8 |
>>>>> eutils.eclass into a dedicated preserve-libs.eclass. These |
9 |
>>>>> functions |
10 |
>>>>> are rarely used and are independent of the rest of eutils, |
11 |
>>>>> therefore |
12 |
>>>>> moving them into their own eclass will help clarifying eclass |
13 |
>>>>> inheritance in ebuilds. |
14 |
>>>>> |
15 |
>>>>> For backwards compatibility, eutils inherits the new eclass in |
16 |
>>>>> existing EAPIs. |
17 |
>>>>> --- |
18 |
>>>>> eclass/eutils.eclass | 65 ++----------------------------- |
19 |
>>>>> -------- |
20 |
>>>>> eclass/preserve-libs.eclass | 74 |
21 |
>>>>> +++++++++++++++++++++++++++++++++++++++++++++ |
22 |
>>>>> 2 files changed, 76 insertions(+), 63 deletions(-) |
23 |
>>>>> create mode 100644 eclass/preserve-libs.eclass |
24 |
>>>>> |
25 |
>>>>> diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass |
26 |
>>>>> index 7d4193e76b51..91d329e99c9e 100644 |
27 |
>>>>> --- a/eclass/eutils.eclass |
28 |
>>>>> +++ b/eclass/eutils.eclass |
29 |
>>>>> @@ -1,4 +1,4 @@ |
30 |
>>>>> -# Copyright 1999-2017 Gentoo Foundation |
31 |
>>>>> +# Copyright 1999-2018 Gentoo Foundation |
32 |
>>>>> # Distributed under the terms of the GNU General Public License |
33 |
>>>>> v2 |
34 |
>>>>> |
35 |
>>>>> # @ECLASS: eutils.eclass |
36 |
>>>>> @@ -20,7 +20,7 @@ _EUTILS_ECLASS=1 |
37 |
>>>>> # implicitly inherited (now split) eclasses |
38 |
>>>>> case ${EAPI:-0} in |
39 |
>>>>> 0|1|2|3|4|5|6) |
40 |
>>>>> - inherit desktop epatch estack ltprune multilib |
41 |
>>>>> toolchain-funcs |
42 |
>>>>> + inherit desktop epatch estack ltprune multilib preserve- |
43 |
>>>>> libs |
44 |
>>>>> toolchain-funcs |
45 |
>>>>> ;; |
46 |
>>>>> esac |
47 |
>>>>> |
48 |
>>>>> @@ -172,67 +172,6 @@ _eutils_eprefix_init() { |
49 |
>>>>> has "${EAPI:-0}" 0 1 2 && : ${ED:=${D}} ${EPREFIX:=} |
50 |
>>>>> ${EROOT:=${ROOT}} |
51 |
>>>>> } |
52 |
>>>>> |
53 |
>>>>> -# @FUNCTION: preserve_old_lib |
54 |
>>>>> -# @USAGE: <libs to preserve> [more libs] |
55 |
>>>>> -# @DESCRIPTION: |
56 |
>>>>> -# These functions are useful when a lib in your package changes |
57 |
>>>>> ABI SONAME. |
58 |
>>>>> -# An example might be from libogg.so.0 to libogg.so.1. Removing |
59 |
>>>>> libogg.so.0 |
60 |
>>>>> -# would break packages that link against it. Most people get |
61 |
>>>>> around this |
62 |
>>>>> -# by using the portage SLOT mechanism, but that is not always a |
63 |
>>>>> relevant |
64 |
>>>>> -# solution, so instead you can call this from pkg_preinst. See |
65 |
>>>>> also the |
66 |
>>>>> -# preserve_old_lib_notify function. |
67 |
>>>>> -preserve_old_lib() { |
68 |
>>>>> - _eutils_eprefix_init |
69 |
>>>>> - if [[ ${EBUILD_PHASE} != "preinst" ]] ; then |
70 |
>>>>> - eerror "preserve_old_lib() must be called from |
71 |
>>>>> pkg_preinst() |
72 |
>>>>> only" |
73 |
>>>>> - die "Invalid preserve_old_lib() usage" |
74 |
>>>>> - fi |
75 |
>>>>> - [[ -z $1 ]] && die "Usage: preserve_old_lib <library to |
76 |
>>>>> preserve> |
77 |
>>>>> [more libraries to preserve]" |
78 |
>>>>> - |
79 |
>>>>> - # let portage worry about it |
80 |
>>>>> - has preserve-libs ${FEATURES} && return 0 |
81 |
>>>>> - |
82 |
>>>>> - local lib dir |
83 |
>>>>> - for lib in "$@" ; do |
84 |
>>>>> - [[ -e ${EROOT}/${lib} ]] || continue |
85 |
>>>>> - dir=${lib%/*} |
86 |
>>>>> - dodir ${dir} || die "dodir ${dir} failed" |
87 |
>>>>> - cp "${EROOT}"/${lib} "${ED}"/${lib} || die "cp |
88 |
>>>>> ${lib} failed" |
89 |
>>>>> - touch "${ED}"/${lib} |
90 |
>>>>> - done |
91 |
>>>>> -} |
92 |
>>>>> - |
93 |
>>>>> -# @FUNCTION: preserve_old_lib_notify |
94 |
>>>>> -# @USAGE: <libs to notify> [more libs] |
95 |
>>>>> -# @DESCRIPTION: |
96 |
>>>>> -# Spit helpful messages about the libraries preserved by |
97 |
>>>>> preserve_old_lib. |
98 |
>>>>> -preserve_old_lib_notify() { |
99 |
>>>>> - if [[ ${EBUILD_PHASE} != "postinst" ]] ; then |
100 |
>>>>> - eerror "preserve_old_lib_notify() must be called |
101 |
>>>>> from |
102 |
>>>>> pkg_postinst() only" |
103 |
>>>>> - die "Invalid preserve_old_lib_notify() usage" |
104 |
>>>>> - fi |
105 |
>>>>> - |
106 |
>>>>> - # let portage worry about it |
107 |
>>>>> - has preserve-libs ${FEATURES} && return 0 |
108 |
>>>>> - |
109 |
>>>>> - _eutils_eprefix_init |
110 |
>>>>> - |
111 |
>>>>> - local lib notice=0 |
112 |
>>>>> - for lib in "$@" ; do |
113 |
>>>>> - [[ -e ${EROOT}/${lib} ]] || continue |
114 |
>>>>> - if [[ ${notice} -eq 0 ]] ; then |
115 |
>>>>> - notice=1 |
116 |
>>>>> - ewarn "Old versions of installed |
117 |
>>>>> libraries were |
118 |
>>>>> detected on your system." |
119 |
>>>>> - ewarn "In order to avoid breaking |
120 |
>>>>> packages that |
121 |
>>>>> depend on these old libs," |
122 |
>>>>> - ewarn "the libraries are not being |
123 |
>>>>> removed. You need |
124 |
>>>>> to run revdep-rebuild" |
125 |
>>>>> - ewarn "in order to remove these old |
126 |
>>>>> dependencies. If |
127 |
>>>>> you do not have this" |
128 |
>>>>> - ewarn "helper program, simply emerge the |
129 |
>>>>> 'gentoolkit' |
130 |
>>>>> package." |
131 |
>>>>> - ewarn |
132 |
>>>>> - fi |
133 |
>>>>> - ewarn " # revdep-rebuild --library '${lib}' && |
134 |
>>>>> rm '${lib}'" |
135 |
>>>>> - done |
136 |
>>>>> -} |
137 |
>>>>> - |
138 |
>>>>> # @FUNCTION: built_with_use |
139 |
>>>>> # @USAGE: [--hidden] [--missing <action>] [-a|-o] <DEPEND ATOM> |
140 |
>>>>> <List of USE |
141 |
>>>>> flags> |
142 |
>>>>> # @DESCRIPTION: |
143 |
>>>>> diff --git a/eclass/preserve-libs.eclass b/eclass/preserve- |
144 |
>>>>> libs.eclass |
145 |
>>>>> new file mode 100644 |
146 |
>>>>> index 000000000000..548c6411fcf0 |
147 |
>>>>> --- /dev/null |
148 |
>>>>> +++ b/eclass/preserve-libs.eclass |
149 |
>>>>> @@ -0,0 +1,74 @@ |
150 |
>>>>> +# Copyright 1999-2018 Gentoo Foundation |
151 |
>>>>> +# Distributed under the terms of the GNU General Public License |
152 |
>>>>> v2 |
153 |
>>>>> + |
154 |
>>>>> +# @ECLASS: preserve-libs.eclass |
155 |
>>>>> +# @MAINTAINER: |
156 |
>>>>> +# base-system@g.o |
157 |
>>>>> +# @BLURB: preserve libraries after SONAME changes |
158 |
>>>>> + |
159 |
>>>>> +if [[ -z ${_PRESERVE_LIBS_ECLASS} ]]; then |
160 |
>>>>> +_PRESERVE_LIBS_ECLASS=1 |
161 |
>>>>> + |
162 |
>>>>> +# @FUNCTION: preserve_old_lib |
163 |
>>>>> +# @USAGE: <libs to preserve> [more libs] |
164 |
>>>>> +# @DESCRIPTION: |
165 |
>>>>> +# These functions are useful when a lib in your package changes |
166 |
>>>>> ABI SONAME. |
167 |
>>>>> +# An example might be from libogg.so.0 to libogg.so.1. Removing |
168 |
>>>>> libogg.so.0 |
169 |
>>>>> +# would break packages that link against it. Most people get |
170 |
>>>>> around this |
171 |
>>>>> +# by using the portage SLOT mechanism, but that is not always a |
172 |
>>>>> relevant |
173 |
>>>>> +# solution, so instead you can call this from pkg_preinst. See |
174 |
>>>>> also the |
175 |
>>>>> +# preserve_old_lib_notify function. |
176 |
>>>>> +preserve_old_lib() { |
177 |
>>>>> + if [[ ${EBUILD_PHASE} != "preinst" ]] ; then |
178 |
>>>>> + eerror "preserve_old_lib() must be called from |
179 |
>>>>> pkg_preinst() |
180 |
>>>>> only" |
181 |
>>>>> + die "Invalid preserve_old_lib() usage" |
182 |
>>>>> + fi |
183 |
>>>>> + [[ -z $1 ]] && die "Usage: preserve_old_lib <library to |
184 |
>>>>> preserve> |
185 |
>>>>> [more libraries to preserve]" |
186 |
>>>>> + |
187 |
>>>>> + # let portage worry about it |
188 |
>>>>> + has preserve-libs ${FEATURES} && return 0 |
189 |
>>>>> + |
190 |
>>>>> + has "${EAPI:-0}" 0 1 2 && local ED=${D} EROOT=${ROOT} |
191 |
>>>>> + |
192 |
>>>>> + local lib dir |
193 |
>>>>> + for lib in "$@" ; do |
194 |
>>>>> + [[ -e ${EROOT}/${lib} ]] || continue |
195 |
>>>>> + dir=${lib%/*} |
196 |
>>>>> + dodir ${dir} || die "dodir ${dir} failed" |
197 |
>>>>> + cp "${EROOT}"/${lib} "${ED}"/${lib} || die "cp |
198 |
>>>>> ${lib} failed" |
199 |
>>>>> + touch "${ED}"/${lib} |
200 |
>>>>> + done |
201 |
>>>>> +} |
202 |
>>>>> + |
203 |
>>>>> +# @FUNCTION: preserve_old_lib_notify |
204 |
>>>>> +# @USAGE: <libs to notify> [more libs] |
205 |
>>>>> +# @DESCRIPTION: |
206 |
>>>>> +# Spit helpful messages about the libraries preserved by |
207 |
>>>>> preserve_old_lib. |
208 |
>>>>> +preserve_old_lib_notify() { |
209 |
>>>>> + if [[ ${EBUILD_PHASE} != "postinst" ]] ; then |
210 |
>>>>> + eerror "preserve_old_lib_notify() must be called |
211 |
>>>>> from |
212 |
>>>>> pkg_postinst() only" |
213 |
>>>>> + die "Invalid preserve_old_lib_notify() usage" |
214 |
>>>>> + fi |
215 |
>>>>> + |
216 |
>>>>> + # let portage worry about it |
217 |
>>>>> + has preserve-libs ${FEATURES} && return 0 |
218 |
>>>>> + |
219 |
>>>>> + has "${EAPI:-0}" 0 1 2 && local EROOT=${ROOT} |
220 |
>>>>> + |
221 |
>>>>> + local lib notice=0 |
222 |
>>>>> + for lib in "$@" ; do |
223 |
>>>>> + [[ -e ${EROOT}/${lib} ]] || continue |
224 |
>>>>> + if [[ ${notice} -eq 0 ]] ; then |
225 |
>>>>> + notice=1 |
226 |
>>>>> + ewarn "Old versions of installed |
227 |
>>>>> libraries were |
228 |
>>>>> detected on your system." |
229 |
>>>>> + ewarn "In order to avoid breaking |
230 |
>>>>> packages that |
231 |
>>>>> depend on these old libs," |
232 |
>>>>> + ewarn "the libraries are not being |
233 |
>>>>> removed. You need |
234 |
>>>>> to run revdep-rebuild" |
235 |
>>>>> + ewarn "in order to remove these old |
236 |
>>>>> dependencies. If |
237 |
>>>>> you do not have this" |
238 |
>>>>> + ewarn "helper program, simply emerge the |
239 |
>>>>> 'gentoolkit' |
240 |
>>>>> package." |
241 |
>>>>> + ewarn |
242 |
>>>>> + fi |
243 |
>>>>> + ewarn " # revdep-rebuild --library '${lib}' && |
244 |
>>>>> rm '${lib}'" |
245 |
>>>>> + done |
246 |
>>>>> +} |
247 |
>>>>> + |
248 |
>>>>> +fi |
249 |
>>>> I have seen this is only used by: |
250 |
>>>> app-arch/xz-utils |
251 |
>>>> dev-libs/gmp |
252 |
>>>> dev-libs/libpcre |
253 |
>>>> dev-libs/mpc |
254 |
>>>> dev-libs/mpfr |
255 |
>>>> net-nds/openldap |
256 |
>>>> sys-libs/gdbm |
257 |
>>>> sys-libs/ncurses |
258 |
>>>> sys-libs/readline |
259 |
>>>> sys-process/audit |
260 |
>>>> |
261 |
>>>> Maybe we could deprecate it and try to drop it in the future :/ |
262 |
>>>> |
263 |
>>> Bear in mind several of these packages are in base-system and are |
264 |
>>> stuck |
265 |
>>> around the EAPI3/4 mark and may not be using some of the new EAPI |
266 |
>>> 'features' yet ... |
267 |
>>> |
268 |
>>> Best not kill them off just yet or there'll be no stages to install |
269 |
>>> from |
270 |
>>> .. and releng have only just got the catalyst-3 transition working, |
271 |
>>> with |
272 |
>>> 17.0 profiles to come next .. |
273 |
>>> |
274 |
>>> :] |
275 |
>>> |
276 |
>> Never mind that this has 0 to do with EAPI3/4 or with newer EAPI |
277 |
>> 'features' and is all about the fact that FEATURES=preserve-libs is |
278 |
>> only implemented in Portage, without comparable functionality in |
279 |
>> paludis or pkgcore. |
280 |
>> |
281 |
>> When you don't know why the function exists, prefer not to give advice |
282 |
>> on how to proceed. |
283 |
>> |
284 |
> Oh I -am- sorry .. did I piss in your cornflakes too? XD |
285 |
> |
286 |
> </sarcasm> |
287 |
> |
288 |
Also, in the spirit of #thegentooway .. perhaps instead of posting |
289 |
"bright ideas" or trolling the lists, perhaps if they actually created |
290 |
the appropriate patches, and/or committed them to tree, we wouldn't even |
291 |
by having this discussion. |
292 |
|
293 |
However ... #thegentooway, as I said :] |
294 |
|
295 |
NB. As a non-dev it would be a complete waste of *my* time even to raise |
296 |
a PR to have it ignored for a few years before someone decided to get |
297 |
around to looking at it... |