diff options
| author | mpeterv <mpeterval@gmail.com> | 2016-03-19 14:31:33 +0300 |
|---|---|---|
| committer | mpeterv <mpeterval@gmail.com> | 2016-03-20 13:14:48 +0300 |
| commit | 88e16001e37eab28f5d6f4c242f65b8a4c2a1e33 (patch) | |
| tree | 076255a03e16f3c859900c92f8d60f1a4d1fc1dc /src | |
| parent | b29a5d1ac614b02d0c8b7b0a4a7413a8d77007c6 (diff) | |
| download | luarocks-88e16001e37eab28f5d6f4c242f65b8a4c2a1e33.tar.gz luarocks-88e16001e37eab28f5d6f4c242f65b8a4c2a1e33.tar.bz2 luarocks-88e16001e37eab28f5d6f4c242f65b8a4c2a1e33.zip | |
Fix stat error on `luarocks download <provided rock> --all`
Diffstat (limited to 'src')
| -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 |
