1.1 --- a/scripts/addToolVersion.sh Thu Apr 15 22:35:18 2010 +0200
1.2 +++ b/scripts/addToolVersion.sh Thu Apr 28 23:26:57 2011 +0200
1.3 @@ -55,13 +55,14 @@
1.4 # $1 : version string to add
1.5 addToolVersion() {
1.6 local version="$1"
1.7 - local file
1.8 + local file="$2"
1.9 local config_ver_option
1.10 local exp_obs_prompt
1.11 local deps v ver_M ver_m ver_p
1.12 local SedExpr1 SedExpr2
1.13
1.14 - file="config/${tool_prefix}/${tool}.in"
1.15 + [ -f "${file}" ] || return 0
1.16 +
1.17 v=$(echo "${version}" |"${sed}" -r -e 's/-/_/g; s/\./_/g;')
1.18
1.19 config_ver_option="${cat}_V_${v}"
1.20 @@ -70,9 +71,11 @@
1.21 # to try adding a new version if the one he/she wants is not listed.
1.22 # But it can be the case where the version is hidden behind either one
1.23 # of EXPERIMENTAL or OBSOLETE, so warn if the version is already listed.
1.24 - if (GREP_OPTIONS= grep -E "^config ${config_ver_option}$" "${file}" >/dev/null 2>&1); then
1.25 + if grep -E "^config ${config_ver_option}$" "${file}" >/dev/null 2>&1; then
1.26 echo "'${tool}': version '${version}' already present:"
1.27 - GREP_OPTIONS= grep -A3 -B0 -E "^config ${config_ver_option}$" "${file}"
1.28 + grep -A1 -B0 -n \
1.29 + -E "^(config ${config_ver_option}| {4}prompt \"${version}\")$" \
1.30 + "${file}" /dev/null
1.31 return 0
1.32 fi
1.33
1.34 @@ -180,7 +183,11 @@
1.35
1.36 # Version string:
1.37 *) [ -n "${tool}" ] || { doHelp; exit 1; }
1.38 - addToolVersion "$1"
1.39 + file_base="config/${tool_prefix}/${tool}.in"
1.40 + # Components have their version selection either
1.41 + # in the .in or the .in.2 file. Handle both.
1.42 + addToolVersion "$1" "${file_base}"
1.43 + addToolVersion "$1" "${file_base}.2"
1.44 ;;
1.45 esac
1.46 shift