aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2019-10-19 10:34:19 +0200
committerdaurnimator <quae@daurnimator.com>2019-11-30 15:52:37 +1100
commit27c09f27b22b26463e7e6b47431d539c7e496c6e (patch)
treedee213251215ab07f6226a58c6a32dd12fe4303d
parentacf8bcb82ae697a5bac94bfbe93c3ad9d7487795 (diff)
downloadluarocks-27c09f27b22b26463e7e6b47431d539c7e496c6e.tar.gz
luarocks-27c09f27b22b26463e7e6b47431d539c7e496c6e.tar.bz2
luarocks-27c09f27b22b26463e7e6b47431d539c7e496c6e.zip
Add --no-manifest flag to skip creating/updating a global manifest
-rw-r--r--spec/install_spec.lua11
-rw-r--r--src/luarocks/cmd.lua4
-rw-r--r--src/luarocks/cmd/install.lua1
-rw-r--r--src/luarocks/cmd/make.lua7
-rw-r--r--src/luarocks/core/cfg.lua1
-rw-r--r--src/luarocks/manif/writer.lua16
6 files changed, 35 insertions, 5 deletions
diff --git a/spec/install_spec.lua b/spec/install_spec.lua
index 76dc2201..7370fef5 100644
--- a/spec/install_spec.lua
+++ b/spec/install_spec.lua
@@ -232,7 +232,16 @@ describe("luarocks install #integration", function()
232 assert.is_true(run.luarocks_bool("build --pack-binary-rock cprint")) 232 assert.is_true(run.luarocks_bool("build --pack-binary-rock cprint"))
233 assert.is_true(run.luarocks_bool("install cprint-0.1-2." .. test_env.platform .. ".rock")) 233 assert.is_true(run.luarocks_bool("install cprint-0.1-2." .. test_env.platform .. ".rock"))
234 assert.is_true(os.remove("cprint-0.1-2." .. test_env.platform .. ".rock")) 234 assert.is_true(os.remove("cprint-0.1-2." .. test_env.platform .. ".rock"))
235 end) 235 end)
236
237 it("accepts --no-manifest flag", function()
238 assert.is_true(run.luarocks_bool("install lxsh 0.8.6-2"))
239 assert.is.truthy(lfs.attributes(testing_paths.testing_sys_rocks .. "/manifest"))
240 assert.is.truthy(os.remove(testing_paths.testing_sys_rocks .. "/manifest"))
241
242 assert.is_true(run.luarocks_bool("install --no-manifest lxsh 0.8.6-2"))
243 assert.is.falsy(lfs.attributes(testing_paths.testing_sys_rocks .. "/manifest"))
244 end)
236 end) 245 end)
237 246
238 describe("New install functionality based on pull request 552", function() 247 describe("New install functionality based on pull request 552", function()
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, ...)
584 cfg.local_cache = dir.path(fs.system_cache_dir(), "luarocks") 584 cfg.local_cache = dir.path(fs.system_cache_dir(), "luarocks")
585 end 585 end
586 586
587 if args.no_manifest then
588 cfg.no_manifest = true
589 end
590
587 if not args.command then 591 if not args.command then
588 parser:epilog(variables_help..get_config_text(cfg)) 592 parser:epilog(variables_help..get_config_text(cfg))
589 util.printout() 593 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)
42 cmd:flag("--check-lua-versions", "If the rock can't be found, check repository ".. 42 cmd:flag("--check-lua-versions", "If the rock can't be found, check repository "..
43 "and report if it is available for another Lua version.") 43 "and report if it is available for another Lua version.")
44 util.deps_mode_option(cmd) 44 util.deps_mode_option(cmd)
45 cmd:flag("--no-manifest", "Skip creating/updating the manifest")
45 -- luarocks build options 46 -- luarocks build options
46 parser:flag("--pack-binary-rock"):hidden(true) 47 parser:flag("--pack-binary-rock"):hidden(true)
47 parser:option("--branch"):hidden(true) 48 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 @@
1 1
2--- Module implementing the LuaRocks "make" command. 2--- Module implementing the LuaRocks "make" command.
3-- Builds sources in the current directory, but unlike "build", 3-- Builds sources in the current directory, but unlike "build",
4-- it does not fetch sources, etc., assuming everything is 4-- it does not fetch sources, etc., assuming everything is
5-- available in the current directory. 5-- available in the current directory.
6local make = {} 6local make = {}
7 7
@@ -40,6 +40,7 @@ function make.cmd_options(parser)
40 "and report if it is available for another Lua version.") 40 "and report if it is available for another Lua version.")
41 parser:flag("--pin", "Pin the exact dependencies used for the rockspec".. 41 parser:flag("--pin", "Pin the exact dependencies used for the rockspec"..
42 "being built into a luarocks.lock file in the current directory.") 42 "being built into a luarocks.lock file in the current directory.")
43 parser:flag("--no-manifest", "Skip creating/updating the manifest")
43 util.deps_mode_option(parser) 44 util.deps_mode_option(parser)
44end 45end
45 46
@@ -53,7 +54,7 @@ version or without version name. If rockspecs for different rocks are found or
53there are several rockspecs without version, you must specify which to use, 54there are several rockspecs without version, you must specify which to use,
54through the command-line. 55through the command-line.
55 56
56This command is useful as a tool for debugging rockspecs. 57This command is useful as a tool for debugging rockspecs.
57To install rocks, you'll normally want to use the "install" and "build" 58To install rocks, you'll normally want to use the "install" and "build"
58commands. See the help on those for details. 59commands. See the help on those for details.
59 60
@@ -87,7 +88,7 @@ function make.command(args)
87 if not rockspec_filename:match("rockspec$") then 88 if not rockspec_filename:match("rockspec$") then
88 return nil, "Invalid argument: 'make' takes a rockspec as a parameter. "..util.see_help("make") 89 return nil, "Invalid argument: 'make' takes a rockspec as a parameter. "..util.see_help("make")
89 end 90 end
90 91
91 local rockspec, err, errcode = fetch.load_rockspec(rockspec_filename) 92 local rockspec, err, errcode = fetch.load_rockspec(rockspec_filename)
92 if not rockspec then 93 if not rockspec then
93 return nil, err 94 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)
187 fs_use_modules = true, 187 fs_use_modules = true,
188 hooks_enabled = true, 188 hooks_enabled = true,
189 deps_mode = "one", 189 deps_mode = "one",
190 no_manifest = false,
190 check_certificates = false, 191 check_certificates = false,
191 192
192 cache_timeout = 60, 193 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)
338 local vmanifest = { repository = {}, modules = {}, commands = {} } 338 local vmanifest = { repository = {}, modules = {}, commands = {} }
339 local ok, err = store_results(results, vmanifest) 339 local ok, err = store_results(results, vmanifest)
340 filter_by_lua_version(vmanifest, luaver, repo, cache) 340 filter_by_lua_version(vmanifest, luaver, repo, cache)
341 save_table(repo, "manifest-"..luaver, vmanifest) 341 if not cfg.no_manifest then
342 save_table(repo, "manifest-"..luaver, vmanifest)
343 end
342 end 344 end
343 else 345 else
344 update_dependencies(manifest, deps_mode) 346 update_dependencies(manifest, deps_mode)
345 end 347 end
346 348
349 if cfg.no_manifest then
350 -- We want to have cache updated; but exit before save_table is called
351 return true
352 end
347 return save_table(repo, "manifest", manifest) 353 return save_table(repo, "manifest", manifest)
348end 354end
349 355
@@ -381,6 +387,10 @@ function writer.add_to_manifest(name, version, repo, deps_mode)
381 if not ok then return nil, err end 387 if not ok then return nil, err end
382 388
383 update_dependencies(manifest, deps_mode) 389 update_dependencies(manifest, deps_mode)
390
391 if cfg.no_manifest then
392 return true
393 end
384 return save_table(rocks_dir, "manifest", manifest) 394 return save_table(rocks_dir, "manifest", manifest)
385end 395end
386 396
@@ -436,6 +446,10 @@ function writer.remove_from_manifest(name, version, repo, deps_mode)
436 end 446 end
437 447
438 update_dependencies(manifest, deps_mode) 448 update_dependencies(manifest, deps_mode)
449
450 if cfg.no_manifest then
451 return true
452 end
439 return save_table(rocks_dir, "manifest", manifest) 453 return save_table(rocks_dir, "manifest", manifest)
440end 454end
441 455