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

Contents of /eclass/mysql_fx.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.13 - (show annotations) (download)
Fri May 5 19:49:43 2006 UTC (11 years, 9 months ago) by chtekk
Branch: MAIN
Changes since 1.12: +42 -98 lines
Sync with overlay.

1 # Copyright 1999-2006 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 # Author: Francesco Riosa <vivo@gentoo.org>
6 # Maintainer: Francesco Riosa <vivo@gentoo.org>
7
8 inherit multilib
9
10 # Helper function, version (integer) may have sections separated by dots
11 # for readability
12 #
13 stripdots() {
14 local dotver=${1:-"0"}
15 while [[ "${dotver/./}" != "${dotver}" ]] ; do dotver="${dotver/./}" ; done
16 echo "${dotver:-"0"}"
17 }
18
19 # bool mysql_check_version_range(char * range, int ver=MYSQL_VERSION_ID, int die_on_err=MYSQL_DIE_ON_RANGE_ERROR)
20 #
21 # Check if a version number falls inside a given range.
22 # The range includes the extremes and must be specified as
23 # "low_version to high_version" i.e. "4.00.00.00 to 5.01.99.99"
24 # Return true if inside the range
25 # 2005-11-19 <vivo@gentoo.org>
26 #
27 mysql_check_version_range() {
28 local lbound="${1%% to *}" ; lbound=$(stripdots "${lbound}")
29 local rbound="${1#* to }" ; rbound=$(stripdots "${rbound}")
30 local my_ver="${2:-"${MYSQL_VERSION_ID}"}"
31 [[ ${lbound} -le ${my_ver} && ${my_ver} -le ${rbound} ]] && return 0
32 return 1
33 }
34
35 # * char mysql_strip_double_slash()
36 #
37 # Strip double slashes from passed argument.
38 # 2005-11-19 <vivo@gentoo.org>
39 #
40 mysql_strip_double_slash() {
41 local path="${1}"
42 local newpath="${path/\/\///}"
43 while [[ "${path}" != "${newpath}" ]] ; do
44 path="${newpath}"
45 newpath="${path/\/\///}"
46 done
47 echo "${newpath}"
48 }
49
50 # Is $2 (defaults to $MYSQL_VERSION_ID) at least version $1?
51 # (nice) idea from versionator.eclass
52 #
53 mysql_version_is_at_least() {
54 local want_s=$(stripdots "$1") have_s=$(stripdots "${2:-${MYSQL_VERSION_ID}}")
55 [[ -z "${want_s}" ]] && die "mysql_version_is_at_least missing value to check"
56 [[ ${want_s} -le ${have_s} ]] && return 0 || return 1
57 }
58
59 # void mysql_lib_symlinks()
60 #
61 # To be called on the live filesystem, reassigning symlinks of each MySQL
62 # library to the best version available.
63 # 2005-12-30 <vivo@gentoo.org>
64 #
65 mysql_lib_symlinks() {
66 local d dirlist maxdots soname sonameln other better
67 pushd "${ROOT}/usr/$(get_libdir)" &> /dev/null
68
69 # dirlist must contain the less significative directory left
70 dirlist="mysql"
71
72 # waste some time in removing and recreating symlinks
73 for d in $dirlist ; do
74 for soname in $(find "${d}" -name "*.so*" -and -not -type "l") ; do
75 # maxdot is a limit versus infinite loop
76 maxdots=0
77 sonameln=${soname##*/}
78 # loop in version of the library to link it, similar to how
79 # libtool works
80 while [[ ${sonameln:0-3} != '.so' ]] && [[ ${maxdots} -lt 6 ]] ; do
81 rm -f "${sonameln}"
82 ln -s "${soname}" "${sonameln}"
83 (( ++maxdots ))
84 sonameln="${sonameln%.*}"
85 done
86 rm -f "${sonameln}"
87 ln -s "${soname}" "${sonameln}"
88 done
89 done
90
91 popd &> /dev/null
92 }

  ViewVC Help
Powered by ViewVC 1.1.20