summaryrefslogtreecommitdiff
path: root/scripts/addToolVersion.sh
diff options
context:
space:
mode:
authorYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2011-04-27 22:13:41 (GMT)
committerYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2011-04-27 22:13:41 (GMT)
commitc9a186ec84d988f3cb9f9a6e7a421df4f0c543f0 (patch)
treebb077b68e912c262c6bb6c9e82ef0554ded2e16c /scripts/addToolVersion.sh
parent1b1bb6c58862b3380ce4d07a9493caa39760f341 (diff)
scripts/addToolsVersion: versions can be either in the .in or the .in.2
The components have their version selection handled either in the .in file or the .in.2 file. Handle both cases. Also, when dumping an existing version, keep the user's grep options (ie. do override neither options nor colors). Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Diffstat (limited to 'scripts/addToolVersion.sh')
-rwxr-xr-xscripts/addToolVersion.sh17
1 files changed, 12 insertions, 5 deletions
diff --git a/scripts/addToolVersion.sh b/scripts/addToolVersion.sh
index 0258cdf..5209f6b 100755
--- a/scripts/addToolVersion.sh
+++ b/scripts/addToolVersion.sh
@@ -55,13 +55,14 @@ doHelp() {
# $1 : version string to add
addToolVersion() {
local version="$1"
- local file
+ local file="$2"
local config_ver_option
local exp_obs_prompt
local deps v ver_M ver_m ver_p
local SedExpr1 SedExpr2
- file="config/${tool_prefix}/${tool}.in"
+ [ -f "${file}" ] || return 0
+
v=$(echo "${version}" |"${sed}" -r -e 's/-/_/g; s/\./_/g;')
config_ver_option="${cat}_V_${v}"
@@ -70,9 +71,11 @@ addToolVersion() {
# to try adding a new version if the one he/she wants is not listed.
# But it can be the case where the version is hidden behind either one
# of EXPERIMENTAL or OBSOLETE, so warn if the version is already listed.
- if (GREP_OPTIONS= grep -E "^config ${config_ver_option}$" "${file}" >/dev/null 2>&1); then
+ if grep -E "^config ${config_ver_option}$" "${file}" >/dev/null 2>&1; then
echo "'${tool}': version '${version}' already present:"
- GREP_OPTIONS= grep -A3 -B0 -E "^config ${config_ver_option}$" "${file}"
+ grep -A1 -B0 -n \
+ -E "^(config ${config_ver_option}| {4}prompt \"${version}\")$" \
+ "${file}" /dev/null
return 0
fi
@@ -180,7 +183,11 @@ while [ $# -gt 0 ]; do
# Version string:
*) [ -n "${tool}" ] || { doHelp; exit 1; }
- addToolVersion "$1"
+ file_base="config/${tool_prefix}/${tool}.in"
+ # Components have their version selection either
+ # in the .in or the .in.2 file. Handle both.
+ addToolVersion "$1" "${file_base}"
+ addToolVersion "$1" "${file_base}.2"
;;
esac
shift