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