aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinis Danne <rei4dan@gmail.com>2014-01-21 18:30:58 +0200
committerReinis Danne <rei4dan@gmail.com>2014-01-21 22:05:14 +0200
commit1ce8f9382dac46e53e5fcd709a20d48c32049afe (patch)
tree1fef4fe5f10ec1dfabf9d6f4938af2a7cebbfbcd /eclass/alternatives-2.eclass
parentalternatives-2.eclass: Fix check for uninstalling (diff)
downloadsci-1ce8f9382dac46e53e5fcd709a20d48c32049afe.tar.gz
sci-1ce8f9382dac46e53e5fcd709a20d48c32049afe.tar.bz2
sci-1ce8f9382dac46e53e5fcd709a20d48c32049afe.zip
alternatives-2.eclass: Don't source eselect modules
They can't be sourced because DESCRIPTION from the package ebuild is a read-only variable and sourcing eselect modules fails since it tries to set its own description. Fall back instead to manually grepping for ALTERNATIVE and VERSION variables. This depends on their values being simple strings.
Diffstat (limited to 'eclass/alternatives-2.eclass')
-rw-r--r--eclass/alternatives-2.eclass6
1 files changed, 3 insertions, 3 deletions
diff --git a/eclass/alternatives-2.eclass b/eclass/alternatives-2.eclass
index 217ba4dba..42150c0db 100644
--- a/eclass/alternatives-2.eclass
+++ b/eclass/alternatives-2.eclass
@@ -142,8 +142,8 @@ alternatives_for() {
# Remove old alternatives module.
cleanup_old_alternatives_module() {
local alt=${1} old_module="${EROOT%/}/usr/share/eselect/modules/${alt}.eselect"
- if [[ -f "${old_module}" && "$(source "${old_module}" &>/dev/null; echo "${ALTERNATIVE}")" == "${alt}" ]]; then
- local version="$(source "${old_module}" &>/dev/null; echo "${VERSION}")"
+ if [[ -f "${old_module}" && $(grep 'ALTERNATIVE=' "${old_module}" | cut -d '=' -f 2) == "${alt}" ]]; then
+ local version="$(grep 'VERSION=' "${old_module}" | grep -o '[0-9.]\+')"
if [[ "${version}" == "0.1" || "${version}" == "20080924" ]]; then
echo "rm ${old_module}"
rm "${old_module}" || eerror "rm ${old_module} failed"
@@ -166,7 +166,7 @@ alternatives-2_pkg_postinst() {
alt="${a%:*}"
provider="${a#*:}"
if [[ ! -f "${EAUTO}/${alt}.eselect" \
- || "$(source "${EAUTO}/${alt}.eselect" &>/dev/null; echo "${VERSION}")" \
+ || "$(grep '^VERSION=' "${EAUTO}/${alt}.eselect" | grep -o '[0-9]\+')" \
-ne "${module_version}" ]]; then
if [[ ! -d ${EAUTO} ]]; then
install -d "${EAUTO}" || eerror "Could not create eselect modules dir"