diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2016-01-11 04:10:43 -0200 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2016-01-11 04:10:43 -0200 |
commit | 12e3d413bef8e19b26e0f995ebf05ed3fdf1ef70 (patch) | |
tree | eb19d3a953731ea1c794475e9865bc39f66524bb /src | |
parent | bc758f8577a7a44e43fe047aa2e6ce019c3045de (diff) | |
parent | d62622aa2502cf9d100723ad9232fd72b7e75b9b (diff) | |
download | luarocks-12e3d413bef8e19b26e0f995ebf05ed3fdf1ef70.tar.gz luarocks-12e3d413bef8e19b26e0f995ebf05ed3fdf1ef70.tar.bz2 luarocks-12e3d413bef8e19b26e0f995ebf05ed3fdf1ef70.zip |
Merge pull request #467 from mpeterv/build-builtin-errors
Improve builtin build backend errors
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/build/builtin.lua | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/luarocks/build/builtin.lua b/src/luarocks/build/builtin.lua index 00fd09ea..afd05954 100644 --- a/src/luarocks/build/builtin.lua +++ b/src/luarocks/build/builtin.lua | |||
@@ -174,7 +174,7 @@ function builtin.run(rockspec) | |||
174 | --TODO EXEWRAPPER | 174 | --TODO EXEWRAPPER |
175 | end | 175 | end |
176 | 176 | ||
177 | local ok = true | 177 | local ok, err |
178 | local built_modules = {} | 178 | local built_modules = {} |
179 | local luadir = path.lua_dir(rockspec.name, rockspec.version) | 179 | local luadir = path.lua_dir(rockspec.name, rockspec.version) |
180 | local libdir = path.lib_dir(rockspec.name, rockspec.version) | 180 | local libdir = path.lib_dir(rockspec.name, rockspec.version) |
@@ -202,7 +202,7 @@ function builtin.run(rockspec) | |||
202 | for name, info in pairs(build.modules) do | 202 | for name, info in pairs(build.modules) do |
203 | local moddir = path.module_to_path(name) | 203 | local moddir = path.module_to_path(name) |
204 | if type(info) == "string" then | 204 | if type(info) == "string" then |
205 | local ext = info:match(".([^.]+)$") | 205 | local ext = info:match("%.([^.]+)$") |
206 | if ext == "lua" then | 206 | if ext == "lua" then |
207 | local filename = dir.base_name(info) | 207 | local filename = dir.base_name(info) |
208 | if info:match("init%.lua$") and not name:match("%.init$") then | 208 | if info:match("init%.lua$") and not name:match("%.init$") then |
@@ -226,7 +226,7 @@ function builtin.run(rockspec) | |||
226 | if info[1] then sources = info end | 226 | if info[1] then sources = info end |
227 | if type(sources) == "string" then sources = {sources} end | 227 | if type(sources) == "string" then sources = {sources} end |
228 | for _, source in ipairs(sources) do | 228 | for _, source in ipairs(sources) do |
229 | local object = source:gsub(".[^.]*$", "."..cfg.obj_extension) | 229 | local object = source:gsub("%.[^.]*$", "."..cfg.obj_extension) |
230 | if not object then | 230 | if not object then |
231 | object = source.."."..cfg.obj_extension | 231 | object = source.."."..cfg.obj_extension |
232 | end | 232 | end |
@@ -236,11 +236,10 @@ function builtin.run(rockspec) | |||
236 | end | 236 | end |
237 | table.insert(objects, object) | 237 | table.insert(objects, object) |
238 | end | 238 | end |
239 | if not ok then break end | ||
240 | local module_name = name:match("([^.]*)$").."."..util.matchquote(cfg.lib_extension) | 239 | local module_name = name:match("([^.]*)$").."."..util.matchquote(cfg.lib_extension) |
241 | if moddir ~= "" then | 240 | if moddir ~= "" then |
242 | module_name = dir.path(moddir, module_name) | 241 | module_name = dir.path(moddir, module_name) |
243 | local ok, err = fs.make_dir(moddir) | 242 | ok, err = fs.make_dir(moddir) |
244 | if not ok then return nil, err end | 243 | if not ok then return nil, err end |
245 | end | 244 | end |
246 | built_modules[module_name] = dir.path(libdir, module_name) | 245 | built_modules[module_name] = dir.path(libdir, module_name) |
@@ -252,13 +251,13 @@ function builtin.run(rockspec) | |||
252 | end | 251 | end |
253 | for name, dest in pairs(built_modules) do | 252 | for name, dest in pairs(built_modules) do |
254 | fs.make_dir(dir.dir_name(dest)) | 253 | fs.make_dir(dir.dir_name(dest)) |
255 | ok = fs.copy(name, dest) | 254 | ok, err = fs.copy(name, dest) |
256 | if not ok then | 255 | if not ok then |
257 | return nil, "Failed installing "..name.." in "..dest | 256 | return nil, "Failed installing "..name.." in "..dest..": "..err |
258 | end | 257 | end |
259 | end | 258 | end |
260 | if fs.is_dir("lua") then | 259 | if fs.is_dir("lua") then |
261 | local ok, err = fs.copy_contents("lua", luadir) | 260 | ok, err = fs.copy_contents("lua", luadir) |
262 | if not ok then | 261 | if not ok then |
263 | return nil, "Failed copying contents of 'lua' directory: "..err | 262 | return nil, "Failed copying contents of 'lua' directory: "..err |
264 | end | 263 | end |