Updating for new slotted kind; 500 => 5_0_26
authorFrancesco Riosa <vivo@gentoo.org>
Tue, 2 Jan 2007 11:37:13 +0000 (11:37 +0000)
committerFrancesco Riosa <vivo@gentoo.org>
Tue, 2 Jan 2007 11:37:13 +0000 (11:37 +0000)
Package-Manager: portage-2.1.2_rc4-r1

app-admin/eselect-mysql/ChangeLog
app-admin/eselect-mysql/eselect-mysql-1.1.8.ebuild [new file with mode: 0644]
app-admin/eselect-mysql/files/digest-eselect-mysql-1.1.8 [new file with mode: 0644]
app-admin/eselect-mysql/files/mysql.eselect

index 279c21d24c542a88608990a081a6490284c3d69d..74217f49dfb989604ae87fd5fea3a183f74d7291 100644 (file)
@@ -1,6 +1,12 @@
 # ChangeLog for app-admin/eselect-mysql
-# Copyright 1999-2006 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/app-admin/eselect-mysql/ChangeLog,v 1.11 2006/02/15 02:34:44 vivo Exp $
+# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/app-admin/eselect-mysql/ChangeLog,v 1.12 2007/01/02 11:37:13 vivo Exp $
+
+*eselect-mysql-1.1.8 (02 Jan 2007)
+
+  02 Jan 2007; Francesco Riosa <vivo@gentoo.org> files/mysql.eselect,
+  +eselect-mysql-1.1.8.ebuild:
+  Updating for new slotted kind; 500 => 5_0_26
 
 *eselect-mysql-1.1.0 (15 Feb 2006)
 
diff --git a/app-admin/eselect-mysql/eselect-mysql-1.1.8.ebuild b/app-admin/eselect-mysql/eselect-mysql-1.1.8.ebuild
new file mode 100644 (file)
index 0000000..65da238
--- /dev/null
@@ -0,0 +1,22 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-admin/eselect-mysql/eselect-mysql-1.1.8.ebuild,v 1.1 2007/01/02 11:37:13 vivo Exp $
+
+DESCRIPTION="Utility to change the default MySQL server being used"
+HOMEPAGE="http://www.gentoo.org/"
+
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+IUSE=""
+
+RDEPEND="app-admin/eselect"
+
+src_install() {
+       pushd "${FILESDIR}" 1>/dev/null
+       insinto /usr/share/eselect/modules
+       doins mysql.eselect
+       popd 1>/dev/null
+}
diff --git a/app-admin/eselect-mysql/files/digest-eselect-mysql-1.1.8 b/app-admin/eselect-mysql/files/digest-eselect-mysql-1.1.8
new file mode 100644 (file)
index 0000000..e69de29
index 3a0486644ff427854894f3d6ceb3def4e509e466..9a8ad15a1a141abc3d174971a21c99c7aab4beb7 100644 (file)
@@ -1,10 +1,12 @@
 # Copyright 1999-2005 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Id: mysql.eselect,v 1.12 2006/02/15 02:34:44 vivo Exp $
+# $Id: mysql.eselect,v 1.13 2007/01/02 11:37:13 vivo Exp $
 
-DESCRIPTION="Manage the /usr/lib/*mysql* links"
+[[ -d "${ROOT}/lib64" ]] && LIBDIR="lib64" || LIBDIR="lib"
+
+DESCRIPTION="Manage the /usr/${LIBDIR}/*mysql* links"
 MAINTAINER="vivo@gentoo.org"
-SVN_DATE='$Date: 2006/02/15 02:34:44 $'
+SVN_DATE='$Date: 2007/01/02 11:37:13 $'
 VERSION=$(svn_date_to_version "${SVN_DATE}" )
 MYSQL_SYMLINK_CHECKDIR="${ROOT}/usr/bin"
 ERR_NOT_FOUND="(not-found)"
@@ -15,10 +17,7 @@ ERR_UNSET="(unset)"
 #
 # $1 - version to transform
 function version4human() {
-       local major=${1:0:1}
-       local minor=${1:1:2}
-       [[ ${minor:0:1} == "0" ]] && minor=${minor:1:1}
-       echo "${major}.${minor}.x"
+       echo "${1//_/.}"
 }
 
 # return a integer version
@@ -26,17 +25,14 @@ function version4human() {
 # $1 - version to transform
 
 function version4bash() {
-       local minor=${1#*.}
-       minor=${minor%%.x*}
-       [[ ${#minor} -lt 10 ]] && minor="0${minor}"
-       echo "${1%%.*}${minor}"
+       echo "${1//./_}"
 }
 
 # Return the versions currently installed
 find_versions() {
        local versions list
-       # "eselect mysql set 1" will always set the best version
-       list=$( ls ${MYSQL_SYMLINK_CHECKDIR}/perror-* 2>/dev/null )
+       # TODO: "eselect mysql set 1" will always set the best version
+       list=$( mysql_make_file_list ${MYSQL_SYMLINK_CHECKDIR}/perror 2>/dev/null )
        for x in ${list} ; do
                versions=( $( version4human ${x##*-}) ${versions[@]} )
        done
@@ -66,38 +62,23 @@ check_symlink() {
        return ${ret}
 }
 
-# another one inherited from versionator.eclass (version_sort)
 # THERE IS A COPY OF THIS ONE IN MYSQL_FX.ECLASS, keep the two synced
 mysql_make_file_list() {
-       local items= left=0
-       items=$( ls -d ${1}-[[:digit:]][[:digit:]][[:digit:]] )
-
-       while [[ ${left} -lt ${#items[@]} ]] ; do
-               local lowest_idx=${left}
-               local idx=$(( ${lowest_idx} + 1 ))
-               while [[ ${idx} -lt ${#items[@]} ]] ; do
-                       [[ "${items[${lowest_idx}]}" > "${items[${idx}]}" ]] \
-                               && lowest_idx=${idx}
-                       idx=$(( ${idx} + 1 ))
-               done
-               local tmp=${items[${lowest_idx}]}
-               items[${lowest_idx}]=${items[${left}]}
-               items[${left}]=${tmp}
-               left=$(( ${left} + 1 ))
-       done
-       echo ${items[@]}
+    local base="${1}-"
+    local items
+    local ret
+    echo $( for i in $( ls -d ${1}-[[:digit:]]_[[:digit:]]{,[[:digit:]]}_[[:digit:]]{,[[:digit:]]} 2>/dev/null )
+    do
+        n=${i#${base}}
+        n=( ${n//_/ } )
+        echo "$(( ${n[0]} * 10000 + 100 + ${n[1]} * 100 + 100 + ${n[2]} ))$i"
+    done | sort | cut -c 6- )
 }
 
 # THERE IS A COPY OF THIS ONE IN ESELECT-MYSQL, keep the two synced
 mysql_choose_better_version() {
-       local items= better="" i
-       items="$( ls -d ${1}-[[:digit:]][[:digit:]][[:digit:]] )"
-       for i in ${items} ; do
-               if [[ "${i}" > "${better}" ]] ; then
-                       better="${i}"
-               fi
-       done
-       echo "${better}"
+       local better=$(mysql_make_file_list ${1})
+       echo ${better##* }
 }
 
 # void mysql_lib_symlinks()
@@ -108,14 +89,13 @@ mysql_choose_better_version() {
 # THERE IS A COPY OF THIS ONE IN MYSQL_FX.ECLASS, keep the two synced
 mysql_lib_symlinks() {
        local d dirlist maxdots soname sonameln other better
-       pushd "${ROOT}/usr/lib" &> /dev/null
+       pushd "${ROOT}/usr/${LIBDIR}" &> /dev/null
                # dirlist must contain the less significative directory left
                dirlist="mysql $( mysql_make_file_list mysql )"
 
                # waste some time in removing and recreating symlinks
                for d in $dirlist ; do
-                       for soname
-                       in $( find "${d}" -name "*.so*" -and -not -type "l" 2>/dev/null)
+                       for soname in $( find "${d}" -name "*.so*" -and -not -type "l" 2>/dev/null )
                        do
                                # maxdot is a limit versus infinite loop
                                maxdots=0
@@ -136,7 +116,7 @@ mysql_lib_symlinks() {
        popd &> /dev/null
 
        # "include"s and "mysql_config", needed to compile other sw
-       for other in "/usr/lib/mysql" "/usr/include/mysql" "/usr/bin/mysql_config" ; do
+       for other in "/usr/${LIBDIR}/mysql" "/usr/include/mysql" "/usr/bin/mysql_config" ; do
                pushd "${ROOT}${other%/*}" &> /dev/null
                better=$( mysql_choose_better_version "${other##*/}" )
                if ! [[ -d "${other##*/}" ]] ; then
@@ -179,7 +159,7 @@ get_current_version() {
        link=$(readlink ${MYSQL_SYMLINK_CHECKDIR}/perror)
        version=${link##*-}
 
-       if ! is_number "${version}" || [[ "${version}" == "" ]] ; then
+       if ! is_number "${version//_/}" || [[ "${version}" == "" ]] ; then
                version="${ERR_UNSET}"
                echo "${version}"
        else
@@ -190,12 +170,12 @@ get_current_version() {
 set_current_version() {
 
        local version=${1}
-       is_number "${version}" || die -q "No usable version: ${version}"
+       is_number "${version//_/}" || die -q "No usable version: ${version}"
        local CWD=$(pwd)
        local lastdir dir linkname
        local list=$(< $ROOT/var/lib/eselect/mysql/mysql-${version}.filelist )
 
-       # perform a check on the entire file lis
+       # perform a check on the entire file list
        for filename in $list ; do
                dir="${ROOT}/$(dirname "${filename}")"
                if [[ "${dir}" != "${lastdir}" ]] ; then
@@ -239,7 +219,7 @@ set_current_version() {
 remove_current_version() {
 
        local version=${1}
-       is_number "${version}" || die -q "No usable version: ${version}"
+       is_number "${version//_/}" || die -q "No usable version: ${version}"
        local CWD=$(pwd)
        local lastdir dir linkname
        local list=$(< $ROOT/var/lib/eselect/mysql/mysql-${version}.filelist )