diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2014-01-09 20:42:25 -0200 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2014-01-09 20:44:25 -0200 |
commit | 757539bac6ed6271d9f125a36c77dcd7366e7f50 (patch) | |
tree | e71374265a9ac443353df40da8c680740cd7f128 | |
parent | 2511c8377f6c924625b10d6e6cc77c5053890b94 (diff) | |
download | luarocks-757539bac6ed6271d9f125a36c77dcd7366e7f50.tar.gz luarocks-757539bac6ed6271d9f125a36c77dcd7366e7f50.tar.bz2 luarocks-757539bac6ed6271d9f125a36c77dcd7366e7f50.zip |
Performance improvements
-rwxr-xr-x | src/bin/luarocks | 36 | ||||
-rw-r--r-- | src/luarocks/build/builtin.lua | 3 | ||||
-rw-r--r-- | src/luarocks/command_line.lua | 3 | ||||
-rw-r--r-- | src/luarocks/deps.lua | 2 | ||||
-rw-r--r-- | src/luarocks/dir.lua | 14 | ||||
-rw-r--r-- | src/luarocks/fetch.lua | 18 | ||||
-rw-r--r-- | src/luarocks/help.lua | 19 | ||||
-rw-r--r-- | src/luarocks/index.lua | 11 | ||||
-rw-r--r-- | src/luarocks/manif.lua | 79 | ||||
-rw-r--r-- | src/luarocks/search.lua | 7 |
10 files changed, 108 insertions, 84 deletions
diff --git a/src/bin/luarocks b/src/bin/luarocks index 6ab27fa3..e9cfc349 100755 --- a/src/bin/luarocks +++ b/src/bin/luarocks | |||
@@ -5,22 +5,24 @@ local command_line = require("luarocks.command_line") | |||
5 | 5 | ||
6 | program_description = "LuaRocks main command-line interface" | 6 | program_description = "LuaRocks main command-line interface" |
7 | 7 | ||
8 | commands = {} | 8 | commands = { |
9 | commands.help = require("luarocks.help") | 9 | help = "luarocks.help", |
10 | commands.pack = require("luarocks.pack") | 10 | pack = "luarocks.pack", |
11 | commands.unpack = require("luarocks.unpack") | 11 | unpack = "luarocks.unpack", |
12 | commands.build = require("luarocks.build") | 12 | build = "luarocks.build", |
13 | commands.install = require("luarocks.install") | 13 | install = "luarocks.install", |
14 | commands.search = require("luarocks.search") | 14 | search = "luarocks.search", |
15 | commands.list = require("luarocks.list") | 15 | list = "luarocks.list", |
16 | commands.remove = require("luarocks.remove") | 16 | remove = "luarocks.remove", |
17 | commands.make = require("luarocks.make") | 17 | make = "luarocks.make", |
18 | commands.download = require("luarocks.download") | 18 | download = "luarocks.download", |
19 | commands.path = require("luarocks.path") | 19 | path = "luarocks.path", |
20 | commands.show = require("luarocks.show") | 20 | show = "luarocks.show", |
21 | commands.new_version = require("luarocks.new_version") | 21 | new_version = "luarocks.new_version", |
22 | commands.lint = require("luarocks.lint") | 22 | lint = "luarocks.lint", |
23 | commands.write_rockspec = require("luarocks.write_rockspec") | 23 | write_rockspec = "luarocks.write_rockspec", |
24 | commands.purge = require("luarocks.purge") | 24 | purge = "luarocks.purge", |
25 | doc = "luarocks.doc", | ||
26 | } | ||
25 | 27 | ||
26 | command_line.run_command(...) | 28 | command_line.run_command(...) |
diff --git a/src/luarocks/build/builtin.lua b/src/luarocks/build/builtin.lua index f9ef4c44..5c58265a 100644 --- a/src/luarocks/build/builtin.lua +++ b/src/luarocks/build/builtin.lua | |||
@@ -235,8 +235,9 @@ function run(rockspec) | |||
235 | table.insert(objects, object) | 235 | table.insert(objects, object) |
236 | end | 236 | end |
237 | if not ok then break end | 237 | if not ok then break end |
238 | local module_name = dir.path(moddir, name:match("([^.]*)$").."."..util.matchquote(cfg.lib_extension)):gsub("//", "/") | 238 | local module_name = name:match("([^.]*)$").."."..util.matchquote(cfg.lib_extension) |
239 | if moddir ~= "" then | 239 | if moddir ~= "" then |
240 | module_name = dir.path(moddir, module_name) | ||
240 | local ok, err = fs.make_dir(moddir) | 241 | local ok, err = fs.make_dir(moddir) |
241 | if not ok then return nil, err end | 242 | if not ok then return nil, err end |
242 | end | 243 | end |
diff --git a/src/luarocks/command_line.lua b/src/luarocks/command_line.lua index e79b1442..19d04290 100644 --- a/src/luarocks/command_line.lua +++ b/src/luarocks/command_line.lua | |||
@@ -185,7 +185,8 @@ function run_command(...) | |||
185 | -- I'm not changing this now to avoid messing with the run() | 185 | -- I'm not changing this now to avoid messing with the run() |
186 | -- interface, which I know some people use (even though | 186 | -- interface, which I know some people use (even though |
187 | -- I never published it as a public API...) | 187 | -- I never published it as a public API...) |
188 | local xp, ok, err, exitcode = xpcall(function() return commands[command].run(unpack(args)) end, function(err) | 188 | local cmd = require(commands[command]) |
189 | local xp, ok, err, exitcode = xpcall(function() return cmd.run(unpack(args)) end, function(err) | ||
189 | die(debug.traceback("LuaRocks "..cfg.program_version | 190 | die(debug.traceback("LuaRocks "..cfg.program_version |
190 | .." bug (please report at luarocks-developers@lists.sourceforge.net).\n" | 191 | .." bug (please report at luarocks-developers@lists.sourceforge.net).\n" |
191 | ..err, 2)) | 192 | ..err, 2)) |
diff --git a/src/luarocks/deps.lua b/src/luarocks/deps.lua index 116b4bbb..0adb5834 100644 --- a/src/luarocks/deps.lua +++ b/src/luarocks/deps.lua | |||
@@ -689,7 +689,7 @@ function scan_deps(results, missing, manifest, name, version, deps_mode) | |||
689 | local deplist = dependencies_name[version] | 689 | local deplist = dependencies_name[version] |
690 | local rockspec, err | 690 | local rockspec, err |
691 | if not deplist then | 691 | if not deplist then |
692 | rockspec, err = fetch.load_local_rockspec(path.rockspec_file(name, version)) | 692 | rockspec, err = fetch.load_local_rockspec(path.rockspec_file(name, version), false) |
693 | if err then | 693 | if err then |
694 | missing[name.." "..version] = err | 694 | missing[name.." "..version] = err |
695 | return results, missing | 695 | return results, missing |
diff --git a/src/luarocks/dir.lua b/src/luarocks/dir.lua index e8cd746e..1f3b5c3d 100644 --- a/src/luarocks/dir.lua +++ b/src/luarocks/dir.lua | |||
@@ -35,17 +35,11 @@ end | |||
35 | -- @return string: a string with a platform-specific representation | 35 | -- @return string: a string with a platform-specific representation |
36 | -- of the path. | 36 | -- of the path. |
37 | function path(...) | 37 | function path(...) |
38 | local items = {...} | 38 | local t = {...} |
39 | local i = 1 | 39 | while t[1] == "" do |
40 | while items[i] do | 40 | table.remove(t, 1) |
41 | items[i] = items[i]:gsub("(.+)/+$", "%1") | ||
42 | if items[i] == "" then | ||
43 | table.remove(items, i) | ||
44 | else | ||
45 | i = i + 1 | ||
46 | end | ||
47 | end | 41 | end |
48 | return (table.concat(items, "/"):gsub("(.+)/+$", "%1")) | 42 | return (table.concat(t, "/"):gsub("([^:])/+", "%1/"):gsub("^/+", "/"):gsub("/*$", "")) |
49 | end | 43 | end |
50 | 44 | ||
51 | --- Split protocol and path from an URL or local pathname. | 45 | --- Split protocol and path from an URL or local pathname. |
diff --git a/src/luarocks/fetch.lua b/src/luarocks/fetch.lua index 53c9d748..83ab6fa9 100644 --- a/src/luarocks/fetch.lua +++ b/src/luarocks/fetch.lua | |||
@@ -137,9 +137,11 @@ end | |||
137 | --- Back-end function that actually loads the local rockspec. | 137 | --- Back-end function that actually loads the local rockspec. |
138 | -- Performs some validation and postprocessing of the rockspec contents. | 138 | -- Performs some validation and postprocessing of the rockspec contents. |
139 | -- @param filename string: The local filename of the rockspec file. | 139 | -- @param filename string: The local filename of the rockspec file. |
140 | -- @param quick boolean: if true, skips some steps when loading | ||
141 | -- rockspec. | ||
140 | -- @return table or (nil, string): A table representing the rockspec | 142 | -- @return table or (nil, string): A table representing the rockspec |
141 | -- or nil followed by an error message. | 143 | -- or nil followed by an error message. |
142 | function load_local_rockspec(filename) | 144 | function load_local_rockspec(filename, quick) |
143 | assert(type(filename) == "string") | 145 | assert(type(filename) == "string") |
144 | filename = fs.absolute_name(filename) | 146 | filename = fs.absolute_name(filename) |
145 | local rockspec, err = persist.load_into_table(filename) | 147 | local rockspec, err = persist.load_into_table(filename) |
@@ -147,9 +149,12 @@ function load_local_rockspec(filename) | |||
147 | return nil, "Could not load rockspec file "..filename.." ("..err..")" | 149 | return nil, "Could not load rockspec file "..filename.." ("..err..")" |
148 | end | 150 | end |
149 | 151 | ||
150 | local ok, err = type_check.type_check_rockspec(rockspec) | 152 | local ok, err = true, nil |
151 | if not ok then | 153 | if not quick then |
152 | return nil, filename..": "..err | 154 | ok, err = type_check.type_check_rockspec(rockspec) |
155 | if not ok then | ||
156 | return nil, filename..": "..err | ||
157 | end | ||
153 | end | 158 | end |
154 | 159 | ||
155 | if rockspec.rockspec_format then | 160 | if rockspec.rockspec_format then |
@@ -207,9 +212,8 @@ function load_local_rockspec(filename) | |||
207 | else | 212 | else |
208 | rockspec.dependencies = {} | 213 | rockspec.dependencies = {} |
209 | end | 214 | end |
210 | local ok, err = path.configure_paths(rockspec) | 215 | if not quick then |
211 | if err then | 216 | path.configure_paths(rockspec) |
212 | return nil, "Error verifying paths: "..err | ||
213 | end | 217 | end |
214 | 218 | ||
215 | return rockspec | 219 | return rockspec |
diff --git a/src/luarocks/help.lua b/src/luarocks/help.lua index 2774dc41..2136f5da 100644 --- a/src/luarocks/help.lua +++ b/src/luarocks/help.lua | |||
@@ -71,14 +71,10 @@ function run(...) | |||
71 | can be overriden with VAR=VALUE assignments.]]) | 71 | can be overriden with VAR=VALUE assignments.]]) |
72 | print_section("COMMANDS") | 72 | print_section("COMMANDS") |
73 | local names = {} | 73 | local names = {} |
74 | for name, command in pairs(commands) do | 74 | for name, command in util.sortedpairs(commands) do |
75 | table.insert(names, name) | 75 | local cmd = require(command) |
76 | end | ||
77 | table.sort(names) | ||
78 | for _, name in ipairs(names) do | ||
79 | local command = commands[name] | ||
80 | util.printout("", name) | 76 | util.printout("", name) |
81 | util.printout("\t", command.help_summary) | 77 | util.printout("\t", cmd.help_summary) |
82 | end | 78 | end |
83 | print_section("CONFIGURATION") | 79 | print_section("CONFIGURATION") |
84 | util.printout("\tLua version: " .. cfg.lua_version) | 80 | util.printout("\tLua version: " .. cfg.lua_version) |
@@ -100,15 +96,16 @@ function run(...) | |||
100 | end | 96 | end |
101 | else | 97 | else |
102 | command = command:gsub("-", "_") | 98 | command = command:gsub("-", "_") |
103 | if commands[command] then | 99 | local cmd = require(commands[command]) |
104 | local arguments = commands[command].help_arguments or "<argument>" | 100 | if cmd then |
101 | local arguments = cmd.help_arguments or "<argument>" | ||
105 | print_banner() | 102 | print_banner() |
106 | print_section("NAME") | 103 | print_section("NAME") |
107 | util.printout("\t"..program.." "..command.." - "..commands[command].help_summary) | 104 | util.printout("\t"..program.." "..command.." - "..cmd.help_summary) |
108 | print_section("SYNOPSIS") | 105 | print_section("SYNOPSIS") |
109 | util.printout("\t"..program.." "..command.." "..arguments) | 106 | util.printout("\t"..program.." "..command.." "..arguments) |
110 | print_section("DESCRIPTION") | 107 | print_section("DESCRIPTION") |
111 | util.printout("",(commands[command].help:gsub("\n","\n\t"):gsub("\n\t$",""))) | 108 | util.printout("",(cmd.help:gsub("\n","\n\t"):gsub("\n\t$",""))) |
112 | print_section("SEE ALSO") | 109 | print_section("SEE ALSO") |
113 | util.printout("","'"..program.." help' for general options and configuration.\n") | 110 | util.printout("","'"..program.." help' for general options and configuration.\n") |
114 | else | 111 | else |
diff --git a/src/luarocks/index.lua b/src/luarocks/index.lua index e0785d9c..1ce66f70 100644 --- a/src/luarocks/index.lua +++ b/src/luarocks/index.lua | |||
@@ -139,15 +139,14 @@ function make_index(repo) | |||
139 | output = output..version..': ' | 139 | output = output..version..': ' |
140 | table.sort(data, function(a,b) return a.arch < b.arch end) | 140 | table.sort(data, function(a,b) return a.arch < b.arch end) |
141 | for _, item in ipairs(data) do | 141 | for _, item in ipairs(data) do |
142 | local link = '<a href="$url">'..item.arch..'</a>' | 142 | local file |
143 | if item.arch == 'rockspec' then | 143 | if item.arch == 'rockspec' then |
144 | local rs = ("%s-%s.rockspec"):format(package, version) | 144 | file = ("%s-%s.rockspec"):format(package, version) |
145 | if not latest_rockspec then latest_rockspec = rs end | 145 | if not latest_rockspec then latest_rockspec = file end |
146 | link = link:gsub("$url", rs) | ||
147 | else | 146 | else |
148 | link = link:gsub("$url", ("%s-%s.%s.rock"):format(package, version, item.arch)) | 147 | file = ("%s-%s.%s.rock"):format(package, version, item.arch) |
149 | end | 148 | end |
150 | table.insert(versions, link) | 149 | table.insert(versions, '<a href="'..file..'">'..item.arch..'</a>') |
151 | end | 150 | end |
152 | output = output .. table.concat(versions, ', ') .. '<br/>' | 151 | output = output .. table.concat(versions, ', ') .. '<br/>' |
153 | end | 152 | end |
diff --git a/src/luarocks/manif.lua b/src/luarocks/manif.lua index 238c4056..ed1780b3 100644 --- a/src/luarocks/manif.lua +++ b/src/luarocks/manif.lua | |||
@@ -231,18 +231,11 @@ end | |||
231 | -- @param deps_mode string: Dependency mode: "one" for the current default tree, | 231 | -- @param deps_mode string: Dependency mode: "one" for the current default tree, |
232 | -- "all" for all trees, "order" for all trees with priority >= the current default, | 232 | -- "all" for all trees, "order" for all trees with priority >= the current default, |
233 | -- "none" for no trees. | 233 | -- "none" for no trees. |
234 | -- @param repodir string: directory of repository being scanned | 234 | local function update_dependencies(manifest, deps_mode) |
235 | -- @param filter_lua string or nil: filter by Lua version | ||
236 | -- @param cache table: temporary rockspec cache table | ||
237 | local function update_dependencies(manifest, deps_mode, repodir, filter_lua, cache) | ||
238 | assert(type(manifest) == "table") | 235 | assert(type(manifest) == "table") |
239 | assert(type(deps_mode) == "string") | 236 | assert(type(deps_mode) == "string") |
240 | 237 | ||
241 | cache = cache or {} | ||
242 | local lua_version = filter_lua and deps.parse_version(filter_lua) | ||
243 | |||
244 | for pkg, versions in pairs(manifest.repository) do | 238 | for pkg, versions in pairs(manifest.repository) do |
245 | local to_remove = {} | ||
246 | for version, repositories in pairs(versions) do | 239 | for version, repositories in pairs(versions) do |
247 | local current = pkg.." "..version | 240 | local current = pkg.." "..version |
248 | for _, repo in ipairs(repositories) do | 241 | for _, repo in ipairs(repositories) do |
@@ -259,11 +252,34 @@ local function update_dependencies(manifest, deps_mode, repodir, filter_lua, cac | |||
259 | end | 252 | end |
260 | end | 253 | end |
261 | end | 254 | end |
262 | elseif filter_lua and repo.arch == "rockspec" then | 255 | end |
256 | end | ||
257 | end | ||
258 | end | ||
259 | end | ||
260 | |||
261 | --- Filter manifest table by Lua version, removing rockspecs whose Lua version | ||
262 | -- does not match. | ||
263 | -- @param manifest table: a manifest table. | ||
264 | -- @param lua_version string or nil: filter by Lua version | ||
265 | -- @param repodir string: directory of repository being scanned | ||
266 | -- @param cache table: temporary rockspec cache table | ||
267 | local function filter_by_lua_version(manifest, lua_version, repodir, cache) | ||
268 | assert(type(manifest) == "table") | ||
269 | assert(type(repodir) == "string") | ||
270 | assert((not cache) or type(cache) == "table") | ||
271 | |||
272 | cache = cache or {} | ||
273 | lua_version = deps.parse_version(lua_version) | ||
274 | for pkg, versions in pairs(manifest.repository) do | ||
275 | local to_remove = {} | ||
276 | for version, repositories in pairs(versions) do | ||
277 | for _, repo in ipairs(repositories) do | ||
278 | if repo.arch == "rockspec" then | ||
263 | local pathname = dir.path(repodir, pkg.."-"..version..".rockspec") | 279 | local pathname = dir.path(repodir, pkg.."-"..version..".rockspec") |
264 | local rockspec, err = cache[pathname] | 280 | local rockspec, err = cache[pathname] |
265 | if not rockspec then | 281 | if not rockspec then |
266 | rockspec, err = fetch.load_local_rockspec(pathname) | 282 | rockspec, err = fetch.load_local_rockspec(pathname, true) |
267 | end | 283 | end |
268 | if rockspec then | 284 | if rockspec then |
269 | cache[pathname] = rockspec | 285 | cache[pathname] = rockspec |
@@ -283,9 +299,9 @@ local function update_dependencies(manifest, deps_mode, repodir, filter_lua, cac | |||
283 | end | 299 | end |
284 | if next(to_remove) then | 300 | if next(to_remove) then |
285 | for _, incompat in ipairs(to_remove) do | 301 | for _, incompat in ipairs(to_remove) do |
286 | manifest.repository[pkg][incompat] = nil | 302 | versions[incompat] = nil |
287 | end | 303 | end |
288 | if not next(manifest.repository[pkg]) then | 304 | if not next(versions) then |
289 | manifest.repository[pkg] = nil | 305 | manifest.repository[pkg] = nil |
290 | end | 306 | end |
291 | end | 307 | end |
@@ -296,17 +312,12 @@ end | |||
296 | -- @param results table: The search results as returned by search.disk_search. | 312 | -- @param results table: The search results as returned by search.disk_search. |
297 | -- @param manifest table: A manifest table (must contain repository, modules, commands tables). | 313 | -- @param manifest table: A manifest table (must contain repository, modules, commands tables). |
298 | -- It will be altered to include the search results. | 314 | -- It will be altered to include the search results. |
299 | -- @param deps_mode string: Dependency mode: "one" for the current default tree, | 315 | -- @param dep_handler: dependency handler function |
300 | -- "all" for all trees, "order" for all trees with priority >= the current default, | ||
301 | -- "none" for no trees. | ||
302 | -- @param repo string: directory of repository | ||
303 | -- @param filter_lua string or nil: filter by Lua version | ||
304 | -- @param cache table: temporary rockspec cache table | ||
305 | -- @return boolean or (nil, string): true in case of success, or nil followed by an error message. | 316 | -- @return boolean or (nil, string): true in case of success, or nil followed by an error message. |
306 | local function store_results(results, manifest, deps_mode, repo, filter_lua, cache) | 317 | local function store_results(results, manifest, dep_handler) |
307 | assert(type(results) == "table") | 318 | assert(type(results) == "table") |
308 | assert(type(manifest) == "table") | 319 | assert(type(manifest) == "table") |
309 | assert(type(deps_mode) == "string") | 320 | assert((not dep_handler) or type(dep_handler) == "function") |
310 | 321 | ||
311 | for name, versions in pairs(results) do | 322 | for name, versions in pairs(results) do |
312 | local pkgtable = manifest.repository[name] or {} | 323 | local pkgtable = manifest.repository[name] or {} |
@@ -329,7 +340,9 @@ local function store_results(results, manifest, deps_mode, repo, filter_lua, cac | |||
329 | end | 340 | end |
330 | manifest.repository[name] = pkgtable | 341 | manifest.repository[name] = pkgtable |
331 | end | 342 | end |
332 | update_dependencies(manifest, deps_mode, repo, filter_lua, cache) | 343 | if dep_handler then |
344 | dep_handler(manifest) | ||
345 | end | ||
333 | sort_package_matching_table(manifest.modules) | 346 | sort_package_matching_table(manifest.modules) |
334 | sort_package_matching_table(manifest.commands) | 347 | sort_package_matching_table(manifest.commands) |
335 | return true | 348 | return true |
@@ -345,7 +358,7 @@ end | |||
345 | -- @param versioned boolean: if versioned versions of the manifest should be created. | 358 | -- @param versioned boolean: if versioned versions of the manifest should be created. |
346 | -- @return boolean or (nil, string): True if manifest was generated, | 359 | -- @return boolean or (nil, string): True if manifest was generated, |
347 | -- or nil and an error message. | 360 | -- or nil and an error message. |
348 | function make_manifest(repo, deps_mode, versioned) | 361 | function make_manifest(repo, deps_mode, remote) |
349 | assert(type(repo) == "string") | 362 | assert(type(repo) == "string") |
350 | assert(type(deps_mode) == "string") | 363 | assert(type(deps_mode) == "string") |
351 | 364 | ||
@@ -363,14 +376,23 @@ function make_manifest(repo, deps_mode, versioned) | |||
363 | 376 | ||
364 | manif_core.manifest_cache[repo] = manifest | 377 | manif_core.manifest_cache[repo] = manifest |
365 | 378 | ||
366 | local cache = {} | 379 | local dep_handler = nil |
367 | local ok, err = store_results(results, manifest, deps_mode, repo, nil, cache) | 380 | if not remote then |
381 | dep_handler = function(manifest) | ||
382 | update_dependencies(manifest, deps_mode) | ||
383 | end | ||
384 | end | ||
385 | local ok, err = store_results(results, manifest, dep_handler) | ||
368 | if not ok then return nil, err end | 386 | if not ok then return nil, err end |
369 | 387 | ||
370 | if versioned then | 388 | if remote then |
389 | local cache = {} | ||
371 | for luaver in util.lua_versions() do | 390 | for luaver in util.lua_versions() do |
372 | local vmanifest = { repository = {}, modules = {}, commands = {} } | 391 | local vmanifest = { repository = {}, modules = {}, commands = {} } |
373 | local ok, err = store_results(results, vmanifest, deps_mode, repo, luaver, cache) | 392 | local dep_handler = function(manifest) |
393 | filter_by_lua_version(manifest, luaver, repo, cache) | ||
394 | end | ||
395 | local ok, err = store_results(results, vmanifest, dep_handler) | ||
374 | save_table(repo, "manifest-"..luaver, vmanifest) | 396 | save_table(repo, "manifest-"..luaver, vmanifest) |
375 | end | 397 | end |
376 | end | 398 | end |
@@ -416,7 +438,10 @@ function update_manifest(name, version, repo, deps_mode) | |||
416 | 438 | ||
417 | local results = {[name] = {[version] = {{arch = "installed", repo = repo}}}} | 439 | local results = {[name] = {[version] = {{arch = "installed", repo = repo}}}} |
418 | 440 | ||
419 | local ok, err = store_results(results, manifest, deps_mode, repo) | 441 | local dep_handler = function(manifest) |
442 | update_dependencies(manifest, deps_mode) | ||
443 | end | ||
444 | local ok, err = store_results(results, manifest, dep_handler) | ||
420 | if not ok then return nil, err end | 445 | if not ok then return nil, err end |
421 | 446 | ||
422 | return save_table(repo, "manifest", manifest) | 447 | return save_table(repo, "manifest", manifest) |
diff --git a/src/luarocks/search.lua b/src/luarocks/search.lua index 76ea6815..ad205d6a 100644 --- a/src/luarocks/search.lua +++ b/src/luarocks/search.lua | |||
@@ -139,14 +139,15 @@ function disk_search(repo, query, results) | |||
139 | for _, name in pairs(fs.list_dir(repo)) do | 139 | for _, name in pairs(fs.list_dir(repo)) do |
140 | local pathname = dir.path(repo, name) | 140 | local pathname = dir.path(repo, name) |
141 | local rname, rversion, rarch = path.parse_name(name) | 141 | local rname, rversion, rarch = path.parse_name(name) |
142 | if fs.is_dir(pathname) then | 142 | |
143 | if rname and (pathname:match(".rockspec$") or pathname:match(".rock$")) then | ||
144 | store_if_match(results, repo, rname, rversion, rarch, query) | ||
145 | elseif fs.is_dir(pathname) then | ||
143 | for _, version in pairs(fs.list_dir(pathname)) do | 146 | for _, version in pairs(fs.list_dir(pathname)) do |
144 | if version:match("-%d+$") then | 147 | if version:match("-%d+$") then |
145 | store_if_match(results, repo, name, version, "installed", query) | 148 | store_if_match(results, repo, name, version, "installed", query) |
146 | end | 149 | end |
147 | end | 150 | end |
148 | elseif rname then | ||
149 | store_if_match(results, repo, rname, rversion, rarch, query) | ||
150 | end | 151 | end |
151 | end | 152 | end |
152 | return results | 153 | return results |