From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id BAF18138247 for ; Wed, 22 Jan 2014 10:09:46 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id ADF4EE10B7; Wed, 22 Jan 2014 10:09:41 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 85392E10B7 for ; Wed, 22 Jan 2014 10:09:40 +0000 (UTC) Received: from spoonbill.gentoo.org (spoonbill.gentoo.org [81.93.255.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 04B6C33FB16 for ; Wed, 22 Jan 2014 10:09:39 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id 39A91187CA for ; Wed, 22 Jan 2014 10:09:37 +0000 (UTC) From: "Reinis Danne" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Reinis Danne" Message-ID: <1390334714.1ce8f9382dac46e53e5fcd709a20d48c32049afe.rei4dan@gentoo> Subject: [gentoo-commits] proj/sci:master commit in: eclass/ X-VCS-Repository: proj/sci X-VCS-Files: eclass/alternatives-2.eclass X-VCS-Directories: eclass/ X-VCS-Committer: rei4dan X-VCS-Committer-Name: Reinis Danne X-VCS-Revision: 1ce8f9382dac46e53e5fcd709a20d48c32049afe X-VCS-Branch: master Date: Wed, 22 Jan 2014 10:09:37 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 91ecfe1e-bb13-4334-a5d4-d1601945fae5 X-Archives-Hash: d2372e77f4b0ce6f610efd28c5e0d224 commit: 1ce8f9382dac46e53e5fcd709a20d48c32049afe Author: Reinis Danne gmail com> AuthorDate: Tue Jan 21 16:30:58 2014 +0000 Commit: Reinis Danne gmail com> CommitDate: Tue Jan 21 20:05:14 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=1ce8f938 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. --- eclass/alternatives-2.eclass | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eclass/alternatives-2.eclass b/eclass/alternatives-2.eclass index 217ba4d..42150c0 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"