aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2012-09-18 20:55:12 -0300
committerHisham Muhammad <hisham@gobolinux.org>2012-09-18 20:55:12 -0300
commitaf2b92b5a922ecdb18c8d4ab202ab84a44125cf2 (patch)
tree7737d05c25804ab0b7d4eb8677f25de9d08babdf
parent716be435f2853c59ebf134e5beac647f278985c7 (diff)
downloadluarocks-af2b92b5a922ecdb18c8d4ab202ab84a44125cf2.tar.gz
luarocks-af2b92b5a922ecdb18c8d4ab202ab84a44125cf2.tar.bz2
luarocks-af2b92b5a922ecdb18c8d4ab202ab84a44125cf2.zip
Be stricter in type check to catch errors such as #90. Closes #90.
This does not affect any rocks in the repos; they all validate properly with this stricter check.
-rw-r--r--src/luarocks/build.lua2
-rw-r--r--src/luarocks/type_check.lua4
2 files changed, 4 insertions, 2 deletions
diff --git a/src/luarocks/build.lua b/src/luarocks/build.lua
index 42ae3fd7..e9b3adc1 100644
--- a/src/luarocks/build.lua
+++ b/src/luarocks/build.lua
@@ -223,6 +223,8 @@ function build_rockspec(rockspec_file, need_to_fetch, minimal_mode, no_deps)
223 local dest = dir.path(path.install_dir(name, version), copy_dir) 223 local dest = dir.path(path.install_dir(name, version), copy_dir)
224 fs.make_dir(dest) 224 fs.make_dir(dest)
225 fs.copy_contents(copy_dir, dest) 225 fs.copy_contents(copy_dir, dest)
226 else
227 util.warning("Directory '"..copy_dir.."' not found")
226 end 228 end
227 end 229 end
228 230
diff --git a/src/luarocks/type_check.lua b/src/luarocks/type_check.lua
index 282198f6..28e6e7b9 100644
--- a/src/luarocks/type_check.lua
+++ b/src/luarocks/type_check.lua
@@ -172,8 +172,8 @@ local function type_check_item(name, item, expected, context)
172 return nil, "Type mismatch on field "..context..name..": expected a number" 172 return nil, "Type mismatch on field "..context..name..": expected a number"
173 end 173 end
174 elseif expected_type == "string" then 174 elseif expected_type == "string" then
175 if not tostring(item) then 175 if type(item) ~= "string" then
176 return nil, "Type mismatch on field "..context..name..": expected a value convertible to string" 176 return nil, "Type mismatch on field "..context..name..": expected a string"
177 end 177 end
178 if expected ~= "string" then 178 if expected ~= "string" then
179 if not item:match("^"..expected.."$") then 179 if not item:match("^"..expected.."$") then