From 27c09f27b22b26463e7e6b47431d539c7e496c6e Mon Sep 17 00:00:00 2001 From: daurnimator Date: Sat, 19 Oct 2019 10:34:19 +0200 Subject: Add --no-manifest flag to skip creating/updating a global manifest --- src/luarocks/cmd.lua | 4 ++++ src/luarocks/cmd/install.lua | 1 + src/luarocks/cmd/make.lua | 7 ++++--- src/luarocks/core/cfg.lua | 1 + src/luarocks/manif/writer.lua | 16 +++++++++++++++- 5 files changed, 25 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/luarocks/cmd.lua b/src/luarocks/cmd.lua index eef043e7..b19535e2 100644 --- a/src/luarocks/cmd.lua +++ b/src/luarocks/cmd.lua @@ -584,6 +584,10 @@ function cmd.run_command(description, commands, external_namespace, ...) cfg.local_cache = dir.path(fs.system_cache_dir(), "luarocks") end + if args.no_manifest then + cfg.no_manifest = true + end + if not args.command then parser:epilog(variables_help..get_config_text(cfg)) util.printout() diff --git a/src/luarocks/cmd/install.lua b/src/luarocks/cmd/install.lua index ad2a5ea7..88556e25 100644 --- a/src/luarocks/cmd/install.lua +++ b/src/luarocks/cmd/install.lua @@ -42,6 +42,7 @@ function install.add_to_parser(parser) cmd:flag("--check-lua-versions", "If the rock can't be found, check repository ".. "and report if it is available for another Lua version.") util.deps_mode_option(cmd) + cmd:flag("--no-manifest", "Skip creating/updating the manifest") -- luarocks build options parser:flag("--pack-binary-rock"):hidden(true) parser:option("--branch"):hidden(true) diff --git a/src/luarocks/cmd/make.lua b/src/luarocks/cmd/make.lua index a2ae4cd0..13e974c1 100644 --- a/src/luarocks/cmd/make.lua +++ b/src/luarocks/cmd/make.lua @@ -1,7 +1,7 @@ --- Module implementing the LuaRocks "make" command. -- Builds sources in the current directory, but unlike "build", --- it does not fetch sources, etc., assuming everything is +-- it does not fetch sources, etc., assuming everything is -- available in the current directory. local make = {} @@ -40,6 +40,7 @@ function make.cmd_options(parser) "and report if it is available for another Lua version.") parser:flag("--pin", "Pin the exact dependencies used for the rockspec".. "being built into a luarocks.lock file in the current directory.") + parser:flag("--no-manifest", "Skip creating/updating the manifest") util.deps_mode_option(parser) end @@ -53,7 +54,7 @@ version or without version name. If rockspecs for different rocks are found or there are several rockspecs without version, you must specify which to use, through the command-line. -This command is useful as a tool for debugging rockspecs. +This command is useful as a tool for debugging rockspecs. To install rocks, you'll normally want to use the "install" and "build" commands. See the help on those for details. @@ -87,7 +88,7 @@ function make.command(args) if not rockspec_filename:match("rockspec$") then return nil, "Invalid argument: 'make' takes a rockspec as a parameter. "..util.see_help("make") end - + local rockspec, err, errcode = fetch.load_rockspec(rockspec_filename) if not rockspec then return nil, err diff --git a/src/luarocks/core/cfg.lua b/src/luarocks/core/cfg.lua index e26c263c..ffa6964a 100644 --- a/src/luarocks/core/cfg.lua +++ b/src/luarocks/core/cfg.lua @@ -187,6 +187,7 @@ local function make_defaults(lua_version, target_cpu, platforms, home) fs_use_modules = true, hooks_enabled = true, deps_mode = "one", + no_manifest = false, check_certificates = false, cache_timeout = 60, diff --git a/src/luarocks/manif/writer.lua b/src/luarocks/manif/writer.lua index 44580a46..8c6e4505 100644 --- a/src/luarocks/manif/writer.lua +++ b/src/luarocks/manif/writer.lua @@ -338,12 +338,18 @@ function writer.make_manifest(repo, deps_mode, remote) local vmanifest = { repository = {}, modules = {}, commands = {} } local ok, err = store_results(results, vmanifest) filter_by_lua_version(vmanifest, luaver, repo, cache) - save_table(repo, "manifest-"..luaver, vmanifest) + if not cfg.no_manifest then + save_table(repo, "manifest-"..luaver, vmanifest) + end end else update_dependencies(manifest, deps_mode) end + if cfg.no_manifest then + -- We want to have cache updated; but exit before save_table is called + return true + end return save_table(repo, "manifest", manifest) end @@ -381,6 +387,10 @@ function writer.add_to_manifest(name, version, repo, deps_mode) if not ok then return nil, err end update_dependencies(manifest, deps_mode) + + if cfg.no_manifest then + return true + end return save_table(rocks_dir, "manifest", manifest) end @@ -436,6 +446,10 @@ function writer.remove_from_manifest(name, version, repo, deps_mode) end update_dependencies(manifest, deps_mode) + + if cfg.no_manifest then + return true + end return save_table(rocks_dir, "manifest", manifest) end -- cgit v1.2.3-55-g6feb