From 908e4ba7f0d09fafb35272e021605404261f4432 Mon Sep 17 00:00:00 2001 From: mpeterv Date: Sat, 19 Dec 2015 19:22:37 +0300 Subject: Fix extension splitting in builting backend Fixes incorrect gcc command and error message when a file name doesn't contain a dot: Error: Build error: Failed compiling object .o becomes Error: Build error: Failed compiling object dotlessname --- src/luarocks/build/builtin.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/luarocks/build/builtin.lua b/src/luarocks/build/builtin.lua index 00fd09ea..ffdc9450 100644 --- a/src/luarocks/build/builtin.lua +++ b/src/luarocks/build/builtin.lua @@ -202,7 +202,7 @@ function builtin.run(rockspec) for name, info in pairs(build.modules) do local moddir = path.module_to_path(name) if type(info) == "string" then - local ext = info:match(".([^.]+)$") + local ext = info:match("%.([^.]+)$") if ext == "lua" then local filename = dir.base_name(info) if info:match("init%.lua$") and not name:match("%.init$") then @@ -226,7 +226,7 @@ function builtin.run(rockspec) if info[1] then sources = info end if type(sources) == "string" then sources = {sources} end for _, source in ipairs(sources) do - local object = source:gsub(".[^.]*$", "."..cfg.obj_extension) + local object = source:gsub("%.[^.]*$", "."..cfg.obj_extension) if not object then object = source.."."..cfg.obj_extension end -- cgit v1.2.3-55-g6feb From d62622aa2502cf9d100723ad9232fd72b7e75b9b Mon Sep 17 00:00:00 2001 From: mpeterv Date: Sat, 19 Dec 2015 19:30:29 +0300 Subject: Improve error handling in builtin backend Show error message from fs.copy when failed to install a file. Nice for Lua module files, since their existence is not checked beforehand. Also remove extra 'local ok, err' declarations. --- src/luarocks/build/builtin.lua | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/luarocks/build/builtin.lua b/src/luarocks/build/builtin.lua index ffdc9450..afd05954 100644 --- a/src/luarocks/build/builtin.lua +++ b/src/luarocks/build/builtin.lua @@ -174,7 +174,7 @@ function builtin.run(rockspec) --TODO EXEWRAPPER end - local ok = true + local ok, err local built_modules = {} local luadir = path.lua_dir(rockspec.name, rockspec.version) local libdir = path.lib_dir(rockspec.name, rockspec.version) @@ -236,11 +236,10 @@ function builtin.run(rockspec) end table.insert(objects, object) end - if not ok then break end local module_name = name:match("([^.]*)$").."."..util.matchquote(cfg.lib_extension) if moddir ~= "" then module_name = dir.path(moddir, module_name) - local ok, err = fs.make_dir(moddir) + ok, err = fs.make_dir(moddir) if not ok then return nil, err end end built_modules[module_name] = dir.path(libdir, module_name) @@ -252,13 +251,13 @@ function builtin.run(rockspec) end for name, dest in pairs(built_modules) do fs.make_dir(dir.dir_name(dest)) - ok = fs.copy(name, dest) + ok, err = fs.copy(name, dest) if not ok then - return nil, "Failed installing "..name.." in "..dest + return nil, "Failed installing "..name.." in "..dest..": "..err end end if fs.is_dir("lua") then - local ok, err = fs.copy_contents("lua", luadir) + ok, err = fs.copy_contents("lua", luadir) if not ok then return nil, "Failed copying contents of 'lua' directory: "..err end -- cgit v1.2.3-55-g6feb From cf02cd21e225f9c9c0eba8f3cf53567209bebe47 Mon Sep 17 00:00:00 2001 From: mpeterv Date: Mon, 4 Jan 2016 15:32:37 +0300 Subject: Upgrade to LuaCov 0.9.1, make coverage viewable --- test/testing.sh | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/test/testing.sh b/test/testing.sh index 70bd68b2..dc7912bf 100755 --- a/test/testing.sh +++ b/test/testing.sh @@ -119,20 +119,15 @@ upload_servers = { EOF cat < $testing_dir/luacov.config return { - ["configfile"] = ".luacov", - ["statsfile"] = "$testing_dir/luacov.stats.out", - ["reportfile"] = "$testing_dir/luacov.report.out", - runreport = false, - deletestats = false, - ["include"] = {}, - ["exclude"] = { - "luacov$", - "luacov%.reporter$", - "luacov%.defaults$", - "luacov%.runner$", - "luacov%.stats$", - "luacov%.tick$", - }, + statsfile = "$testing_dir/luacov.stats.out", + reportfile = "$testing_dir/luacov.report.out", + modules = { + ["luarocks"] = "src/bin/luarocks", + ["luarocks-admin"] = "src/bin/luarocks-admin", + ["luarocks.*"] = "src", + ["luarocks.*.*"] = "src", + ["luarocks.*.*.*"] = "src" + } } EOF @@ -184,7 +179,7 @@ srcdir_luasocket=luasocket-3.0-rc1 version_cprint=0.1 verrev_cprint=0.1-2 -version_luacov=0.8 +version_luacov=0.9.1 verrev_luacov=${version_luacov}-1 version_lxsh=0.8.6 version_validate_args=1.5.4 @@ -591,16 +586,18 @@ run_all_tests() { run_all_tests $1 #run_with_minimal_environment $1 +cd "$testing_dir/.." + if [ "$travis" ] then if [ "$TRAVIS" ] then build_environment luacov luafilesystem luacov-coveralls - ( cd $testing_dir; $testing_sys_tree/bin/luacov-coveralls || echo "ok" ) + $testing_sys_tree/bin/luacov-coveralls -c "$testing_dir/luacov.config" || echo "ok" fi - $testing_sys_tree/bin/luacov -c $testing_dir/luacov.config src/luarocks src/bin - grep "Summary" -B1 -A1000 $testing_dir/luacov.report.out + $testing_sys_tree/bin/luacov -c "$testing_dir/luacov.config" + grep "Summary" -B1 -A1000 "$testing_dir/luacov.report.out" else - $testing_sys_tree/bin/luacov -c $testing_dir/luacov.config src/luarocks src/bin + $testing_sys_tree/bin/luacov -c "$testing_dir/luacov.config" cat "$testing_dir/luacov.report.out" fi -- cgit v1.2.3-55-g6feb From 3766d49926771f754bcd255c9e82102cbbe6ce01 Mon Sep 17 00:00:00 2001 From: mpeterv Date: Tue, 5 Jan 2016 13:05:58 +0300 Subject: luarocks make: ignore 'rockspec' directory when no argument given Without an argument luarocks make looks if there is only one rockspec in the current directory. Consider only files as potential rockspec to avoid strange error when current directory contains a directory ending with 'rockspec'. --- src/luarocks/make.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/luarocks/make.lua b/src/luarocks/make.lua index 1dfe6473..4f70bafe 100644 --- a/src/luarocks/make.lua +++ b/src/luarocks/make.lua @@ -54,7 +54,7 @@ function make.run(...) if not rockspec then for file in fs.dir() do - if file:match("rockspec$") then + if file:match("rockspec$") and fs.is_file(file) then if rockspec then return nil, "Please specify which rockspec file to use." else -- cgit v1.2.3-55-g6feb From 8254cd3e69321963673e4909de4ec585adf6a706 Mon Sep 17 00:00:00 2001 From: mpeterv Date: Tue, 5 Jan 2016 13:12:34 +0300 Subject: Remove two unnecessary require calls --- src/luarocks/command_line.lua | 1 - src/luarocks/fetch.lua | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/luarocks/command_line.lua b/src/luarocks/command_line.lua index e1c9f492..a016fc72 100644 --- a/src/luarocks/command_line.lua +++ b/src/luarocks/command_line.lua @@ -144,7 +144,6 @@ function command_line.run_command(...) end end if not named then - local fs = require("luarocks.fs") local root_dir = fs.absolute_name(flags["tree"]) replace_tree(flags, args, root_dir) end diff --git a/src/luarocks/fetch.lua b/src/luarocks/fetch.lua index e92aeddf..2c028771 100644 --- a/src/luarocks/fetch.lua +++ b/src/luarocks/fetch.lua @@ -371,7 +371,7 @@ function fetch.fetch_sources(rockspec, extract, dest_dir) local protocol = rockspec.source.protocol local ok, proto if fetch.is_basic_protocol(protocol) then - proto = require("luarocks.fetch") + proto = fetch else ok, proto = pcall(require, "luarocks.fetch."..protocol:gsub("[+-]", "_")) if not ok then -- cgit v1.2.3-55-g6feb From f73a7d9bca18884c7f882e90b5be650ab625a485 Mon Sep 17 00:00:00 2001 From: mpeterv Date: Tue, 5 Jan 2016 13:16:16 +0300 Subject: Report unknown commands consistently Now both 'luarocks foo' and 'luarocks help foo' print 'Unknown command: foo'. --- src/luarocks/help.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/luarocks/help.lua b/src/luarocks/help.lua index 92458b2b..5a2681a3 100644 --- a/src/luarocks/help.lua +++ b/src/luarocks/help.lua @@ -111,7 +111,7 @@ function help.run(...) print_section("SEE ALSO") util.printout("","'"..program.." help' for general options and configuration.\n") else - return nil, "Unknown command '"..command.."'" + return nil, "Unknown command: "..command end end return true -- cgit v1.2.3-55-g6feb From d725a42e2efd2df34dc21cc1a8bb087241064268 Mon Sep 17 00:00:00 2001 From: mpeterv Date: Mon, 11 Jan 2016 19:21:46 +0300 Subject: Do not handle cfg.local_cache == nil in luarocks.cache cfg.local_cache is always set by defaults. Fixes #479. --- src/luarocks/cache.lua | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/luarocks/cache.lua b/src/luarocks/cache.lua index dbea8405..fb6344d8 100644 --- a/src/luarocks/cache.lua +++ b/src/luarocks/cache.lua @@ -45,25 +45,12 @@ function cache.split_server_url(server, url, user, password) user = credentials end end - local local_cache - if cfg.local_cache then - local_cache = cfg.local_cache .. "/" .. server - end + local local_cache = cfg.local_cache .. "/" .. server return local_cache, protocol, server_path, user, password end function cache.refresh_local_cache(server, url, user, password) local local_cache, protocol, server_path, user, password = cache.split_server_url(server, url, user, password) - - local ok, err = fs.make_dir(cfg.local_cache) - if not ok then return nil, err end - - local tmp_cache = false - if not local_cache then - local err - local_cache, err = fs.make_temp_dir("local_cache") - tmp_cache = true - end local ok, err = fs.make_dir(local_cache) if not ok then return nil, "Failed creating local cache dir: "..err -- cgit v1.2.3-55-g6feb From 6f52c02e33e37078d595eb03b29332e6aaf0dce9 Mon Sep 17 00:00:00 2001 From: Jonathan Goble Date: Fri, 22 Jan 2016 03:17:34 -0500 Subject: Update repo URLs to luarocks.org instead of rocks.moonscript.org Previously, this used an old URL and downloaded over HTTP, in cleartext. This commit updates to the URL that the old one redirects to, and changes to HTTPS encryption for security. HTTPS is currently impossible on rocks.moonscript.org because the security certificate for that domain expired in May 2015. --- test/testing.bat | 2 +- test/testing.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/testing.bat b/test/testing.bat index 319e12c3..7083678b 100644 --- a/test/testing.bat +++ b/test/testing.bat @@ -1,7 +1,7 @@ @echo off Setlocal EnableDelayedExpansion EnableExtensions -if not defined LUAROCKS_REPO set LUAROCKS_REPO=http://rocks.moonscript.org +if not defined LUAROCKS_REPO set LUAROCKS_REPO=https://luarocks.org appveyor DownloadFile %LUAROCKS_REPO%/stdlib-41.0.0-1.src.rock luarocks build stdlib diff --git a/test/testing.sh b/test/testing.sh index dc7912bf..44e78205 100755 --- a/test/testing.sh +++ b/test/testing.sh @@ -225,7 +225,7 @@ luarocks_admin_nocov="run_lua --nocov luarocks-admin" mkdir -p "$testing_server" ( cd "$testing_server" - luarocks_repo="http://rocks.moonscript.org" + luarocks_repo="https://luarocks.org" get() { [ -e `basename "$1"` ] || wget -c "$1"; } get "$luarocks_repo/luacov-${verrev_luacov}.src.rock" get "$luarocks_repo/luacov-${verrev_luacov}.rockspec" -- cgit v1.2.3-55-g6feb