1 |
commit: 1ce8f9382dac46e53e5fcd709a20d48c32049afe |
2 |
Author: Reinis Danne <rei4dan <AT> gmail <DOT> com> |
3 |
AuthorDate: Tue Jan 21 16:30:58 2014 +0000 |
4 |
Commit: Reinis Danne <rei4dan <AT> gmail <DOT> com> |
5 |
CommitDate: Tue Jan 21 20:05:14 2014 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=1ce8f938 |
7 |
|
8 |
alternatives-2.eclass: Don't source eselect modules |
9 |
|
10 |
They can't be sourced because DESCRIPTION from the package ebuild is a |
11 |
read-only variable and sourcing eselect modules fails since it tries to |
12 |
set its own description. |
13 |
|
14 |
Fall back instead to manually grepping for ALTERNATIVE and VERSION |
15 |
variables. This depends on their values being simple strings. |
16 |
|
17 |
--- |
18 |
eclass/alternatives-2.eclass | 6 +++--- |
19 |
1 file changed, 3 insertions(+), 3 deletions(-) |
20 |
|
21 |
diff --git a/eclass/alternatives-2.eclass b/eclass/alternatives-2.eclass |
22 |
index 217ba4d..42150c0 100644 |
23 |
--- a/eclass/alternatives-2.eclass |
24 |
+++ b/eclass/alternatives-2.eclass |
25 |
@@ -142,8 +142,8 @@ alternatives_for() { |
26 |
# Remove old alternatives module. |
27 |
cleanup_old_alternatives_module() { |
28 |
local alt=${1} old_module="${EROOT%/}/usr/share/eselect/modules/${alt}.eselect" |
29 |
- if [[ -f "${old_module}" && "$(source "${old_module}" &>/dev/null; echo "${ALTERNATIVE}")" == "${alt}" ]]; then |
30 |
- local version="$(source "${old_module}" &>/dev/null; echo "${VERSION}")" |
31 |
+ if [[ -f "${old_module}" && $(grep 'ALTERNATIVE=' "${old_module}" | cut -d '=' -f 2) == "${alt}" ]]; then |
32 |
+ local version="$(grep 'VERSION=' "${old_module}" | grep -o '[0-9.]\+')" |
33 |
if [[ "${version}" == "0.1" || "${version}" == "20080924" ]]; then |
34 |
echo "rm ${old_module}" |
35 |
rm "${old_module}" || eerror "rm ${old_module} failed" |
36 |
@@ -166,7 +166,7 @@ alternatives-2_pkg_postinst() { |
37 |
alt="${a%:*}" |
38 |
provider="${a#*:}" |
39 |
if [[ ! -f "${EAUTO}/${alt}.eselect" \ |
40 |
- || "$(source "${EAUTO}/${alt}.eselect" &>/dev/null; echo "${VERSION}")" \ |
41 |
+ || "$(grep '^VERSION=' "${EAUTO}/${alt}.eselect" | grep -o '[0-9]\+')" \ |
42 |
-ne "${module_version}" ]]; then |
43 |
if [[ ! -d ${EAUTO} ]]; then |
44 |
install -d "${EAUTO}" || eerror "Could not create eselect modules dir" |