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