/[gentoo-x86]/eclass/mysql_fx.eclass
Gentoo

Diff of /eclass/mysql_fx.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.10 Revision 1.11
1# Copyright 1999-2005 Gentoo Foundation 1# Copyright 1999-2005 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/mysql_fx.eclass,v 1.10 2006/03/10 12:29:44 herbs Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/mysql_fx.eclass,v 1.11 2006/03/17 20:17:53 vivo Exp $
4 4
5# Author: Francesco Riosa <vivo at gentoo.org> 5# Author: Francesco Riosa <vivo at gentoo.org>
6# Maintainer: Francesco Riosa <vivo at gentoo.org> 6# Maintainer: Francesco Riosa <vivo at gentoo.org>
7 7
8inherit multilib 8inherit multilib
110 local want_s=$(stripdots "$1") have_s=$( stripdots "${2:-${MYSQL_VERSION_ID}}") 110 local want_s=$(stripdots "$1") have_s=$( stripdots "${2:-${MYSQL_VERSION_ID}}")
111 [[ -z "${want_s}" ]] && die "mysql_version_is_at_least missing value" 111 [[ -z "${want_s}" ]] && die "mysql_version_is_at_least missing value"
112 [[ ${want_s} -le ${have_s} ]] && return 0 || return 1 112 [[ ${want_s} -le ${have_s} ]] && return 0 || return 1
113} 113}
114 114
115# another one inherited from versionator.eclass (version_sort)
116# THERE IS A COPY OF THIS ONE IN ESELECT-MYSQL, keep the two synced
117mysql_make_file_list() {
118 local items= left=0
119 items=$( ls -d ${1}-[[:digit:]][[:digit:]][[:digit:]] 2>/dev/null )
120
121 while [[ ${left} -lt ${#items[@]} ]] ; do
122 local lowest_idx=${left}
123 local idx=$(( ${lowest_idx} + 1 ))
124 while [[ ${idx} -lt ${#items[@]} ]] ; do
125 [[ "${items[${lowest_idx}]}" > "${items[${idx}]}" ]] \
126 && lowest_idx=${idx}
127 idx=$(( ${idx} + 1 ))
128 done
129 local tmp=${items[${lowest_idx}]}
130 items[${lowest_idx}]=${items[${left}]}
131 items[${left}]=${tmp}
132 left=$(( ${left} + 1 ))
133 done
134 echo ${items[@]}
135}
136
137# THERE IS A COPY OF THIS ONE IN ESELECT-MYSQL, keep the two synced
138mysql_choose_better_version() {
139 local items= better="" i
140 items="$( ls -d ${1}-[[:digit:]][[:digit:]][[:digit:]] )"
141 for i in ${items} ; do
142 if [[ "${i}" > "${better}" ]] ; then
143 better="${i}"
144 fi
145 done
146 echo "${better}"
147}
148
149
150# void mysql_lib_symlinks() 115# void mysql_lib_symlinks()
151# 116#
152# To be called on the live filesystem, reassign symlinks to each mysql 117# To be called on the live filesystem, reassign symlinks to each mysql
153# library to the best version avaiable 118# library to the best version available
154# 2005-12-30 <vivo at gentoo.org> 119# 2005-12-30 <vivo at gentoo.org>
155# THERE IS A COPY OF THIS ONE IN ESELECT-MYSQL, keep the two synced
156mysql_lib_symlinks() { 120mysql_lib_symlinks() {
157 local d dirlist maxdots soname sonameln other better 121 local d dirlist maxdots soname sonameln other better
158 pushd "${ROOT}/usr/$(get_libdir)" &> /dev/null 122 pushd "${ROOT}/usr/$(get_libdir)" &> /dev/null
159 # dirlist must contain the less significative directory left 123 # dirlist must contain the less significative directory left
160 dirlist="mysql $( mysql_make_file_list mysql )" 124 dirlist="mysql"
161 125
162 # waste some time in removing and recreating symlinks 126 # waste some time in removing and recreating symlinks
163 for d in $dirlist ; do 127 for d in $dirlist ; do
164 for soname in $(find "${d}" -name "*.so*" -and -not -type "l") ; do 128 for soname in $(find "${d}" -name "*.so*" -and -not -type "l") ; do
165 # maxdot is a limit versus infinite loop 129 # maxdot is a limit versus infinite loop
177 rm -f "${sonameln}" 141 rm -f "${sonameln}"
178 ln -s "${soname}" "${sonameln}" 142 ln -s "${soname}" "${sonameln}"
179 done 143 done
180 done 144 done
181 popd &> /dev/null 145 popd &> /dev/null
182
183 # "include"s and "mysql_config", needed to compile other sw
184 for other in "/usr/$(get_libdir)/mysql" "/usr/include/mysql" "/usr/bin/mysql_config" ; do
185 pushd "${ROOT}${other%/*}" &> /dev/null
186 better=$( mysql_choose_better_version "${other##*/}" )
187 if ! [[ -d "${other##*/}" ]] ; then
188 [[ -L "${other##*/}" ]] && rm -f "${other##*/}"
189 ! [[ -f "${other##*/}" ]] && ln -sf "${better}" "${other##*/}"
190 else
191 [[ -L "${other##*/}" ]] && rm -f "${other##*/}"
192 ! [[ -d "${other##*/}" ]] && ln -s "${better}" "${other##*/}"
193 fi
194 popd &> /dev/null
195 done
196} 146}

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

  ViewVC Help
Powered by ViewVC 1.1.20