diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2018-09-07 01:11:18 +0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-09-07 02:42:15 +0300 |
commit | 9943217b68457fb7ffdeffcf0df9af2861a1e07a (patch) | |
tree | 927a4d518816701195fdc6ccbfd057f5864ffea7 | |
parent | 3a9c57a3bbf9db4c668b79bd83198f7372dbb310 (diff) | |
download | luarocks-9943217b68457fb7ffdeffcf0df9af2861a1e07a.tar.gz luarocks-9943217b68457fb7ffdeffcf0df9af2861a1e07a.tar.bz2 luarocks-9943217b68457fb7ffdeffcf0df9af2861a1e07a.zip |
cfg: allow an empty rocks_trees in a config-5.x.lua file
This is so a project uses only the auto-inserted project tree
-rw-r--r-- | src/luarocks/core/cfg.lua | 5 | ||||
-rw-r--r-- | src/luarocks/loader.lua | 2 |
2 files changed, 3 insertions, 4 deletions
diff --git a/src/luarocks/core/cfg.lua b/src/luarocks/core/cfg.lua index 7a764160..bab6bd06 100644 --- a/src/luarocks/core/cfg.lua +++ b/src/luarocks/core/cfg.lua | |||
@@ -584,8 +584,6 @@ function cfg.init(lua_data, project_dir, warning) | |||
584 | LUA_LIBDIR = lua_libdir, | 584 | LUA_LIBDIR = lua_libdir, |
585 | } | 585 | } |
586 | 586 | ||
587 | cfg.rocks_trees = {} | ||
588 | |||
589 | cfg.init = init | 587 | cfg.init = init |
590 | 588 | ||
591 | ---------------------------------------- | 589 | ---------------------------------------- |
@@ -704,7 +702,8 @@ function cfg.init(lua_data, project_dir, warning) | |||
704 | cfg.variables.LUA_DIR = lua_data.lua_dir or cfg.variables.LUA_DIR or lua_dir | 702 | cfg.variables.LUA_DIR = lua_data.lua_dir or cfg.variables.LUA_DIR or lua_dir |
705 | 703 | ||
706 | -- Build a default list of rocks trees if not given | 704 | -- Build a default list of rocks trees if not given |
707 | if not next(cfg.rocks_trees) then | 705 | if cfg.rocks_trees == nil then |
706 | cfg.rocks_trees = {} | ||
708 | if cfg.home_tree then | 707 | if cfg.home_tree then |
709 | table.insert(cfg.rocks_trees, { name = "user", root = cfg.home_tree } ) | 708 | table.insert(cfg.rocks_trees, { name = "user", root = cfg.home_tree } ) |
710 | end | 709 | end |
diff --git a/src/luarocks/loader.lua b/src/luarocks/loader.lua index 4df55a04..780a0371 100644 --- a/src/luarocks/loader.lua +++ b/src/luarocks/loader.lua | |||
@@ -60,7 +60,7 @@ loader.rocks_trees = nil | |||
60 | function loader.load_rocks_trees() | 60 | function loader.load_rocks_trees() |
61 | local any_ok = false | 61 | local any_ok = false |
62 | local trees = {} | 62 | local trees = {} |
63 | for _, tree in ipairs(cfg.rocks_trees) do | 63 | for _, tree in ipairs(cfg.rocks_trees or {}) do |
64 | local manifest, err = manif.fast_load_local_manifest(path.rocks_dir(tree)) | 64 | local manifest, err = manif.fast_load_local_manifest(path.rocks_dir(tree)) |
65 | if manifest then | 65 | if manifest then |
66 | any_ok = true | 66 | any_ok = true |