Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 348788
Collapse All | Expand All

(-)/g/portage/eclass/mysql_fx.eclass (-13 / +42 lines)
Lines 3-9 Link Here
3
# $Header: /var/cvsroot/gentoo-x86/eclass/mysql_fx.eclass,v 1.22 2009/02/12 05:05:14 robbat2 Exp $
3
# $Header: /var/cvsroot/gentoo-x86/eclass/mysql_fx.eclass,v 1.22 2009/02/12 05:05:14 robbat2 Exp $
4
4
5
# Author: Francesco Riosa (Retired) <vivo@gentoo.org>
5
# Author: Francesco Riosa (Retired) <vivo@gentoo.org>
6
# Maintainer: Luca Longinotti <chtekk@gentoo.org>
6
# Maintainer: MySQL Team <mysql-bugs@gentoo.org>
7
#		Luca Longinotti <chtekk@gentoo.org>
7
8
8
inherit multilib
9
inherit multilib
9
10
Lines 177-189 Link Here
177
	[[ ${want_s} -le ${have_s} ]] && return 0 || return 1
178
	[[ ${want_s} -le ${have_s} ]] && return 0 || return 1
178
}
179
}
179
180
181
__rm_and_ln() {
182
	rm -f "${2}"
183
	ln -s "${1}" "${2}"
184
}
185
180
#
186
#
181
# To be called on the live filesystem, reassigning symlinks of each MySQL
187
# To be called on the live filesystem, reassigning symlinks of each MySQL
182
# library to the best version available.
188
# library to the best version available.
183
#
189
#
184
mysql_lib_symlinks() {
190
mysql_lib_symlinks() {
185
	einfo "Updating MySQL .so symlinks"
191
	local d dirlist maxdots libname libnameln libsuffix reldir t
186
	local d dirlist maxdots soname sonameln reldir
192
	libsuffix=$(get_libname)
193
	[[ -z ${libsuffix} ]] && return
194
	einfo "Updating MySQL ${libsuffix} symlinks"
187
	reldir="${1}"
195
	reldir="${1}"
188
	pushd "${reldir}/usr/$(get_libdir)" &> /dev/null
196
	pushd "${reldir}/usr/$(get_libdir)" &> /dev/null
189
		# dirlist must contain the less significative directory left
197
		# dirlist must contain the less significative directory left
Lines 191-210 Link Here
191
199
192
		# waste some time in removing and recreating symlinks
200
		# waste some time in removing and recreating symlinks
193
		for d in $dirlist ; do
201
		for d in $dirlist ; do
194
			for soname in $( find "${d}" -name "*.so*" -and -not -type "l" 2>/dev/null ) ; do
202
			for libname in $( find "${d}" -name "*.${libsuffix}*" -and -not -type "l" 2>/dev/null ) ; do
195
				# maxdot is a limit versus infinite loop
203
				# maxdot is a limit versus infinite loop
196
				maxdots=0
204
				maxdots=0
197
				sonameln=${soname##*/}
205
				libnameln=${libname##*/}
206
				t=${libnameln//./} # t will be used to count number of dots
198
				# loop in version of the library to link it, similar to how
207
				# loop in version of the library to link it, similar to how
199
				# libtool works
208
				# libtool works
200
				while [[ ${sonameln:0-3} != '.so' ]] && [[ ${maxdots} -lt 6 ]] ; do
209
				# - [[ $((${#libnameln} - ${#t})) > 1 ]] check is redundant 
201
					rm -f "${sonameln}"
210
				#   because libmysqlclient.dylib libmysqlclient.so behave the same
202
					ln -s "${soname}" "${sonameln}"
211
				# - idem for maxdots check
203
					(( ++maxdots ))
212
				if [[ ${libnameln:0-${#libsuffix}} == "${libsuffix}" ]] \
204
					sonameln="${sonameln%.*}"
213
				&& [[ $((${#libnameln} - ${#t})) > 1 ]]
205
				done
214
				then
206
				rm -f "${sonameln}"
215
					# .dylib like naming scheme
207
				ln -s "${soname}" "${sonameln}"
216
					libnameln=${libnameln%.${libsuffix}}
217
					t=${libnameln%%.*}
218
					while [[ ${t} != ${libnameln} ]] \
219
					   && [[ ${maxdots} -lt 6 ]]
220
					do
221
						__rm_and_ln "${libname}" "${libnameln}.${libsuffix}"
222
						(( ++maxdots ))
223
						libnameln="${libnameln%.*}"
224
					done
225
					__rm_and_ln "${libname}" "${libnameln}.${libsuffix}"
226
				else
227
					# .so like naming scheme
228
					while [[ ${libnameln:0-${#libsuffix}} != "${libsuffix}" ]] \
229
					   && [[ ${maxdots} -lt 6 ]]
230
					do
231
						__rm_and_ln "${libname}" "${libnameln}"
232
						(( ++maxdots ))
233
						libnameln="${libnameln%.*}"
234
					done
235
					__rm_and_ln "${libname}" "${libnameln}"
236
				fi
208
			done
237
			done
209
		done
238
		done
210
	popd &> /dev/null
239
	popd &> /dev/null

Return to bug 348788