public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] dev/bicatali:master commit in: eclass/
@ 2011-02-23  5:39 Sebastien Fabbro
  0 siblings, 0 replies; 6+ messages in thread
From: Sebastien Fabbro @ 2011-02-23  5:39 UTC (permalink / raw
  To: gentoo-commits

commit:     ef35bfeb161a9231505189a2cc5ad1bc27b2791d
Author:     Sébastien Fabbro <bicatali <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 23 05:20:34 2011 +0000
Commit:     Sebastien Fabbro <bicatali <AT> gentoo <DOT> org>
CommitDate: Wed Feb 23 05:20:34 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=dev/bicatali.git;a=commit;h=ef35bfeb

added alternatives-2 eclass

---
 eclass/alternatives-2.eclass |  155 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 155 insertions(+), 0 deletions(-)

diff --git a/eclass/alternatives-2.eclass b/eclass/alternatives-2.eclass
new file mode 100644
index 0000000..ee6a549
--- /dev/null
+++ b/eclass/alternatives-2.eclass
@@ -0,0 +1,155 @@
+# Copyright 2008, 2009 Bo Ørsted Andresen
+# Copyright 2008, 2009 Mike Kelly
+# Copyright 2009 David Leverton
+# 2010: Adapted for Gentoo by Sebastien Fabbro, who does not like copyrights
+# 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 appropriate.
+
+EAPI=3
+ALTERNATIVES_DIR="/etc/env.d/alternatives"
+
+DEPENDS=">=app-admin/eselect-1.2.90"
+RDEPENDS="${DEPENDS}"
+
+# alternatives_for alternative provider importance source target [ source target [...]]
+alternatives_for() {
+	#echo alternatives_for "${@}"
+
+	(( $# >= 5 )) && (( ($#-3)%2 == 0)) || die "${FUNCNAME} requires exactly 3+N*2 arguments where N>=1"
+	local x dupl alternative=${1} provider=${2} importance=${3} index unique src target ret=0
+	shift 3
+
+	# make sure importance is a signed integer
+	if [[ -n ${importance} ]] && ! [[ ${importance} =~ ^[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 value
+	if ! has "${alternative}:${provider}" "${ALTERNATIVES_PROVIDED[@]}"; then
+		index=${#ALTERNATIVES_PROVIDED[@]}
+		ALTERNATIVES_PROVIDED+=( "${alternative}:${provider}" )
+		ALTERNATIVES_IMPORTANCE[index]=${importance}
+		[[ -n ${importance} ]] && echo "${importance}" > "${ED}${ALTERNATIVES_DIR}/${alternative}/${provider}/_importance"
+	else
+		for((index=0;index<${#ALTERNATIVES_PROVIDED[@]};index++)); do
+			if [[ ${alternative}:${provider} == ${ALTERNATIVES_PROVIDED[index]} ]]; then
+				if [[ -n ${ALTERNATIVES_IMPORTANCE[index]} ]]; then
+					if [[ -n ${importance} && ${ALTERNATIVES_IMPORTANCE[index]} != ${importance} ]]; then
+						eerror "Differing importance (${ALTERNATIVES_IMPORTANCE[index]} != ${importance}) detected"
+						((ret++))
+					fi
+				else
+					ALTERNATIVES_IMPORTANCE[index]=${importance}
+					[[ -n ${importance} ]] && echo "${importance}" > "${ED}${ALTERNATIVES_DIR}/${alternative}/${provider}/_importance"
+				fi
+			fi
+		done
+	fi
+
+	while (( $# >= 2 )); do
+		src=${1//+(\/)/\/}; target=${2//+(\/)/\/}
+		if [[ ${src} != /* ]]; then
+			eerror "Source path must be absolute, but got ${src}"
+			((ret++))
+
+		else
+			local reltarget= dir=${ALTERNATIVES_DIR}/${alternative}/${provider}${src%/*}
+			while [[ -n ${dir} ]]; do
+				reltarget+=../
+				dir=${dir%/*}
+			done
+
+			reltarget=${reltarget%/}
+			[[ ${target} == /* ]] || reltarget+=${src%/*}/
+			reltarget+=${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=${target}
+				[[ ${fulltarget} != /* ]] && fulltarget=${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 for ${alternative}"
+}
+
+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 [[ "${version}" == "0.1" || "${version}" == "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="20090908"
+	for a in "${ALTERNATIVES_PROVIDED[@]}"; do
+		alt="${a%:*}"
+		provider="${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 "Could 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="Alternatives for ${alt}"
+				VERSION="${module_version}"
+				MAINTAINER="eselect@gentoo.org"
+				ESELECT_MODULE_GROUP="Alternatives"
+
+				ALTERNATIVE="${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=" --ignore"
+	for a in "${ALTERNATIVES_PROVIDED[@]}"; do
+		alt="${a%:*}"
+		provider="${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" failed
+		fi
+	done
+}
+
+EXPORT_FUNCTIONS pkg_postinst pkg_prerm



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] dev/bicatali:master commit in: eclass/
@ 2011-02-23  5:39 Sebastien Fabbro
  0 siblings, 0 replies; 6+ messages in thread
From: Sebastien Fabbro @ 2011-02-23  5:39 UTC (permalink / raw
  To: gentoo-commits

commit:     4898e966794662908138191c437ffaaf33d60a98
Author:     Sébastien Fabbro <bicatali <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 23 05:21:23 2011 +0000
Commit:     Sebastien Fabbro <bicatali <AT> gentoo <DOT> org>
CommitDate: Wed Feb 23 05:21:23 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=dev/bicatali.git;a=commit;h=4898e966

fixed intel eclass for newer package naming

---
 eclass/intel-sdp.eclass |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/eclass/intel-sdp.eclass b/eclass/intel-sdp.eclass
index 79479a2..4d966e1 100644
--- a/eclass/intel-sdp.eclass
+++ b/eclass/intel-sdp.eclass
@@ -56,8 +56,8 @@ RESTRICT="mirror"
 
 RDEPEND=""
 DEPEND=">=app-arch/rpm2targz-9.0.0.3g"
-
-INTEL_SDP_DIR="opt/intel/${INTEL_SUBDIR}-${INTEL_DPV:-${INTEL_PV1}}.${INTEL_PV3}.${INTEL_PV4}"
+INTEL_SDP_YEAR=${INTEL_DPV%_update*}
+INTEL_SDP_DIR="opt/intel/${INTEL_SUBDIR}-${INTEL_SDP_YEAR:-${INTEL_PV1}}.${INTEL_PV3}.${INTEL_PV4}"
 INTEL_SDP_EDIR="${EROOT#/}/${INTEL_SDP_DIR}"
 
 S="${WORKDIR}"



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] dev/bicatali:master commit in: eclass/
@ 2011-03-21 17:13 Sebastien Fabbro
  0 siblings, 0 replies; 6+ messages in thread
From: Sebastien Fabbro @ 2011-03-21 17:13 UTC (permalink / raw
  To: gentoo-commits

commit:     e0855505b08fb70636c1734bc330e1dbd5a48b57
Author:     Sébastien Fabbro <bicatali <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 21 17:13:30 2011 +0000
Commit:     Sebastien Fabbro <bicatali <AT> gentoo <DOT> org>
CommitDate: Mon Mar 21 17:13:30 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=dev/bicatali.git;a=commit;h=e0855505

fixed for EAPI

---
 eclass/intel-sdp.eclass |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/eclass/intel-sdp.eclass b/eclass/intel-sdp.eclass
index 4d966e1..0234520 100644
--- a/eclass/intel-sdp.eclass
+++ b/eclass/intel-sdp.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Header: $
 
@@ -28,9 +28,6 @@
 # @DEFAULT_UNSET
 # @DESCRIPTION: the package sub-directory where it will end-up in /opt/intel
 # To find out its value, you have to do a raw install from the Intel tar ball
-# in your home directory
-
-EAPI=3
 
 inherit versionator check-reqs multilib
 
@@ -40,9 +37,6 @@ INTEL_PV3=$(get_version_component_range 3)
 INTEL_PV4=$(get_version_component_range 4)
 INTEL_URI="http://registrationcenter-download.intel.com/irc_nas/${INTEL_DID}/${INTEL_DPN}"
 
-# TODO: on some cases, the package variables are inverted
-#  e.g.: ${INTEL_URI}_intel64_${INTEL_DPV}.tgz
-
 SRC_URI="amd64? ( multilib? ( ${INTEL_URI}_${INTEL_DPV}.tgz ) )
 	amd64? ( !multilib? ( ${INTEL_URI}_${INTEL_DPV}_intel64.tgz ) )
 	x86?  ( ${INTEL_URI}_${INTEL_DPV}_ia32.tgz )"
@@ -138,7 +132,7 @@ intel-sdp_src_install() {
 	find opt -name \*sh -type f -exec sed -i \
 		-e "s:<.*DIR>:${INTEL_SDP_EDIR}:g" \
 		'{}' \;
-	mv opt "${ED}"/ || die "moving files failed"
+	mv opt "${ED:-${D}}"/ || die "moving files failed"
 }
 
 intel-sdp_pkg_postinst() {



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] dev/bicatali:master commit in: eclass/
@ 2011-03-22  4:10 Sebastien Fabbro
  0 siblings, 0 replies; 6+ messages in thread
From: Sebastien Fabbro @ 2011-03-22  4:10 UTC (permalink / raw
  To: gentoo-commits

commit:     559a7d6987ff67d30e9845721c355850dbf3e093
Author:     Sébastien Fabbro <bicatali <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 22 04:06:15 2011 +0000
Commit:     Sebastien Fabbro <bicatali <AT> gentoo <DOT> org>
CommitDate: Tue Mar 22 04:06:15 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=dev/bicatali.git;a=commit;h=559a7d69

fixed major syntax

---
 eclass/alternatives-2.eclass |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/eclass/alternatives-2.eclass b/eclass/alternatives-2.eclass
index a82e754..427d73b 100644
--- a/eclass/alternatives-2.eclass
+++ b/eclass/alternatives-2.eclass
@@ -10,8 +10,8 @@
 EAPI=3
 ALTERNATIVES_DIR="/etc/env.d/alternatives"
 
-DEPENDS=">=app-admin/eselect-1.2.15-r1"
-RDEPENDS="${DEPENDS}
+DEPEND=">=app-admin/eselect-1.2.15-r1"
+RDEPEND="${DEPEND}
 	!app-admin/eselect-blas
 	!app-admin/eselect-cblas
 	!app-admin/eselect-lapack"



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] dev/bicatali:master commit in: eclass/
@ 2011-05-23 18:44 Sebastien Fabbro
  0 siblings, 0 replies; 6+ messages in thread
From: Sebastien Fabbro @ 2011-05-23 18:44 UTC (permalink / raw
  To: gentoo-commits

commit:     e685b21303dd8f4e52812014b4cdf12ff0d6e6dd
Author:     Sébastien Fabbro <bicatali <AT> gentoo <DOT> org>
AuthorDate: Mon May 23 15:45:48 2011 +0000
Commit:     Sebastien Fabbro <bicatali <AT> gentoo <DOT> org>
CommitDate: Mon May 23 15:45:48 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=dev/bicatali.git;a=commit;h=e685b213

removed eapi forcing

---
 eclass/alternatives-2.eclass |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/eclass/alternatives-2.eclass b/eclass/alternatives-2.eclass
index 427d73b..bbbe6e0 100644
--- a/eclass/alternatives-2.eclass
+++ b/eclass/alternatives-2.eclass
@@ -7,7 +7,6 @@
 # If your package provides pkg_postinst or pkg_prerm phases, you need to be
 # sure you explicitly run alternatives_pkg_{postinst,prerm} where appropriate.
 
-EAPI=3
 ALTERNATIVES_DIR="/etc/env.d/alternatives"
 
 DEPEND=">=app-admin/eselect-1.2.15-r1"



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] dev/bicatali:master commit in: eclass/
@ 2011-06-20  5:19 Sebastien Fabbro
  0 siblings, 0 replies; 6+ messages in thread
From: Sebastien Fabbro @ 2011-06-20  5:19 UTC (permalink / raw
  To: gentoo-commits

commit:     aa0ca12b16eb1e90101367d1b77a0e643f8bdd06
Author:     Sébastien Fabbro <bicatali <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 20 01:07:09 2011 +0000
Commit:     Sebastien Fabbro <bicatali <AT> gentoo <DOT> org>
CommitDate: Mon Jun 20 01:07:09 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=dev/bicatali.git;a=commit;h=aa0ca12b

more multilib and prefix fixes

---
 eclass/intel-sdp.eclass |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/eclass/intel-sdp.eclass b/eclass/intel-sdp.eclass
index 0234520..6759185 100644
--- a/eclass/intel-sdp.eclass
+++ b/eclass/intel-sdp.eclass
@@ -52,7 +52,7 @@ RDEPEND=""
 DEPEND=">=app-arch/rpm2targz-9.0.0.3g"
 INTEL_SDP_YEAR=${INTEL_DPV%_update*}
 INTEL_SDP_DIR="opt/intel/${INTEL_SUBDIR}-${INTEL_SDP_YEAR:-${INTEL_PV1}}.${INTEL_PV3}.${INTEL_PV4}"
-INTEL_SDP_EDIR="${EROOT#/}/${INTEL_SDP_DIR}"
+INTEL_SDP_EDIR="${EROOT%/}/${INTEL_SDP_DIR}"
 
 S="${WORKDIR}"
 
@@ -64,7 +64,7 @@ intel-sdp_pkg_setup() {
 	elif use amd64; then
 		arch=x86_64
 		INTEL_ARCH="intel64"
-		if use multilib; then
+		if has_multilib_profile; then
 			arch="x86_64 ${INTEL_X86:-i486}"
 			INTEL_ARCH="intel64 ia32"
 		fi
@@ -132,15 +132,16 @@ intel-sdp_src_install() {
 	find opt -name \*sh -type f -exec sed -i \
 		-e "s:<.*DIR>:${INTEL_SDP_EDIR}:g" \
 		'{}' \;
+	mkdir -p "${ED:-${D}}"/ || die
 	mv opt "${ED:-${D}}"/ || die "moving files failed"
 }
 
 intel-sdp_pkg_postinst() {
 	# add product registry to intel "database"
 	local l r
-	INTEL_SDP_DB="${EROOT#/}"/opt/intel/intel-sdp-products.db
+	INTEL_SDP_DB="${EROOT%/}"/opt/intel/intel-sdp-products.db
 	for r in ${INTEL_RPMS}; do
-		l="$(ls -1 ${EROOT#/}/opt/intel/.${r}_*.log | head -n 1)"
+		l="$(ls -1 ${EROOT%/}/opt/intel/.${r}_*.log | head -n 1)"
 		echo >> ${INTEL_SDP_DB} \
 			"<:${r%-${INTEL_PV4}*}-${INTEL_PV4}:${r}:${INTEL_SDP_EDIR}:${l}:>"
 	done



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-06-20  5:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-22  4:10 [gentoo-commits] dev/bicatali:master commit in: eclass/ Sebastien Fabbro
  -- strict thread matches above, loose matches on Subject: below --
2011-06-20  5:19 Sebastien Fabbro
2011-05-23 18:44 Sebastien Fabbro
2011-03-21 17:13 Sebastien Fabbro
2011-02-23  5:39 Sebastien Fabbro
2011-02-23  5:39 Sebastien Fabbro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox