aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml1
-rw-r--r--src/luarocks/build/cmake.lua22
-rw-r--r--src/luarocks/cfg.lua6
-rw-r--r--src/luarocks/deps.lua31
-rw-r--r--src/luarocks/fetch.lua10
-rw-r--r--src/luarocks/fetch/git.lua57
-rw-r--r--src/luarocks/tools/tar.lua6
-rw-r--r--src/luarocks/type_check.lua2
-rw-r--r--test/testfiles/luajit-fail-1.0-1.rockspec22
-rw-r--r--test/testfiles/luajit-success-1.0-1.rockspec23
-rwxr-xr-xtest/testing.sh72
11 files changed, 213 insertions, 39 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
13script: cd test && ./testing.sh --travis --lua $LUA_VER 14script: cd test && ./testing.sh --travis --lua $LUA_VER
diff --git a/src/luarocks/build/cmake.lua b/src/luarocks/build/cmake.lua
index 7b16fa51..34f6ada0 100644
--- a/src/luarocks/build/cmake.lua
+++ b/src/luarocks/build/cmake.lua
@@ -6,6 +6,7 @@ local cmake = {}
6local fs = require("luarocks.fs") 6local fs = require("luarocks.fs")
7local util = require("luarocks.util") 7local util = require("luarocks.util")
8local cfg = require("luarocks.cfg") 8local cfg = require("luarocks.cfg")
9local deps = require("luarocks.deps")
9 10
10--- Driver function for the "cmake" build back-end. 11--- Driver function for the "cmake" build back-end.
11-- @param rockspec table: the loaded rockspec. 12-- @param rockspec table: the loaded rockspec.
@@ -53,13 +54,26 @@ function cmake.run(rockspec)
53 return nil, "Failed cmake." 54 return nil, "Failed cmake."
54 end 55 end
55 56
56 if not fs.execute_string(rockspec.variables.CMAKE.." --build build.luarocks --config Release") then 57 local do_build, do_install
57 return nil, "Failed building." 58 if deps.format_is_at_least(rockspec, "3.0") then
59 do_build = (build.build_pass == nil) and true or build.build_pass
60 do_install = (build.install_pass == nil) and true or build.install_pass
61 else
62 do_build = true
63 do_install = true
58 end 64 end
59 65
60 if not fs.execute_string(rockspec.variables.CMAKE.." --build build.luarocks --target install --config Release") then 66 if do_build then
61 return nil, "Failed installing." 67 if not fs.execute_string(rockspec.variables.CMAKE.." --build build.luarocks --config Release") then
68 return nil, "Failed building."
69 end
62 end 70 end
71 if do_install then
72 if not fs.execute_string(rockspec.variables.CMAKE.." --build build.luarocks --target install --config Release") then
73 return nil, "Failed installing."
74 end
75 end
76
63 return true 77 return true
64end 78end
65 79
diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua
index e3d6e74b..4fb1b23b 100644
--- a/src/luarocks/cfg.lua
+++ b/src/luarocks/cfg.lua
@@ -387,7 +387,8 @@ local defaults = {
387 include = "include" 387 include = "include"
388 }, 388 },
389 389
390 rocks_provided = {} 390 rocks_provided = {},
391 rocks_provided_3_0 = {},
391} 392}
392 393
393if cfg.platforms.windows then 394if cfg.platforms.windows then
@@ -591,8 +592,8 @@ end
591if package.loaded.jit then 592if package.loaded.jit then
592 -- LuaJIT 593 -- LuaJIT
593 local lj_version = package.loaded.jit.version:match("LuaJIT (.*)"):gsub("%-","") 594 local lj_version = package.loaded.jit.version:match("LuaJIT (.*)"):gsub("%-","")
594 --defaults.rocks_provided["luajit"] = lj_version.."-1"
595 defaults.rocks_provided["luabitop"] = lj_version.."-1" 595 defaults.rocks_provided["luabitop"] = lj_version.."-1"
596 defaults.rocks_provided_3_0["luajit"] = lj_version.."-1"
596end 597end
597 598
598-- Use defaults: 599-- Use defaults:
@@ -609,6 +610,7 @@ for _, entry in ipairs({"variables", "rocks_provided"}) do
609 end 610 end
610 end 611 end
611end 612end
613setmetatable(defaults.rocks_provided_3_0, { __index = cfg.rocks_provided })
612 614
613-- For values not set in the config file, use values from the 'defaults' table. 615-- For values not set in the config file, use values from the 'defaults' table.
614local cfg_mt = { 616local cfg_mt = {
diff --git a/src/luarocks/deps.lua b/src/luarocks/deps.lua
index 0e3265b5..3f7eb4d2 100644
--- a/src/luarocks/deps.lua
+++ b/src/luarocks/deps.lua
@@ -159,6 +159,15 @@ function deps.compare_versions(a, b)
159 return deps.parse_version(a) > deps.parse_version(b) 159 return deps.parse_version(a) > deps.parse_version(b)
160end 160end
161 161
162--- Check if rockspec format version satisfies version requirement.
163-- @param rockspec table: The rockspec table.
164-- @param version string: required version.
165-- @return boolean: true if rockspec format matches version or is newer, false otherwise.
166function deps.format_is_at_least(rockspec, version)
167 local rockspec_format = rockspec.rockspec_format or "1.0"
168 return deps.parse_version(rockspec_format) >= deps.parse_version(version)
169end
170
162--- Consumes a constraint from a string, converting it to table format. 171--- Consumes a constraint from a string, converting it to table format.
163-- For example, a string ">= 1.0, > 2.0" is converted to a table in the 172-- For example, a string ">= 1.0, > 2.0" is converted to a table in the
164-- format {op = ">=", version={1,0}} and the rest, "> 2.0", is returned 173-- format {op = ">=", version={1,0}} and the rest, "> 2.0", is returned
@@ -318,16 +327,20 @@ end
318-- @param dep table: A dependency parsed in table format. 327-- @param dep table: A dependency parsed in table format.
319-- @param blacklist table: Versions that can't be accepted. Table where keys 328-- @param blacklist table: Versions that can't be accepted. Table where keys
320-- are program versions and values are 'true'. 329-- are program versions and values are 'true'.
330-- @param provided table: A table of auto-dependencies provided
331-- by this Lua implementation for the given dependency.
321-- @return table or nil: A table containing fields 'name' and 'version' 332-- @return table or nil: A table containing fields 'name' and 'version'
322-- representing an installed rock which matches the given dependency, 333-- representing an installed rock which matches the given dependency,
323-- or nil if it could not be matched. 334-- or nil if it could not be matched.
324local function match_dep(dep, blacklist, deps_mode) 335local function match_dep(dep, blacklist, deps_mode, rocks_provided)
325 assert(type(dep) == "table") 336 assert(type(dep) == "table")
326 337 assert(type(rocks_provided) == "table")
327 local versions = cfg.rocks_provided[dep.name] 338
328 if cfg.rocks_provided[dep.name] then 339 local versions
340 local provided = rocks_provided[dep.name]
341 if provided then
329 -- provided rocks have higher priority than manifest's rocks 342 -- provided rocks have higher priority than manifest's rocks
330 versions = { cfg.rocks_provided[dep.name] } 343 versions = { provided }
331 else 344 else
332 versions = manif_core.get_versions(dep.name, deps_mode) 345 versions = manif_core.get_versions(dep.name, deps_mode)
333 end 346 end
@@ -379,9 +392,9 @@ function deps.match_deps(rockspec, blacklist, deps_mode)
379 local matched, missing, no_upgrade = {}, {}, {} 392 local matched, missing, no_upgrade = {}, {}, {}
380 393
381 for _, dep in ipairs(rockspec.dependencies) do 394 for _, dep in ipairs(rockspec.dependencies) do
382 local found = match_dep(dep, blacklist and blacklist[dep.name] or nil, deps_mode) 395 local found = match_dep(dep, blacklist and blacklist[dep.name] or nil, deps_mode, rockspec.rocks_provided)
383 if found then 396 if found then
384 if not cfg.rocks_provided[dep.name] then 397 if not rockspec.rocks_provided[dep.name] then
385 matched[dep] = found 398 matched[dep] = found
386 end 399 end
387 else 400 else
@@ -479,7 +492,7 @@ function deps.fulfill_dependencies(rockspec, deps_mode)
479 492
480 for _, dep in pairs(missing) do 493 for _, dep in pairs(missing) do
481 -- Double-check in case dependency was filled during recursion. 494 -- Double-check in case dependency was filled during recursion.
482 if not match_dep(dep, nil, deps_mode) then 495 if not match_dep(dep, nil, deps_mode, rockspec.rocks_provided) then
483 local rock = search.find_suitable_rock(dep) 496 local rock = search.find_suitable_rock(dep)
484 if not rock then 497 if not rock then
485 return nil, "Could not satisfy dependency: "..deps.show_dep(dep) 498 return nil, "Could not satisfy dependency: "..deps.show_dep(dep)
@@ -699,7 +712,7 @@ function deps.scan_deps(results, missing, manifest, name, version, deps_mode)
699 end 712 end
700 dependencies_name[version] = rockspec.dependencies 713 dependencies_name[version] = rockspec.dependencies
701 else 714 else
702 rockspec = { dependencies = deplist } 715 rockspec = { dependencies = deplist, rocks_provided = {} }
703 end 716 end
704 local matched, failures = deps.match_deps(rockspec, nil, deps_mode) 717 local matched, failures = deps.match_deps(rockspec, nil, deps_mode)
705 results[name] = results 718 results[name] = results
diff --git a/src/luarocks/fetch.lua b/src/luarocks/fetch.lua
index e92aeddf..e1cad11b 100644
--- a/src/luarocks/fetch.lua
+++ b/src/luarocks/fetch.lua
@@ -247,8 +247,16 @@ function fetch.load_local_rockspec(filename, quick)
247 local base = fetch.url_to_base_dir(filebase) 247 local base = fetch.url_to_base_dir(filebase)
248 rockspec.source.dir = rockspec.source.dir 248 rockspec.source.dir = rockspec.source.dir
249 or rockspec.source.module 249 or rockspec.source.module
250 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 ".") )
251 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
252 if rockspec.dependencies then 260 if rockspec.dependencies then
253 for i = 1, #rockspec.dependencies do 261 for i = 1, #rockspec.dependencies do
254 local parsed, err = deps.parse_dep(rockspec.dependencies[i]) 262 local parsed, err = deps.parse_dep(rockspec.dependencies[i])
diff --git a/src/luarocks/fetch/git.lua b/src/luarocks/fetch/git.lua
index a635f190..aa735b3f 100644
--- a/src/luarocks/fetch/git.lua
+++ b/src/luarocks/fetch/git.lua
@@ -7,20 +7,48 @@ local unpack = unpack or table.unpack
7 7
8local fs = require("luarocks.fs") 8local fs = require("luarocks.fs")
9local dir = require("luarocks.dir") 9local dir = require("luarocks.dir")
10local deps = require("luarocks.deps")
10local util = require("luarocks.util") 11local util = require("luarocks.util")
11 12
13local cached_git_version
14
15--- Get git version.
16-- @param git_cmd string: name of git command.
17-- @return table: git version as returned by luarocks.deps.parse_version.
18local function git_version(git_cmd)
19 if not cached_git_version then
20 local version_line = io.popen(fs.Q(git_cmd)..' --version'):read()
21 local version_string = version_line:match('%d-%.%d+%.?%d*')
22 cached_git_version = deps.parse_version(version_string)
23 end
24
25 return cached_git_version
26end
27
28--- Check if git satisfies version requirement.
29-- @param git_cmd string: name of git command.
30-- @param version string: required version.
31-- @return boolean: true if git matches version or is newer, false otherwise.
32local function git_is_at_least(git_cmd, version)
33 return git_version(git_cmd) >= deps.parse_version(version)
34end
35
12--- Git >= 1.7.10 can clone a branch **or tag**, < 1.7.10 by branch only. We 36--- Git >= 1.7.10 can clone a branch **or tag**, < 1.7.10 by branch only. We
13-- need to know this in order to build the appropriate command; if we can't 37-- need to know this in order to build the appropriate command; if we can't
14-- clone by tag then we'll have to issue a subsequent command to check out the 38-- clone by tag then we'll have to issue a subsequent command to check out the
15-- given tag. 39-- given tag.
40-- @param git_cmd string: name of git command.
16-- @return boolean: Whether Git can clone by tag. 41-- @return boolean: Whether Git can clone by tag.
17local function git_can_clone_by_tag(git_cmd) 42local function git_can_clone_by_tag(git_cmd)
18 local version_string = io.popen(fs.Q(git_cmd)..' --version'):read() 43 return git_is_at_least(git_cmd, "1.7.10")
19 local major, minor, tiny = version_string:match('(%d-)%.(%d+)%.?(%d*)') 44end
20 major, minor, tiny = tonumber(major), tonumber(minor), tonumber(tiny) or 0 45
21 local value = major > 1 or (major == 1 and (minor > 7 or (minor == 7 and tiny >= 10))) 46--- Git >= 1.8.4 can fetch submodules shallowly, saving bandwidth and time for
22 git_can_clone_by_tag = function() return value end 47-- submodules with large history.
23 return value 48-- @param git_cmd string: name of git command.
49-- @return boolean: Whether Git can fetch submodules shallowly.
50local function git_supports_shallow_submodules(git_cmd)
51 return git_is_at_least(git_cmd, "1.8.4")
24end 52end
25 53
26--- Download sources for building a rock, using git. 54--- Download sources for building a rock, using git.
@@ -77,12 +105,25 @@ function git.get_sources(rockspec, extract, dest_dir, depth)
77 ok, err = fs.change_dir(module) 105 ok, err = fs.change_dir(module)
78 if not ok then return nil, err end 106 if not ok then return nil, err end
79 if tag_or_branch and not git_can_clone_by_tag() then 107 if tag_or_branch and not git_can_clone_by_tag() then
80 local checkout_command = {fs.Q(git_cmd), "checkout", tag_or_branch} 108 if not fs.execute(fs.Q(git_cmd), "checkout", tag_or_branch) then
81 if not fs.execute(unpack(checkout_command)) then
82 return nil, 'Failed to check out the "' .. tag_or_branch ..'" tag or branch.' 109 return nil, 'Failed to check out the "' .. tag_or_branch ..'" tag or branch.'
83 end 110 end
84 end 111 end
85 112
113 -- Fetching git submodules is supported only when rockspec format is >= 3.0.
114 if deps.format_is_at_least(rockspec, "3.0") then
115 command = {fs.Q(git_cmd), "submodule", "update", "--init", "--recursive"}
116
117 if git_supports_shallow_submodules(git_cmd) then
118 -- Fetch only the last commit of each submodule.
119 table.insert(command, 5, "--depth=1")
120 end
121
122 if not fs.execute(unpack(command)) then
123 return nil, 'Failed to fetch submodules.'
124 end
125 end
126
86 fs.delete(dir.path(store_dir, module, ".git")) 127 fs.delete(dir.path(store_dir, module, ".git"))
87 fs.delete(dir.path(store_dir, module, ".gitignore")) 128 fs.delete(dir.path(store_dir, module, ".gitignore"))
88 fs.pop_dir() 129 fs.pop_dir()
diff --git a/src/luarocks/tools/tar.lua b/src/luarocks/tools/tar.lua
index b2bd930a..cedcceee 100644
--- a/src/luarocks/tools/tar.lua
+++ b/src/luarocks/tools/tar.lua
@@ -57,10 +57,11 @@ end
57local function read_header_block(block) 57local function read_header_block(block)
58 local header = {} 58 local header = {}
59 header.name = nullterm(block:sub(1,100)) 59 header.name = nullterm(block:sub(1,100))
60 header.mode = nullterm(block:sub(101,108)) 60 header.mode = nullterm(block:sub(101,108)):gsub(" ", "")
61 header.uid = octal_to_number(nullterm(block:sub(109,116))) 61 header.uid = octal_to_number(nullterm(block:sub(109,116)))
62 header.gid = octal_to_number(nullterm(block:sub(117,124))) 62 header.gid = octal_to_number(nullterm(block:sub(117,124)))
63 header.size = octal_to_number(nullterm(block:sub(125,136))) 63 header.size = octal_to_number(nullterm(block:sub(125,136)))
64print("{"..block:sub(125,136).."}", "{"..nullterm(block:sub(125,136)).."}", "{"..octal_to_number(nullterm(block:sub(125,136))).."}", header.size)
64 header.mtime = octal_to_number(nullterm(block:sub(137,148))) 65 header.mtime = octal_to_number(nullterm(block:sub(137,148)))
65 header.chksum = octal_to_number(nullterm(block:sub(149,156))) 66 header.chksum = octal_to_number(nullterm(block:sub(149,156)))
66 header.typeflag = get_typeflag(block:sub(157,157)) 67 header.typeflag = get_typeflag(block:sub(157,157))
@@ -94,13 +95,14 @@ function tar.untar(filename, destdir)
94 local long_name, long_link_name 95 local long_name, long_link_name
95 while true do 96 while true do
96 local block 97 local block
97 repeat 98 repeat
98 block = tar_handle:read(blocksize) 99 block = tar_handle:read(blocksize)
99 until (not block) or checksum_header(block) > 256 100 until (not block) or checksum_header(block) > 256
100 if not block then break end 101 if not block then break end
101 local header, err = read_header_block(block) 102 local header, err = read_header_block(block)
102 if not header then 103 if not header then
103 util.printerr(err) 104 util.printerr(err)
105 return nil, err
104 end 106 end
105 107
106 local file_data = tar_handle:read(math.ceil(header.size / blocksize) * blocksize):sub(1,header.size) 108 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 65b4fc15..83091a29 100644
--- a/src/luarocks/type_check.lua
+++ b/src/luarocks/type_check.lua
@@ -8,7 +8,7 @@ package.loaded["luarocks.type_check"] = type_check
8local cfg = require("luarocks.cfg") 8local cfg = require("luarocks.cfg")
9local deps = require("luarocks.deps") 9local deps = require("luarocks.deps")
10 10
11type_check.rockspec_format = "1.1" 11type_check.rockspec_format = "3.0"
12 12
13local string_1 = { _type = "string" } 13local string_1 = { _type = "string" }
14local number_1 = { _type = "number" } 14local number_1 = { _type = "number" }
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 @@
1package = "luajit-fail"
2version = "1.0-1"
3source = {
4 url = "https://raw.githubusercontent.com/keplerproject/luarocks/master/test/testing.lua",
5}
6description = {
7 summary = "Test luajit dependency fail",
8 detailed = [[
9Fail luajit dependency when running with rockspec_format < 3.0.
10]],
11 homepage = "http://luarocks.org/",
12 license = "MIT/X license"
13}
14dependencies = {
15 "luajit >= 2.0"
16}
17build = {
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 @@
1rockspec_format = "3.0"
2package = "luajit-success"
3version = "1.0-1"
4source = {
5 url = "https://raw.githubusercontent.com/keplerproject/luarocks/master/test/testing.lua",
6}
7description = {
8 summary = "Test luajit dependency fail",
9 detailed = [[
10Use luajit dependency when running with rockspec_format >= 3.0.
11]],
12 homepage = "http://luarocks.org/",
13 license = "MIT/X license"
14}
15dependencies = {
16 "luajit >= 2.0"
17}
18build = {
19 type = "builtin",
20 modules = {
21 testing = "testing.lua"
22 }
23}
diff --git a/test/testing.sh b/test/testing.sh
index 26bdde5f..abda18d4 100755
--- a/test/testing.sh
+++ b/test/testing.sh
@@ -30,7 +30,15 @@ then
30 shift 30 shift
31fi 31fi
32 32
33luashortversion=`echo $luaversion | cut -d. -f 1-2` 33is_jit=`[ "${luaversion::3}" = "jit" ] && echo 1 || echo 0`
34
35if [ "$is_jit" = 1 ]
36then
37 luashortversion=5.1
38 luajitversion=${luaversion:4}
39else
40 luashortversion=`echo $luaversion | cut -d. -f 1-2`
41fi
34 42
35testing_dir="$PWD" 43testing_dir="$PWD"
36 44
@@ -147,13 +155,27 @@ then
147 if [ ! -e "$luadir/bin/lua" ] 155 if [ ! -e "$luadir/bin/lua" ]
148 then 156 then
149 mkdir -p lua 157 mkdir -p lua
150 echo "Downloading lua $luaversion..." 158 cd lua
151 wget "http://www.lua.org/ftp/lua-$luaversion.tar.gz" &> /dev/null 159 if [ "$is_jit" = 1 ]
152 tar zxpf "lua-$luaversion.tar.gz" 160 then
153 cd "lua-$luaversion" 161 echo "Downloading LuaJIT $luajitversion..."
154 echo "Building lua $luaversion..." 162 #rm -f "LuaJIT-$luajitversion.tar.gz"
155 make linux INSTALL_TOP="$luadir" &> /dev/null 163 wget -c "http://luajit.org/download/LuaJIT-$luajitversion.tar.gz" &> /dev/null
156 make install INSTALL_TOP="$luadir" &> /dev/null 164 tar zxpf "LuaJIT-$luajitversion.tar.gz"
165 cd "LuaJIT-$luajitversion"
166 echo "Building LuaJIT $luajitversion..."
167 make PREFIX="$luadir" &> /dev/null
168 make install PREFIX="$luadir" &> /dev/null
169 else
170 echo "Downloading Lua $luaversion..."
171 #rm -f "lua-$luaversion.tar.gz"
172 wget -c "http://www.lua.org/ftp/lua-$luaversion.tar.gz" &> /dev/null
173 tar zxpf "lua-$luaversion.tar.gz"
174 cd "lua-$luaversion"
175 echo "Building Lua $luaversion..."
176 make linux INSTALL_TOP="$luadir" &> /dev/null
177 make install INSTALL_TOP="$luadir" &> /dev/null
178 fi
157 fi 179 fi
158 popd 180 popd
159 [ -e ~/.ssh/id_rsa.pub ] || ssh-keygen -t rsa -P "" -f ~/.ssh/id_rsa 181 [ -e ~/.ssh/id_rsa.pub ] || ssh-keygen -t rsa -P "" -f ~/.ssh/id_rsa
@@ -161,7 +183,13 @@ then
161 chmod og-wx ~/.ssh/authorized_keys 183 chmod og-wx ~/.ssh/authorized_keys
162 ssh-keyscan localhost >> ~/.ssh/known_hosts 184 ssh-keyscan localhost >> ~/.ssh/known_hosts
163else 185else
164 luadir="/Programs/Lua/Current" 186 if [ "$is_jit" = 1 ]
187 then
188 luadir="/Programs/LuaJIT/$luajitversion"
189echo HELLO $luadir
190 else
191 luadir="/Programs/Lua/$luaversion"
192 fi
165 if [ ! -e "$luadir" ] 193 if [ ! -e "$luadir" ]
166 then 194 then
167 luadir="/usr/local" 195 luadir="/usr/local"
@@ -175,7 +203,13 @@ else
175 platform="linux-x86_64" 203 platform="linux-x86_64"
176fi 204fi
177 205
178lua="$luadir/bin/lua" 206if [ "$is_jit" = 1 ]
207then
208 lua="$luadir/bin/luajit"
209 luarocks_configure_extra_args="--lua-suffix=jit --with-lua-include=$luadir/include/luajit-2.0"
210else
211 lua="$luadir/bin/lua"
212fi
179 213
180version_luasocket=3.0rc1 214version_luasocket=3.0rc1
181verrev_luasocket=${version_luasocket}-1 215verrev_luasocket=${version_luasocket}-1
@@ -196,7 +230,7 @@ verrev_abelhas=${version_abelhas}-1
196luasec=luasec 230luasec=luasec
197 231
198cd .. 232cd ..
199./configure --with-lua="$luadir" --prefix="$testing_lrprefix" 233./configure --with-lua="$luadir" --prefix="$testing_lrprefix" $luarocks_configure_extra_args
200make clean 234make clean
201make src/luarocks/site_config.lua 235make src/luarocks/site_config.lua
202make dev 236make dev
@@ -224,6 +258,7 @@ luarocks_noecho="run_lua --noecho luarocks"
224luarocks_noecho_nocov="run_lua --noecho --nocov luarocks" 258luarocks_noecho_nocov="run_lua --noecho --nocov luarocks"
225luarocks_admin="run_lua luarocks-admin" 259luarocks_admin="run_lua luarocks-admin"
226luarocks_admin_nocov="run_lua --nocov luarocks-admin" 260luarocks_admin_nocov="run_lua --nocov luarocks-admin"
261luajit_luarocks="luajit -e require('luacov.runner')('$testing_dir/luacov.config') $basedir/bin/luarocks"
227 262
228################################################### 263###################################################
229 264
@@ -242,7 +277,7 @@ mkdir -p "$testing_server"
242 get "$luarocks_repo/stdlib-41.0.0-1.src.rock" 277 get "$luarocks_repo/stdlib-41.0.0-1.src.rock"
243 get "$luarocks_repo/luarepl-0.4-1.src.rock" 278 get "$luarocks_repo/luarepl-0.4-1.src.rock"
244 get "$luarocks_repo/validate-args-1.5.4-1.rockspec" 279 get "$luarocks_repo/validate-args-1.5.4-1.rockspec"
245 get "$luarocks_repo/luasec-0.5-2.rockspec" 280 get "https://raw.githubusercontent.com/brunoos/luasec/master/luasec-0.6alpha-2.rockspec"
246 get "$luarocks_repo/luabitop-1.0.2-1.rockspec" 281 get "$luarocks_repo/luabitop-1.0.2-1.rockspec"
247 get "$luarocks_repo/lpty-1.0.1-1.src.rock" 282 get "$luarocks_repo/lpty-1.0.1-1.src.rock"
248 get "$luarocks_repo/cprint-${verrev_cprint}.src.rock" 283 get "$luarocks_repo/cprint-${verrev_cprint}.src.rock"
@@ -524,6 +559,19 @@ test_fetch_base_dir() { $lua <<EOF
524EOF 559EOF
525} 560}
526 561
562test_luajit_dependency() {
563 if [ "$is_jit" = 1 ]
564 then $luarocks build "$testing_dir/testfiles/luajit-success-1.0-1.rockspec"
565 else true
566 fi
567}
568fail_luajit_dependency() {
569 if [ "$is_jit" = 1 ]
570 then $luarocks build "$testing_dir/testfiles/luajit-fail-1.0-1.rockspec"
571 else false
572 fi
573}
574
527test_doc() { $luarocks install luarepl; $luarocks doc luarepl; } 575test_doc() { $luarocks install luarepl; $luarocks doc luarepl; }
528 576
529# Driver ######################################### 577# Driver #########################################