Give mysql_fx.eclass a few smarts to look for a versioned mysql-extras directory.
authorRobin H. Johnson <robbat2@gentoo.org>
Sun, 15 Apr 2007 12:18:49 +0000 (12:18 +0000)
committerRobin H. Johnson <robbat2@gentoo.org>
Sun, 15 Apr 2007 12:18:49 +0000 (12:18 +0000)
eclass/mysql_fx.eclass

index 53212aa929278759cb70c06717b0b34325b28425..9e9014b55b49f9ecb68b402f2a33b93c39798236 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2007 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/mysql_fx.eclass,v 1.18 2007/01/12 20:51:28 chtekk Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/mysql_fx.eclass,v 1.19 2007/04/15 12:18:49 robbat2 Exp $
 
 # Author: Francesco Riosa (Retired) <vivo@gentoo.org>
 # Maintainer: Luca Longinotti <chtekk@gentoo.org>
@@ -56,8 +56,16 @@ mysql_check_version_range() {
 # True if at least one applicable range is found for the patch.
 #
 _mysql_test_patch_ver_pn() {
-       local filesdir="${WORKDIR}/mysql-extras"
        local allelements=", version, package name"
+       # So that it fails the directory test if none of them exist
+       local filesdir="/dev/null" 
+       for d in "${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}" \
+               "${WORKDIR}/mysql-extras" ; do
+               if [ -d "${d}" ]; then
+                       filesdir="${d}"
+                       break
+               fi
+       done
 
        [[ -d "${filesdir}" ]] || die "Source dir must be a directory"
        local flags=$1 pname=$2
@@ -85,9 +93,29 @@ _mysql_test_patch_ver_pn() {
 # If the patch applies, print its description.
 #
 mysql_mv_patches() {
-       local index_file="${1:-"${WORKDIR}/mysql-extras/000_index.txt"}"
+       # So that it fails the directory test if none of them exist
+       local filesdir="/dev/null"
+       if [[ -z "${1}" ]]; then
+               for d in "${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}" \
+                       "${WORKDIR}/mysql-extras" ; do
+                       if [ -d "${d}" ]; then
+                               filesdir="${d}"
+                               break
+                       fi
+               done
+               [[ -d "${filesdir}" ]] || die "No patches directory found!"
+       fi
+
+       local index_file="${1:-"${filesdir}/000_index.txt"}"
        local my_ver="${2:-"${MYSQL_VERSION_ID}"}"
        local my_test_fx=${3:-"_mysql_test_patch_ver_pn"}
+       _mysql_mv_patches "${index_file}" "${my_ver}" "${my_test_fx}"
+}
+
+_mysql_mv_patches() {
+       local index_file="${1}"
+       local my_ver="${2}"
+       local my_test_fx="${3}"
        local dsc ndsc=0 i
        dsc=( )