/[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.15 Revision 1.16
1# Copyright 1999-2006 Gentoo Foundation 1# Copyright 1999-2006 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.15 2007/01/01 22:27:01 swegener Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/mysql_fx.eclass,v 1.16 2007/01/03 15:27:13 vivo Exp $
4# kate: encoding utf-8; eol unix;
5# kate: indent-width 4; mixedindent off; remove-trailing-space on; space-indent off;
6# kate: word-wrap-column 80; word-wrap off;
4 7
5# Author: Francesco Riosa <vivo@gentoo.org> 8# Author: Francesco Riosa (Retired) <vivo@gentoo.org>
6# Maintainer: Francesco Riosa <vivo@gentoo.org> 9# Maintainer: Francesco Riosa <vivo@gentoo.org>
7 10
8ECLASS="mysql_fx" 11ECLASS="mysql_fx"
9INHERITED="$INHERITED $ECLASS" 12INHERITED="$INHERITED $ECLASS"
10inherit multilib 13inherit multilib
48# 51#
49mysql_check_version_range() { 52mysql_check_version_range() {
50 local lbound="${1%% to *}" ; lbound=$(stripdots "${lbound}") 53 local lbound="${1%% to *}" ; lbound=$(stripdots "${lbound}")
51 local rbound="${1#* to }" ; rbound=$(stripdots "${rbound}") 54 local rbound="${1#* to }" ; rbound=$(stripdots "${rbound}")
52 local my_ver="${2:-"${MYSQL_VERSION_ID}"}" 55 local my_ver="${2:-"${MYSQL_VERSION_ID}"}"
53 [[ ${lbound} -le ${my_ver} && ${my_ver} -le ${rbound} ]] && return 0 56 [[ ${lbound} -le ${my_ver} ]] && [[ ${my_ver} -le ${rbound} ]] && return 0
54 return 1 57 return 1
55} 58}
56 59
57# * char mysql_strip_double_slash() 60# true if found at least one appliable range
58#
59# Strip double slashes from passed argument.
60# 2005-11-19 <vivo@gentoo.org> 61# 2005-11-19 <vivo at gentoo.org>
62_mysql_test_patch_ver_pn() {
63 local filesdir="${WORKDIR}/mysql-extras"
64 local allelements=", version, package name"
65
66 [[ -d "${filesdir}" ]] || die "sourcedir must be a directory"
67 local flags=$1 pname=$2
68 if [[ $(( $flags & $(( 1 + 4 + 16 )) )) -eq 21 ]] ; then
69 einfo "using \"${pname}\""
70 mv "${filesdir}/${pname}" "${EPATCH_SOURCE}" || die "cannot move ${pname}"
71 return 0
72 fi
73
74 [[ $(( $flags & $(( 2 + 4 )) )) -gt 0 ]] \
75 && allelements="${allelements//", version"}"
76
77 [[ $(( $flags & $(( 8 + 16 )) )) -gt 0 ]] \
78 && allelements="${allelements//", package name"}"
79
80 [[ -n "${allelements}" ]] && [[ "${flags}" -gt 0 ]] \
81 && ewarn "QA notice ${allelements} missing in ${pname} patch"
82
83 return 1
84}
85
86# void mysql_mv_patches(char * index_file, char * filesdir, int my_ver)
61# 87#
62mysql_strip_double_slash() { 88# parse a "index_file" looking for patches to apply to current
63 local path="${1}" 89# version.
64 local newpath="${path/\/\///}" 90# If the patch apply then print it's description
65 while [[ "${path}" != "${newpath}" ]] ; do 91# 2005-11-19 <vivo at gentoo.org>
66 path="${newpath}" 92mysql_mv_patches() {
67 newpath="${path/\/\///}" 93 local index_file="${1:-"${WORKDIR}/mysql-extras/000_index.txt"}"
68 done 94 local my_ver="${2:-"${MYSQL_VERSION_ID}"}"
69 echo "${newpath}" 95 local my_test_fx=${3:-"_mysql_test_patch_ver_pn"}
96 local dsc ndsc=0 i
97 dsc=( )
98
99 # values for flags are (2^x):
100 # 1 - one patch found
101 # 2 - at least one version range is wrong
102 # 4 - at least one version range is _good_
103 # 8 - at least one ${PN} did not match
104 # 16 - at least one ${PN} has been matched
105 local flags=0 pname=''
106 while read row; do
107 case "${row}" in
108 @patch\ *)
109 [[ -n "${pname}" ]] \
110 && ${my_test_fx} $flags "${pname}" \
111 && for (( i=0 ; $i < $ndsc ; i++ )) ; do einfo "> ${dsc[$i]}" ; done
112 flags=1 ; ndsc=0 ; dsc=( )
113 pname=${row#"@patch "}
114 ;;
115 @ver\ *)
116 if mysql_check_version_range "${row#"@ver "}" "${my_ver}" ; then
117 flags=$(( $flags | 4 ))
118 else
119 flags=$(( $flags | 2 ))
120 fi
121 ;;
122 @pn\ *)
123 if [[ ${row#"@pn "} == "${PN}" ]] ; then
124 flags=$(( $flags | 16 ))
125 else
126 flags=$(( $flags | 8 ))
127 fi
128 ;;
129 # @use\ *) ;;
130 @@\ *)
131 dsc[$ndsc]="${row#"@@ "}"
132 (( ++ndsc ))
133 ;;
134 esac
135 done < "${index_file}"
136 ${my_test_fx} $flags "${pname}" \
137 && for (( i=0 ; $i < $ndsc ; i++ )) ; do einfo "> ${dsc[$i]}" ; done
70} 138}
71 139
72# Is $2 (defaults to $MYSQL_VERSION_ID) at least version $1? 140# Is $2 (defaults to $MYSQL_VERSION_ID) at least version $1?
73# (nice) idea from versionator.eclass 141# (nice) idea from versionator.eclass
74# 142#
100 echo ${better##* } 168 echo ${better##* }
101} 169}
102 170
103# void mysql_lib_symlinks() 171# void mysql_lib_symlinks()
104# 172#
105# To be called on the live filesystem, reassigning symlinks of each MySQL 173# To be called on the live filesystem, reassign symlinks to each mysql
106# library to the best version available. 174# library to the best version available
107# 2005-12-30 <vivo@gentoo.org> 175# 2005-12-30 <vivo at gentoo.org>
108# 176# THERE IS A COPY OF THIS ONE IN ESELECT-MYSQL, keep the two synced
109mysql_lib_symlinks() { 177mysql_lib_symlinks() {
110 local d dirlist maxdots soname sonameln other better 178 local d dirlist maxdots soname sonameln other better
111 pushd "${ROOT}/usr/$(get_libdir)" &> /dev/null 179 pushd "${ROOT}/usr/$(get_libdir)" &> /dev/null
112
113 # dirlist must contain the less significative directory left 180 # dirlist must contain the less significative directory left
114 dirlist="mysql" 181 dirlist="mysql $( mysql_make_file_list mysql )"
115 182
116 # waste some time in removing and recreating symlinks 183 # waste some time in removing and recreating symlinks
117 for d in $dirlist ; do 184 for d in $dirlist ; do
118 for soname in $(find "${d}" -name "*.so*" -and -not -type "l") ; do 185 for soname in $( find "${d}" -name "*.so*" -and -not -type "l" 2>/dev/null )
186 do
119 # maxdot is a limit versus infinite loop 187 # maxdot is a limit versus infinite loop
120 maxdots=0 188 maxdots=0
121 sonameln=${soname##*/} 189 sonameln=${soname##*/}
122 # loop in version of the library to link it, similar to how 190 # loop in version of the library to link it, similar to the
123 # libtool works 191 # libtool work
124 while [[ ${sonameln:0-3} != '.so' ]] && [[ ${maxdots} -lt 6 ]] ; do 192 while [[ ${sonameln:0-3} != '.so' ]] && [[ ${maxdots} -lt 6 ]]
193 do
194 rm -f "${sonameln}"
195 ln -s "${soname}" "${sonameln}"
196 (( ++maxdots ))
197 sonameln="${sonameln%.*}"
198 done
125 rm -f "${sonameln}" 199 rm -f "${sonameln}"
126 ln -s "${soname}" "${sonameln}" 200 ln -s "${soname}" "${sonameln}"
127 (( ++maxdots ))
128 sonameln="${sonameln%.*}"
129 done 201 done
130 rm -f "${sonameln}"
131 ln -s "${soname}" "${sonameln}"
132 done 202 done
203 popd &> /dev/null
204
205 # "include"s and "mysql_config", needed to compile other sw
206 for other in "/usr/$(get_libdir)/mysql" "/usr/include/mysql" "/usr/bin/mysql_config" ; do
207 pushd "${ROOT}${other%/*}" &> /dev/null
208 better=$( mysql_choose_better_version "${other##*/}" )
209 if ! [[ -d "${other##*/}" ]] ; then
210 [[ -L "${other##*/}" ]] && rm -f "${other##*/}"
211 ! [[ -f "${other##*/}" ]] && ln -sf "${better}" "${other##*/}"
212 else
213 [[ -L "${other##*/}" ]] && rm -f "${other##*/}"
214 ! [[ -d "${other##*/}" ]] && ln -s "${better}" "${other##*/}"
215 fi
216 popd &> /dev/null
133 done 217 done
134
135 popd &> /dev/null
136} 218}

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

  ViewVC Help
Powered by ViewVC 1.1.20