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

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.12

  ViewVC Help
Powered by ViewVC 1.1.20