diff options
author | hisham <hisham@9ca3f7c1-7366-0410-b1a3-b5c78f85698c> | 2009-10-13 22:50:09 +0000 |
---|---|---|
committer | hisham <hisham@9ca3f7c1-7366-0410-b1a3-b5c78f85698c> | 2009-10-13 22:50:09 +0000 |
commit | e89cde014d381bcac4d0bdd76f385b67122e0489 (patch) | |
tree | 61a7419992d109cb3708110613fea7a6a8ebc0b3 /src | |
parent | 783424f942cae6be08c6fe1774e2949b9220382a (diff) | |
download | luarocks-e89cde014d381bcac4d0bdd76f385b67122e0489.tar.gz luarocks-e89cde014d381bcac4d0bdd76f385b67122e0489.tar.bz2 luarocks-e89cde014d381bcac4d0bdd76f385b67122e0489.zip |
cleaner behavior
git-svn-id: http://luarocks.org/svn/luarocks/trunk@99 9ca3f7c1-7366-0410-b1a3-b5c78f85698c
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/util.lua | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/luarocks/util.lua b/src/luarocks/util.lua index ab6ad34f..662e9739 100644 --- a/src/luarocks/util.lua +++ b/src/luarocks/util.lua | |||
@@ -169,11 +169,14 @@ end | |||
169 | -- warning the user that substitutions have failed. | 169 | -- warning the user that substitutions have failed. |
170 | -- @param line string: the input string | 170 | -- @param line string: the input string |
171 | local function warn_failed_matches(line) | 171 | local function warn_failed_matches(line) |
172 | local any_failed = false | ||
172 | if line:match(var_format_pattern) then | 173 | if line:match(var_format_pattern) then |
173 | for unmatched in line:gmatch(var_format_pattern) do | 174 | for unmatched in line:gmatch(var_format_pattern) do |
174 | warning("unmatched variable " .. unmatched) | 175 | warning("unmatched variable " .. unmatched) |
176 | any_failed = true | ||
175 | end | 177 | end |
176 | end | 178 | end |
179 | return any_failed | ||
177 | end | 180 | end |
178 | 181 | ||
179 | --- Perform make-style variable substitutions on string values of a table. | 182 | --- Perform make-style variable substitutions on string values of a table. |
@@ -192,7 +195,9 @@ function variable_substitutions(tbl, vars) | |||
192 | for k, v in pairs(tbl) do | 195 | for k, v in pairs(tbl) do |
193 | if type(v) == "string" then | 196 | if type(v) == "string" then |
194 | updated[k] = v:gsub(var_format_pattern, vars) | 197 | updated[k] = v:gsub(var_format_pattern, vars) |
195 | warn_failed_matches(updated[k]) | 198 | if warn_failed_matches(updated[k]) then |
199 | updated[k] = updated[k]:gsub(var_format_pattern, "") | ||
200 | end | ||
196 | end | 201 | end |
197 | end | 202 | end |
198 | for k, v in pairs(updated) do | 203 | for k, v in pairs(updated) do |