diff options
38 files changed, 333 insertions, 85 deletions
diff --git a/.travis.yml b/.travis.yml index 69ec28f3..f946bb99 100644 --- a/.travis.yml +++ b/.travis.yml | |||
@@ -9,5 +9,6 @@ env: | |||
9 | - LUA_VER=5.1.5 | 9 | - LUA_VER=5.1.5 |
10 | - LUA_VER=5.2.4 | 10 | - LUA_VER=5.2.4 |
11 | - LUA_VER=5.3.1 | 11 | - LUA_VER=5.3.1 |
12 | - LUA_VER=jit-2.0.4 | ||
12 | 13 | ||
13 | script: cd test && ./testing.sh --travis --lua $LUA_VER | 14 | script: cd test && ./testing.sh --travis --lua $LUA_VER |
diff --git a/src/luarocks/add.lua b/src/luarocks/add.lua index f37d334d..66f7504f 100644 --- a/src/luarocks/add.lua +++ b/src/luarocks/add.lua | |||
@@ -12,7 +12,6 @@ local index = require("luarocks.index") | |||
12 | local fs = require("luarocks.fs") | 12 | local fs = require("luarocks.fs") |
13 | local cache = require("luarocks.cache") | 13 | local cache = require("luarocks.cache") |
14 | 14 | ||
15 | util.add_run_function(add) | ||
16 | add.help_summary = "Add a rock or rockspec to a rocks server." | 15 | add.help_summary = "Add a rock or rockspec to a rocks server." |
17 | add.help_arguments = "[--server=<server>] [--no-refresh] {<rockspec>|<rock>...}" | 16 | add.help_arguments = "[--server=<server>] [--no-refresh] {<rockspec>|<rock>...}" |
18 | add.help = [[ | 17 | add.help = [[ |
diff --git a/src/luarocks/admin_remove.lua b/src/luarocks/admin_remove.lua index 621f1317..be1e7cbc 100644 --- a/src/luarocks/admin_remove.lua +++ b/src/luarocks/admin_remove.lua | |||
@@ -12,7 +12,6 @@ local index = require("luarocks.index") | |||
12 | local fs = require("luarocks.fs") | 12 | local fs = require("luarocks.fs") |
13 | local cache = require("luarocks.cache") | 13 | local cache = require("luarocks.cache") |
14 | 14 | ||
15 | util.add_run_function(admin_remove) | ||
16 | admin_remove.help_summary = "Remove a rock or rockspec from a rocks server." | 15 | admin_remove.help_summary = "Remove a rock or rockspec from a rocks server." |
17 | admin_remove.help_arguments = "[--server=<server>] [--no-refresh] {<rockspec>|<rock>...}" | 16 | admin_remove.help_arguments = "[--server=<server>] [--no-refresh] {<rockspec>|<rock>...}" |
18 | admin_remove.help = [[ | 17 | admin_remove.help = [[ |
diff --git a/src/luarocks/build.lua b/src/luarocks/build.lua index f87b2f1b..2d29e23f 100644 --- a/src/luarocks/build.lua +++ b/src/luarocks/build.lua | |||
@@ -16,7 +16,6 @@ local manif = require("luarocks.manif") | |||
16 | local remove = require("luarocks.remove") | 16 | local remove = require("luarocks.remove") |
17 | local cfg = require("luarocks.cfg") | 17 | local cfg = require("luarocks.cfg") |
18 | 18 | ||
19 | util.add_run_function(build) | ||
20 | build.help_summary = "Build/compile a rock." | 19 | build.help_summary = "Build/compile a rock." |
21 | build.help_arguments = "[--pack-binary-rock] [--keep] {<rockspec>|<rock>|<name> [<version>]}" | 20 | build.help_arguments = "[--pack-binary-rock] [--keep] {<rockspec>|<rock>|<name> [<version>]}" |
22 | build.help = [[ | 21 | build.help = [[ |
@@ -151,6 +150,31 @@ local function install_default_docs(name, version) | |||
151 | end | 150 | end |
152 | end | 151 | end |
153 | 152 | ||
153 | local function check_macosx_deployment_target(rockspec) | ||
154 | local target = rockspec.build.macosx_deployment_target | ||
155 | local function minor(version) | ||
156 | return tonumber(version and version:match("^[^.]+%.([^.]+)")) | ||
157 | end | ||
158 | local function patch_variable(var, target) | ||
159 | if rockspec.variables[var]:match("MACOSX_DEPLOYMENT_TARGET") then | ||
160 | rockspec.variables[var] = (rockspec.variables[var]):gsub("MACOSX_DEPLOYMENT_TARGET=[^ ]*", "MACOSX_DEPLOYMENT_TARGET="..target) | ||
161 | else | ||
162 | rockspec.variables[var] = "env MACOSX_DEPLOYMENT_TARGET="..target.." "..rockspec.variables[var] | ||
163 | end | ||
164 | end | ||
165 | if cfg.platforms.macosx and deps.format_is_at_least(rockspec, "3.0") and target then | ||
166 | local version = util.popen_read("sw_vers -productVersion") | ||
167 | local versionminor = minor(version) | ||
168 | local targetminor = minor(target) | ||
169 | if targetminor > versionminor then | ||
170 | return nil, ("This rock requires Mac OSX 10.%d, and you are running 10.%d."):format(targetminor, versionminor) | ||
171 | end | ||
172 | patch_variable("CC", target) | ||
173 | patch_variable("LD", target) | ||
174 | end | ||
175 | return true | ||
176 | end | ||
177 | |||
154 | --- Build and install a rock given a rockspec. | 178 | --- Build and install a rock given a rockspec. |
155 | -- @param rockspec_file string: local or remote filename of a rockspec. | 179 | -- @param rockspec_file string: local or remote filename of a rockspec. |
156 | -- @param need_to_fetch boolean: true if sources need to be fetched, | 180 | -- @param need_to_fetch boolean: true if sources need to be fetched, |
@@ -248,6 +272,11 @@ function build.build_rockspec(rockspec_file, need_to_fetch, minimal_mode, deps_m | |||
248 | end | 272 | end |
249 | end | 273 | end |
250 | 274 | ||
275 | ok, err = check_macosx_deployment_target(rockspec) | ||
276 | if not ok then | ||
277 | return nil, err | ||
278 | end | ||
279 | |||
251 | if build_spec.type ~= "none" then | 280 | if build_spec.type ~= "none" then |
252 | 281 | ||
253 | -- Temporary compatibility | 282 | -- Temporary compatibility |
diff --git a/src/luarocks/build/builtin.lua b/src/luarocks/build/builtin.lua index b6f53271..81fa8b13 100644 --- a/src/luarocks/build/builtin.lua +++ b/src/luarocks/build/builtin.lua | |||
@@ -49,7 +49,7 @@ end | |||
49 | -- nil and an error message otherwise. | 49 | -- nil and an error message otherwise. |
50 | function builtin.run(rockspec) | 50 | function builtin.run(rockspec) |
51 | assert(type(rockspec) == "table") | 51 | assert(type(rockspec) == "table") |
52 | local compile_object, compile_library, compile_wrapper_binary --TODO EXEWRAPPER | 52 | local compile_object, compile_library, compile_static_library, compile_wrapper_binary --TODO EXEWRAPPER |
53 | 53 | ||
54 | local build = rockspec.build | 54 | local build = rockspec.build |
55 | local variables = rockspec.variables | 55 | local variables = rockspec.variables |
@@ -82,6 +82,13 @@ function builtin.run(rockspec) | |||
82 | local ok = execute(variables.LD.." "..variables.LIBFLAG, "-o", library, unpack(extras)) | 82 | local ok = execute(variables.LD.." "..variables.LIBFLAG, "-o", library, unpack(extras)) |
83 | return ok | 83 | return ok |
84 | end | 84 | end |
85 | compile_static_library = function(library, objects, libraries, libdirs, name) | ||
86 | local ok = execute(variables.AR, "rc", library, unpack(objects)) | ||
87 | if ok then | ||
88 | ok = execute(variables.RANLIB, library) | ||
89 | end | ||
90 | return ok | ||
91 | end | ||
85 | compile_wrapper_binary = function(fullname, name) | 92 | compile_wrapper_binary = function(fullname, name) |
86 | --TODO EXEWRAPPER | 93 | --TODO EXEWRAPPER |
87 | local fullbasename = fullname:gsub("%.lua$", ""):gsub("/", "\\") | 94 | local fullbasename = fullname:gsub("%.lua$", ""):gsub("/", "\\") |
@@ -128,6 +135,10 @@ function builtin.run(rockspec) | |||
128 | end | 135 | end |
129 | return ok | 136 | return ok |
130 | end | 137 | end |
138 | compile_static_library = function(library, objects, libraries, libdirs, name) | ||
139 | local ok = execute(variables.AR, "-out:"..library, unpack(objects)) | ||
140 | return ok | ||
141 | end | ||
131 | compile_wrapper_binary = function(fullname, name) | 142 | compile_wrapper_binary = function(fullname, name) |
132 | --TODO EXEWRAPPER | 143 | --TODO EXEWRAPPER |
133 | local fullbasename = fullname:gsub("%.lua$", ""):gsub("/", "\\") | 144 | local fullbasename = fullname:gsub("%.lua$", ""):gsub("/", "\\") |
@@ -169,6 +180,13 @@ function builtin.run(rockspec) | |||
169 | end | 180 | end |
170 | return execute(variables.LD.." "..variables.LIBFLAG, "-o", library, "-L"..variables.LUA_LIBDIR, unpack(extras)) | 181 | return execute(variables.LD.." "..variables.LIBFLAG, "-o", library, "-L"..variables.LUA_LIBDIR, unpack(extras)) |
171 | end | 182 | end |
183 | compile_static_library = function(library, objects, libraries, libdirs, name) | ||
184 | local ok = execute(variables.AR, "rc", library, unpack(objects)) | ||
185 | if ok then | ||
186 | ok = execute(variables.RANLIB, library) | ||
187 | end | ||
188 | return ok | ||
189 | end | ||
172 | compile_wrapper_binary = function(_, name) return true, name end | 190 | compile_wrapper_binary = function(_, name) return true, name end |
173 | --TODO EXEWRAPPER | 191 | --TODO EXEWRAPPER |
174 | end | 192 | end |
@@ -247,6 +265,15 @@ function builtin.run(rockspec) | |||
247 | if not ok then | 265 | if not ok then |
248 | return nil, "Failed compiling module "..module_name | 266 | return nil, "Failed compiling module "..module_name |
249 | end | 267 | end |
268 | module_name = name:match("([^.]*)$").."."..util.matchquote(cfg.static_lib_extension) | ||
269 | if moddir ~= "" then | ||
270 | module_name = dir.path(moddir, module_name) | ||
271 | end | ||
272 | lib_modules[module_name] = dir.path(libdir, module_name) | ||
273 | ok = compile_static_library(module_name, objects, info.libraries, info.libdirs, name) | ||
274 | if not ok then | ||
275 | return nil, "Failed compiling static library "..module_name | ||
276 | end | ||
250 | end | 277 | end |
251 | end | 278 | end |
252 | for _, mods in ipairs({{ tbl = lua_modules, perms = cfg.perm_read }, { tbl = lib_modules, perms = cfg.perm_exec }}) do | 279 | for _, mods in ipairs({{ tbl = lua_modules, perms = cfg.perm_read }, { tbl = lib_modules, perms = cfg.perm_exec }}) do |
diff --git a/src/luarocks/build/cmake.lua b/src/luarocks/build/cmake.lua index da5a31f1..c2712bb2 100644 --- a/src/luarocks/build/cmake.lua +++ b/src/luarocks/build/cmake.lua | |||
@@ -5,6 +5,7 @@ local cmake = {} | |||
5 | local fs = require("luarocks.fs") | 5 | local fs = require("luarocks.fs") |
6 | local util = require("luarocks.util") | 6 | local util = require("luarocks.util") |
7 | local cfg = require("luarocks.cfg") | 7 | local cfg = require("luarocks.cfg") |
8 | local deps = require("luarocks.deps") | ||
8 | 9 | ||
9 | --- Driver function for the "cmake" build back-end. | 10 | --- Driver function for the "cmake" build back-end. |
10 | -- @param rockspec table: the loaded rockspec. | 11 | -- @param rockspec table: the loaded rockspec. |
@@ -52,13 +53,26 @@ function cmake.run(rockspec) | |||
52 | return nil, "Failed cmake." | 53 | return nil, "Failed cmake." |
53 | end | 54 | end |
54 | 55 | ||
55 | if not fs.execute_string(rockspec.variables.CMAKE.." --build build.luarocks --config Release") then | 56 | local do_build, do_install |
56 | return nil, "Failed building." | 57 | if deps.format_is_at_least(rockspec, "3.0") then |
58 | do_build = (build.build_pass == nil) and true or build.build_pass | ||
59 | do_install = (build.install_pass == nil) and true or build.install_pass | ||
60 | else | ||
61 | do_build = true | ||
62 | do_install = true | ||
57 | end | 63 | end |
58 | 64 | ||
59 | if not fs.execute_string(rockspec.variables.CMAKE.." --build build.luarocks --target install --config Release") then | 65 | if do_build then |
60 | return nil, "Failed installing." | 66 | if not fs.execute_string(rockspec.variables.CMAKE.." --build build.luarocks --config Release") then |
67 | return nil, "Failed building." | ||
68 | end | ||
61 | end | 69 | end |
70 | if do_install then | ||
71 | if not fs.execute_string(rockspec.variables.CMAKE.." --build build.luarocks --target install --config Release") then | ||
72 | return nil, "Failed installing." | ||
73 | end | ||
74 | end | ||
75 | |||
62 | return true | 76 | return true |
63 | end | 77 | end |
64 | 78 | ||
diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua index 9b1c5902..53387276 100644 --- a/src/luarocks/cfg.lua +++ b/src/luarocks/cfg.lua | |||
@@ -76,8 +76,8 @@ end | |||
76 | -- so that this detection does not run every time. When it is | 76 | -- so that this detection does not run every time. When it is |
77 | -- performed, we use the Unix way to identify the system, | 77 | -- performed, we use the Unix way to identify the system, |
78 | -- even on Windows (assuming UnxUtils or Cygwin). | 78 | -- even on Windows (assuming UnxUtils or Cygwin). |
79 | local system = site_config.LUAROCKS_UNAME_S or io.popen("uname -s"):read("*l") | 79 | local system = site_config.LUAROCKS_UNAME_S or util.popen_read("uname -s") |
80 | local proc = site_config.LUAROCKS_UNAME_M or io.popen("uname -m"):read("*l") | 80 | local proc = site_config.LUAROCKS_UNAME_M or util.popen_read("uname -m") |
81 | if proc:match("i[%d]86") then | 81 | if proc:match("i[%d]86") then |
82 | cfg.target_cpu = "x86" | 82 | cfg.target_cpu = "x86" |
83 | elseif proc:match("amd64") or proc:match("x86_64") then | 83 | elseif proc:match("amd64") or proc:match("x86_64") then |
@@ -343,6 +343,8 @@ local defaults = { | |||
343 | MAKE = "make", | 343 | MAKE = "make", |
344 | CC = "cc", | 344 | CC = "cc", |
345 | LD = "ld", | 345 | LD = "ld", |
346 | AR = "ar", | ||
347 | RANLIB = "ranlib", | ||
346 | 348 | ||
347 | CVS = "cvs", | 349 | CVS = "cvs", |
348 | GIT = "git", | 350 | GIT = "git", |
@@ -398,7 +400,8 @@ local defaults = { | |||
398 | include = "include" | 400 | include = "include" |
399 | }, | 401 | }, |
400 | 402 | ||
401 | rocks_provided = {} | 403 | rocks_provided = {}, |
404 | rocks_provided_3_0 = {}, | ||
402 | } | 405 | } |
403 | 406 | ||
404 | if cfg.platforms.windows then | 407 | if cfg.platforms.windows then |
@@ -410,6 +413,7 @@ if cfg.platforms.windows then | |||
410 | defaults.arch = "win32-"..cfg.target_cpu | 413 | defaults.arch = "win32-"..cfg.target_cpu |
411 | defaults.lib_extension = "dll" | 414 | defaults.lib_extension = "dll" |
412 | defaults.external_lib_extension = "dll" | 415 | defaults.external_lib_extension = "dll" |
416 | defaults.static_lib_extension = "lib" | ||
413 | defaults.obj_extension = "obj" | 417 | defaults.obj_extension = "obj" |
414 | defaults.external_deps_dirs = { "c:/external/" } | 418 | defaults.external_deps_dirs = { "c:/external/" } |
415 | defaults.variables.LUA_BINDIR = site_config.LUA_BINDIR and site_config.LUA_BINDIR:gsub("\\", "/") or "c:/lua"..cfg.lua_version.."/bin" | 419 | defaults.variables.LUA_BINDIR = site_config.LUA_BINDIR and site_config.LUA_BINDIR:gsub("\\", "/") or "c:/lua"..cfg.lua_version.."/bin" |
@@ -423,6 +427,7 @@ if cfg.platforms.windows then | |||
423 | defaults.variables.WRAPPER = full_prefix.."\\rclauncher.c" | 427 | defaults.variables.WRAPPER = full_prefix.."\\rclauncher.c" |
424 | defaults.variables.LD = "link" | 428 | defaults.variables.LD = "link" |
425 | defaults.variables.MT = "mt" | 429 | defaults.variables.MT = "mt" |
430 | defaults.variables.AR = "lib" | ||
426 | defaults.variables.LUALIB = "lua"..cfg.lua_version..".lib" | 431 | defaults.variables.LUALIB = "lua"..cfg.lua_version..".lib" |
427 | defaults.variables.CFLAGS = "/nologo /MD /O2" | 432 | defaults.variables.CFLAGS = "/nologo /MD /O2" |
428 | defaults.variables.LIBFLAG = "/nologo /dll" | 433 | defaults.variables.LIBFLAG = "/nologo /dll" |
@@ -462,11 +467,14 @@ end | |||
462 | 467 | ||
463 | if cfg.platforms.mingw32 then | 468 | if cfg.platforms.mingw32 then |
464 | defaults.obj_extension = "o" | 469 | defaults.obj_extension = "o" |
470 | defaults.static_lib_extension = "a" | ||
465 | defaults.cmake_generator = "MinGW Makefiles" | 471 | defaults.cmake_generator = "MinGW Makefiles" |
466 | defaults.variables.MAKE = "mingw32-make" | 472 | defaults.variables.MAKE = "mingw32-make" |
467 | defaults.variables.CC = "mingw32-gcc" | 473 | defaults.variables.CC = "mingw32-gcc" |
468 | defaults.variables.RC = "windres" | 474 | defaults.variables.RC = "windres" |
469 | defaults.variables.LD = "mingw32-gcc" | 475 | defaults.variables.LD = "mingw32-gcc" |
476 | defaults.variables.AR = "ar" | ||
477 | defaults.variables.RANLIB = "ranlib" | ||
470 | defaults.variables.CFLAGS = "-O2" | 478 | defaults.variables.CFLAGS = "-O2" |
471 | defaults.variables.LIBFLAG = "-shared" | 479 | defaults.variables.LIBFLAG = "-shared" |
472 | defaults.external_deps_patterns = { | 480 | defaults.external_deps_patterns = { |
@@ -486,6 +494,7 @@ end | |||
486 | 494 | ||
487 | if cfg.platforms.unix then | 495 | if cfg.platforms.unix then |
488 | defaults.lib_extension = "so" | 496 | defaults.lib_extension = "so" |
497 | defaults.static_lib_extension = "a" | ||
489 | defaults.external_lib_extension = "so" | 498 | defaults.external_lib_extension = "so" |
490 | defaults.obj_extension = "o" | 499 | defaults.obj_extension = "o" |
491 | defaults.external_deps_dirs = { "/usr/local", "/usr" } | 500 | defaults.external_deps_dirs = { "/usr/local", "/usr" } |
@@ -558,7 +567,7 @@ if cfg.platforms.macosx then | |||
558 | defaults.variables.LIBFLAG = "-bundle -undefined dynamic_lookup -all_load" | 567 | defaults.variables.LIBFLAG = "-bundle -undefined dynamic_lookup -all_load" |
559 | defaults.variables.STAT = "/usr/bin/stat" | 568 | defaults.variables.STAT = "/usr/bin/stat" |
560 | defaults.variables.STATFLAG = "-f '%A'" | 569 | defaults.variables.STATFLAG = "-f '%A'" |
561 | local version = io.popen("sw_vers -productVersion"):read("*l") | 570 | local version = util.popen_read("sw_vers -productVersion") |
562 | version = tonumber(version and version:match("^[^.]+%.([^.]+)")) or 3 | 571 | version = tonumber(version and version:match("^[^.]+%.([^.]+)")) or 3 |
563 | if version >= 10 then | 572 | if version >= 10 then |
564 | version = 8 | 573 | version = 8 |
@@ -617,8 +626,8 @@ end | |||
617 | if package.loaded.jit then | 626 | if package.loaded.jit then |
618 | -- LuaJIT | 627 | -- LuaJIT |
619 | local lj_version = package.loaded.jit.version:match("LuaJIT (.*)"):gsub("%-","") | 628 | local lj_version = package.loaded.jit.version:match("LuaJIT (.*)"):gsub("%-","") |
620 | --defaults.rocks_provided["luajit"] = lj_version.."-1" | ||
621 | defaults.rocks_provided["luabitop"] = lj_version.."-1" | 629 | defaults.rocks_provided["luabitop"] = lj_version.."-1" |
630 | defaults.rocks_provided_3_0["luajit"] = lj_version.."-1" | ||
622 | end | 631 | end |
623 | 632 | ||
624 | -- Use defaults: | 633 | -- Use defaults: |
@@ -635,6 +644,7 @@ for _, entry in ipairs({"variables", "rocks_provided"}) do | |||
635 | end | 644 | end |
636 | end | 645 | end |
637 | end | 646 | end |
647 | setmetatable(defaults.rocks_provided_3_0, { __index = cfg.rocks_provided }) | ||
638 | 648 | ||
639 | -- For values not set in the config file, use values from the 'defaults' table. | 649 | -- For values not set in the config file, use values from the 'defaults' table. |
640 | local cfg_mt = { | 650 | local cfg_mt = { |
diff --git a/src/luarocks/config_cmd.lua b/src/luarocks/config_cmd.lua index fe3cc637..9e73d228 100644 --- a/src/luarocks/config_cmd.lua +++ b/src/luarocks/config_cmd.lua | |||
@@ -6,7 +6,6 @@ local cfg = require("luarocks.cfg") | |||
6 | local util = require("luarocks.util") | 6 | local util = require("luarocks.util") |
7 | local dir = require("luarocks.dir") | 7 | local dir = require("luarocks.dir") |
8 | 8 | ||
9 | util.add_run_function(config_cmd) | ||
10 | config_cmd.help_summary = "Query information about the LuaRocks configuration." | 9 | config_cmd.help_summary = "Query information about the LuaRocks configuration." |
11 | config_cmd.help_arguments = "<flag>" | 10 | config_cmd.help_arguments = "<flag>" |
12 | config_cmd.help = [[ | 11 | config_cmd.help = [[ |
diff --git a/src/luarocks/deps.lua b/src/luarocks/deps.lua index f8deff3c..0d85d33e 100644 --- a/src/luarocks/deps.lua +++ b/src/luarocks/deps.lua | |||
@@ -158,6 +158,15 @@ function deps.compare_versions(a, b) | |||
158 | return deps.parse_version(a) > deps.parse_version(b) | 158 | return deps.parse_version(a) > deps.parse_version(b) |
159 | end | 159 | end |
160 | 160 | ||
161 | --- Check if rockspec format version satisfies version requirement. | ||
162 | -- @param rockspec table: The rockspec table. | ||
163 | -- @param version string: required version. | ||
164 | -- @return boolean: true if rockspec format matches version or is newer, false otherwise. | ||
165 | function deps.format_is_at_least(rockspec, version) | ||
166 | local rockspec_format = rockspec.rockspec_format or "1.0" | ||
167 | return deps.parse_version(rockspec_format) >= deps.parse_version(version) | ||
168 | end | ||
169 | |||
161 | --- Consumes a constraint from a string, converting it to table format. | 170 | --- Consumes a constraint from a string, converting it to table format. |
162 | -- For example, a string ">= 1.0, > 2.0" is converted to a table in the | 171 | -- For example, a string ">= 1.0, > 2.0" is converted to a table in the |
163 | -- format {op = ">=", version={1,0}} and the rest, "> 2.0", is returned | 172 | -- format {op = ">=", version={1,0}} and the rest, "> 2.0", is returned |
@@ -321,15 +330,19 @@ end | |||
321 | -- @param dep table: A dependency parsed in table format. | 330 | -- @param dep table: A dependency parsed in table format. |
322 | -- @param blacklist table: Versions that can't be accepted. Table where keys | 331 | -- @param blacklist table: Versions that can't be accepted. Table where keys |
323 | -- are program versions and values are 'true'. | 332 | -- are program versions and values are 'true'. |
333 | -- @param provided table: A table of auto-dependencies provided | ||
334 | -- by this Lua implementation for the given dependency. | ||
324 | -- @return string or nil: latest installed version of the rock matching the dependency | 335 | -- @return string or nil: latest installed version of the rock matching the dependency |
325 | -- or nil if it could not be matched. | 336 | -- or nil if it could not be matched. |
326 | local function match_dep(dep, blacklist, deps_mode) | 337 | local function match_dep(dep, blacklist, deps_mode, rocks_provided) |
327 | assert(type(dep) == "table") | 338 | assert(type(dep) == "table") |
328 | 339 | assert(type(rocks_provided) == "table") | |
340 | |||
329 | local versions | 341 | local versions |
330 | if cfg.rocks_provided[dep.name] then | 342 | local provided = rocks_provided[dep.name] |
331 | -- provided rocks have higher priority than manifest's rocks | 343 | if provided then |
332 | versions = { cfg.rocks_provided[dep.name] } | 344 | -- Provided rocks have higher priority than manifest's rocks. |
345 | versions = { provided } | ||
333 | else | 346 | else |
334 | versions = manif_core.get_versions(dep.name, deps_mode) | 347 | versions = manif_core.get_versions(dep.name, deps_mode) |
335 | end | 348 | end |
@@ -366,9 +379,9 @@ function deps.match_deps(rockspec, blacklist, deps_mode) | |||
366 | local matched, missing, no_upgrade = {}, {}, {} | 379 | local matched, missing, no_upgrade = {}, {}, {} |
367 | 380 | ||
368 | for _, dep in ipairs(rockspec.dependencies) do | 381 | for _, dep in ipairs(rockspec.dependencies) do |
369 | local found = match_dep(dep, blacklist and blacklist[dep.name] or nil, deps_mode) | 382 | local found = match_dep(dep, blacklist and blacklist[dep.name] or nil, deps_mode, rockspec.rocks_provided) |
370 | if found then | 383 | if found then |
371 | if not cfg.rocks_provided[dep.name] then | 384 | if not rockspec.rocks_provided[dep.name] then |
372 | matched[dep] = {name = dep.name, version = found} | 385 | matched[dep] = {name = dep.name, version = found} |
373 | end | 386 | end |
374 | else | 387 | else |
@@ -393,10 +406,10 @@ local function values_set(tbl) | |||
393 | return set | 406 | return set |
394 | end | 407 | end |
395 | 408 | ||
396 | local function rock_status(name, deps_mode) | 409 | local function rock_status(name, deps_mode, rocks_provided) |
397 | local search = require("luarocks.search") | 410 | local search = require("luarocks.search") |
398 | local installed = match_dep(search.make_query(name), nil, deps_mode) | 411 | local installed = match_dep(search.make_query(name), nil, deps_mode, rocks_provided) |
399 | local installation_type = cfg.rocks_provided[name] and "provided by VM" or "installed" | 412 | local installation_type = rocks_provided[name] and "provided by VM" or "installed" |
400 | return installed and installed.." "..installation_type or "not installed" | 413 | return installed and installed.." "..installation_type or "not installed" |
401 | end | 414 | end |
402 | 415 | ||
@@ -442,27 +455,27 @@ function deps.fulfill_dependencies(rockspec, deps_mode) | |||
442 | local first_missing_dep = true | 455 | local first_missing_dep = true |
443 | 456 | ||
444 | for _, dep in ipairs(rockspec.dependencies) do | 457 | for _, dep in ipairs(rockspec.dependencies) do |
445 | if not match_dep(dep, nil, deps_mode) then | 458 | if not match_dep(dep, nil, deps_mode, rockspec.rocks_provided) then |
446 | if first_missing_dep then | 459 | if first_missing_dep then |
447 | util.printout(("Missing dependencies for %s %s:"):format(rockspec.name, rockspec.version)) | 460 | util.printout(("Missing dependencies for %s %s:"):format(rockspec.name, rockspec.version)) |
448 | first_missing_dep = false | 461 | first_missing_dep = false |
449 | end | 462 | end |
450 | 463 | ||
451 | util.printout((" %s (%s)"):format(deps.show_dep(dep), rock_status(dep.name, deps_mode))) | 464 | util.printout((" %s (%s)"):format(deps.show_dep(dep), rock_status(dep.name, deps_mode, rockspec.rocks_provided))) |
452 | end | 465 | end |
453 | end | 466 | end |
454 | 467 | ||
455 | first_missing_dep = true | 468 | first_missing_dep = true |
456 | 469 | ||
457 | for _, dep in ipairs(rockspec.dependencies) do | 470 | for _, dep in ipairs(rockspec.dependencies) do |
458 | if not match_dep(dep, nil, deps_mode) then | 471 | if not match_dep(dep, nil, deps_mode, rockspec.rocks_provided) then |
459 | if first_missing_dep then | 472 | if first_missing_dep then |
460 | util.printout() | 473 | util.printout() |
461 | first_missing_dep = false | 474 | first_missing_dep = false |
462 | end | 475 | end |
463 | 476 | ||
464 | util.printout(("%s %s depends on %s (%s)"):format( | 477 | util.printout(("%s %s depends on %s (%s)"):format( |
465 | rockspec.name, rockspec.version, deps.show_dep(dep), rock_status(dep.name, deps_mode))) | 478 | rockspec.name, rockspec.version, deps.show_dep(dep), rock_status(dep.name, deps_mode, rockspec.rocks_provided))) |
466 | 479 | ||
467 | if dep.constraints[1] and dep.constraints[1].no_upgrade then | 480 | if dep.constraints[1] and dep.constraints[1].no_upgrade then |
468 | util.printerr("This version of "..rockspec.name.." is designed for use with") | 481 | util.printerr("This version of "..rockspec.name.." is designed for use with") |
@@ -709,7 +722,10 @@ function deps.scan_deps(results, missing, manifest, name, version, deps_mode) | |||
709 | end | 722 | end |
710 | dependencies_name[version] = rockspec.dependencies | 723 | dependencies_name[version] = rockspec.dependencies |
711 | else | 724 | else |
712 | rockspec = { dependencies = deplist } | 725 | rockspec = { |
726 | dependencies = deplist, | ||
727 | rocks_provided = setmetatable({}, { __index = cfg.rocks_provided_3_0 }) | ||
728 | } | ||
713 | end | 729 | end |
714 | local matched, failures = deps.match_deps(rockspec, nil, deps_mode) | 730 | local matched, failures = deps.match_deps(rockspec, nil, deps_mode) |
715 | results[name] = results | 731 | results[name] = results |
@@ -744,8 +760,4 @@ function deps.get_deps_mode(flags) | |||
744 | end | 760 | end |
745 | end | 761 | end |
746 | 762 | ||
747 | function deps.deps_mode_to_flag(deps_mode) | ||
748 | return "--deps-mode="..deps_mode | ||
749 | end | ||
750 | |||
751 | return deps | 763 | return deps |
diff --git a/src/luarocks/doc.lua b/src/luarocks/doc.lua index ec2b1110..758fd9c5 100644 --- a/src/luarocks/doc.lua +++ b/src/luarocks/doc.lua | |||
@@ -12,7 +12,6 @@ local fetch = require("luarocks.fetch") | |||
12 | local fs = require("luarocks.fs") | 12 | local fs = require("luarocks.fs") |
13 | local download = require("luarocks.download") | 13 | local download = require("luarocks.download") |
14 | 14 | ||
15 | util.add_run_function(doc) | ||
16 | doc.help_summary = "Show documentation for an installed rock." | 15 | doc.help_summary = "Show documentation for an installed rock." |
17 | 16 | ||
18 | doc.help = [[ | 17 | doc.help = [[ |
diff --git a/src/luarocks/download.lua b/src/luarocks/download.lua index 18573ae4..d793cab7 100644 --- a/src/luarocks/download.lua +++ b/src/luarocks/download.lua | |||
@@ -12,7 +12,6 @@ local fs = require("luarocks.fs") | |||
12 | local dir = require("luarocks.dir") | 12 | local dir = require("luarocks.dir") |
13 | local cfg = require("luarocks.cfg") | 13 | local cfg = require("luarocks.cfg") |
14 | 14 | ||
15 | util.add_run_function(download) | ||
16 | download.help_summary = "Download a specific rock file from a rocks server." | 15 | download.help_summary = "Download a specific rock file from a rocks server." |
17 | download.help_arguments = "[--all] [--arch=<arch> | --source | --rockspec] [<name> [<version>]]" | 16 | download.help_arguments = "[--all] [--arch=<arch> | --source | --rockspec] [<name> [<version>]]" |
18 | 17 | ||
diff --git a/src/luarocks/fetch.lua b/src/luarocks/fetch.lua index 824a3731..2590afd4 100644 --- a/src/luarocks/fetch.lua +++ b/src/luarocks/fetch.lua | |||
@@ -244,10 +244,19 @@ function fetch.load_local_rockspec(filename, quick) | |||
244 | rockspec.local_filename = filename | 244 | rockspec.local_filename = filename |
245 | local filebase = rockspec.source.file or rockspec.source.url | 245 | local filebase = rockspec.source.file or rockspec.source.url |
246 | local base = fetch.url_to_base_dir(filebase) | 246 | local base = fetch.url_to_base_dir(filebase) |
247 | rockspec.source.dir_set = rockspec.source.dir ~= nil | ||
247 | rockspec.source.dir = rockspec.source.dir | 248 | rockspec.source.dir = rockspec.source.dir |
248 | or rockspec.source.module | 249 | or rockspec.source.module |
249 | or ((filebase:match("%.lua$") or filebase:match("%.c$")) and ".") | 250 | or ( (filebase:match("%.lua$") or filebase:match("%.c$")) |
251 | and (deps.format_is_at_least(rockspec, "3.0") | ||
252 | and (fetch.is_basic_protocol(protocol) and "." or base) | ||
253 | or ".") ) | ||
250 | or base | 254 | or base |
255 | |||
256 | rockspec.rocks_provided = (deps.format_is_at_least(rockspec, "3.0") | ||
257 | and cfg.rocks_provided_3_0 | ||
258 | or cfg.rocks_provided) | ||
259 | |||
251 | if rockspec.dependencies then | 260 | if rockspec.dependencies then |
252 | for i = 1, #rockspec.dependencies do | 261 | for i = 1, #rockspec.dependencies do |
253 | local parsed, err = deps.parse_dep(rockspec.dependencies[i]) | 262 | local parsed, err = deps.parse_dep(rockspec.dependencies[i]) |
@@ -347,7 +356,29 @@ function fetch.get_sources(rockspec, extract, dest_dir) | |||
347 | ok, err = fs.unpack_archive(rockspec.source.file) | 356 | ok, err = fs.unpack_archive(rockspec.source.file) |
348 | if not ok then return nil, err end | 357 | if not ok then return nil, err end |
349 | if not fs.exists(rockspec.source.dir) then | 358 | if not fs.exists(rockspec.source.dir) then |
350 | return nil, "Directory "..rockspec.source.dir.." not found inside archive "..rockspec.source.file, "source.dir", source_file, store_dir | 359 | |
360 | -- If rockspec.source.dir can't be found, see if we only have one | ||
361 | -- directory in store_dir. If that's the case, assume it's what | ||
362 | -- we're looking for. | ||
363 | -- We only do this if the rockspec source.dir was not set, and only | ||
364 | -- with rockspecs newer than 3.0. | ||
365 | local dir_count, found_dir = 0 | ||
366 | |||
367 | if not rockspec.source.dir_set and deps.format_is_at_least(rockspec, "3.0") then | ||
368 | local files = fs.list_dir() | ||
369 | for _, f in ipairs(files) do | ||
370 | if fs.is_dir(f) then | ||
371 | dir_count = dir_count + 1 | ||
372 | found_dir = f | ||
373 | end | ||
374 | end | ||
375 | end | ||
376 | |||
377 | if dir_count == 1 then | ||
378 | rockspec.source.dir = found_dir | ||
379 | else | ||
380 | return nil, "Directory "..rockspec.source.dir.." not found inside archive "..rockspec.source.file, "source.dir", source_file, store_dir | ||
381 | end | ||
351 | end | 382 | end |
352 | fs.pop_dir() | 383 | fs.pop_dir() |
353 | end | 384 | end |
diff --git a/src/luarocks/fetch/git.lua b/src/luarocks/fetch/git.lua index f61d89e9..eaba7ffd 100644 --- a/src/luarocks/fetch/git.lua +++ b/src/luarocks/fetch/git.lua | |||
@@ -6,20 +6,48 @@ local unpack = unpack or table.unpack | |||
6 | 6 | ||
7 | local fs = require("luarocks.fs") | 7 | local fs = require("luarocks.fs") |
8 | local dir = require("luarocks.dir") | 8 | local dir = require("luarocks.dir") |
9 | local deps = require("luarocks.deps") | ||
9 | local util = require("luarocks.util") | 10 | local util = require("luarocks.util") |
10 | 11 | ||
12 | local cached_git_version | ||
13 | |||
14 | --- Get git version. | ||
15 | -- @param git_cmd string: name of git command. | ||
16 | -- @return table: git version as returned by luarocks.deps.parse_version. | ||
17 | local function git_version(git_cmd) | ||
18 | if not cached_git_version then | ||
19 | local version_line = io.popen(fs.Q(git_cmd)..' --version'):read() | ||
20 | local version_string = version_line:match('%d-%.%d+%.?%d*') | ||
21 | cached_git_version = deps.parse_version(version_string) | ||
22 | end | ||
23 | |||
24 | return cached_git_version | ||
25 | end | ||
26 | |||
27 | --- Check if git satisfies version requirement. | ||
28 | -- @param git_cmd string: name of git command. | ||
29 | -- @param version string: required version. | ||
30 | -- @return boolean: true if git matches version or is newer, false otherwise. | ||
31 | local function git_is_at_least(git_cmd, version) | ||
32 | return git_version(git_cmd) >= deps.parse_version(version) | ||
33 | end | ||
34 | |||
11 | --- Git >= 1.7.10 can clone a branch **or tag**, < 1.7.10 by branch only. We | 35 | --- Git >= 1.7.10 can clone a branch **or tag**, < 1.7.10 by branch only. We |
12 | -- need to know this in order to build the appropriate command; if we can't | 36 | -- need to know this in order to build the appropriate command; if we can't |
13 | -- clone by tag then we'll have to issue a subsequent command to check out the | 37 | -- clone by tag then we'll have to issue a subsequent command to check out the |
14 | -- given tag. | 38 | -- given tag. |
39 | -- @param git_cmd string: name of git command. | ||
15 | -- @return boolean: Whether Git can clone by tag. | 40 | -- @return boolean: Whether Git can clone by tag. |
16 | local function git_can_clone_by_tag(git_cmd) | 41 | local function git_can_clone_by_tag(git_cmd) |
17 | local version_string = io.popen(fs.Q(git_cmd)..' --version'):read() | 42 | return git_is_at_least(git_cmd, "1.7.10") |
18 | local major, minor, tiny = version_string:match('(%d-)%.(%d+)%.?(%d*)') | 43 | end |
19 | major, minor, tiny = tonumber(major), tonumber(minor), tonumber(tiny) or 0 | 44 | |
20 | local value = major > 1 or (major == 1 and (minor > 7 or (minor == 7 and tiny >= 10))) | 45 | --- Git >= 1.8.4 can fetch submodules shallowly, saving bandwidth and time for |
21 | git_can_clone_by_tag = function() return value end | 46 | -- submodules with large history. |
22 | return value | 47 | -- @param git_cmd string: name of git command. |
48 | -- @return boolean: Whether Git can fetch submodules shallowly. | ||
49 | local function git_supports_shallow_submodules(git_cmd) | ||
50 | return git_is_at_least(git_cmd, "1.8.4") | ||
23 | end | 51 | end |
24 | 52 | ||
25 | --- Download sources for building a rock, using git. | 53 | --- Download sources for building a rock, using git. |
@@ -76,12 +104,25 @@ function git.get_sources(rockspec, extract, dest_dir, depth) | |||
76 | ok, err = fs.change_dir(module) | 104 | ok, err = fs.change_dir(module) |
77 | if not ok then return nil, err end | 105 | if not ok then return nil, err end |
78 | if tag_or_branch and not git_can_clone_by_tag() then | 106 | if tag_or_branch and not git_can_clone_by_tag() then |
79 | local checkout_command = {fs.Q(git_cmd), "checkout", tag_or_branch} | 107 | if not fs.execute(fs.Q(git_cmd), "checkout", tag_or_branch) then |
80 | if not fs.execute(unpack(checkout_command)) then | ||
81 | return nil, 'Failed to check out the "' .. tag_or_branch ..'" tag or branch.' | 108 | return nil, 'Failed to check out the "' .. tag_or_branch ..'" tag or branch.' |
82 | end | 109 | end |
83 | end | 110 | end |
84 | 111 | ||
112 | -- Fetching git submodules is supported only when rockspec format is >= 3.0. | ||
113 | if deps.format_is_at_least(rockspec, "3.0") then | ||
114 | command = {fs.Q(git_cmd), "submodule", "update", "--init", "--recursive"} | ||
115 | |||
116 | if git_supports_shallow_submodules(git_cmd) then | ||
117 | -- Fetch only the last commit of each submodule. | ||
118 | table.insert(command, 5, "--depth=1") | ||
119 | end | ||
120 | |||
121 | if not fs.execute(unpack(command)) then | ||
122 | return nil, 'Failed to fetch submodules.' | ||
123 | end | ||
124 | end | ||
125 | |||
85 | fs.delete(dir.path(store_dir, module, ".git")) | 126 | fs.delete(dir.path(store_dir, module, ".git")) |
86 | fs.delete(dir.path(store_dir, module, ".gitignore")) | 127 | fs.delete(dir.path(store_dir, module, ".gitignore")) |
87 | fs.pop_dir() | 128 | fs.pop_dir() |
diff --git a/src/luarocks/help.lua b/src/luarocks/help.lua index 28f97702..5bac77ce 100644 --- a/src/luarocks/help.lua +++ b/src/luarocks/help.lua | |||
@@ -12,7 +12,6 @@ local dir = require("luarocks.dir") | |||
12 | 12 | ||
13 | local program = util.this_program("luarocks") | 13 | local program = util.this_program("luarocks") |
14 | 14 | ||
15 | util.add_run_function(help) | ||
16 | help.help_summary = "Help on commands. Type '"..program.." help <command>' for more." | 15 | help.help_summary = "Help on commands. Type '"..program.." help <command>' for more." |
17 | 16 | ||
18 | help.help_arguments = "[<command>]" | 17 | help.help_arguments = "[<command>]" |
diff --git a/src/luarocks/install.lua b/src/luarocks/install.lua index acbf584a..10d57f37 100644 --- a/src/luarocks/install.lua +++ b/src/luarocks/install.lua | |||
@@ -13,7 +13,6 @@ local manif = require("luarocks.manif") | |||
13 | local remove = require("luarocks.remove") | 13 | local remove = require("luarocks.remove") |
14 | local cfg = require("luarocks.cfg") | 14 | local cfg = require("luarocks.cfg") |
15 | 15 | ||
16 | util.add_run_function(install) | ||
17 | install.help_summary = "Install a rock." | 16 | install.help_summary = "Install a rock." |
18 | 17 | ||
19 | install.help_arguments = "{<rock>|<name> [<version>]}" | 18 | install.help_arguments = "{<rock>|<name> [<version>]}" |
diff --git a/src/luarocks/lint.lua b/src/luarocks/lint.lua index d5cc48d0..4c30804b 100644 --- a/src/luarocks/lint.lua +++ b/src/luarocks/lint.lua | |||
@@ -8,7 +8,6 @@ local util = require("luarocks.util") | |||
8 | local download = require("luarocks.download") | 8 | local download = require("luarocks.download") |
9 | local fetch = require("luarocks.fetch") | 9 | local fetch = require("luarocks.fetch") |
10 | 10 | ||
11 | util.add_run_function(lint) | ||
12 | lint.help_summary = "Check syntax of a rockspec." | 11 | lint.help_summary = "Check syntax of a rockspec." |
13 | lint.help_arguments = "<rockspec>" | 12 | lint.help_arguments = "<rockspec>" |
14 | lint.help = [[ | 13 | lint.help = [[ |
diff --git a/src/luarocks/list.lua b/src/luarocks/list.lua index c65e058f..8c9c5107 100644 --- a/src/luarocks/list.lua +++ b/src/luarocks/list.lua | |||
@@ -10,7 +10,6 @@ local cfg = require("luarocks.cfg") | |||
10 | local util = require("luarocks.util") | 10 | local util = require("luarocks.util") |
11 | local path = require("luarocks.path") | 11 | local path = require("luarocks.path") |
12 | 12 | ||
13 | util.add_run_function(list) | ||
14 | list.help_summary = "List currently installed rocks." | 13 | list.help_summary = "List currently installed rocks." |
15 | list.help_arguments = "[--porcelain] <filter>" | 14 | list.help_arguments = "[--porcelain] <filter>" |
16 | list.help = [[ | 15 | list.help = [[ |
diff --git a/src/luarocks/make.lua b/src/luarocks/make.lua index 1464def7..476150eb 100644 --- a/src/luarocks/make.lua +++ b/src/luarocks/make.lua | |||
@@ -15,7 +15,6 @@ local pack = require("luarocks.pack") | |||
15 | local remove = require("luarocks.remove") | 15 | local remove = require("luarocks.remove") |
16 | local deps = require("luarocks.deps") | 16 | local deps = require("luarocks.deps") |
17 | 17 | ||
18 | util.add_run_function(make) | ||
19 | make.help_summary = "Compile package in current directory using a rockspec." | 18 | make.help_summary = "Compile package in current directory using a rockspec." |
20 | make.help_arguments = "[--pack-binary-rock] [<rockspec>]" | 19 | make.help_arguments = "[--pack-binary-rock] [<rockspec>]" |
21 | make.help = [[ | 20 | make.help = [[ |
diff --git a/src/luarocks/make_manifest.lua b/src/luarocks/make_manifest.lua index c39c2939..b89ba47f 100644 --- a/src/luarocks/make_manifest.lua +++ b/src/luarocks/make_manifest.lua | |||
@@ -12,7 +12,6 @@ local deps = require("luarocks.deps") | |||
12 | local fs = require("luarocks.fs") | 12 | local fs = require("luarocks.fs") |
13 | local dir = require("luarocks.dir") | 13 | local dir = require("luarocks.dir") |
14 | 14 | ||
15 | util.add_run_function(make_manifest) | ||
16 | make_manifest.help_summary = "Compile a manifest file for a repository." | 15 | make_manifest.help_summary = "Compile a manifest file for a repository." |
17 | 16 | ||
18 | make_manifest.help = [[ | 17 | make_manifest.help = [[ |
diff --git a/src/luarocks/new_version.lua b/src/luarocks/new_version.lua index bd73e308..eb5dea25 100644 --- a/src/luarocks/new_version.lua +++ b/src/luarocks/new_version.lua | |||
@@ -10,7 +10,6 @@ local persist = require("luarocks.persist") | |||
10 | local fs = require("luarocks.fs") | 10 | local fs = require("luarocks.fs") |
11 | local type_check = require("luarocks.type_check") | 11 | local type_check = require("luarocks.type_check") |
12 | 12 | ||
13 | util.add_run_function(new_version) | ||
14 | new_version.help_summary = "Auto-write a rockspec for a new version of a rock." | 13 | new_version.help_summary = "Auto-write a rockspec for a new version of a rock." |
15 | new_version.help_arguments = "[--tag=<tag>] [<package>|<rockspec>] [<new_version>] [<new_url>]" | 14 | new_version.help_arguments = "[--tag=<tag>] [<package>|<rockspec>] [<new_version>] [<new_url>]" |
16 | new_version.help = [[ | 15 | new_version.help = [[ |
diff --git a/src/luarocks/pack.lua b/src/luarocks/pack.lua index 277cf246..3a163e92 100644 --- a/src/luarocks/pack.lua +++ b/src/luarocks/pack.lua | |||
@@ -16,7 +16,6 @@ local dir = require("luarocks.dir") | |||
16 | local manif = require("luarocks.manif") | 16 | local manif = require("luarocks.manif") |
17 | local search = require("luarocks.search") | 17 | local search = require("luarocks.search") |
18 | 18 | ||
19 | util.add_run_function(pack) | ||
20 | pack.help_summary = "Create a rock, packing sources or binaries." | 19 | pack.help_summary = "Create a rock, packing sources or binaries." |
21 | pack.help_arguments = "{<rockspec>|<name> [<version>]}" | 20 | pack.help_arguments = "{<rockspec>|<name> [<version>]}" |
22 | pack.help = [[ | 21 | pack.help = [[ |
diff --git a/src/luarocks/path.lua b/src/luarocks/path.lua index dafc64e7..6219d8c6 100644 --- a/src/luarocks/path.lua +++ b/src/luarocks/path.lua | |||
@@ -250,6 +250,11 @@ function path.path_to_module(file) | |||
250 | name = file:match("(.*)%."..cfg.lib_extension.."$") | 250 | name = file:match("(.*)%."..cfg.lib_extension.."$") |
251 | if name then | 251 | if name then |
252 | name = name:gsub(dir.separator, ".") | 252 | name = name:gsub(dir.separator, ".") |
253 | else | ||
254 | name = file:match("(.*)%."..cfg.static_lib_extension.."$") | ||
255 | if name then | ||
256 | name = name:gsub(dir.separator, ".") | ||
257 | end | ||
253 | end | 258 | end |
254 | end | 259 | end |
255 | if not name then name = file end | 260 | if not name then name = file end |
diff --git a/src/luarocks/path_cmd.lua b/src/luarocks/path_cmd.lua index 15fb9ca2..c0329977 100644 --- a/src/luarocks/path_cmd.lua +++ b/src/luarocks/path_cmd.lua | |||
@@ -7,7 +7,6 @@ local util = require("luarocks.util") | |||
7 | local deps = require("luarocks.deps") | 7 | local deps = require("luarocks.deps") |
8 | local cfg = require("luarocks.cfg") | 8 | local cfg = require("luarocks.cfg") |
9 | 9 | ||
10 | util.add_run_function(path_cmd) | ||
11 | path_cmd.help_summary = "Return the currently configured package path." | 10 | path_cmd.help_summary = "Return the currently configured package path." |
12 | path_cmd.help_arguments = "" | 11 | path_cmd.help_arguments = "" |
13 | path_cmd.help = [[ | 12 | path_cmd.help = [[ |
diff --git a/src/luarocks/purge.lua b/src/luarocks/purge.lua index 1ce46c0f..18043cc3 100644 --- a/src/luarocks/purge.lua +++ b/src/luarocks/purge.lua | |||
@@ -14,7 +14,6 @@ local manif = require("luarocks.manif") | |||
14 | local cfg = require("luarocks.cfg") | 14 | local cfg = require("luarocks.cfg") |
15 | local remove = require("luarocks.remove") | 15 | local remove = require("luarocks.remove") |
16 | 16 | ||
17 | util.add_run_function(purge) | ||
18 | purge.help_summary = "Remove all installed rocks from a tree." | 17 | purge.help_summary = "Remove all installed rocks from a tree." |
19 | purge.help_arguments = "--tree=<tree> [--old-versions]" | 18 | purge.help_arguments = "--tree=<tree> [--old-versions]" |
20 | purge.help = [[ | 19 | purge.help = [[ |
diff --git a/src/luarocks/refresh_cache.lua b/src/luarocks/refresh_cache.lua index bbfd1f4d..1261044f 100644 --- a/src/luarocks/refresh_cache.lua +++ b/src/luarocks/refresh_cache.lua | |||
@@ -3,11 +3,9 @@ | |||
3 | local refresh_cache = {} | 3 | local refresh_cache = {} |
4 | package.loaded["luarocks.refresh_cache"] = refresh_cache | 4 | package.loaded["luarocks.refresh_cache"] = refresh_cache |
5 | 5 | ||
6 | local util = require("luarocks.util") | ||
7 | local cfg = require("luarocks.cfg") | 6 | local cfg = require("luarocks.cfg") |
8 | local cache = require("luarocks.cache") | 7 | local cache = require("luarocks.cache") |
9 | 8 | ||
10 | util.add_run_function(refresh_cache) | ||
11 | refresh_cache.help_summary = "Refresh local cache of a remote rocks server." | 9 | refresh_cache.help_summary = "Refresh local cache of a remote rocks server." |
12 | refresh_cache.help_arguments = "[--from=<server>]" | 10 | refresh_cache.help_arguments = "[--from=<server>]" |
13 | refresh_cache.help = [[ | 11 | refresh_cache.help = [[ |
diff --git a/src/luarocks/remove.lua b/src/luarocks/remove.lua index d72fabaf..3f62e89e 100644 --- a/src/luarocks/remove.lua +++ b/src/luarocks/remove.lua | |||
@@ -14,7 +14,6 @@ local cfg = require("luarocks.cfg") | |||
14 | local manif = require("luarocks.manif") | 14 | local manif = require("luarocks.manif") |
15 | local fs = require("luarocks.fs") | 15 | local fs = require("luarocks.fs") |
16 | 16 | ||
17 | util.add_run_function(remove) | ||
18 | remove.help_summary = "Uninstall a rock." | 17 | remove.help_summary = "Uninstall a rock." |
19 | remove.help_arguments = "[--force|--force-fast] <name> [<version>]" | 18 | remove.help_arguments = "[--force|--force-fast] <name> [<version>]" |
20 | remove.help = [[ | 19 | remove.help = [[ |
diff --git a/src/luarocks/search.lua b/src/luarocks/search.lua index eaa321d5..c3f00a7c 100644 --- a/src/luarocks/search.lua +++ b/src/luarocks/search.lua | |||
@@ -11,7 +11,6 @@ local deps = require("luarocks.deps") | |||
11 | local cfg = require("luarocks.cfg") | 11 | local cfg = require("luarocks.cfg") |
12 | local util = require("luarocks.util") | 12 | local util = require("luarocks.util") |
13 | 13 | ||
14 | util.add_run_function(search) | ||
15 | search.help_summary = "Query the LuaRocks servers." | 14 | search.help_summary = "Query the LuaRocks servers." |
16 | search.help_arguments = "[--source] [--binary] { <name> [<version>] | --all }" | 15 | search.help_arguments = "[--source] [--binary] { <name> [<version>] | --all }" |
17 | search.help = [[ | 16 | search.help = [[ |
diff --git a/src/luarocks/show.lua b/src/luarocks/show.lua index 01860e78..df992f5c 100644 --- a/src/luarocks/show.lua +++ b/src/luarocks/show.lua | |||
@@ -11,7 +11,6 @@ local deps = require("luarocks.deps") | |||
11 | local fetch = require("luarocks.fetch") | 11 | local fetch = require("luarocks.fetch") |
12 | local manif = require("luarocks.manif") | 12 | local manif = require("luarocks.manif") |
13 | 13 | ||
14 | util.add_run_function(show) | ||
15 | show.help_summary = "Show information about an installed rock." | 14 | show.help_summary = "Show information about an installed rock." |
16 | 15 | ||
17 | show.help = [[ | 16 | show.help = [[ |
diff --git a/src/luarocks/tools/tar.lua b/src/luarocks/tools/tar.lua index 637a6c95..ae5c83e2 100644 --- a/src/luarocks/tools/tar.lua +++ b/src/luarocks/tools/tar.lua | |||
@@ -56,10 +56,11 @@ end | |||
56 | local function read_header_block(block) | 56 | local function read_header_block(block) |
57 | local header = {} | 57 | local header = {} |
58 | header.name = nullterm(block:sub(1,100)) | 58 | header.name = nullterm(block:sub(1,100)) |
59 | header.mode = nullterm(block:sub(101,108)) | 59 | header.mode = nullterm(block:sub(101,108)):gsub(" ", "") |
60 | header.uid = octal_to_number(nullterm(block:sub(109,116))) | 60 | header.uid = octal_to_number(nullterm(block:sub(109,116))) |
61 | header.gid = octal_to_number(nullterm(block:sub(117,124))) | 61 | header.gid = octal_to_number(nullterm(block:sub(117,124))) |
62 | header.size = octal_to_number(nullterm(block:sub(125,136))) | 62 | header.size = octal_to_number(nullterm(block:sub(125,136))) |
63 | print("{"..block:sub(125,136).."}", "{"..nullterm(block:sub(125,136)).."}", "{"..octal_to_number(nullterm(block:sub(125,136))).."}", header.size) | ||
63 | header.mtime = octal_to_number(nullterm(block:sub(137,148))) | 64 | header.mtime = octal_to_number(nullterm(block:sub(137,148))) |
64 | header.chksum = octal_to_number(nullterm(block:sub(149,156))) | 65 | header.chksum = octal_to_number(nullterm(block:sub(149,156))) |
65 | header.typeflag = get_typeflag(block:sub(157,157)) | 66 | header.typeflag = get_typeflag(block:sub(157,157)) |
@@ -93,13 +94,14 @@ function tar.untar(filename, destdir) | |||
93 | local long_name, long_link_name | 94 | local long_name, long_link_name |
94 | while true do | 95 | while true do |
95 | local block | 96 | local block |
96 | repeat | 97 | repeat |
97 | block = tar_handle:read(blocksize) | 98 | block = tar_handle:read(blocksize) |
98 | until (not block) or checksum_header(block) > 256 | 99 | until (not block) or checksum_header(block) > 256 |
99 | if not block then break end | 100 | if not block then break end |
100 | local header, err = read_header_block(block) | 101 | local header, err = read_header_block(block) |
101 | if not header then | 102 | if not header then |
102 | util.printerr(err) | 103 | util.printerr(err) |
104 | return nil, err | ||
103 | end | 105 | end |
104 | 106 | ||
105 | local file_data = tar_handle:read(math.ceil(header.size / blocksize) * blocksize):sub(1,header.size) | 107 | local file_data = tar_handle:read(math.ceil(header.size / blocksize) * blocksize):sub(1,header.size) |
diff --git a/src/luarocks/type_check.lua b/src/luarocks/type_check.lua index 82763401..287d8151 100644 --- a/src/luarocks/type_check.lua +++ b/src/luarocks/type_check.lua | |||
@@ -7,7 +7,7 @@ package.loaded["luarocks.type_check"] = type_check | |||
7 | local cfg = require("luarocks.cfg") | 7 | local cfg = require("luarocks.cfg") |
8 | local deps = require("luarocks.deps") | 8 | local deps = require("luarocks.deps") |
9 | 9 | ||
10 | type_check.rockspec_format = "1.1" | 10 | type_check.rockspec_format = "3.0" |
11 | 11 | ||
12 | local string_1 = { _type = "string" } | 12 | local string_1 = { _type = "string" } |
13 | local number_1 = { _type = "number" } | 13 | local number_1 = { _type = "number" } |
diff --git a/src/luarocks/unpack.lua b/src/luarocks/unpack.lua index 2face005..4e4d9a06 100644 --- a/src/luarocks/unpack.lua +++ b/src/luarocks/unpack.lua | |||
@@ -11,7 +11,6 @@ local build = require("luarocks.build") | |||
11 | local dir = require("luarocks.dir") | 11 | local dir = require("luarocks.dir") |
12 | local cfg = require("luarocks.cfg") | 12 | local cfg = require("luarocks.cfg") |
13 | 13 | ||
14 | util.add_run_function(unpack) | ||
15 | unpack.help_summary = "Unpack the contents of a rock." | 14 | unpack.help_summary = "Unpack the contents of a rock." |
16 | unpack.help_arguments = "[--force] {<rock>|<name> [<version>]}" | 15 | unpack.help_arguments = "[--force] {<rock>|<name> [<version>]}" |
17 | unpack.help = [[ | 16 | unpack.help = [[ |
diff --git a/src/luarocks/upload.lua b/src/luarocks/upload.lua index 3adc1704..5031b1ef 100644 --- a/src/luarocks/upload.lua +++ b/src/luarocks/upload.lua | |||
@@ -7,7 +7,6 @@ local pack = require("luarocks.pack") | |||
7 | local cfg = require("luarocks.cfg") | 7 | local cfg = require("luarocks.cfg") |
8 | local Api = require("luarocks.upload.api") | 8 | local Api = require("luarocks.upload.api") |
9 | 9 | ||
10 | util.add_run_function(upload) | ||
11 | upload.help_summary = "Upload a rockspec to the public rocks repository." | 10 | upload.help_summary = "Upload a rockspec to the public rocks repository." |
12 | upload.help_arguments = "[--skip-pack] [--api-key=<key>] [--force] <rockspec>" | 11 | upload.help_arguments = "[--skip-pack] [--api-key=<key>] [--force] <rockspec>" |
13 | upload.help = [[ | 12 | upload.help = [[ |
diff --git a/src/luarocks/util.lua b/src/luarocks/util.lua index 532bea8b..d27710c1 100644 --- a/src/luarocks/util.lua +++ b/src/luarocks/util.lua | |||
@@ -8,6 +8,20 @@ local util = {} | |||
8 | 8 | ||
9 | local unpack = unpack or table.unpack | 9 | local unpack = unpack or table.unpack |
10 | 10 | ||
11 | --- Run a process and read a its output. | ||
12 | -- Equivalent to io.popen(cmd):read("*l"), except that it | ||
13 | -- closes the fd right away. | ||
14 | -- @param cmd string: The command to execute | ||
15 | -- @param spec string: "*l" by default, to read a single line. | ||
16 | -- May be used to read more, passing, for instance, "*a". | ||
17 | -- @return string: the output of the program. | ||
18 | function util.popen_read(cmd, spec) | ||
19 | local fd = io.popen(cmd) | ||
20 | local out = fd:read(spec or "*l") | ||
21 | fd:close() | ||
22 | return out | ||
23 | end | ||
24 | |||
11 | local scheduled_functions = {} | 25 | local scheduled_functions = {} |
12 | local debug = require("debug") | 26 | local debug = require("debug") |
13 | 27 | ||
@@ -196,13 +210,6 @@ function util.parse_flags(...) | |||
196 | return flags, unpack(out) | 210 | return flags, unpack(out) |
197 | end | 211 | end |
198 | 212 | ||
199 | -- Adds legacy 'run' function to a command module. | ||
200 | -- @param command table: command module with 'command' function, | ||
201 | -- the added 'run' function calls it after parseing command-line arguments. | ||
202 | function util.add_run_function(command) | ||
203 | command.run = function(...) return command.command(util.parse_flags(...)) end | ||
204 | end | ||
205 | |||
206 | --- Merges contents of src on top of dst's contents. | 213 | --- Merges contents of src on top of dst's contents. |
207 | -- @param dst Destination table, which will receive src's contents. | 214 | -- @param dst Destination table, which will receive src's contents. |
208 | -- @param src Table which provides new contents to dst. | 215 | -- @param src Table which provides new contents to dst. |
diff --git a/src/luarocks/validate.lua b/src/luarocks/validate.lua index c4570aa4..f0452bbd 100644 --- a/src/luarocks/validate.lua +++ b/src/luarocks/validate.lua | |||
@@ -11,7 +11,6 @@ local build = require("luarocks.build") | |||
11 | local install = require("luarocks.install") | 11 | local install = require("luarocks.install") |
12 | local util = require("luarocks.util") | 12 | local util = require("luarocks.util") |
13 | 13 | ||
14 | util.add_run_function(validate) | ||
15 | validate.help_summary = "Sandboxed test of build/install of all packages in a repository." | 14 | validate.help_summary = "Sandboxed test of build/install of all packages in a repository." |
16 | 15 | ||
17 | validate.help = [[ | 16 | validate.help = [[ |
diff --git a/src/luarocks/write_rockspec.lua b/src/luarocks/write_rockspec.lua index 33edeb1b..68c00cce 100644 --- a/src/luarocks/write_rockspec.lua +++ b/src/luarocks/write_rockspec.lua | |||
@@ -11,7 +11,6 @@ local persist = require("luarocks.persist") | |||
11 | local type_check = require("luarocks.type_check") | 11 | local type_check = require("luarocks.type_check") |
12 | local util = require("luarocks.util") | 12 | local util = require("luarocks.util") |
13 | 13 | ||
14 | util.add_run_function(write_rockspec) | ||
15 | write_rockspec.help_summary = "Write a template for a rockspec file." | 14 | write_rockspec.help_summary = "Write a template for a rockspec file." |
16 | write_rockspec.help_arguments = "[--output=<file> ...] [<name>] [<version>] [<url>|<path>]" | 15 | write_rockspec.help_arguments = "[--output=<file> ...] [<name>] [<version>] [<url>|<path>]" |
17 | write_rockspec.help = [[ | 16 | write_rockspec.help = [[ |
diff --git a/test/testfiles/luajit-fail-1.0-1.rockspec b/test/testfiles/luajit-fail-1.0-1.rockspec new file mode 100644 index 00000000..f8204600 --- /dev/null +++ b/test/testfiles/luajit-fail-1.0-1.rockspec | |||
@@ -0,0 +1,22 @@ | |||
1 | package = "luajit-fail" | ||
2 | version = "1.0-1" | ||
3 | source = { | ||
4 | url = "https://raw.githubusercontent.com/keplerproject/luarocks/master/test/testing.lua", | ||
5 | } | ||
6 | description = { | ||
7 | summary = "Test luajit dependency fail", | ||
8 | detailed = [[ | ||
9 | Fail luajit dependency when running with rockspec_format < 3.0. | ||
10 | ]], | ||
11 | homepage = "http://luarocks.org/", | ||
12 | license = "MIT/X license" | ||
13 | } | ||
14 | dependencies = { | ||
15 | "luajit >= 2.0" | ||
16 | } | ||
17 | build = { | ||
18 | type = "builtin", | ||
19 | modules = { | ||
20 | testing = "testing.lua" | ||
21 | } | ||
22 | } | ||
diff --git a/test/testfiles/luajit-success-1.0-1.rockspec b/test/testfiles/luajit-success-1.0-1.rockspec new file mode 100644 index 00000000..31c930c3 --- /dev/null +++ b/test/testfiles/luajit-success-1.0-1.rockspec | |||
@@ -0,0 +1,23 @@ | |||
1 | rockspec_format = "3.0" | ||
2 | package = "luajit-success" | ||
3 | version = "1.0-1" | ||
4 | source = { | ||
5 | url = "https://raw.githubusercontent.com/keplerproject/luarocks/master/test/testing.lua", | ||
6 | } | ||
7 | description = { | ||
8 | summary = "Test luajit dependency fail", | ||
9 | detailed = [[ | ||
10 | Use luajit dependency when running with rockspec_format >= 3.0. | ||
11 | ]], | ||
12 | homepage = "http://luarocks.org/", | ||
13 | license = "MIT/X license" | ||
14 | } | ||
15 | dependencies = { | ||
16 | "luajit >= 2.0" | ||
17 | } | ||
18 | build = { | ||
19 | type = "builtin", | ||
20 | modules = { | ||
21 | testing = "testing.lua" | ||
22 | } | ||
23 | } | ||
diff --git a/test/testing.sh b/test/testing.sh index cb10441c..e4b5d8c2 100755 --- a/test/testing.sh +++ b/test/testing.sh | |||
@@ -30,7 +30,15 @@ then | |||
30 | shift | 30 | shift |
31 | fi | 31 | fi |
32 | 32 | ||
33 | luashortversion=`echo $luaversion | cut -d. -f 1-2` | 33 | is_jit=`[ "${luaversion::3}" = "jit" ] && echo 1 || echo 0` |
34 | |||
35 | if [ "$is_jit" = 1 ] | ||
36 | then | ||
37 | luashortversion=5.1 | ||
38 | luajitversion=${luaversion:4} | ||
39 | else | ||
40 | luashortversion=`echo $luaversion | cut -d. -f 1-2` | ||
41 | fi | ||
34 | 42 | ||
35 | testing_dir="$PWD" | 43 | testing_dir="$PWD" |
36 | 44 | ||
@@ -142,13 +150,27 @@ then | |||
142 | if [ ! -e "$luadir/bin/lua" ] | 150 | if [ ! -e "$luadir/bin/lua" ] |
143 | then | 151 | then |
144 | mkdir -p lua | 152 | mkdir -p lua |
145 | echo "Downloading lua $luaversion..." | 153 | cd lua |
146 | wget "http://www.lua.org/ftp/lua-$luaversion.tar.gz" &> /dev/null | 154 | if [ "$is_jit" = 1 ] |
147 | tar zxpf "lua-$luaversion.tar.gz" | 155 | then |
148 | cd "lua-$luaversion" | 156 | echo "Downloading LuaJIT $luajitversion..." |
149 | echo "Building lua $luaversion..." | 157 | #rm -f "LuaJIT-$luajitversion.tar.gz" |
150 | make linux INSTALL_TOP="$luadir" &> /dev/null | 158 | wget -c "https://github.com/LuaJIT/LuaJIT/archive/v$luajitversion.tar.gz" &> /dev/null |
151 | make install INSTALL_TOP="$luadir" &> /dev/null | 159 | tar zxpf "v$luajitversion.tar.gz" |
160 | cd "LuaJIT-$luajitversion" | ||
161 | echo "Building LuaJIT $luajitversion..." | ||
162 | make PREFIX="$luadir" &> /dev/null | ||
163 | make install PREFIX="$luadir" &> /dev/null | ||
164 | else | ||
165 | echo "Downloading Lua $luaversion..." | ||
166 | #rm -f "lua-$luaversion.tar.gz" | ||
167 | wget -c "http://www.lua.org/ftp/lua-$luaversion.tar.gz" &> /dev/null | ||
168 | tar zxpf "lua-$luaversion.tar.gz" | ||
169 | cd "lua-$luaversion" | ||
170 | echo "Building Lua $luaversion..." | ||
171 | make linux INSTALL_TOP="$luadir" &> /dev/null | ||
172 | make install INSTALL_TOP="$luadir" &> /dev/null | ||
173 | fi | ||
152 | fi | 174 | fi |
153 | popd | 175 | popd |
154 | [ -e ~/.ssh/id_rsa.pub ] || ssh-keygen -t rsa -P "" -f ~/.ssh/id_rsa | 176 | [ -e ~/.ssh/id_rsa.pub ] || ssh-keygen -t rsa -P "" -f ~/.ssh/id_rsa |
@@ -156,7 +178,13 @@ then | |||
156 | chmod og-wx ~/.ssh/authorized_keys | 178 | chmod og-wx ~/.ssh/authorized_keys |
157 | ssh-keyscan localhost >> ~/.ssh/known_hosts | 179 | ssh-keyscan localhost >> ~/.ssh/known_hosts |
158 | else | 180 | else |
159 | luadir="/Programs/Lua/Current" | 181 | if [ "$is_jit" = 1 ] |
182 | then | ||
183 | luadir="/Programs/LuaJIT/$luajitversion" | ||
184 | echo HELLO $luadir | ||
185 | else | ||
186 | luadir="/Programs/Lua/$luaversion" | ||
187 | fi | ||
160 | if [ ! -e "$luadir" ] | 188 | if [ ! -e "$luadir" ] |
161 | then | 189 | then |
162 | luadir="/usr/local" | 190 | luadir="/usr/local" |
@@ -170,7 +198,13 @@ else | |||
170 | platform="linux-x86_64" | 198 | platform="linux-x86_64" |
171 | fi | 199 | fi |
172 | 200 | ||
173 | lua="$luadir/bin/lua" | 201 | if [ "$is_jit" = 1 ] |
202 | then | ||
203 | lua="$luadir/bin/luajit" | ||
204 | luarocks_configure_extra_args="--lua-suffix=jit --with-lua-include=$luadir/include/luajit-2.0" | ||
205 | else | ||
206 | lua="$luadir/bin/lua" | ||
207 | fi | ||
174 | 208 | ||
175 | version_luasocket=3.0rc1 | 209 | version_luasocket=3.0rc1 |
176 | verrev_luasocket=${version_luasocket}-1 | 210 | verrev_luasocket=${version_luasocket}-1 |
@@ -194,7 +228,7 @@ verrev_abelhas=${version_abelhas}-1 | |||
194 | luasec=luasec | 228 | luasec=luasec |
195 | 229 | ||
196 | cd .. | 230 | cd .. |
197 | ./configure --with-lua="$luadir" --prefix="$testing_lrprefix" | 231 | ./configure --with-lua="$luadir" --prefix="$testing_lrprefix" $luarocks_configure_extra_args |
198 | make clean | 232 | make clean |
199 | make src/luarocks/site_config.lua | 233 | make src/luarocks/site_config.lua |
200 | make dev | 234 | make dev |
@@ -222,6 +256,7 @@ luarocks_noecho="run_lua --noecho luarocks" | |||
222 | luarocks_noecho_nocov="run_lua --noecho --nocov luarocks" | 256 | luarocks_noecho_nocov="run_lua --noecho --nocov luarocks" |
223 | luarocks_admin="run_lua luarocks-admin" | 257 | luarocks_admin="run_lua luarocks-admin" |
224 | luarocks_admin_nocov="run_lua --nocov luarocks-admin" | 258 | luarocks_admin_nocov="run_lua --nocov luarocks-admin" |
259 | luajit_luarocks="luajit -e require('luacov.runner')('$testing_dir/luacov.config') $basedir/bin/luarocks" | ||
225 | 260 | ||
226 | ################################################### | 261 | ################################################### |
227 | 262 | ||
@@ -559,6 +594,19 @@ test_fetch_base_dir() { $lua <<EOF | |||
559 | EOF | 594 | EOF |
560 | } | 595 | } |
561 | 596 | ||
597 | test_luajit_dependency() { | ||
598 | if [ "$is_jit" = 1 ] | ||
599 | then $luarocks build "$testing_dir/testfiles/luajit-success-1.0-1.rockspec" | ||
600 | else true | ||
601 | fi | ||
602 | } | ||
603 | fail_luajit_dependency() { | ||
604 | if [ "$is_jit" = 1 ] | ||
605 | then $luarocks build "$testing_dir/testfiles/luajit-fail-1.0-1.rockspec" | ||
606 | else false | ||
607 | fi | ||
608 | } | ||
609 | |||
562 | test_doc() { $luarocks install luarepl; $luarocks doc luarepl; } | 610 | test_doc() { $luarocks install luarepl; $luarocks doc luarepl; } |
563 | test_doc_home() { $luarocks install luacov; $luarocks doc luacov --home; } | 611 | test_doc_home() { $luarocks install luacov; $luarocks doc luacov --home; } |
564 | fail_doc_invalid() { $luarocks doc invalid; } | 612 | fail_doc_invalid() { $luarocks doc invalid; } |