From 5f069526966ae37319ba745644a43e0cf64ad62c Mon Sep 17 00:00:00 2001 From: Peter Melnichenko Date: Tue, 5 Jul 2016 15:24:01 +0300 Subject: Fix field name building in type_check.lua Use 'parent[field]' notation for non-string fields. --- src/luarocks/type_check.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/luarocks/type_check.lua b/src/luarocks/type_check.lua index 82763401..63c59ca2 100644 --- a/src/luarocks/type_check.lua +++ b/src/luarocks/type_check.lua @@ -234,9 +234,12 @@ end local function mkfield(context, field) if context == "" then - return field + return tostring(field) + elseif type(field) == "string" then + return context.."."..field + else + return context.."["..tostring(field).."]" end - return context.."."..field end --- Type check the contents of a table. -- cgit v1.2.3-55-g6feb From b5b285a678fe78b80d452cc9eb7565b8bf087b81 Mon Sep 17 00:00:00 2001 From: Peter Melnichenko Date: Tue, 5 Jul 2016 15:46:43 +0300 Subject: Fix implicit number-to-string coversion in luarocks.help --- src/luarocks/help.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/luarocks/help.lua b/src/luarocks/help.lua index 28f97702..871e97e9 100644 --- a/src/luarocks/help.lua +++ b/src/luarocks/help.lua @@ -65,7 +65,7 @@ function help.command(flags, command) --verbose Display verbose output of commands executed. --timeout= Timeout on network operations, in seconds. 0 means no timeout (wait forever). - Default is ]]..cfg.connection_timeout..[[.]]) + Default is ]]..tostring(cfg.connection_timeout)..[[.]]) print_section("VARIABLES") util.printout([[ Variables from the "variables" table of the configuration file -- cgit v1.2.3-55-g6feb From 41eccd4ca6fe51f8174dd43744e7a4bab4daf2cb Mon Sep 17 00:00:00 2001 From: Hisham Date: Mon, 11 Jul 2016 01:15:10 -0300 Subject: Fix crash when given a remote rockspec. --- src/luarocks/new_version.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/luarocks/new_version.lua b/src/luarocks/new_version.lua index bd73e308..8fc00a86 100644 --- a/src/luarocks/new_version.lua +++ b/src/luarocks/new_version.lua @@ -134,15 +134,19 @@ function new_version.command(flags, input, version, url) end assert(type(input) == "string") - local filename = input - if not input:match("rockspec$") then - local err + local filename, err + if input:match("rockspec$") then + filename, err = fetch.fetch_url(input) + if not filename then + return nil, err + end + else filename, err = download.download("rockspec", input) if not filename then return nil, err end end - + local valid_rs, err = fetch.load_rockspec(filename) if not valid_rs then return nil, err @@ -168,7 +172,7 @@ function new_version.command(flags, input, version, url) end local new_rockver = new_ver:gsub("-", "") - local out_rs = persist.load_into_table(filename) + local out_rs, err = persist.load_into_table(filename) local out_name = out_rs.package:lower() out_rs.version = new_rockver.."-"..new_rev -- cgit v1.2.3-55-g6feb From 2a3eb136ec3542a70dab3cca1d432d8228cb29b1 Mon Sep 17 00:00:00 2001 From: Xpol Wan Date: Mon, 11 Jul 2016 12:47:46 +0800 Subject: Make package.path and package.cpath unique in win32 bin scripts. --- src/luarocks/cfg.lua | 2 +- src/luarocks/fs/win32.lua | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua index 9b1c5902..d58c7407 100644 --- a/src/luarocks/cfg.lua +++ b/src/luarocks/cfg.lua @@ -403,7 +403,7 @@ local defaults = { if cfg.platforms.windows then local full_prefix = (site_config.LUAROCKS_PREFIX or (os.getenv("PROGRAMFILES")..[[\LuaRocks]])) - extra_luarocks_module_dir = full_prefix.."\\lua\\?.lua" + extra_luarocks_module_dir = full_prefix.."/lua/?.lua" home_config_file = home_config_file and home_config_file:gsub("\\","/") defaults.fs_use_modules = false diff --git a/src/luarocks/fs/win32.lua b/src/luarocks/fs/win32.lua index 8debaeef..c99cc895 100644 --- a/src/luarocks/fs/win32.lua +++ b/src/luarocks/fs/win32.lua @@ -130,6 +130,8 @@ function win32.wrap_script(file, dest, name, version) local wrapname = fs.is_dir(dest) and dest.."/"..base or dest wrapname = wrapname..".bat" local lpath, lcpath = cfg.package_paths() + lpath = util.remove_path_dupes(lpath, ";") + lcpath = util.remove_path_dupes(lcpath, ";") local wrapper = io.open(wrapname, "w") if not wrapper then return nil, "Could not open "..wrapname.." for writing." -- cgit v1.2.3-55-g6feb From 0f63a95e991435c769584abd01b16bd748a1434b Mon Sep 17 00:00:00 2001 From: Hisham Date: Thu, 14 Jul 2016 14:27:46 -0300 Subject: Check for invalid server response. --- src/luarocks/upload.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/luarocks/upload.lua b/src/luarocks/upload.lua index 3adc1704..7c0c416c 100644 --- a/src/luarocks/upload.lua +++ b/src/luarocks/upload.lua @@ -76,6 +76,9 @@ function upload.command(flags, fname) local module_url = res.module_url if rock_fname then + if (not res.version) or (not res.version.id) then + return nil, "Invalid response from server." + end util.printout(("Sending " .. tostring(rock_fname) .. " ...")) res, err = api:method("upload_rock/" .. ("%d"):format(res.version.id), nil, { rock_file = multipart.new_file(rock_fname) -- cgit v1.2.3-55-g6feb From 67a737310b31eed8d1c38eb0e34ff4b6fc411731 Mon Sep 17 00:00:00 2001 From: Hisham Date: Thu, 28 Jul 2016 16:37:20 -0300 Subject: Closes #595. Fixes placement of rockspec when unpacking a git:// rock. --- spec/unpack_spec.lua | 13 +++++++++++-- src/luarocks/unpack.lua | 1 - 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'src') 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 @@ local test_env = require("test/test_environment") local run = test_env.run local testing_paths = test_env.testing_paths +local lfs = require("lfs") test_env.unload_luarocks() local extra_rocks = { "/cprint-0.1-2.src.rock", - "/cprint-0.1-2.rockspec" + "/cprint-0.1-2.rockspec", + "/luazip-1.2.4-1.rockspec" } describe("LuaRocks unpack tests #blackbox #b_unpack", function() @@ -38,13 +40,20 @@ describe("LuaRocks unpack tests #blackbox #b_unpack", function() os.remove("cprint-0.1-2.src.rock") test_env.remove_dir("cprint-0.1-2") end) - it("LuaRocks unpack src", function() + it("LuaRocks unpack rockspec", function() assert.is_true(run.luarocks_bool("download --rockspec cprint")) assert.is_true(run.luarocks_bool("unpack cprint-0.1-2.rockspec")) os.remove("cprint-0.1-2.rockspec") os.remove("lua-cprint") test_env.remove_dir("cprint-0.1-2") end) + -- #595 luarocks unpack of a git:// rockspec fails to copy the rockspec + it("LuaRocks unpack git:// rockspec", function() + assert.is_true(run.luarocks_bool("download --rockspec cprint")) + assert.is_true(run.luarocks_bool("unpack luazip-1.2.4-1.rockspec")) + assert.is_truthy(lfs.attributes("luazip-1.2.4-1/luazip/luazip-1.2.4-1.rockspec")) + test_env.remove_dir("luazip-1.2.4-1") + end) it("LuaRocks unpack binary", function() assert.is_true(run.luarocks_bool("build cprint")) 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) if not ok then return nil, err end ok, err = build.apply_patches(rockspec) fs.pop_dir() - fs.pop_dir() if not ok then return nil, err end return rockspec end -- cgit v1.2.3-55-g6feb