diff options
| author | Hisham <hisham@gobolinux.org> | 2016-07-28 16:37:20 -0300 |
|---|---|---|
| committer | Hisham <hisham@gobolinux.org> | 2016-07-28 16:37:20 -0300 |
| commit | 67a737310b31eed8d1c38eb0e34ff4b6fc411731 (patch) | |
| tree | e3c33f3101cce7afeeb479e993d8faca3a317dca | |
| parent | bbefca871ab5d872c457fe4bc0a2a5279a8179c4 (diff) | |
| download | luarocks-67a737310b31eed8d1c38eb0e34ff4b6fc411731.tar.gz luarocks-67a737310b31eed8d1c38eb0e34ff4b6fc411731.tar.bz2 luarocks-67a737310b31eed8d1c38eb0e34ff4b6fc411731.zip | |
Closes #595. Fixes placement of rockspec when unpacking a git:// rock.
| -rw-r--r-- | spec/unpack_spec.lua | 13 | ||||
| -rw-r--r-- | src/luarocks/unpack.lua | 1 |
2 files changed, 11 insertions, 3 deletions
diff --git a/spec/unpack_spec.lua b/spec/unpack_spec.lua index 76e9e5a8..495c514e 100644 --- a/spec/unpack_spec.lua +++ b/spec/unpack_spec.lua | |||
| @@ -1,12 +1,14 @@ | |||
| 1 | local test_env = require("test/test_environment") | 1 | local test_env = require("test/test_environment") |
| 2 | local run = test_env.run | 2 | local run = test_env.run |
| 3 | local testing_paths = test_env.testing_paths | 3 | local testing_paths = test_env.testing_paths |
| 4 | local lfs = require("lfs") | ||
| 4 | 5 | ||
| 5 | test_env.unload_luarocks() | 6 | test_env.unload_luarocks() |
| 6 | 7 | ||
| 7 | local extra_rocks = { | 8 | local extra_rocks = { |
| 8 | "/cprint-0.1-2.src.rock", | 9 | "/cprint-0.1-2.src.rock", |
| 9 | "/cprint-0.1-2.rockspec" | 10 | "/cprint-0.1-2.rockspec", |
| 11 | "/luazip-1.2.4-1.rockspec" | ||
| 10 | } | 12 | } |
| 11 | 13 | ||
| 12 | describe("LuaRocks unpack tests #blackbox #b_unpack", function() | 14 | describe("LuaRocks unpack tests #blackbox #b_unpack", function() |
| @@ -38,13 +40,20 @@ describe("LuaRocks unpack tests #blackbox #b_unpack", function() | |||
| 38 | os.remove("cprint-0.1-2.src.rock") | 40 | os.remove("cprint-0.1-2.src.rock") |
| 39 | test_env.remove_dir("cprint-0.1-2") | 41 | test_env.remove_dir("cprint-0.1-2") |
| 40 | end) | 42 | end) |
| 41 | it("LuaRocks unpack src", function() | 43 | it("LuaRocks unpack rockspec", function() |
| 42 | assert.is_true(run.luarocks_bool("download --rockspec cprint")) | 44 | assert.is_true(run.luarocks_bool("download --rockspec cprint")) |
| 43 | assert.is_true(run.luarocks_bool("unpack cprint-0.1-2.rockspec")) | 45 | assert.is_true(run.luarocks_bool("unpack cprint-0.1-2.rockspec")) |
| 44 | os.remove("cprint-0.1-2.rockspec") | 46 | os.remove("cprint-0.1-2.rockspec") |
| 45 | os.remove("lua-cprint") | 47 | os.remove("lua-cprint") |
| 46 | test_env.remove_dir("cprint-0.1-2") | 48 | test_env.remove_dir("cprint-0.1-2") |
| 47 | end) | 49 | end) |
| 50 | -- #595 luarocks unpack of a git:// rockspec fails to copy the rockspec | ||
| 51 | it("LuaRocks unpack git:// rockspec", function() | ||
| 52 | assert.is_true(run.luarocks_bool("download --rockspec cprint")) | ||
| 53 | assert.is_true(run.luarocks_bool("unpack luazip-1.2.4-1.rockspec")) | ||
| 54 | assert.is_truthy(lfs.attributes("luazip-1.2.4-1/luazip/luazip-1.2.4-1.rockspec")) | ||
| 55 | test_env.remove_dir("luazip-1.2.4-1") | ||
| 56 | end) | ||
| 48 | it("LuaRocks unpack binary", function() | 57 | it("LuaRocks unpack binary", function() |
| 49 | assert.is_true(run.luarocks_bool("build cprint")) | 58 | assert.is_true(run.luarocks_bool("build cprint")) |
| 50 | assert.is_true(run.luarocks_bool("pack cprint")) | 59 | assert.is_true(run.luarocks_bool("pack cprint")) |
diff --git a/src/luarocks/unpack.lua b/src/luarocks/unpack.lua index 2face005..c3dc9a4c 100644 --- a/src/luarocks/unpack.lua +++ b/src/luarocks/unpack.lua | |||
| @@ -46,7 +46,6 @@ local function unpack_rockspec(rockspec_file, dir_name) | |||
| 46 | if not ok then return nil, err end | 46 | if not ok then return nil, err end |
| 47 | ok, err = build.apply_patches(rockspec) | 47 | ok, err = build.apply_patches(rockspec) |
| 48 | fs.pop_dir() | 48 | fs.pop_dir() |
| 49 | fs.pop_dir() | ||
| 50 | if not ok then return nil, err end | 49 | if not ok then return nil, err end |
| 51 | return rockspec | 50 | return rockspec |
| 52 | end | 51 | end |
