summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancesco Riosa <vivo@gentoo.org>2006-01-30 17:47:13 +0000
committerFrancesco Riosa <vivo@gentoo.org>2006-01-30 17:47:13 +0000
commitef1af10bc0e37ead9b7c9c1ffd743ed442328d4b (patch)
treec75da722adb343a5240faaffb2a8b5ae2b9b117b /app-admin
parentre-added to ~ppc, bug #120857 (diff)
downloadhistorical-ef1af10bc0e37ead9b7c9c1ffd743ed442328d4b.tar.gz
historical-ef1af10bc0e37ead9b7c9c1ffd743ed442328d4b.tar.bz2
historical-ef1af10bc0e37ead9b7c9c1ffd743ed442328d4b.zip
duplicate symlinking of libraries and include files from mysql eclasses
Package-Manager: portage-2.1_pre3-r1
Diffstat (limited to 'app-admin')
-rw-r--r--app-admin/eselect-mysql/ChangeLog6
-rw-r--r--app-admin/eselect-mysql/Manifest14
-rw-r--r--app-admin/eselect-mysql/files/mysql.eselect87
3 files changed, 102 insertions, 5 deletions
diff --git a/app-admin/eselect-mysql/ChangeLog b/app-admin/eselect-mysql/ChangeLog
index 582fe022b934..47fae8c0f685 100644
--- a/app-admin/eselect-mysql/ChangeLog
+++ b/app-admin/eselect-mysql/ChangeLog
@@ -1,6 +1,10 @@
# 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.4 2006/01/08 23:41:42 vivo Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-admin/eselect-mysql/ChangeLog,v 1.5 2006/01/30 17:47:13 vivo Exp $
+
+ 30 Jan 2006; Francesco Riosa <vivo@gentoo.org> files/mysql.eselect:
+ Additional security, duplicated the code from mysql eclasses to symlink
+ required include files and libraries (always to the best version)
08 Jan 2006; Francesco Riosa <vivo@gentoo.org> files/mysql.eselect:
Added "remove" action to remove simlinks
diff --git a/app-admin/eselect-mysql/Manifest b/app-admin/eselect-mysql/Manifest
index 8d6a0f241b01..9da6ad1b48d4 100644
--- a/app-admin/eselect-mysql/Manifest
+++ b/app-admin/eselect-mysql/Manifest
@@ -1,5 +1,15 @@
-MD5 292cd87be527af4de5f87b1e2b5a6af1 ChangeLog 997
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+MD5 51e50a482a295166aa4aba9d8a9ac9be ChangeLog 1210
MD5 c069ec9f84ebf9fab35f5d0ccdcc8943 eselect-mysql-1.0.0.ebuild 614
MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-eselect-mysql-1.0.0 0
-MD5 80f375dbb99b7608ce24e40919ead50a files/mysql.eselect 5689
+MD5 6b8f8f5d9e1f816e8321448469c395f2 files/mysql.eselect 8249
MD5 fa97fe3e6f213f79ccf7ffbd53838095 metadata.xml 338
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.2 (GNU/Linux)
+
+iD8DBQFD3lEyKolR564NvWYRAqv9AKCP+7sBwp5UV8B6GQBbUVz69PBX2wCgyL5t
+RgmSbsBUfXp1RqHhUAWw1ow=
+=jmvg
+-----END PGP SIGNATURE-----
diff --git a/app-admin/eselect-mysql/files/mysql.eselect b/app-admin/eselect-mysql/files/mysql.eselect
index 4ba4a8d4e5ba..80648179aa91 100644
--- a/app-admin/eselect-mysql/files/mysql.eselect
+++ b/app-admin/eselect-mysql/files/mysql.eselect
@@ -1,10 +1,10 @@
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Id: mysql.eselect,v 1.4 2006/01/08 23:41:42 vivo Exp $
+# $Id: mysql.eselect,v 1.5 2006/01/30 17:47:13 vivo Exp $
DESCRIPTION="Manage the /usr/lib/*mysql* links"
MAINTAINER="vivo@gentoo.org"
-SVN_DATE='$Date: 2006/01/08 23:41:42 $'
+SVN_DATE='$Date: 2006/01/30 17:47:13 $'
VERSION=$(svn_date_to_version "${SVN_DATE}" )
MYSQL_SYMLINK_CHECKDIR="${ROOT}/usr/sbin"
ERR_NOT_FOUND="(not-found)"
@@ -67,6 +67,87 @@ 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=( ${1}-[[:digit:]][[:digit:]][[:digit:]] )
+ [[ "${items}" == "${1}-[[:digit:]][[:digit:]][[:digit:]]" ]] && items=( )
+
+ 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[@]}
+}
+
+# THERE IS A COPY OF THIS ONE IN ESELECT-MYSQL, keep the two synced
+mysql_choose_better_version() {
+ local items= better="" i
+ items="$( ls ${1}-[[:digit:]][[:digit:]][[:digit:]] )"
+ for i in ${items} ; do
+ if [[ "${i}" > "${better}" ]] ; then
+ better="${i}"
+ fi
+ done
+ echo "${better}"
+}
+
+# void mysql_lib_symlinks()
+#
+# To be called on the live filesystem, reassign symlinks to each mysql
+# library to the best version avaiable
+# 2005-12-30 <vivo at gentoo.org>
+# 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
+ # 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") ; do
+ # maxdot is a limit versus infinite loop
+ maxdots=0
+ sonameln=${soname##*/}
+ # loop in version of the library to link it, similar to the
+ # libtool work
+ while [[ ${sonameln:0-3} != '.so' ]] && [[ ${maxdots} -lt 6 ]]
+ do
+ rm -f "${sonameln}"
+ ln -s "${soname}" "${sonameln}"
+ (( ++maxdots ))
+ sonameln="${sonameln%.*}"
+ done
+ rm -f "${sonameln}"
+ ln -s "${soname}" "${sonameln}"
+ done
+ done
+ popd &> /dev/null
+
+ # "include"s and "mysql_config", needed to compile other sw
+ for other in "/usr/include/mysql" "/usr/bin/mysql_config" ; do
+ pushd "${ROOT}${other%/*}" &> /dev/null
+ if ! [[ -d "${other##*/}" ]] ; then
+ better=$( mysql_choose_better_version "${other##*/}" )
+ [[ -L "${other##*/}" ]] && rm -f "${other##*/}"
+ ! [[ -f "${other##*/}" ]] && ln -sf "${better}" "${other##*/}"
+ fi
+ popd &> /dev/null
+ done
+}
+
+
# work out which MYSQL version the user has chosen from the list
#
# $1: the list id that the user has chosen
@@ -216,6 +297,7 @@ do_set() {
fi
set_current_version "$(version4bash "${version}")"
+ mysql_lib_symlinks
}
### remove action ###
@@ -234,6 +316,7 @@ do_remove() {
fi
remove_current_version "$(version4bash "${version}")"
+ mysql_lib_symlinks
}
# vim: set ft=eselect :