From 1a7f921e4cf1d4023340a8ba4dde17cb3e6bd311 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Fri, 7 Feb 2020 10:42:50 +0100 Subject: fix downgrades of rocks containing directories (#1151) Fixes #1141 --- spec/build_spec.lua | 8 ++++++++ spec/test_spec.lua | 18 ++++++------------ 2 files changed, 14 insertions(+), 12 deletions(-) (limited to 'spec') diff --git a/spec/build_spec.lua b/spec/build_spec.lua index 14837d89..e498509f 100644 --- a/spec/build_spec.lua +++ b/spec/build_spec.lua @@ -25,6 +25,8 @@ local extra_rocks = { "/stdlib-41.0.0-1.src.rock", "/validate-args-1.5.4-1.rockspec", "spec/fixtures/a_rock-1.0-1.src.rock", + "/busted-2.0.0-1.rockspec", + "/busted-2.0.rc13-0.rockspec", } local c_module_source = [[ @@ -290,6 +292,12 @@ describe("LuaRocks build #integration", function() end) end + it("downgrades directories correctly", function() + assert(run.luarocks_bool("build --nodeps busted 2.0.0" )) + assert(run.luarocks_bool("build --nodeps busted 2.0.rc13" )) + assert(run.luarocks_bool("build --nodeps busted 2.0.0" )) + end) + it("only deps", function() local rockspec = testing_paths.fixtures_dir .. "/build_only_deps-0.1-1.rockspec" diff --git a/spec/test_spec.lua b/spec/test_spec.lua index ca1d5917..ddb64b0e 100644 --- a/spec/test_spec.lua +++ b/spec/test_spec.lua @@ -8,13 +8,13 @@ local write_file = test_env.write_file test_env.unload_luarocks() local extra_rocks = { - "/busted-2.0.rc12-1.rockspec", + "/busted-2.0.0-1.rockspec", "/lua_cliargs-3.0-1.src.rock", "/luafilesystem-1.7.0-2.src.rock", "/luasystem-0.2.1-0.src.rock", "/dkjson-2.5-2.src.rock", "/say-1.3-1.rockspec", - "/luassert-1.7.10-0.rockspec", + "/luassert-1.8.0-0.rockspec", "/lua-term-0.7-1.rockspec", "/penlight-1.5.4-1.rockspec", "/mediator_lua-1.1.2-0.rockspec", @@ -40,16 +40,10 @@ describe("luarocks test #integration", function() lazy_setup(function() -- Try to cache rocks from the host system to speed up test - os.execute("luarocks pack busted") - os.execute("luarocks pack lua_cliargs") - os.execute("luarocks pack luafilesystem") - os.execute("luarocks pack dkjson") - os.execute("luarocks pack luasystem") - os.execute("luarocks pack say") - os.execute("luarocks pack luassert") - os.execute("luarocks pack lua-term") - os.execute("luarocks pack penlight") - os.execute("luarocks pack mediator_lua") + for _, r in ipairs(extra_rocks) do + local n, v = r:match("^/(.*)%-([^%-]+)%-%d+%.[^%-]+$") + os.execute("luarocks pack " .. n .. " " .. v) + end if test_env.TEST_TARGET_OS == "windows" then os.execute("move *.rock " .. testing_paths.testing_server) else -- cgit v1.2.3-55-g6feb