aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/luarocks/cmd/pack.lua4
-rw-r--r--src/luarocks/pack.lua11
2 files changed, 7 insertions, 8 deletions
diff --git a/src/luarocks/cmd/pack.lua b/src/luarocks/cmd/pack.lua
index 3d3cdef5..52b2fbca 100644
--- a/src/luarocks/cmd/pack.lua
+++ b/src/luarocks/cmd/pack.lua
@@ -5,6 +5,7 @@ local cmd_pack = {}
5 5
6local util = require("luarocks.util") 6local util = require("luarocks.util")
7local pack = require("luarocks.pack") 7local pack = require("luarocks.pack")
8local queries = require("luarocks.queries")
8 9
9cmd_pack.help_summary = "Create a rock, packing sources or binaries." 10cmd_pack.help_summary = "Create a rock, packing sources or binaries."
10cmd_pack.help_arguments = "{<rockspec>|<name> [<version>]}" 11cmd_pack.help_arguments = "{<rockspec>|<name> [<version>]}"
@@ -33,7 +34,8 @@ function cmd_pack.command(flags, arg, version)
33 file, err = pack.pack_source_rock(arg) 34 file, err = pack.pack_source_rock(arg)
34 else 35 else
35 local name = util.adjust_name_and_namespace(arg, flags) 36 local name = util.adjust_name_and_namespace(arg, flags)
36 file, err = pack.pack_installed_rock(name, version, flags["tree"]) 37 local query = queries.new(name, version)
38 file, err = pack.pack_installed_rock(query, flags["tree"])
37 end 39 end
38 if err then 40 if err then
39 return nil, err 41 return nil, err
diff --git a/src/luarocks/pack.lua b/src/luarocks/pack.lua
index a02fb677..60ba4caf 100644
--- a/src/luarocks/pack.lua
+++ b/src/luarocks/pack.lua
@@ -77,13 +77,9 @@ end
77-- @param tree string or nil: An optional tree to pick the package from. 77-- @param tree string or nil: An optional tree to pick the package from.
78-- @return string or (nil, string): The filename of the resulting 78-- @return string or (nil, string): The filename of the resulting
79-- .src.rock file; or nil and an error message. 79-- .src.rock file; or nil and an error message.
80function pack.pack_installed_rock(name, version, tree) 80function pack.pack_installed_rock(query, tree)
81 assert(type(name) == "string")
82 assert(type(version) == "string" or not version)
83 81
84 local query = queries.new(name, version) 82 local name, version, repo, repo_url = search.pick_installed_rock(query, tree)
85 local repo, repo_url
86 name, version, repo, repo_url = search.pick_installed_rock(query, tree)
87 if not name then 83 if not name then
88 return nil, version 84 return nil, version
89 end 85 end
@@ -152,7 +148,8 @@ function pack.pack_binary_rock(name, version, cmd)
152 if not rname then 148 if not rname then
153 rname, rversion = name, version 149 rname, rversion = name, version
154 end 150 end
155 return pack.pack_installed_rock(rname, rversion, temp_dir) 151 local query = queries.new(rname, rversion)
152 return pack.pack_installed_rock(query, temp_dir)
156end 153end
157 154
158return pack 155return pack