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

Contents of /eclass/mysql_fx.eclass

Parent Directory Parent Directory | Revision Log Revision Log


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

1 chtekk 1.13 # Copyright 1999-2006 Gentoo Foundation
2 vivo 1.1 # Distributed under the terms of the GNU General Public License v2
3 vivo 1.12 # $Header: $
4    
5 chtekk 1.13 # Author: Francesco Riosa <vivo@gentoo.org>
6     # Maintainer: Francesco Riosa <vivo@gentoo.org>
7 vivo 1.1
8 herbs 1.10 inherit multilib
9    
10 chtekk 1.13 # Helper function, version (integer) may have sections separated by dots
11     # for readability
12     #
13 vivo 1.1 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 chtekk 1.13 # 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 vivo 1.1 # Return true if inside the range
25 chtekk 1.13 # 2005-11-19 <vivo@gentoo.org>
26     #
27 vivo 1.1 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 chtekk 1.13 [[ ${lbound} -le ${my_ver} && ${my_ver} -le ${rbound} ]] && return 0
32 vivo 1.1 return 1
33     }
34    
35 chtekk 1.13 # * char mysql_strip_double_slash()
36 vivo 1.1 #
37 chtekk 1.13 # Strip double slashes from passed argument.
38     # 2005-11-19 <vivo@gentoo.org>
39 vivo 1.1 #
40     mysql_strip_double_slash() {
41     local path="${1}"
42     local newpath="${path/\/\///}"
43 chtekk 1.13 while [[ "${path}" != "${newpath}" ]] ; do
44     path="${newpath}"
45 vivo 1.1 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 chtekk 1.13 #
53 vivo 1.1 mysql_version_is_at_least() {
54 chtekk 1.13 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 vivo 1.1 [[ ${want_s} -le ${have_s} ]] && return 0 || return 1
57     }
58    
59     # void mysql_lib_symlinks()
60     #
61 chtekk 1.13 # 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 vivo 1.1 mysql_lib_symlinks() {
66 vivo 1.3 local d dirlist maxdots soname sonameln other better
67 herbs 1.10 pushd "${ROOT}/usr/$(get_libdir)" &> /dev/null
68 vivo 1.1
69 chtekk 1.13 # 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 vivo 1.1 rm -f "${sonameln}"
82     ln -s "${soname}" "${sonameln}"
83 chtekk 1.13 (( ++maxdots ))
84     sonameln="${sonameln%.*}"
85 vivo 1.1 done
86 chtekk 1.13 rm -f "${sonameln}"
87     ln -s "${soname}" "${sonameln}"
88 vivo 1.1 done
89 chtekk 1.13 done
90    
91 vivo 1.5 popd &> /dev/null
92 vivo 1.1 }

  ViewVC Help
Powered by ViewVC 1.1.20