From 478fc5517c686c080797f840cc000cc9828ffcb4 Mon Sep 17 00:00:00 2001 From: Peter Melnichenko Date: Thu, 20 Oct 2016 23:22:44 +0300 Subject: Remove some unused locals and imports --- src/luarocks/build.lua | 2 +- src/luarocks/command_line.lua | 1 - src/luarocks/deps.lua | 1 - src/luarocks/manif.lua | 3 +-- src/luarocks/path_cmd.lua | 3 --- src/luarocks/remove.lua | 1 - 6 files changed, 2 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/luarocks/build.lua b/src/luarocks/build.lua index f52fb7a8..20d094b1 100644 --- a/src/luarocks/build.lua +++ b/src/luarocks/build.lua @@ -203,7 +203,7 @@ function build.build_rockspec(rockspec_file, need_to_fetch, minimal_mode, deps_m end if not minimal_mode then - local _, source_dir + local source_dir if need_to_fetch then ok, source_dir, errcode = fetch.fetch_sources(rockspec, true) if not ok then diff --git a/src/luarocks/command_line.lua b/src/luarocks/command_line.lua index 858e871f..ecf3a61b 100644 --- a/src/luarocks/command_line.lua +++ b/src/luarocks/command_line.lua @@ -2,7 +2,6 @@ --- Functions for command-line scripts. local command_line = {} -local pack = function(...) return {...}, select("#", ...) end local unpack = unpack or table.unpack local util = require("luarocks.util") diff --git a/src/luarocks/deps.lua b/src/luarocks/deps.lua index f8deff3c..756ba6bd 100644 --- a/src/luarocks/deps.lua +++ b/src/luarocks/deps.lua @@ -691,7 +691,6 @@ function deps.scan_deps(results, missing, manifest, name, version, deps_mode) local fetch = require("luarocks.fetch") - local err if results[name] then return results, missing end diff --git a/src/luarocks/manif.lua b/src/luarocks/manif.lua index 1b75452b..2d983a85 100644 --- a/src/luarocks/manif.lua +++ b/src/luarocks/manif.lua @@ -55,7 +55,6 @@ end function manif.make_rock_manifest(name, version) local install_dir = path.install_dir(name, version) - local rock_manifest = path.rock_manifest_file(name, version) local tree = {} for _, file in ipairs(fs.find(install_dir)) do local full_path = dir.path(install_dir, file) @@ -80,7 +79,7 @@ function manif.make_rock_manifest(name, version) last[last_name] = sum end end - rock_manifest = { rock_manifest=tree } + local rock_manifest = { rock_manifest=tree } manif.rock_manifest_cache[name.."/"..version] = rock_manifest save_table(install_dir, "rock_manifest", rock_manifest ) end diff --git a/src/luarocks/path_cmd.lua b/src/luarocks/path_cmd.lua index 15fb9ca2..eba85d46 100644 --- a/src/luarocks/path_cmd.lua +++ b/src/luarocks/path_cmd.lua @@ -4,7 +4,6 @@ local path_cmd = {} local util = require("luarocks.util") -local deps = require("luarocks.deps") local cfg = require("luarocks.cfg") util.add_run_function(path_cmd) @@ -35,8 +34,6 @@ And on Windows: --- Driver function for "path" command. -- @return boolean This function always succeeds. function path_cmd.command(flags) - local deps_mode = deps.get_deps_mode(flags) - local lr_path, lr_cpath, lr_bin = cfg.package_paths(flags["tree"]) local path_sep = cfg.export_path_separator diff --git a/src/luarocks/remove.lua b/src/luarocks/remove.lua index 82c9818b..54756388 100644 --- a/src/luarocks/remove.lua +++ b/src/luarocks/remove.lua @@ -11,7 +11,6 @@ local repos = require("luarocks.repos") local path = require("luarocks.path") local util = require("luarocks.util") local cfg = require("luarocks.cfg") -local manif = require("luarocks.manif") local fs = require("luarocks.fs") util.add_run_function(remove) -- cgit v1.2.3-55-g6feb From a9c34fc0c92a5931eb73d867d18fbad410683ea0 Mon Sep 17 00:00:00 2001 From: Peter Melnichenko Date: Wed, 26 Oct 2016 16:22:10 +0300 Subject: Treat rock name arguments in case insensitive way Internally package names are lowercased, however, rockspec may contain a name with uppercase letters, which will be displayed by `luarocks show`. Some commands, like `luarocks search`, `luarocks install` and `luarocks build`, support this and convert input name to lowercase before passing it to interanl functions. Do the same thing in other commands accepting rock names. --- src/luarocks/doc.lua | 2 ++ src/luarocks/download.lua | 2 +- src/luarocks/lint.lua | 2 +- src/luarocks/new_version.lua | 2 +- src/luarocks/pack.lua | 2 +- src/luarocks/remove.lua | 1 + src/luarocks/show.lua | 2 +- src/luarocks/unpack.lua | 2 +- 8 files changed, 9 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/luarocks/doc.lua b/src/luarocks/doc.lua index 15460b31..423ebe02 100644 --- a/src/luarocks/doc.lua +++ b/src/luarocks/doc.lua @@ -63,6 +63,8 @@ function doc.command(flags, name, version) return nil, "Argument missing. "..util.see_help("doc") end + name = name:lower() + local iname, iversion, repo = search.pick_installed_rock(name, version, flags["tree"]) if not iname then util.printout(name..(version and " "..version or "").." is not installed. Looking for it in the rocks servers...") diff --git a/src/luarocks/download.lua b/src/luarocks/download.lua index 18573ae4..e434cdbb 100644 --- a/src/luarocks/download.lua +++ b/src/luarocks/download.lua @@ -102,7 +102,7 @@ function download.command(flags, name, version) arch = flags["arch"] end - local dl, err = download.download(arch, name, version, flags["all"]) + local dl, err = download.download(arch, name:lower(), version, flags["all"]) return dl and true, err end diff --git a/src/luarocks/lint.lua b/src/luarocks/lint.lua index d5cc48d0..0fd81a20 100644 --- a/src/luarocks/lint.lua +++ b/src/luarocks/lint.lua @@ -26,7 +26,7 @@ function lint.command(flags, input) local filename = input if not input:match(".rockspec$") then local err - filename, err = download.download("rockspec", input) + filename, err = download.download("rockspec", input:lower()) if not filename then return nil, err end diff --git a/src/luarocks/new_version.lua b/src/luarocks/new_version.lua index 8fc00a86..91f7607c 100644 --- a/src/luarocks/new_version.lua +++ b/src/luarocks/new_version.lua @@ -141,7 +141,7 @@ function new_version.command(flags, input, version, url) return nil, err end else - filename, err = download.download("rockspec", input) + filename, err = download.download("rockspec", input:lower()) if not filename then return nil, err end diff --git a/src/luarocks/pack.lua b/src/luarocks/pack.lua index 932ff0d5..35bbe838 100644 --- a/src/luarocks/pack.lua +++ b/src/luarocks/pack.lua @@ -184,7 +184,7 @@ function pack.command(flags, arg, version) if arg:match(".*%.rockspec") then file, err = pack.pack_source_rock(arg) else - file, err = do_pack_binary_rock(arg, version, flags["tree"]) + file, err = do_pack_binary_rock(arg:lower(), version, flags["tree"]) end if err then return nil, err diff --git a/src/luarocks/remove.lua b/src/luarocks/remove.lua index 54756388..601eedcf 100644 --- a/src/luarocks/remove.lua +++ b/src/luarocks/remove.lua @@ -155,6 +155,7 @@ function remove.command(flags, name, version) end local results = {} + name = name:lower() search.manifest_search(results, cfg.rocks_dir, search.make_query(name, version)) if not results[name] then return nil, "Could not find rock '"..name..(version and " "..version or "").."' in "..path.rocks_tree_to_string(cfg.root_dir) diff --git a/src/luarocks/show.lua b/src/luarocks/show.lua index 88f9512d..85c7edcb 100644 --- a/src/luarocks/show.lua +++ b/src/luarocks/show.lua @@ -78,7 +78,7 @@ function show.command(flags, name, version) end local repo, repo_url - name, version, repo, repo_url = search.pick_installed_rock(name, version, flags["tree"]) + name, version, repo, repo_url = search.pick_installed_rock(name:lower(), version, flags["tree"]) if not name then return nil, version end diff --git a/src/luarocks/unpack.lua b/src/luarocks/unpack.lua index c3dc9a4c..0922f9b9 100644 --- a/src/luarocks/unpack.lua +++ b/src/luarocks/unpack.lua @@ -159,7 +159,7 @@ function unpack.command(flags, name, version) return run_unpacker(name, flags["force"]) else local search = require("luarocks.search") - return search.act_on_src_or_rockspec(run_unpacker, name, version) + return search.act_on_src_or_rockspec(run_unpacker, name:lower(), version) end end -- cgit v1.2.3-55-g6feb