diff options
| author | Peter Melnichenko <mpeterval@gmail.com> | 2016-10-19 11:55:51 +0300 |
|---|---|---|
| committer | Peter Melnichenko <mpeterval@gmail.com> | 2016-10-19 12:18:16 +0300 |
| commit | 574897fb8a878e0abf56d7f3f5ed2a6459dbfba8 (patch) | |
| tree | 8e3d9bda43cc262232457b198eb485935f0238ee | |
| parent | f83a936687d33b9b5ec9211d8b5534650b471385 (diff) | |
| download | luarocks-574897fb8a878e0abf56d7f3f5ed2a6459dbfba8.tar.gz luarocks-574897fb8a878e0abf56d7f3f5ed2a6459dbfba8.tar.bz2 luarocks-574897fb8a878e0abf56d7f3f5ed2a6459dbfba8.zip | |
Run manif.update_manifest in repos.deploy_files
Similarly to repos.delete_version, it's a good idea to update
manifest immediately after altering what's deployed, even though
in this case manifest was always updated by the caller.
Also added more doc comments for repos functions.
| -rw-r--r-- | src/luarocks/build.lua | 5 | ||||
| -rw-r--r-- | src/luarocks/install.lua | 7 | ||||
| -rw-r--r-- | src/luarocks/repos.lua | 27 |
3 files changed, 26 insertions, 13 deletions
diff --git a/src/luarocks/build.lua b/src/luarocks/build.lua index f2784a3a..b306b050 100644 --- a/src/luarocks/build.lua +++ b/src/luarocks/build.lua | |||
| @@ -320,7 +320,7 @@ function build.build_rockspec(rockspec_file, need_to_fetch, minimal_mode, deps_m | |||
| 320 | ok, err = manif.make_rock_manifest(name, version) | 320 | ok, err = manif.make_rock_manifest(name, version) |
| 321 | if err then return nil, err end | 321 | if err then return nil, err end |
| 322 | 322 | ||
| 323 | ok, err = repos.deploy_files(name, version, repos.should_wrap_bin_scripts(rockspec)) | 323 | ok, err = repos.deploy_files(name, version, repos.should_wrap_bin_scripts(rockspec), deps_mode) |
| 324 | if err then return nil, err end | 324 | if err then return nil, err end |
| 325 | 325 | ||
| 326 | util.remove_scheduled_function(rollback) | 326 | util.remove_scheduled_function(rollback) |
| @@ -331,9 +331,6 @@ function build.build_rockspec(rockspec_file, need_to_fetch, minimal_mode, deps_m | |||
| 331 | ok, err = repos.run_hook(rockspec, "post_install") | 331 | ok, err = repos.run_hook(rockspec, "post_install") |
| 332 | if err then return nil, err end | 332 | if err then return nil, err end |
| 333 | 333 | ||
| 334 | ok, err = manif.update_manifest(name, version, nil, deps_mode) | ||
| 335 | if err then return nil, err end | ||
| 336 | |||
| 337 | util.announce_install(rockspec) | 334 | util.announce_install(rockspec) |
| 338 | util.remove_scheduled_function(rollback) | 335 | util.remove_scheduled_function(rollback) |
| 339 | return name, version | 336 | return name, version |
diff --git a/src/luarocks/install.lua b/src/luarocks/install.lua index daebfc70..b5128430 100644 --- a/src/luarocks/install.lua +++ b/src/luarocks/install.lua | |||
| @@ -84,7 +84,7 @@ function install.install_binary_rock(rock_file, deps_mode) | |||
| 84 | if err then return nil, err, errcode end | 84 | if err then return nil, err, errcode end |
| 85 | end | 85 | end |
| 86 | 86 | ||
| 87 | ok, err = repos.deploy_files(name, version, repos.should_wrap_bin_scripts(rockspec)) | 87 | ok, err = repos.deploy_files(name, version, repos.should_wrap_bin_scripts(rockspec), deps_mode) |
| 88 | if err then return nil, err end | 88 | if err then return nil, err end |
| 89 | 89 | ||
| 90 | util.remove_scheduled_function(rollback) | 90 | util.remove_scheduled_function(rollback) |
| @@ -94,10 +94,7 @@ function install.install_binary_rock(rock_file, deps_mode) | |||
| 94 | 94 | ||
| 95 | ok, err = repos.run_hook(rockspec, "post_install") | 95 | ok, err = repos.run_hook(rockspec, "post_install") |
| 96 | if err then return nil, err end | 96 | if err then return nil, err end |
| 97 | 97 | ||
| 98 | ok, err = manif.update_manifest(name, version, nil, deps_mode) | ||
| 99 | if err then return nil, err end | ||
| 100 | |||
| 101 | util.announce_install(rockspec) | 98 | util.announce_install(rockspec) |
| 102 | util.remove_scheduled_function(rollback) | 99 | util.remove_scheduled_function(rollback) |
| 103 | return name, version | 100 | return name, version |
diff --git a/src/luarocks/repos.lua b/src/luarocks/repos.lua index 4e8a9a13..a1cf2bb4 100644 --- a/src/luarocks/repos.lua +++ b/src/luarocks/repos.lua | |||
| @@ -190,7 +190,18 @@ function repos.should_wrap_bin_scripts(rockspec) | |||
| 190 | return true | 190 | return true |
| 191 | end | 191 | end |
| 192 | 192 | ||
| 193 | function repos.deploy_files(name, version, wrap_bin_scripts) | 193 | --- Deploy a package from the rocks subdirectory. |
| 194 | -- It is maintained that for each file the one that is provided | ||
| 195 | -- by the newest version of the lexicographically smallest package | ||
| 196 | -- is installed using unversioned name, and other versions of the file | ||
| 197 | -- use versioned names. | ||
| 198 | -- @param name string: name of package | ||
| 199 | -- @param version string: exact package version in string format | ||
| 200 | -- @param wrap_bin_scripts bool: whether commands written in Lua should be wrapped. | ||
| 201 | -- @param deps_mode: string: Which trees to check dependencies for: | ||
| 202 | -- "one" for the current default tree, "all" for all trees, | ||
| 203 | -- "order" for all trees with priority >= the current default, "none" for no trees. | ||
| 204 | function repos.deploy_files(name, version, wrap_bin_scripts, deps_mode) | ||
| 194 | assert(type(name) == "string") | 205 | assert(type(name) == "string") |
| 195 | assert(type(version) == "string") | 206 | assert(type(version) == "string") |
| 196 | assert(type(wrap_bin_scripts) == "boolean") | 207 | assert(type(wrap_bin_scripts) == "boolean") |
| @@ -245,7 +256,12 @@ function repos.deploy_files(name, version, wrap_bin_scripts) | |||
| 245 | if ok and rock_manifest.lib then | 256 | if ok and rock_manifest.lib then |
| 246 | ok, err = deploy_file_tree(rock_manifest.lib, path.lib_dir, cfg.deploy_lib_dir, make_mover(cfg.perm_exec)) | 257 | ok, err = deploy_file_tree(rock_manifest.lib, path.lib_dir, cfg.deploy_lib_dir, make_mover(cfg.perm_exec)) |
| 247 | end | 258 | end |
| 248 | return ok, err | 259 | |
| 260 | if not ok then | ||
| 261 | return nil, err | ||
| 262 | end | ||
| 263 | |||
| 264 | return manif.update_manifest(name, version, nil, deps_mode) | ||
| 249 | end | 265 | end |
| 250 | 266 | ||
| 251 | local function delete_suffixed(filename, suffix) | 267 | local function delete_suffixed(filename, suffix) |
| @@ -264,9 +280,12 @@ local function delete_suffixed(filename, suffix) | |||
| 264 | end | 280 | end |
| 265 | 281 | ||
| 266 | --- Delete a package from the local repository. | 282 | --- Delete a package from the local repository. |
| 267 | -- Version numbers are compared as exact string comparison. | 283 | -- It is maintained that for each file the one that is provided |
| 284 | -- by the newest version of the lexicographically smallest package | ||
| 285 | -- is installed using unversioned name, and other versions of the file | ||
| 286 | -- use versioned names. | ||
| 268 | -- @param name string: name of package | 287 | -- @param name string: name of package |
| 269 | -- @param version string: package version in string format | 288 | -- @param version string: exact package version in string format |
| 270 | -- @param deps_mode: string: Which trees to check dependencies for: | 289 | -- @param deps_mode: string: Which trees to check dependencies for: |
| 271 | -- "one" for the current default tree, "all" for all trees, | 290 | -- "one" for the current default tree, "all" for all trees, |
| 272 | -- "order" for all trees with priority >= the current default, "none" for no trees. | 291 | -- "order" for all trees with priority >= the current default, "none" for no trees. |
