aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2013-10-18 18:04:10 -0300
committerHisham Muhammad <hisham@gobolinux.org>2013-10-18 18:04:10 -0300
commita9f9050e87c28a9fec1eaa45362a0841728f6849 (patch)
tree9cd88a70867ac4ecd9c4382f6e1bceb34564d61f
parent15cc0d67cc5aefdca7d07242c800b69c6b57ac3a (diff)
downloadluarocks-a9f9050e87c28a9fec1eaa45362a0841728f6849.tar.gz
luarocks-a9f9050e87c28a9fec1eaa45362a0841728f6849.tar.bz2
luarocks-a9f9050e87c28a9fec1eaa45362a0841728f6849.zip
Cleanup temporary fields that escaped; catch an argument error.
-rw-r--r--src/luarocks/write_rockspec.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/luarocks/write_rockspec.lua b/src/luarocks/write_rockspec.lua
index 6bfa4f1c..5b981563 100644
--- a/src/luarocks/write_rockspec.lua
+++ b/src/luarocks/write_rockspec.lua
@@ -178,6 +178,7 @@ local function fill_as_builtin(rockspec, libs)
178end 178end
179 179
180local function rockspec_cleanup(rockspec) 180local function rockspec_cleanup(rockspec)
181 rockspec.source.file = nil
181 rockspec.source.protocol = nil 182 rockspec.source.protocol = nil
182 rockspec.variables = nil 183 rockspec.variables = nil
183 rockspec.name = nil 184 rockspec.name = nil
@@ -200,7 +201,11 @@ function run(...)
200 local_dir = name 201 local_dir = name
201 local filename = dir.base_name(name) 202 local filename = dir.base_name(name)
202 name, version = filename:match("(.*)-([^-]+)") 203 name, version = filename:match("(.*)-([^-]+)")
203 version = version:gsub(".[a-z]+$", ""):gsub(".tar$", "") 204 if version then
205 version = version:gsub(".[a-z]+$", ""):gsub(".tar$", "")
206 else
207 return nil, "Missing name and version arguments. "..util.see_help("write_rockspec")
208 end
204 else 209 else
205 return nil, "Missing name and version arguments. "..util.see_help("write_rockspec") 210 return nil, "Missing name and version arguments. "..util.see_help("write_rockspec")
206 end 211 end
@@ -248,6 +253,7 @@ function run(...)
248 rockspec.source.tag = "v" .. version 253 rockspec.source.tag = "v" .. version
249 end 254 end
250 end 255 end
256 rockspec.source.dir = nil
251 local ok, base_dir, temp_dir = get_url(rockspec) 257 local ok, base_dir, temp_dir = get_url(rockspec)
252 if ok then 258 if ok then
253 if base_dir ~= dir.base_name(local_dir) then 259 if base_dir ~= dir.base_name(local_dir) then