diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2018-04-05 16:32:58 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-04-11 14:38:06 -0300 |
| commit | 1f0e55811b54201625f8397d14015048394d0825 (patch) | |
| tree | 5cb59247967ce0087b6c9438d67393aa1060863e /src | |
| parent | b314a84bf814bcf3a6ac596ccb43699a5a3c36b8 (diff) | |
| download | luarocks-1f0e55811b54201625f8397d14015048394d0825.tar.gz luarocks-1f0e55811b54201625f8397d14015048394d0825.tar.bz2 luarocks-1f0e55811b54201625f8397d14015048394d0825.zip | |
Make pack_installed_rock operate on query objects
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/cmd/pack.lua | 4 | ||||
| -rw-r--r-- | src/luarocks/pack.lua | 11 |
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 | ||
| 6 | local util = require("luarocks.util") | 6 | local util = require("luarocks.util") |
| 7 | local pack = require("luarocks.pack") | 7 | local pack = require("luarocks.pack") |
| 8 | local queries = require("luarocks.queries") | ||
| 8 | 9 | ||
| 9 | cmd_pack.help_summary = "Create a rock, packing sources or binaries." | 10 | cmd_pack.help_summary = "Create a rock, packing sources or binaries." |
| 10 | cmd_pack.help_arguments = "{<rockspec>|<name> [<version>]}" | 11 | cmd_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. |
| 80 | function pack.pack_installed_rock(name, version, tree) | 80 | function 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) | ||
| 156 | end | 153 | end |
| 157 | 154 | ||
| 158 | return pack | 155 | return pack |
