From d0b308ce8c60d5cd28641d248b4305e8575855ef Mon Sep 17 00:00:00 2001
From: Stuart Herbert <stuart@gentoo.org>
Date: Sun, 4 Sep 2005 09:47:51 +0000
Subject: Initial import from PHP overlay Package-Manager: portage-2.0.51.22-r2

---
 app-admin/eselect-php/ChangeLog                    |   7 +
 app-admin/eselect-php/Manifest                     |   7 +
 app-admin/eselect-php/eselect-php-0.96.ebuild      |  22 +++
 .../eselect-php/files/digest-eselect-php-0.96      |   0
 app-admin/eselect-php/files/php-cgi.eselect        | 196 +++++++++++++++++++++
 app-admin/eselect-php/files/php-devel.eselect      | 196 +++++++++++++++++++++
 app-admin/eselect-php/files/php.eselect            | 196 +++++++++++++++++++++
 app-admin/eselect-php/metadata.xml                 |   5 +
 8 files changed, 629 insertions(+)
 create mode 100644 app-admin/eselect-php/ChangeLog
 create mode 100644 app-admin/eselect-php/Manifest
 create mode 100644 app-admin/eselect-php/eselect-php-0.96.ebuild
 create mode 100644 app-admin/eselect-php/files/digest-eselect-php-0.96
 create mode 100644 app-admin/eselect-php/files/php-cgi.eselect
 create mode 100644 app-admin/eselect-php/files/php-devel.eselect
 create mode 100644 app-admin/eselect-php/files/php.eselect
 create mode 100644 app-admin/eselect-php/metadata.xml

(limited to 'app-admin')

diff --git a/app-admin/eselect-php/ChangeLog b/app-admin/eselect-php/ChangeLog
new file mode 100644
index 000000000000..60b4a1ef1a28
--- /dev/null
+++ b/app-admin/eselect-php/ChangeLog
@@ -0,0 +1,7 @@
+# ChangeLog for app-admin/eselect-php
+# Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/app-admin/eselect-php/ChangeLog,v 1.1 2005/09/04 09:47:51 stuart Exp $
+
+  4 Sept 2005; <stuart@gentoo.org> ChangeLog:
+  Initial import
+
diff --git a/app-admin/eselect-php/Manifest b/app-admin/eselect-php/Manifest
new file mode 100644
index 000000000000..04438d964c7c
--- /dev/null
+++ b/app-admin/eselect-php/Manifest
@@ -0,0 +1,7 @@
+MD5 c58d07ca1c1235bbad9bccaec96fc062 metadata.xml 157
+MD5 e28fc3a2f0f9ad3fd70312fee69a0f3a ChangeLog 279
+MD5 18d82db711ba224423ff6aab731d6062 eselect-php-0.96.ebuild 656
+MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-eselect-php-0.96 0
+MD5 0e16c19617c890564754bba88e29ba78 files/php-devel.eselect 4275
+MD5 2c2f1ee6a6de5732b601b8444099aa18 files/php-cgi.eselect 4261
+MD5 7e4b06e9f537e77689b9a56c416e5bb3 files/php.eselect 4249
diff --git a/app-admin/eselect-php/eselect-php-0.96.ebuild b/app-admin/eselect-php/eselect-php-0.96.ebuild
new file mode 100644
index 000000000000..2eeac7f9695f
--- /dev/null
+++ b/app-admin/eselect-php/eselect-php-0.96.ebuild
@@ -0,0 +1,22 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-admin/eselect-php/eselect-php-0.96.ebuild,v 1.1 2005/09/04 09:47:51 stuart Exp $
+
+inherit eutils
+
+DESCRIPTION="PHP modules for eselect."
+HOMEPAGE="http://svn.gnqs.org/projects/gentoo-php-overlay/wiki/InstallPhpEselectModules"
+SRC_URI=""
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~x86 ~ppc"
+IUSE=""
+DEPEND="app-admin/eselect"
+
+src_install() {
+	dodir /usr/share/eselect/modules
+	insinto /usr/share/eselect/modules
+	doins ${FILESDIR}/php.eselect
+	doins ${FILESDIR}/php-cgi.eselect
+	doins ${FILESDIR}/php-devel.eselect
+}
diff --git a/app-admin/eselect-php/files/digest-eselect-php-0.96 b/app-admin/eselect-php/files/digest-eselect-php-0.96
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/app-admin/eselect-php/files/php-cgi.eselect b/app-admin/eselect-php/files/php-cgi.eselect
new file mode 100644
index 000000000000..1926132fd7ea
--- /dev/null
+++ b/app-admin/eselect-php/files/php-cgi.eselect
@@ -0,0 +1,196 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: php-cgi.eselect,v 1.1 2005/09/04 09:47:51 stuart Exp $
+
+DESCRIPTION="Manage the /usr/bin/php link"
+MAINTAINER="stuart@gentoo.org"
+SVN_DATE='$Date: 2005/09/04 09:47:51 $'
+VERSION=$(svn_date_to_version "${SVN_DATE}" )
+
+PHP_SYMLINK_TARGETDIR="${ROOT}/usr/bin"
+PHP_SYMLINK_APPLIST=( php-cgi )
+PHP_VERSIONS="4 5 6"
+PHP_HELP="php-cgi"
+
+find_libdir() {
+	# where has multilib put the native php binary?
+	for x in lib64 lib32 lib ; do
+		for y in ${PHP_VERSIONS} ; do
+			if test -d /usr/${x}/php${y}/bin ; then
+				libdir=${x}
+				return
+			fi
+		done
+	done
+
+	# if we get here, then we can't find where PHP is installed
+	# throw in any old default - it doesn't matter, because there's
+	# no PHP anyway
+
+	libdir=/usr/lib
+}
+
+find_versions() {
+	find_libdir
+
+	# how many packages are we looking for?
+	musthave=${#PHP_SYMLINK_APPLIST[@]}
+
+	for f in $PHP_VERSIONS ; do
+		(( dohave = 0 ))
+		for (( i = 0 ; i < ${#PHP_SYMLINK_APPLIST[@]} ; i = i + 1 )) ; do
+			n=${PHP_SYMLINK_APPLIST[$i]}
+			[[ -f ${ROOT}/usr/${libdir}/php${f}/bin/${n} ]] && (( dohave = $dohave + 1 ))
+		done
+
+		if (( $dohave == $musthave )) ; then
+			echo "php${f}"
+		fi
+	done
+}
+
+# try to remove the php symlink
+#
+# $1 - symlink to remove
+
+remove_symlink() {
+	[[ -L ${1} ]] && rm -f ${1}
+}
+
+# set the php symlink
+#
+# $1 - symlink to set
+# $2 - php version to set it to
+
+set_symlink() {
+	PHP_BASENAME=`basename ${1}`
+
+	find_libdir
+	target="${ROOT}/usr/${libdir}/$2/bin/`basename $1`"
+
+	pushd "`dirname $1`" 1>/dev/null
+	ln -s "${target}" "${PHP_BASENAME}"
+	popd 1>/dev/null
+}
+
+# work out which PHP version the user has chosen from the list
+#
+# $1: the list id that the user has chosen
+
+get_phpversion_fromlist () {
+	version=$1
+
+	versions=( $(find_versions) )
+	for (( i = 0 ; i < ${#versions[@]} ; i = i + 1 )) ; do
+		if [[ ${versions[$i]} == ${version} ]] ; then
+			echo ${version}
+			return
+		fi
+	done
+
+	echo "(not-found)"
+}
+
+get_phpversion_fromlink () {
+	echo $1 | sed -e 's|.*/\(php[0-9]\+\)/.*|\1|;'
+}
+
+get_current_phpversion () {
+	link=$(readlink ${PHP_SYMLINK_TARGETDIR}/${PHP_SYMLINK_APPLIST[0]})
+	version=$(get_phpversion_fromlink $link)
+
+	[[ -z "$version" ]] && version="(unset)"
+	echo $version
+}
+
+# $1: basename of target app
+# $2: php version to use
+
+set_current_phpversion() {
+	PHP_SYMLINK_REALTARGET="${PHP_SYMLINK_TARGETDIR}/$1"
+
+	if [[ -e ${PHP_SYMLINK_REALTARGET} ]] ; then
+		# the target file exists
+		# question is - is it a symlink, or something else?
+
+		if [[ ! -L ${PHP_SYMLINK_REALTARGET} ]] ; then
+			# it is something else
+			#
+			# be cautious - do not remove it
+			die -q "${PHP_SYMLINK_REALTARGET} exists, but is not a symlink"
+		fi
+	fi
+
+	if [[ -L ${PHP_SYMLINK_REALTARGET} ]] ; then
+		# existing symlink
+		if ! remove_symlink ${PHP_SYMLINK_REALTARGET} ; then
+			die -q "Couldn't remove existing symlink"
+		fi
+	fi
+
+	if ! set_symlink ${PHP_SYMLINK_REALTARGET} "${2}" ; then
+		die -q "Couldn't set a new symlink"
+	fi
+}
+
+### show action ###
+
+describe_show() {
+	echo "Show the current PHP version for ${PHP_HELP}"
+}
+
+do_show() {
+	write_list_start "Current PHP version:"
+	version=$(get_current_phpversion)
+	write_kv_list_entry "$version" ""
+}
+
+### list action ###
+
+describe_list() {
+	echo "List available PHP versions to link to"
+}
+
+do_list() {
+	versions=( $(find_versions ) )
+	current=$(get_current_phpversion)
+
+	write_list_start "Available PHP versions:"
+
+	if [[ -n ${versions[@]} ]] ; then
+		local i
+		for (( i = 0 ; i < ${#versions[@]} ; i = i + 1 )) ; do
+			linkversion=${versions[${i}]}
+
+			[[ $linkversion == $current ]] && \
+				versions[${i}]="${versions[${i}]} $(highlight '*' )"
+		done
+		write_numbered_list "${versions[@]}"
+	else
+		write_kv_list_entry "(none found)" ""
+	fi
+}
+
+### set action ###
+
+describe_set() {
+	echo "Set PHP version used"
+}
+
+do_set() {
+	if [[ -z ${1} ]] ; then
+		# no parameter
+		die -q "You didn't tell me which version of PHP to use"
+	fi
+
+	version=$(get_phpversion_fromlist $1)
+	if [[ ${version} == "(not-found)" ]] ; then
+		die -q "I don't recognise that version of PHP"
+	fi
+
+	for (( i = 0 ; i < ${#PHP_SYMLINK_APPLIST[@]} ; i = i + 1 )) ; do
+		set_current_phpversion ${PHP_SYMLINK_APPLIST[$i]} ${version}
+	done
+}
+
+# vim: set ft=eselect :
diff --git a/app-admin/eselect-php/files/php-devel.eselect b/app-admin/eselect-php/files/php-devel.eselect
new file mode 100644
index 000000000000..524120cbc809
--- /dev/null
+++ b/app-admin/eselect-php/files/php-devel.eselect
@@ -0,0 +1,196 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: php-devel.eselect,v 1.1 2005/09/04 09:47:51 stuart Exp $
+
+DESCRIPTION="Manage the /usr/bin/php link"
+MAINTAINER="stuart@gentoo.org"
+SVN_DATE='$Date: 2005/09/04 09:47:51 $'
+VERSION=$(svn_date_to_version "${SVN_DATE}" )
+
+PHP_SYMLINK_TARGETDIR="${ROOT}/usr/bin"
+PHP_SYMLINK_APPLIST=( php-config phpize )
+PHP_VERSIONS="4 5 6"
+PHP_HELP="php-devel"
+
+find_libdir() {
+	# where has multilib put the native php binary?
+	for x in lib64 lib32 lib ; do
+		for y in ${PHP_VERSIONS} ; do
+			if test -d /usr/${x}/php${y}/bin ; then
+				libdir=${x}
+				return
+			fi
+		done
+	done
+
+	# if we get here, then we can't find where PHP is installed
+	# throw in any old default - it doesn't matter, because there's
+	# no PHP anyway
+
+	libdir=/usr/lib
+}
+
+find_versions() {
+	find_libdir
+
+	# how many packages are we looking for?
+	musthave=${#PHP_SYMLINK_APPLIST[@]}
+
+	for f in $PHP_VERSIONS ; do
+		(( dohave = 0 ))
+		for (( i = 0 ; i < ${#PHP_SYMLINK_APPLIST[@]} ; i = i + 1 )) ; do
+			n=${PHP_SYMLINK_APPLIST[$i]}
+			[[ -f ${ROOT}/usr/${libdir}/php${f}/bin/${n} ]] && (( dohave = $dohave + 1 ))
+		done
+
+		if (( $dohave == $musthave )) ; then
+			echo "php${f}"
+		fi
+	done
+}
+
+# try to remove the php symlink
+#
+# $1 - symlink to remove
+
+remove_symlink() {
+	[[ -L ${1} ]] && rm -f ${1}
+}
+
+# set the php symlink
+#
+# $1 - symlink to set
+# $2 - php version to set it to
+
+set_symlink() {
+	PHP_BASENAME=`basename ${1}`
+
+	find_libdir
+	target="${ROOT}/usr/${libdir}/$2/bin/`basename $1`"
+
+	pushd "`dirname $1`" 1>/dev/null
+	ln -s "${target}" "${PHP_BASENAME}"
+	popd 1>/dev/null
+}
+
+# work out which PHP version the user has chosen from the list
+#
+# $1: the list id that the user has chosen
+
+get_phpversion_fromlist () {
+	version=$1
+
+	versions=( $(find_versions) )
+	for (( i = 0 ; i < ${#versions[@]} ; i = i + 1 )) ; do
+		if [[ ${versions[$i]} == ${version} ]] ; then
+			echo ${version}
+			return
+		fi
+	done
+
+	echo "(not-found)"
+}
+
+get_phpversion_fromlink () {
+	echo $1 | sed -e 's|.*/\(php[0-9]\+\)/.*|\1|;'
+}
+
+get_current_phpversion () {
+	link=$(readlink ${PHP_SYMLINK_TARGETDIR}/${PHP_SYMLINK_APPLIST[0]})
+	version=$(get_phpversion_fromlink $link)
+
+	[[ -z "$version" ]] && version="(unset)"
+	echo $version
+}
+
+# $1: basename of target app
+# $2: php version to use
+
+set_current_phpversion() {
+	PHP_SYMLINK_REALTARGET="${PHP_SYMLINK_TARGETDIR}/$1"
+
+	if [[ -e ${PHP_SYMLINK_REALTARGET} ]] ; then
+		# the target file exists
+		# question is - is it a symlink, or something else?
+
+		if [[ ! -L ${PHP_SYMLINK_REALTARGET} ]] ; then
+			# it is something else
+			#
+			# be cautious - do not remove it
+			die -q "${PHP_SYMLINK_REALTARGET} exists, but is not a symlink"
+		fi
+	fi
+
+	if [[ -L ${PHP_SYMLINK_REALTARGET} ]] ; then
+		# existing symlink
+		if ! remove_symlink ${PHP_SYMLINK_REALTARGET} ; then
+			die -q "Couldn't remove existing symlink"
+		fi
+	fi
+
+	if ! set_symlink ${PHP_SYMLINK_REALTARGET} "${2}" ; then
+		die -q "Couldn't set a new symlink"
+	fi
+}
+
+### show action ###
+
+describe_show() {
+	echo "Show the current PHP version for ${PHP_HELP}"
+}
+
+do_show() {
+	write_list_start "Current PHP version:"
+	version=$(get_current_phpversion)
+	write_kv_list_entry "$version" ""
+}
+
+### list action ###
+
+describe_list() {
+	echo "List available PHP versions to link to"
+}
+
+do_list() {
+	versions=( $(find_versions ) )
+	current=$(get_current_phpversion)
+
+	write_list_start "Available PHP versions:"
+
+	if [[ -n ${versions[@]} ]] ; then
+		local i
+		for (( i = 0 ; i < ${#versions[@]} ; i = i + 1 )) ; do
+			linkversion=${versions[${i}]}
+
+			[[ $linkversion == $current ]] && \
+				versions[${i}]="${versions[${i}]} $(highlight '*' )"
+		done
+		write_numbered_list "${versions[@]}"
+	else
+		write_kv_list_entry "(none found)" ""
+	fi
+}
+
+### set action ###
+
+describe_set() {
+	echo "Set PHP version used"
+}
+
+do_set() {
+	if [[ -z ${1} ]] ; then
+		# no parameter
+		die -q "You didn't tell me which version of PHP to use"
+	fi
+
+	version=$(get_phpversion_fromlist $1)
+	if [[ ${version} == "(not-found)" ]] ; then
+		die -q "I don't recognise that version of PHP"
+	fi
+
+	for (( i = 0 ; i < ${#PHP_SYMLINK_APPLIST[@]} ; i = i + 1 )) ; do
+		set_current_phpversion ${PHP_SYMLINK_APPLIST[$i]} ${version}
+	done
+}
+
+# vim: set ft=eselect :
diff --git a/app-admin/eselect-php/files/php.eselect b/app-admin/eselect-php/files/php.eselect
new file mode 100644
index 000000000000..3742b4b40b49
--- /dev/null
+++ b/app-admin/eselect-php/files/php.eselect
@@ -0,0 +1,196 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: php.eselect,v 1.1 2005/09/04 09:47:51 stuart Exp $
+
+DESCRIPTION="Manage the /usr/bin/php link"
+MAINTAINER="stuart@gentoo.org"
+SVN_DATE='$Date: 2005/09/04 09:47:51 $'
+VERSION=$(svn_date_to_version "${SVN_DATE}" )
+
+PHP_SYMLINK_TARGETDIR="${ROOT}/usr/bin"
+PHP_SYMLINK_APPLIST=( php )
+PHP_VERSIONS="4 5 6"
+PHP_HELP="php"
+
+find_libdir() {
+	# where has multilib put the native php binary?
+	for x in lib64 lib32 lib ; do
+		for y in ${PHP_VERSIONS} ; do
+			if test -d /usr/${x}/php${y}/bin ; then
+				libdir=${x}
+				return
+			fi
+		done
+	done
+
+	# if we get here, then we can't find where PHP is installed
+	# throw in any old default - it doesn't matter, because there's
+	# no PHP anyway
+
+	libdir=/usr/lib
+}
+
+find_versions() {
+	find_libdir
+
+	# how many packages are we looking for?
+	musthave=${#PHP_SYMLINK_APPLIST[@]}
+
+	for f in $PHP_VERSIONS ; do
+		(( dohave = 0 ))
+		for (( i = 0 ; i < ${#PHP_SYMLINK_APPLIST[@]} ; i = i + 1 )) ; do
+			n=${PHP_SYMLINK_APPLIST[$i]}
+			[[ -f ${ROOT}/usr/${libdir}/php${f}/bin/${n} ]] && (( dohave = $dohave + 1 ))
+		done
+
+		if (( $dohave == $musthave )) ; then
+			echo "php${f}"
+		fi
+	done
+}
+
+# try to remove the php symlink
+#
+# $1 - symlink to remove
+
+remove_symlink() {
+	[[ -L ${1} ]] && rm -f ${1}
+}
+
+# set the php symlink
+#
+# $1 - symlink to set
+# $2 - php version to set it to
+
+set_symlink() {
+	PHP_BASENAME=`basename ${1}`
+
+	find_libdir
+	target="${ROOT}/usr/${libdir}/$2/bin/`basename $1`"
+
+	pushd "`dirname $1`" 1>/dev/null
+	ln -s "${target}" "${PHP_BASENAME}"
+	popd 1>/dev/null
+}
+
+# work out which PHP version the user has chosen from the list
+#
+# $1: the list id that the user has chosen
+
+get_phpversion_fromlist () {
+	version=$1
+
+	versions=( $(find_versions) )
+	for (( i = 0 ; i < ${#versions[@]} ; i = i + 1 )) ; do
+		if [[ ${versions[$i]} == ${version} ]] ; then
+			echo ${version}
+			return
+		fi
+	done
+
+	echo "(not-found)"
+}
+
+get_phpversion_fromlink () {
+	echo $1 | sed -e 's|.*/\(php[0-9]\+\)/.*|\1|;'
+}
+
+get_current_phpversion () {
+	link=$(readlink ${PHP_SYMLINK_TARGETDIR}/${PHP_SYMLINK_APPLIST[0]})
+	version=$(get_phpversion_fromlink $link)
+
+	[[ -z "$version" ]] && version="(unset)"
+	echo $version
+}
+
+# $1: basename of target app
+# $2: php version to use
+
+set_current_phpversion() {
+	PHP_SYMLINK_REALTARGET="${PHP_SYMLINK_TARGETDIR}/$1"
+
+	if [[ -e ${PHP_SYMLINK_REALTARGET} ]] ; then
+		# the target file exists
+		# question is - is it a symlink, or something else?
+
+		if [[ ! -L ${PHP_SYMLINK_REALTARGET} ]] ; then
+			# it is something else
+			#
+			# be cautious - do not remove it
+			die -q "${PHP_SYMLINK_REALTARGET} exists, but is not a symlink"
+		fi
+	fi
+
+	if [[ -L ${PHP_SYMLINK_REALTARGET} ]] ; then
+		# existing symlink
+		if ! remove_symlink ${PHP_SYMLINK_REALTARGET} ; then
+			die -q "Couldn't remove existing symlink"
+		fi
+	fi
+
+	if ! set_symlink ${PHP_SYMLINK_REALTARGET} "${2}" ; then
+		die -q "Couldn't set a new symlink"
+	fi
+}
+
+### show action ###
+
+describe_show() {
+	echo "Show the current PHP version for ${PHP_HELP}"
+}
+
+do_show() {
+	write_list_start "Current PHP version:"
+	version=$(get_current_phpversion)
+	write_kv_list_entry "$version" ""
+}
+
+### list action ###
+
+describe_list() {
+	echo "List available PHP versions to link to"
+}
+
+do_list() {
+	versions=( $(find_versions ) )
+	current=$(get_current_phpversion)
+
+	write_list_start "Available PHP versions:"
+
+	if [[ -n ${versions[@]} ]] ; then
+		local i
+		for (( i = 0 ; i < ${#versions[@]} ; i = i + 1 )) ; do
+			linkversion=${versions[${i}]}
+
+			[[ $linkversion == $current ]] && \
+				versions[${i}]="${versions[${i}]} $(highlight '*' )"
+		done
+		write_numbered_list "${versions[@]}"
+	else
+		write_kv_list_entry "(none found)" ""
+	fi
+}
+
+### set action ###
+
+describe_set() {
+	echo "Set PHP version used"
+}
+
+do_set() {
+	if [[ -z ${1} ]] ; then
+		# no parameter
+		die -q "You didn't tell me which version of PHP to use"
+	fi
+
+	version=$(get_phpversion_fromlist $1)
+	if [[ ${version} == "(not-found)" ]] ; then
+		die -q "I don't recognise that version of PHP"
+	fi
+
+	for (( i = 0 ; i < ${#PHP_SYMLINK_APPLIST[@]} ; i = i + 1 )) ; do
+		set_current_phpversion ${PHP_SYMLINK_APPLIST[$i]} ${version}
+	done
+}
+
+# vim: set ft=eselect :
diff --git a/app-admin/eselect-php/metadata.xml b/app-admin/eselect-php/metadata.xml
new file mode 100644
index 000000000000..fd3dbe39fa64
--- /dev/null
+++ b/app-admin/eselect-php/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<herd>php</herd>
+</pkgmetadata>
-- 
cgit v1.2.3-65-gdbad