diff options
| author | Hisham <hisham@gobolinux.org> | 2016-02-01 09:54:46 +0100 |
|---|---|---|
| committer | Hisham <hisham@gobolinux.org> | 2016-02-01 09:54:46 +0100 |
| commit | 79f5022066c4d801d973769fe092280e24461cc2 (patch) | |
| tree | 68228aa9a7eebb0262a914a01e64bffecf2ffc8a /src | |
| parent | 6dc745a70be16e99ca2bc3b389f92336f49b05ec (diff) | |
| parent | 102a2bec7c3f54a4c323ccf3125ae85e96a54df3 (diff) | |
| download | luarocks-79f5022066c4d801d973769fe092280e24461cc2.tar.gz luarocks-79f5022066c4d801d973769fe092280e24461cc2.tar.bz2 luarocks-79f5022066c4d801d973769fe092280e24461cc2.zip | |
Merge branch 'master' of https://github.com/keplerproject/luarocks
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/build/builtin.lua | 15 | ||||
| -rw-r--r-- | src/luarocks/cache.lua | 15 | ||||
| -rw-r--r-- | src/luarocks/command_line.lua | 1 | ||||
| -rw-r--r-- | src/luarocks/fetch.lua | 2 | ||||
| -rw-r--r-- | src/luarocks/help.lua | 2 | ||||
| -rw-r--r-- | src/luarocks/make.lua | 2 |
6 files changed, 11 insertions, 26 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 |
diff --git a/src/luarocks/cache.lua b/src/luarocks/cache.lua index dbea8405..fb6344d8 100644 --- a/src/luarocks/cache.lua +++ b/src/luarocks/cache.lua | |||
| @@ -45,25 +45,12 @@ function cache.split_server_url(server, url, user, password) | |||
| 45 | user = credentials | 45 | user = credentials |
| 46 | end | 46 | end |
| 47 | end | 47 | end |
| 48 | local local_cache | 48 | local local_cache = cfg.local_cache .. "/" .. server |
| 49 | if cfg.local_cache then | ||
| 50 | local_cache = cfg.local_cache .. "/" .. server | ||
| 51 | end | ||
| 52 | return local_cache, protocol, server_path, user, password | 49 | return local_cache, protocol, server_path, user, password |
| 53 | end | 50 | end |
| 54 | 51 | ||
| 55 | function cache.refresh_local_cache(server, url, user, password) | 52 | function cache.refresh_local_cache(server, url, user, password) |
| 56 | local local_cache, protocol, server_path, user, password = cache.split_server_url(server, url, user, password) | 53 | local local_cache, protocol, server_path, user, password = cache.split_server_url(server, url, user, password) |
| 57 | |||
| 58 | local ok, err = fs.make_dir(cfg.local_cache) | ||
| 59 | if not ok then return nil, err end | ||
| 60 | |||
| 61 | local tmp_cache = false | ||
| 62 | if not local_cache then | ||
| 63 | local err | ||
| 64 | local_cache, err = fs.make_temp_dir("local_cache") | ||
| 65 | tmp_cache = true | ||
| 66 | end | ||
| 67 | local ok, err = fs.make_dir(local_cache) | 54 | local ok, err = fs.make_dir(local_cache) |
| 68 | if not ok then | 55 | if not ok then |
| 69 | return nil, "Failed creating local cache dir: "..err | 56 | return nil, "Failed creating local cache dir: "..err |
diff --git a/src/luarocks/command_line.lua b/src/luarocks/command_line.lua index e1c9f492..a016fc72 100644 --- a/src/luarocks/command_line.lua +++ b/src/luarocks/command_line.lua | |||
| @@ -144,7 +144,6 @@ function command_line.run_command(...) | |||
| 144 | end | 144 | end |
| 145 | end | 145 | end |
| 146 | if not named then | 146 | if not named then |
| 147 | local fs = require("luarocks.fs") | ||
| 148 | local root_dir = fs.absolute_name(flags["tree"]) | 147 | local root_dir = fs.absolute_name(flags["tree"]) |
| 149 | replace_tree(flags, args, root_dir) | 148 | replace_tree(flags, args, root_dir) |
| 150 | end | 149 | end |
diff --git a/src/luarocks/fetch.lua b/src/luarocks/fetch.lua index e92aeddf..2c028771 100644 --- a/src/luarocks/fetch.lua +++ b/src/luarocks/fetch.lua | |||
| @@ -371,7 +371,7 @@ function fetch.fetch_sources(rockspec, extract, dest_dir) | |||
| 371 | local protocol = rockspec.source.protocol | 371 | local protocol = rockspec.source.protocol |
| 372 | local ok, proto | 372 | local ok, proto |
| 373 | if fetch.is_basic_protocol(protocol) then | 373 | if fetch.is_basic_protocol(protocol) then |
| 374 | proto = require("luarocks.fetch") | 374 | proto = fetch |
| 375 | else | 375 | else |
| 376 | ok, proto = pcall(require, "luarocks.fetch."..protocol:gsub("[+-]", "_")) | 376 | ok, proto = pcall(require, "luarocks.fetch."..protocol:gsub("[+-]", "_")) |
| 377 | if not ok then | 377 | if not ok then |
diff --git a/src/luarocks/help.lua b/src/luarocks/help.lua index 92458b2b..5a2681a3 100644 --- a/src/luarocks/help.lua +++ b/src/luarocks/help.lua | |||
| @@ -111,7 +111,7 @@ function help.run(...) | |||
| 111 | print_section("SEE ALSO") | 111 | print_section("SEE ALSO") |
| 112 | util.printout("","'"..program.." help' for general options and configuration.\n") | 112 | util.printout("","'"..program.." help' for general options and configuration.\n") |
| 113 | else | 113 | else |
| 114 | return nil, "Unknown command '"..command.."'" | 114 | return nil, "Unknown command: "..command |
| 115 | end | 115 | end |
| 116 | end | 116 | end |
| 117 | return true | 117 | return true |
diff --git a/src/luarocks/make.lua b/src/luarocks/make.lua index 1dfe6473..4f70bafe 100644 --- a/src/luarocks/make.lua +++ b/src/luarocks/make.lua | |||
| @@ -54,7 +54,7 @@ function make.run(...) | |||
| 54 | 54 | ||
| 55 | if not rockspec then | 55 | if not rockspec then |
| 56 | for file in fs.dir() do | 56 | for file in fs.dir() do |
| 57 | if file:match("rockspec$") then | 57 | if file:match("rockspec$") and fs.is_file(file) then |
| 58 | if rockspec then | 58 | if rockspec then |
| 59 | return nil, "Please specify which rockspec file to use." | 59 | return nil, "Please specify which rockspec file to use." |
| 60 | else | 60 | else |
