diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2024-04-04 23:32:09 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2024-04-05 17:32:15 -0300 |
| commit | 15d71214638c6f7f808b838cfc4215ece0a53101 (patch) | |
| tree | 9257a042e7bae73aa6aacf03885db03a13091f44 | |
| parent | 8c4b4cf98ab1b46b24db3f1c6478bb8d521720e8 (diff) | |
| download | luarocks-15d71214638c6f7f808b838cfc4215ece0a53101.tar.gz luarocks-15d71214638c6f7f808b838cfc4215ece0a53101.tar.bz2 luarocks-15d71214638c6f7f808b838cfc4215ece0a53101.zip | |
fix(build): ensure --force works for build
| -rw-r--r-- | spec/quick/build.q | 8 | ||||
| -rw-r--r-- | spec/quick/make.q | 37 | ||||
| -rw-r--r-- | src/luarocks/build.lua | 1 | ||||
| -rw-r--r-- | src/luarocks/cmd/build.lua | 3 | ||||
| -rw-r--r-- | src/luarocks/cmd/install.lua | 2 | ||||
| -rw-r--r-- | src/luarocks/cmd/make.lua | 1 |
6 files changed, 50 insertions, 2 deletions
diff --git a/spec/quick/build.q b/spec/quick/build.q index 4d0f6f9f..d0d6a890 100644 --- a/spec/quick/build.q +++ b/spec/quick/build.q | |||
| @@ -214,6 +214,14 @@ Use --force to reinstall | |||
| 214 | -------------------------------------------------------------------------------- | 214 | -------------------------------------------------------------------------------- |
| 215 | 215 | ||
| 216 | 216 | ||
| 217 | RUN: luarocks build a_rock-1.0-1.rockspec --force | ||
| 218 | NOT_STDOUT: | ||
| 219 | -------------------------------------------------------------------------------- | ||
| 220 | a_rock 1.0-1 is already installed | ||
| 221 | Use --force to reinstall | ||
| 222 | -------------------------------------------------------------------------------- | ||
| 223 | |||
| 224 | |||
| 217 | 225 | ||
| 218 | ================================================================================ | 226 | ================================================================================ |
| 219 | TEST: supports --pin #pinning | 227 | TEST: supports --pin #pinning |
diff --git a/spec/quick/make.q b/spec/quick/make.q index c77bb499..eb3472b6 100644 --- a/spec/quick/make.q +++ b/spec/quick/make.q | |||
| @@ -49,3 +49,40 @@ return { | |||
| 49 | } | 49 | } |
| 50 | } | 50 | } |
| 51 | -------------------------------------------------------------------------------- | 51 | -------------------------------------------------------------------------------- |
| 52 | |||
| 53 | |||
| 54 | |||
| 55 | ================================================================================ | ||
| 56 | TEST: running make twice builds twice | ||
| 57 | |||
| 58 | FILE: test-2.0-1.rockspec | ||
| 59 | -------------------------------------------------------------------------------- | ||
| 60 | package = "test" | ||
| 61 | version = "2.0-1" | ||
| 62 | source = { | ||
| 63 | url = "file://%{path(tmpdir)}/test.lua" | ||
| 64 | } | ||
| 65 | build = { | ||
| 66 | type = "builtin", | ||
| 67 | modules = { | ||
| 68 | test = "test.lua" | ||
| 69 | } | ||
| 70 | } | ||
| 71 | -------------------------------------------------------------------------------- | ||
| 72 | |||
| 73 | FILE: test.lua | ||
| 74 | -------------------------------------------------------------------------------- | ||
| 75 | return {} | ||
| 76 | -------------------------------------------------------------------------------- | ||
| 77 | |||
| 78 | RUN: luarocks make --only-server=%{fixtures_dir}/a_repo --pin --tree=lua_modules | ||
| 79 | STDOUT: | ||
| 80 | -------------------------------------------------------------------------------- | ||
| 81 | test 2.0-1 is now installed | ||
| 82 | -------------------------------------------------------------------------------- | ||
| 83 | |||
| 84 | RUN: luarocks make --only-server=%{fixtures_dir}/a_repo --pin --tree=lua_modules | ||
| 85 | STDOUT: | ||
| 86 | -------------------------------------------------------------------------------- | ||
| 87 | test 2.0-1 is now installed | ||
| 88 | -------------------------------------------------------------------------------- | ||
diff --git a/src/luarocks/build.lua b/src/luarocks/build.lua index 55242e60..c6b3388b 100644 --- a/src/luarocks/build.lua +++ b/src/luarocks/build.lua | |||
| @@ -24,6 +24,7 @@ build.opts = util.opts_table("build.opts", { | |||
| 24 | verify = "boolean", | 24 | verify = "boolean", |
| 25 | check_lua_versions = "boolean", | 25 | check_lua_versions = "boolean", |
| 26 | pin = "boolean", | 26 | pin = "boolean", |
| 27 | rebuild = "boolean", | ||
| 27 | no_install = "boolean" | 28 | no_install = "boolean" |
| 28 | }) | 29 | }) |
| 29 | 30 | ||
diff --git a/src/luarocks/cmd/build.lua b/src/luarocks/cmd/build.lua index ada6b7d2..32680411 100644 --- a/src/luarocks/cmd/build.lua +++ b/src/luarocks/cmd/build.lua | |||
| @@ -95,7 +95,7 @@ local function do_build(name, namespace, version, opts) | |||
| 95 | 95 | ||
| 96 | name, version = path.parse_name(url) | 96 | name, version = path.parse_name(url) |
| 97 | if name and repos.is_installed(name, version) then | 97 | if name and repos.is_installed(name, version) then |
| 98 | if (not opts.force) and (not opts.force_fast) then | 98 | if not opts.rebuild then |
| 99 | util.printout(name .. " " .. version .. " is already installed in " .. path.root_dir(cfg.root_dir)) | 99 | util.printout(name .. " " .. version .. " is already installed in " .. path.root_dir(cfg.root_dir)) |
| 100 | util.printout("Use --force to reinstall.") | 100 | util.printout("Use --force to reinstall.") |
| 101 | return name, version, "skip" | 101 | return name, version, "skip" |
| @@ -138,6 +138,7 @@ function cmd_build.command(args) | |||
| 138 | verify = not not args.verify, | 138 | verify = not not args.verify, |
| 139 | check_lua_versions = not not args.check_lua_versions, | 139 | check_lua_versions = not not args.check_lua_versions, |
| 140 | pin = not not args.pin, | 140 | pin = not not args.pin, |
| 141 | rebuild = not not (args.force or args.force_fast), | ||
| 141 | no_install = false | 142 | no_install = false |
| 142 | }) | 143 | }) |
| 143 | 144 | ||
diff --git a/src/luarocks/cmd/install.lua b/src/luarocks/cmd/install.lua index e71b6db8..9e705d12 100644 --- a/src/luarocks/cmd/install.lua +++ b/src/luarocks/cmd/install.lua | |||
| @@ -84,7 +84,7 @@ function install.install_binary_rock(rock_file, opts) | |||
| 84 | return nil, "Incompatible architecture "..arch, "arch" | 84 | return nil, "Incompatible architecture "..arch, "arch" |
| 85 | end | 85 | end |
| 86 | if repos.is_installed(name, version) then | 86 | if repos.is_installed(name, version) then |
| 87 | if (not opts.force) and (not opts.force_fast) then | 87 | if not (opts.force or opts.force_fast) then |
| 88 | util.printout(name .. " " .. version .. " is already installed in " .. path.root_dir(cfg.root_dir)) | 88 | util.printout(name .. " " .. version .. " is already installed in " .. path.root_dir(cfg.root_dir)) |
| 89 | util.printout("Use --force to reinstall.") | 89 | util.printout("Use --force to reinstall.") |
| 90 | return name, version | 90 | return name, version |
diff --git a/src/luarocks/cmd/make.lua b/src/luarocks/cmd/make.lua index eaa4b899..0b3db27c 100644 --- a/src/luarocks/cmd/make.lua +++ b/src/luarocks/cmd/make.lua | |||
| @@ -106,6 +106,7 @@ function make.command(args) | |||
| 106 | verify = not not args.verify, | 106 | verify = not not args.verify, |
| 107 | check_lua_versions = not not args.check_lua_versions, | 107 | check_lua_versions = not not args.check_lua_versions, |
| 108 | pin = not not args.pin, | 108 | pin = not not args.pin, |
| 109 | rebuild = true, | ||
| 109 | no_install = not not args.no_install | 110 | no_install = not not args.no_install |
| 110 | }) | 111 | }) |
| 111 | 112 | ||
