diff options
| -rw-r--r-- | src/luarocks/download.lua | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/luarocks/download.lua b/src/luarocks/download.lua index d241fca8..f08ba7fe 100644 --- a/src/luarocks/download.lua +++ b/src/luarocks/download.lua | |||
| @@ -43,15 +43,17 @@ function download.download(arch, name, version, all) | |||
| 43 | if all then | 43 | if all then |
| 44 | if name == "" then query.exact_name = false end | 44 | if name == "" then query.exact_name = false end |
| 45 | local results = search.search_repos(query) | 45 | local results = search.search_repos(query) |
| 46 | 46 | local has_result = false | |
| 47 | if next(results) then | 47 | local all_ok = true |
| 48 | local all_ok = true | 48 | local any_err = "" |
| 49 | local any_err = "" | 49 | for name, result in pairs(results) do |
| 50 | for name, result in pairs(results) do | 50 | for version, items in pairs(result) do |
| 51 | for version, items in pairs(result) do | 51 | for _, item in ipairs(items) do |
| 52 | for _, item in ipairs(items) do | 52 | -- Ignore provided rocks. |
| 53 | local url = path.make_url(item.repo, name, version, item.arch) | 53 | if item.arch ~= "installed" then |
| 54 | local ok, err = get_file(url) | 54 | has_result = true |
| 55 | local filename = path.make_url(item.repo, name, version, item.arch) | ||
| 56 | local ok, err = get_file(filename) | ||
| 55 | if not ok then | 57 | if not ok then |
| 56 | all_ok = false | 58 | all_ok = false |
| 57 | any_err = any_err .. "\n" .. err | 59 | any_err = any_err .. "\n" .. err |
| @@ -59,6 +61,9 @@ function download.download(arch, name, version, all) | |||
| 59 | end | 61 | end |
| 60 | end | 62 | end |
| 61 | end | 63 | end |
| 64 | end | ||
| 65 | |||
| 66 | if has_result then | ||
| 62 | return all_ok, any_err | 67 | return all_ok, any_err |
| 63 | end | 68 | end |
| 64 | else | 69 | else |
