1 |
El mié, 03-01-2018 a las 17:13 +0100, Ulrich Müller escribió: |
2 |
> Split off functions preserve_old_lib and preserve_old_lib_notify from |
3 |
> eutils.eclass into a dedicated preserve-libs.eclass. These functions |
4 |
> are rarely used and are independent of the rest of eutils, therefore |
5 |
> moving them into their own eclass will help clarifying eclass |
6 |
> inheritance in ebuilds. |
7 |
> |
8 |
> For backwards compatibility, eutils inherits the new eclass in |
9 |
> existing EAPIs. |
10 |
> --- |
11 |
> eclass/eutils.eclass | 65 ++------------------------------------- |
12 |
> eclass/preserve-libs.eclass | 74 |
13 |
> +++++++++++++++++++++++++++++++++++++++++++++ |
14 |
> 2 files changed, 76 insertions(+), 63 deletions(-) |
15 |
> create mode 100644 eclass/preserve-libs.eclass |
16 |
> |
17 |
> diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass |
18 |
> index 7d4193e76b51..91d329e99c9e 100644 |
19 |
> --- a/eclass/eutils.eclass |
20 |
> +++ b/eclass/eutils.eclass |
21 |
> @@ -1,4 +1,4 @@ |
22 |
> -# Copyright 1999-2017 Gentoo Foundation |
23 |
> +# Copyright 1999-2018 Gentoo Foundation |
24 |
> # Distributed under the terms of the GNU General Public License v2 |
25 |
> |
26 |
> # @ECLASS: eutils.eclass |
27 |
> @@ -20,7 +20,7 @@ _EUTILS_ECLASS=1 |
28 |
> # implicitly inherited (now split) eclasses |
29 |
> case ${EAPI:-0} in |
30 |
> 0|1|2|3|4|5|6) |
31 |
> - inherit desktop epatch estack ltprune multilib toolchain-funcs |
32 |
> + inherit desktop epatch estack ltprune multilib preserve-libs |
33 |
> toolchain-funcs |
34 |
> ;; |
35 |
> esac |
36 |
> |
37 |
> @@ -172,67 +172,6 @@ _eutils_eprefix_init() { |
38 |
> has "${EAPI:-0}" 0 1 2 && : ${ED:=${D}} ${EPREFIX:=} |
39 |
> ${EROOT:=${ROOT}} |
40 |
> } |
41 |
> |
42 |
> -# @FUNCTION: preserve_old_lib |
43 |
> -# @USAGE: <libs to preserve> [more libs] |
44 |
> -# @DESCRIPTION: |
45 |
> -# These functions are useful when a lib in your package changes ABI SONAME. |
46 |
> -# An example might be from libogg.so.0 to libogg.so.1. Removing libogg.so.0 |
47 |
> -# would break packages that link against it. Most people get around this |
48 |
> -# by using the portage SLOT mechanism, but that is not always a relevant |
49 |
> -# solution, so instead you can call this from pkg_preinst. See also the |
50 |
> -# preserve_old_lib_notify function. |
51 |
> -preserve_old_lib() { |
52 |
> - _eutils_eprefix_init |
53 |
> - if [[ ${EBUILD_PHASE} != "preinst" ]] ; then |
54 |
> - eerror "preserve_old_lib() must be called from pkg_preinst() |
55 |
> only" |
56 |
> - die "Invalid preserve_old_lib() usage" |
57 |
> - fi |
58 |
> - [[ -z $1 ]] && die "Usage: preserve_old_lib <library to preserve> |
59 |
> [more libraries to preserve]" |
60 |
> - |
61 |
> - # let portage worry about it |
62 |
> - has preserve-libs ${FEATURES} && return 0 |
63 |
> - |
64 |
> - local lib dir |
65 |
> - for lib in "$@" ; do |
66 |
> - [[ -e ${EROOT}/${lib} ]] || continue |
67 |
> - dir=${lib%/*} |
68 |
> - dodir ${dir} || die "dodir ${dir} failed" |
69 |
> - cp "${EROOT}"/${lib} "${ED}"/${lib} || die "cp ${lib} failed" |
70 |
> - touch "${ED}"/${lib} |
71 |
> - done |
72 |
> -} |
73 |
> - |
74 |
> -# @FUNCTION: preserve_old_lib_notify |
75 |
> -# @USAGE: <libs to notify> [more libs] |
76 |
> -# @DESCRIPTION: |
77 |
> -# Spit helpful messages about the libraries preserved by preserve_old_lib. |
78 |
> -preserve_old_lib_notify() { |
79 |
> - if [[ ${EBUILD_PHASE} != "postinst" ]] ; then |
80 |
> - eerror "preserve_old_lib_notify() must be called from |
81 |
> pkg_postinst() only" |
82 |
> - die "Invalid preserve_old_lib_notify() usage" |
83 |
> - fi |
84 |
> - |
85 |
> - # let portage worry about it |
86 |
> - has preserve-libs ${FEATURES} && return 0 |
87 |
> - |
88 |
> - _eutils_eprefix_init |
89 |
> - |
90 |
> - local lib notice=0 |
91 |
> - for lib in "$@" ; do |
92 |
> - [[ -e ${EROOT}/${lib} ]] || continue |
93 |
> - if [[ ${notice} -eq 0 ]] ; then |
94 |
> - notice=1 |
95 |
> - ewarn "Old versions of installed libraries were |
96 |
> detected on your system." |
97 |
> - ewarn "In order to avoid breaking packages that |
98 |
> depend on these old libs," |
99 |
> - ewarn "the libraries are not being removed. You need |
100 |
> to run revdep-rebuild" |
101 |
> - ewarn "in order to remove these old dependencies. If |
102 |
> you do not have this" |
103 |
> - ewarn "helper program, simply emerge the 'gentoolkit' |
104 |
> package." |
105 |
> - ewarn |
106 |
> - fi |
107 |
> - ewarn " # revdep-rebuild --library '${lib}' && rm '${lib}'" |
108 |
> - done |
109 |
> -} |
110 |
> - |
111 |
> # @FUNCTION: built_with_use |
112 |
> # @USAGE: [--hidden] [--missing <action>] [-a|-o] <DEPEND ATOM> <List of USE |
113 |
> flags> |
114 |
> # @DESCRIPTION: |
115 |
> diff --git a/eclass/preserve-libs.eclass b/eclass/preserve-libs.eclass |
116 |
> new file mode 100644 |
117 |
> index 000000000000..548c6411fcf0 |
118 |
> --- /dev/null |
119 |
> +++ b/eclass/preserve-libs.eclass |
120 |
> @@ -0,0 +1,74 @@ |
121 |
> +# Copyright 1999-2018 Gentoo Foundation |
122 |
> +# Distributed under the terms of the GNU General Public License v2 |
123 |
> + |
124 |
> +# @ECLASS: preserve-libs.eclass |
125 |
> +# @MAINTAINER: |
126 |
> +# base-system@g.o |
127 |
> +# @BLURB: preserve libraries after SONAME changes |
128 |
> + |
129 |
> +if [[ -z ${_PRESERVE_LIBS_ECLASS} ]]; then |
130 |
> +_PRESERVE_LIBS_ECLASS=1 |
131 |
> + |
132 |
> +# @FUNCTION: preserve_old_lib |
133 |
> +# @USAGE: <libs to preserve> [more libs] |
134 |
> +# @DESCRIPTION: |
135 |
> +# These functions are useful when a lib in your package changes ABI SONAME. |
136 |
> +# An example might be from libogg.so.0 to libogg.so.1. Removing libogg.so.0 |
137 |
> +# would break packages that link against it. Most people get around this |
138 |
> +# by using the portage SLOT mechanism, but that is not always a relevant |
139 |
> +# solution, so instead you can call this from pkg_preinst. See also the |
140 |
> +# preserve_old_lib_notify function. |
141 |
> +preserve_old_lib() { |
142 |
> + if [[ ${EBUILD_PHASE} != "preinst" ]] ; then |
143 |
> + eerror "preserve_old_lib() must be called from pkg_preinst() |
144 |
> only" |
145 |
> + die "Invalid preserve_old_lib() usage" |
146 |
> + fi |
147 |
> + [[ -z $1 ]] && die "Usage: preserve_old_lib <library to preserve> |
148 |
> [more libraries to preserve]" |
149 |
> + |
150 |
> + # let portage worry about it |
151 |
> + has preserve-libs ${FEATURES} && return 0 |
152 |
> + |
153 |
> + has "${EAPI:-0}" 0 1 2 && local ED=${D} EROOT=${ROOT} |
154 |
> + |
155 |
> + local lib dir |
156 |
> + for lib in "$@" ; do |
157 |
> + [[ -e ${EROOT}/${lib} ]] || continue |
158 |
> + dir=${lib%/*} |
159 |
> + dodir ${dir} || die "dodir ${dir} failed" |
160 |
> + cp "${EROOT}"/${lib} "${ED}"/${lib} || die "cp ${lib} failed" |
161 |
> + touch "${ED}"/${lib} |
162 |
> + done |
163 |
> +} |
164 |
> + |
165 |
> +# @FUNCTION: preserve_old_lib_notify |
166 |
> +# @USAGE: <libs to notify> [more libs] |
167 |
> +# @DESCRIPTION: |
168 |
> +# Spit helpful messages about the libraries preserved by preserve_old_lib. |
169 |
> +preserve_old_lib_notify() { |
170 |
> + if [[ ${EBUILD_PHASE} != "postinst" ]] ; then |
171 |
> + eerror "preserve_old_lib_notify() must be called from |
172 |
> pkg_postinst() only" |
173 |
> + die "Invalid preserve_old_lib_notify() usage" |
174 |
> + fi |
175 |
> + |
176 |
> + # let portage worry about it |
177 |
> + has preserve-libs ${FEATURES} && return 0 |
178 |
> + |
179 |
> + has "${EAPI:-0}" 0 1 2 && local EROOT=${ROOT} |
180 |
> + |
181 |
> + local lib notice=0 |
182 |
> + for lib in "$@" ; do |
183 |
> + [[ -e ${EROOT}/${lib} ]] || continue |
184 |
> + if [[ ${notice} -eq 0 ]] ; then |
185 |
> + notice=1 |
186 |
> + ewarn "Old versions of installed libraries were |
187 |
> detected on your system." |
188 |
> + ewarn "In order to avoid breaking packages that |
189 |
> depend on these old libs," |
190 |
> + ewarn "the libraries are not being removed. You need |
191 |
> to run revdep-rebuild" |
192 |
> + ewarn "in order to remove these old dependencies. If |
193 |
> you do not have this" |
194 |
> + ewarn "helper program, simply emerge the 'gentoolkit' |
195 |
> package." |
196 |
> + ewarn |
197 |
> + fi |
198 |
> + ewarn " # revdep-rebuild --library '${lib}' && rm '${lib}'" |
199 |
> + done |
200 |
> +} |
201 |
> + |
202 |
> +fi |
203 |
|
204 |
I have seen this is only used by: |
205 |
app-arch/xz-utils |
206 |
dev-libs/gmp |
207 |
dev-libs/libpcre |
208 |
dev-libs/mpc |
209 |
dev-libs/mpfr |
210 |
net-nds/openldap |
211 |
sys-libs/gdbm |
212 |
sys-libs/ncurses |
213 |
sys-libs/readline |
214 |
sys-process/audit |
215 |
|
216 |
Maybe we could deprecate it and try to drop it in the future :/ |