From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QolHc-0004e5-QP for garchives@archives.gentoo.org; Wed, 03 Aug 2011 23:55:29 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E62FA21C0BE; Wed, 3 Aug 2011 23:55:21 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id A9EBD21C0BE for ; Wed, 3 Aug 2011 23:55:21 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 149932AC010 for ; Wed, 3 Aug 2011 23:55:21 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 68A708003C for ; Wed, 3 Aug 2011 23:55:20 +0000 (UTC) From: "Andrea Arteaga" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Andrea Arteaga" Message-ID: <9e277ac959b3cbd1e63591111780d74f92632c1c.spiros@gentoo> Subject: [gentoo-commits] proj/sci:master commit in: eclass/ X-VCS-Repository: proj/sci X-VCS-Files: eclass/alternatives-2.eclass eclass/intel-sdp.eclass X-VCS-Directories: eclass/ X-VCS-Committer: spiros X-VCS-Committer-Name: Andrea Arteaga X-VCS-Revision: 9e277ac959b3cbd1e63591111780d74f92632c1c Date: Wed, 3 Aug 2011 23:55:20 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 8424f775aba9601cdfd24951d2c94f86 commit: 9e277ac959b3cbd1e63591111780d74f92632c1c Author: Andrea Arteaga gmail com> AuthorDate: Wed Aug 3 23:54:28 2011 +0000 Commit: Andrea Arteaga gmail com> CommitDate: Wed Aug 3 23:54:28 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/sci.git;a=3Dc= ommit;h=3D9e277ac9 alternatives-2 imported from bicatali and intel-sdp corrected --- eclass/alternatives-2.eclass | 157 ++++++++++++++++++++++++++++++++++++= ++++++ eclass/intel-sdp.eclass | 2 +- 2 files changed, 158 insertions(+), 1 deletions(-) diff --git a/eclass/alternatives-2.eclass b/eclass/alternatives-2.eclass new file mode 100644 index 0000000..bbbe6e0 --- /dev/null +++ b/eclass/alternatives-2.eclass @@ -0,0 +1,157 @@ +# Copyright 2008, 2009 Bo =C3=98rsted Andresen +# Copyright 2008, 2009 Mike Kelly +# Copyright 2009 David Leverton +# 2010: Adapted for Gentoo by Sebastien Fabbro, who does not like copyri= ghts +# Distributed under the terms of the GNU General Public License v2 + +# If your package provides pkg_postinst or pkg_prerm phases, you need to= be +# sure you explicitly run alternatives_pkg_{postinst,prerm} where approp= riate. + +ALTERNATIVES_DIR=3D"/etc/env.d/alternatives" + +DEPEND=3D">=3Dapp-admin/eselect-1.2.15-r1" +RDEPEND=3D"${DEPEND} + !app-admin/eselect-blas + !app-admin/eselect-cblas + !app-admin/eselect-lapack" + +# alternatives_for alternative provider importance source target [ sourc= e target [...]] +alternatives_for() { + #echo alternatives_for "${@}" + + (( $# >=3D 5 )) && (( ($#-3)%2 =3D=3D 0)) || die "${FUNCNAME} requires = exactly 3+N*2 arguments where N>=3D1" + local x dupl alternative=3D${1} provider=3D${2} importance=3D${3} index= unique src target ret=3D0 + shift 3 + + # make sure importance is a signed integer + if [[ -n ${importance} ]] && ! [[ ${importance} =3D~ ^[0-9]+(\.[0-9]+)*= $ ]]; then + eerror "Invalid importance (${importance}) detected" + ((ret++)) + fi + + [[ -d "${ED}${ALTERNATIVES_DIR}/${alternative}/${provider}" ]] || dodir= "${ALTERNATIVES_DIR}/${alternative}/${provider}" + + # keep track of provided alternatives for use in pkg_{postinst,prerm}. = keep a mapping between importance and + # provided alternatives and make sure the former is set to only one val= ue + if ! has "${alternative}:${provider}" "${ALTERNATIVES_PROVIDED[@]}"; th= en + index=3D${#ALTERNATIVES_PROVIDED[@]} + ALTERNATIVES_PROVIDED+=3D( "${alternative}:${provider}" ) + ALTERNATIVES_IMPORTANCE[index]=3D${importance} + [[ -n ${importance} ]] && echo "${importance}" > "${ED}${ALTERNATIVES_= DIR}/${alternative}/${provider}/_importance" + else + for((index=3D0;index<${#ALTERNATIVES_PROVIDED[@]};index++)); do + if [[ ${alternative}:${provider} =3D=3D ${ALTERNATIVES_PROVIDED[index= ]} ]]; then + if [[ -n ${ALTERNATIVES_IMPORTANCE[index]} ]]; then + if [[ -n ${importance} && ${ALTERNATIVES_IMPORTANCE[index]} !=3D ${= importance} ]]; then + eerror "Differing importance (${ALTERNATIVES_IMPORTANCE[index]} !=3D= ${importance}) detected" + ((ret++)) + fi + else + ALTERNATIVES_IMPORTANCE[index]=3D${importance} + [[ -n ${importance} ]] && echo "${importance}" > "${ED}${ALTERNATIV= ES_DIR}/${alternative}/${provider}/_importance" + fi + fi + done + fi + + while (( $# >=3D 2 )); do + src=3D${1//+(\/)/\/}; target=3D${2//+(\/)/\/} + if [[ ${src} !=3D /* ]]; then + eerror "Source path must be absolute, but got ${src}" + ((ret++)) + + else + local reltarget=3D dir=3D${ALTERNATIVES_DIR}/${alternative}/${provide= r}${src%/*} + while [[ -n ${dir} ]]; do + reltarget+=3D../ + dir=3D${dir%/*} + done + + reltarget=3D${reltarget%/} + [[ ${target} =3D=3D /* ]] || reltarget+=3D${src%/*}/ + reltarget+=3D${target} + dodir "${ALTERNATIVES_DIR}/${alternative}/${provider}${src%/*}" + dosym "${reltarget}" "${ALTERNATIVES_DIR}/${alternative}/${provider}$= {src}" + + # say ${ED}/sbin/init exists and links to /bin/systemd (which doesn't= exist yet) + # the -e test will fail, so check for -L also + if [[ -e ${ED}${src} || -L ${ED}${src} ]]; then + local fulltarget=3D${target} + [[ ${fulltarget} !=3D /* ]] && fulltarget=3D${src%/*}/${fulltarget} + if [[ -e ${ED}${fulltarget} || -L ${ED}${fulltarget} ]]; then + die "${src} defined as provider for ${fulltarget}, but both already= exist in \${ED}" + else + mv "${ED}${src}" "${ED}${fulltarget}" || die + fi + fi + fi + shift 2 + done + + [[ ${ret} -eq 0 ]] || die "Errors detected for ${provider}, provided fo= r ${alternative}" +} + +cleanup_old_alternatives_module() { + local alt=3D${1} old_module=3D"${EROOT}/usr/share/eselect/modules/${alt= }.eselect" + if [[ -f "${old_module}" && "$(source "${old_module}" &>/dev/null; echo= "${ALTERNATIVE}")" =3D=3D "${alt}" ]]; then + local version=3D"$(source "${old_module}" &>/dev/null; echo "${VERSION= }")" + if [[ "${version}" =3D=3D "0.1" || "${version}" =3D=3D "20080924" ]]; = then + echo rm "${old_module}" + rm "${old_module}" || eerror "rm ${old_module} failed" + fi + fi +} + +alternatives-2_pkg_postinst() { + local a alt provider module_version=3D"20090908" + for a in "${ALTERNATIVES_PROVIDED[@]}"; do + alt=3D"${a%:*}" + provider=3D"${a#*:}" + if [[ ! -f "${EROOT}/usr/share/eselect/modules/auto/${alt}.eselect" \ + || "$(source "${EROOT}/usr/share/eselect/modules/auto/${alt}.eselect"= &>/dev/null; echo "${VERSION}")" \ + -ne "${module_version}" ]]; then + #einfo "Creating alternatives module for ${alt}" + if [[ ! -d ${EROOT}/usr/share/eselect/modules/auto ]]; then + install -d "${EROOT}"/usr/share/eselect/modules/auto || eerror "Coul= d not create eselect modules dir" + fi + cat > "${EROOT}/usr/share/eselect/modules/auto/${alt}.eselect" <<-EOF + # This module was automatically generated by alternatives.eclass + DESCRIPTION=3D"Alternatives for ${alt}" + VERSION=3D"${module_version}" + MAINTAINER=3D"eselect@gentoo.org" + ESELECT_MODULE_GROUP=3D"Alternatives" + + ALTERNATIVE=3D"${alt}" + + inherit alternatives + EOF + fi + + #echo eselect "${alt}" update "${provider}" + einfo "Creating ${provider} alternative module for ${alt}" + eselect "${alt}" update "${provider}" + + cleanup_old_alternatives_module ${alt} + done +} + +alternatives-2_pkg_prerm() { + local a alt provider p ignore + [[ -n ${REPLACED_BY_ID} ]] || ignore=3D" --ignore" + for a in "${ALTERNATIVES_PROVIDED[@]}"; do + alt=3D"${a%:*}" + provider=3D"${a#*:}" + #echo "Making sure ${alt} has a valid provider" + #echo eselect "${alt}" update${ignore} "${provider}" + eselect "${alt}" update${ignore} "${provider}" && continue + einfo "Removed ${provider} alternative module for ${alt}, current is $= (eselect ${alt} show)" + if [[ $? -eq 2 ]]; then + einfo "Cleaning up unused alternatives module for ${alt}" + echo rm "${EROOT}/usr/share/eselect/modules/auto/${alt}.eselect" + rm "${EROOT}/usr/share/eselect/modules/auto/${alt}.eselect" || + eerror rm "${EROOT}/usr/share/eselect/modules/auto/${alt}.eselect" f= ailed + fi + done +} + +EXPORT_FUNCTIONS pkg_postinst pkg_prerm diff --git a/eclass/intel-sdp.eclass b/eclass/intel-sdp.eclass index be74bd1..6759185 100644 --- a/eclass/intel-sdp.eclass +++ b/eclass/intel-sdp.eclass @@ -64,7 +64,7 @@ intel-sdp_pkg_setup() { elif use amd64; then arch=3Dx86_64 INTEL_ARCH=3D"intel64" - if use multilib; then + if has_multilib_profile; then arch=3D"x86_64 ${INTEL_X86:-i486}" INTEL_ARCH=3D"intel64 ia32" fi