diff options
| author | hisham <hisham@9ca3f7c1-7366-0410-b1a3-b5c78f85698c> | 2009-11-20 14:19:47 +0000 |
|---|---|---|
| committer | hisham <hisham@9ca3f7c1-7366-0410-b1a3-b5c78f85698c> | 2009-11-20 14:19:47 +0000 |
| commit | b691a57e180fc7d20d2684e00583a5d570183073 (patch) | |
| tree | 2be72541ccd0c02f3a3a454e32b79dc668ae65e8 /src | |
| parent | 8a85a35af7820e482c57885a0e18823a0f1a9efd (diff) | |
| download | luarocks-b691a57e180fc7d20d2684e00583a5d570183073.tar.gz luarocks-b691a57e180fc7d20d2684e00583a5d570183073.tar.bz2 luarocks-b691a57e180fc7d20d2684e00583a5d570183073.zip | |
Search fixes by David Manura
git-svn-id: http://luarocks.org/svn/luarocks/trunk@124 9ca3f7c1-7366-0410-b1a3-b5c78f85698c
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/search.lua | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/luarocks/search.lua b/src/luarocks/search.lua index f48dc567..adbf47a8 100644 --- a/src/luarocks/search.lua +++ b/src/luarocks/search.lua | |||
| @@ -165,6 +165,7 @@ end | |||
| 165 | -- If the arch field is omitted, the local architecture (cfg.arch) | 165 | -- If the arch field is omitted, the local architecture (cfg.arch) |
| 166 | -- is used. The special value "any" is also recognized, returning all | 166 | -- is used. The special value "any" is also recognized, returning all |
| 167 | -- matches regardless of architecture. | 167 | -- matches regardless of architecture. |
| 168 | -- @return true or, in case of errors, nil and an error message. | ||
| 168 | function manifest_search(results, repo, query) | 169 | function manifest_search(results, repo, query) |
| 169 | assert(type(results) == "table") | 170 | assert(type(results) == "table") |
| 170 | assert(type(repo) == "string") | 171 | assert(type(repo) == "string") |
| @@ -173,7 +174,7 @@ function manifest_search(results, repo, query) | |||
| 173 | query_arch_as_table(query) | 174 | query_arch_as_table(query) |
| 174 | local manifest, err = manif.load_manifest(repo) | 175 | local manifest, err = manif.load_manifest(repo) |
| 175 | if not manifest then | 176 | if not manifest then |
| 176 | return | 177 | return nil, "Failed loading manifest: "..err |
| 177 | end | 178 | end |
| 178 | for name, versions in pairs(manifest.repository) do | 179 | for name, versions in pairs(manifest.repository) do |
| 179 | for version, items in pairs(versions) do | 180 | for version, items in pairs(versions) do |
| @@ -182,6 +183,7 @@ function manifest_search(results, repo, query) | |||
| 182 | end | 183 | end |
| 183 | end | 184 | end |
| 184 | end | 185 | end |
| 186 | return true | ||
| 185 | end | 187 | end |
| 186 | 188 | ||
| 187 | --- Search on all configured rocks servers. | 189 | --- Search on all configured rocks servers. |
| @@ -199,7 +201,10 @@ function search_repos(query) | |||
| 199 | if protocol == "file" then | 201 | if protocol == "file" then |
| 200 | repo = pathname | 202 | repo = pathname |
| 201 | end | 203 | end |
| 202 | manifest_search(results, repo, query) | 204 | local ok, err = manifest_search(results, repo, query) |
| 205 | if not ok then | ||
| 206 | util.warning("Failed searching manifest: "..err) | ||
| 207 | end | ||
| 203 | end | 208 | end |
| 204 | return results | 209 | return results |
| 205 | end | 210 | end |
| @@ -362,7 +367,7 @@ function run(...) | |||
| 362 | local flags, name, version = util.parse_flags(...) | 367 | local flags, name, version = util.parse_flags(...) |
| 363 | 368 | ||
| 364 | if flags["all"] then | 369 | if flags["all"] then |
| 365 | name, version = "", "" | 370 | name, version = "", nil |
| 366 | end | 371 | end |
| 367 | 372 | ||
| 368 | if type(name) ~= "string" and not flags["all"] then | 373 | if type(name) ~= "string" and not flags["all"] then |
