diff options
| -rw-r--r-- | spec/install_spec.lua | 8 | ||||
| -rw-r--r-- | src/luarocks/build.lua | 5 | ||||
| -rw-r--r-- | src/luarocks/build/builtin.lua | 7 | ||||
| -rw-r--r-- | src/luarocks/install.lua | 7 | ||||
| -rw-r--r-- | src/luarocks/repos.lua | 28 |
5 files changed, 33 insertions, 22 deletions
diff --git a/spec/install_spec.lua b/spec/install_spec.lua index 45b3e2f9..2bbf4221 100644 --- a/spec/install_spec.lua +++ b/spec/install_spec.lua | |||
| @@ -20,7 +20,7 @@ local extra_rocks = { | |||
| 20 | "/say-1.0-1.src.rock", | 20 | "/say-1.0-1.src.rock", |
| 21 | "/wsapi-1.6-1.src.rock", | 21 | "/wsapi-1.6-1.src.rock", |
| 22 | "/luafilesystem-1.6.3-2.src.rock", | 22 | "/luafilesystem-1.6.3-2.src.rock", |
| 23 | "/luafilesystem-1.6.1-1.src.rock", | 23 | "/luafilesystem-1.6.3-1.src.rock", |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | describe("LuaRocks install tests #blackbox #b_install", function() | 26 | describe("LuaRocks install tests #blackbox #b_install", function() |
| @@ -87,12 +87,12 @@ describe("LuaRocks install tests #blackbox #b_install", function() | |||
| 87 | it('LuaRocks install - handle versioned modules when installing another version with --keep #268', function() | 87 | it('LuaRocks install - handle versioned modules when installing another version with --keep #268', function() |
| 88 | assert.is_true(run.luarocks_bool("install luafilesystem")) | 88 | assert.is_true(run.luarocks_bool("install luafilesystem")) |
| 89 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/lua/"..env_variables.LUA_VERSION.."/lfs."..test_env.lib_extension)) | 89 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/lua/"..env_variables.LUA_VERSION.."/lfs."..test_env.lib_extension)) |
| 90 | assert.is_true(run.luarocks_bool("install luafilesystem 1.6.1 --keep")) | 90 | assert.is_true(run.luarocks_bool("install luafilesystem 1.6.3-1 --keep")) |
| 91 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/lua/"..env_variables.LUA_VERSION.."/lfs."..test_env.lib_extension)) | 91 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/lua/"..env_variables.LUA_VERSION.."/lfs."..test_env.lib_extension)) |
| 92 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/lua/"..env_variables.LUA_VERSION.."/luafilesystem_1_6_1_1-lfs."..test_env.lib_extension)) | 92 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/lua/"..env_variables.LUA_VERSION.."/luafilesystem_1_6_3_1-lfs."..test_env.lib_extension)) |
| 93 | assert.is_true(run.luarocks_bool("install luafilesystem")) | 93 | assert.is_true(run.luarocks_bool("install luafilesystem")) |
| 94 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/lua/"..env_variables.LUA_VERSION.."/lfs."..test_env.lib_extension)) | 94 | assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/lua/"..env_variables.LUA_VERSION.."/lfs."..test_env.lib_extension)) |
| 95 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/lua/"..env_variables.LUA_VERSION.."/luafilesystem_1_6_1_1-lfs."..test_env.lib_extension)) | 95 | assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/lua/"..env_variables.LUA_VERSION.."/luafilesystem_1_6_3_1-lfs."..test_env.lib_extension)) |
| 96 | end) | 96 | end) |
| 97 | 97 | ||
| 98 | it("LuaRocks install only-deps of luasocket packed rock", function() | 98 | it("LuaRocks install only-deps of luasocket packed rock", function() |
diff --git a/src/luarocks/build.lua b/src/luarocks/build.lua index c43ee949..1d2925f9 100644 --- a/src/luarocks/build.lua +++ b/src/luarocks/build.lua | |||
| @@ -348,7 +348,7 @@ function build.build_rockspec(rockspec_file, need_to_fetch, minimal_mode, deps_m | |||
| 348 | ok, err = writer.make_rock_manifest(name, version) | 348 | ok, err = writer.make_rock_manifest(name, version) |
| 349 | if err then return nil, err end | 349 | if err then return nil, err end |
| 350 | 350 | ||
| 351 | ok, err = repos.deploy_files(name, version, repos.should_wrap_bin_scripts(rockspec)) | 351 | ok, err = repos.deploy_files(name, version, repos.should_wrap_bin_scripts(rockspec), deps_mode) |
| 352 | if err then return nil, err end | 352 | if err then return nil, err end |
| 353 | 353 | ||
| 354 | util.remove_scheduled_function(rollback) | 354 | util.remove_scheduled_function(rollback) |
| @@ -359,9 +359,6 @@ function build.build_rockspec(rockspec_file, need_to_fetch, minimal_mode, deps_m | |||
| 359 | ok, err = repos.run_hook(rockspec, "post_install") | 359 | ok, err = repos.run_hook(rockspec, "post_install") |
| 360 | if err then return nil, err end | 360 | if err then return nil, err end |
| 361 | 361 | ||
| 362 | ok, err = writer.update_manifest(name, version, nil, deps_mode) | ||
| 363 | if err then return nil, err end | ||
| 364 | |||
| 365 | util.announce_install(rockspec) | 362 | util.announce_install(rockspec) |
| 366 | util.remove_scheduled_function(rollback) | 363 | util.remove_scheduled_function(rollback) |
| 367 | return name, version | 364 | return name, version |
diff --git a/src/luarocks/build/builtin.lua b/src/luarocks/build/builtin.lua index d9785b0c..3a4beb17 100644 --- a/src/luarocks/build/builtin.lua +++ b/src/luarocks/build/builtin.lua | |||
| @@ -223,14 +223,11 @@ function builtin.run(rockspec) | |||
| 223 | local ext = info:match("%.([^.]+)$") | 223 | local ext = info:match("%.([^.]+)$") |
| 224 | if ext == "lua" then | 224 | if ext == "lua" then |
| 225 | local filename = dir.base_name(info) | 225 | local filename = dir.base_name(info) |
| 226 | if info:match("init%.lua$") and not name:match("%.init$") then | 226 | if filename == "init.lua" and not name:match("%.init$") then |
| 227 | moddir = path.module_to_path(name..".init") | 227 | moddir = path.module_to_path(name..".init") |
| 228 | else | 228 | else |
| 229 | local basename = name:match("([^.]+)$") | 229 | local basename = name:match("([^.]+)$") |
| 230 | local baseinfo = filename:gsub("%.lua$", "") | 230 | filename = basename..".lua" |
| 231 | if basename ~= baseinfo then | ||
| 232 | filename = basename..".lua" | ||
| 233 | end | ||
| 234 | end | 231 | end |
| 235 | local dest = dir.path(luadir, moddir, filename) | 232 | local dest = dir.path(luadir, moddir, filename) |
| 236 | lua_modules[info] = dest | 233 | lua_modules[info] = dest |
diff --git a/src/luarocks/install.lua b/src/luarocks/install.lua index 6dded8ee..c9b085f5 100644 --- a/src/luarocks/install.lua +++ b/src/luarocks/install.lua | |||
| @@ -82,7 +82,7 @@ function install.install_binary_rock(rock_file, deps_mode) | |||
| 82 | if err then return nil, err, errcode end | 82 | if err then return nil, err, errcode end |
| 83 | end | 83 | end |
| 84 | 84 | ||
| 85 | ok, err = repos.deploy_files(name, version, repos.should_wrap_bin_scripts(rockspec)) | 85 | ok, err = repos.deploy_files(name, version, repos.should_wrap_bin_scripts(rockspec), deps_mode) |
| 86 | if err then return nil, err end | 86 | if err then return nil, err end |
| 87 | 87 | ||
| 88 | util.remove_scheduled_function(rollback) | 88 | util.remove_scheduled_function(rollback) |
| @@ -92,10 +92,7 @@ function install.install_binary_rock(rock_file, deps_mode) | |||
| 92 | 92 | ||
| 93 | ok, err = repos.run_hook(rockspec, "post_install") | 93 | ok, err = repos.run_hook(rockspec, "post_install") |
| 94 | if err then return nil, err end | 94 | if err then return nil, err end |
| 95 | 95 | ||
| 96 | ok, err = writer.update_manifest(name, version, nil, deps_mode) | ||
| 97 | if err then return nil, err end | ||
| 98 | |||
| 99 | util.announce_install(rockspec) | 96 | util.announce_install(rockspec) |
| 100 | util.remove_scheduled_function(rollback) | 97 | util.remove_scheduled_function(rollback) |
| 101 | return name, version | 98 | return name, version |
diff --git a/src/luarocks/repos.lua b/src/luarocks/repos.lua index 0ed9068c..47a501af 100644 --- a/src/luarocks/repos.lua +++ b/src/luarocks/repos.lua | |||
| @@ -191,7 +191,18 @@ function repos.should_wrap_bin_scripts(rockspec) | |||
| 191 | return true | 191 | return true |
| 192 | end | 192 | end |
| 193 | 193 | ||
| 194 | function repos.deploy_files(name, version, wrap_bin_scripts) | 194 | --- Deploy a package from the rocks subdirectory. |
| 195 | -- It is maintained that for each file the one that is provided | ||
| 196 | -- by the newest version of the lexicographically smallest package | ||
| 197 | -- is installed using unversioned name, and other versions of the file | ||
| 198 | -- use versioned names. | ||
| 199 | -- @param name string: name of package | ||
| 200 | -- @param version string: exact package version in string format | ||
| 201 | -- @param wrap_bin_scripts bool: whether commands written in Lua should be wrapped. | ||
| 202 | -- @param deps_mode: string: Which trees to check dependencies for: | ||
| 203 | -- "one" for the current default tree, "all" for all trees, | ||
| 204 | -- "order" for all trees with priority >= the current default, "none" for no trees. | ||
| 205 | function repos.deploy_files(name, version, wrap_bin_scripts, deps_mode) | ||
| 195 | assert(type(name) == "string") | 206 | assert(type(name) == "string") |
| 196 | assert(type(version) == "string") | 207 | assert(type(version) == "string") |
| 197 | assert(type(wrap_bin_scripts) == "boolean") | 208 | assert(type(wrap_bin_scripts) == "boolean") |
| @@ -247,7 +258,13 @@ function repos.deploy_files(name, version, wrap_bin_scripts) | |||
| 247 | if ok and rock_manifest.lib then | 258 | if ok and rock_manifest.lib then |
| 248 | ok, err = deploy_file_tree(rock_manifest.lib, path.lib_dir, cfg.deploy_lib_dir, make_mover(cfg.perm_exec)) | 259 | ok, err = deploy_file_tree(rock_manifest.lib, path.lib_dir, cfg.deploy_lib_dir, make_mover(cfg.perm_exec)) |
| 249 | end | 260 | end |
| 250 | return ok, err | 261 | |
| 262 | if not ok then | ||
| 263 | return nil, err | ||
| 264 | end | ||
| 265 | |||
| 266 | local writer = require("luarocks.manif.writer") | ||
| 267 | return writer.update_manifest(name, version, nil, deps_mode) | ||
| 251 | end | 268 | end |
| 252 | 269 | ||
| 253 | local function delete_suffixed(filename, suffix) | 270 | local function delete_suffixed(filename, suffix) |
| @@ -266,9 +283,12 @@ local function delete_suffixed(filename, suffix) | |||
| 266 | end | 283 | end |
| 267 | 284 | ||
| 268 | --- Delete a package from the local repository. | 285 | --- Delete a package from the local repository. |
| 269 | -- Version numbers are compared as exact string comparison. | 286 | -- It is maintained that for each file the one that is provided |
| 287 | -- by the newest version of the lexicographically smallest package | ||
| 288 | -- is installed using unversioned name, and other versions of the file | ||
| 289 | -- use versioned names. | ||
| 270 | -- @param name string: name of package | 290 | -- @param name string: name of package |
| 271 | -- @param version string: package version in string format | 291 | -- @param version string: exact package version in string format |
| 272 | -- @param deps_mode: string: Which trees to check dependencies for: | 292 | -- @param deps_mode: string: Which trees to check dependencies for: |
| 273 | -- "one" for the current default tree, "all" for all trees, | 293 | -- "one" for the current default tree, "all" for all trees, |
| 274 | -- "order" for all trees with priority >= the current default, "none" for no trees. | 294 | -- "order" for all trees with priority >= the current default, "none" for no trees. |
