diff options
author | V1K1NGbg <victor@ilchev.com> | 2024-08-12 15:39:43 +0300 |
---|---|---|
committer | V1K1NGbg <victor@ilchev.com> | 2024-08-12 15:39:43 +0300 |
commit | 6297dbfd0723ef53717dfa0a9fc9ef12b2e3488c (patch) | |
tree | c9549a8f360a4d1d14889c2d8db011f35eaf5eb1 | |
parent | d822c9375552013830006cf07bcf4bdc2b83876f (diff) | |
download | luarocks-6297dbfd0723ef53717dfa0a9fc9ef12b2e3488c.tar.gz luarocks-6297dbfd0723ef53717dfa0a9fc9ef12b2e3488c.tar.bz2 luarocks-6297dbfd0723ef53717dfa0a9fc9ef12b2e3488c.zip |
queries
-rw-r--r-- | src/luarocks/queries.lua | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/src/luarocks/queries.lua b/src/luarocks/queries.lua index 89cd1799..12eb9237 100644 --- a/src/luarocks/queries.lua +++ b/src/luarocks/queries.lua | |||
@@ -1,18 +1,13 @@ | |||
1 | local _tl_compat; if (tonumber((_VERSION or ''):match('[%d.]*$')) or 0) < 5.3 then local p, m = pcall(require, 'compat53.module'); if p then _tl_compat = m end end; local ipairs = _tl_compat and _tl_compat.ipairs or ipairs; local string = _tl_compat and _tl_compat.string or string; local table = _tl_compat and _tl_compat.table or table | 1 | local _tl_compat; if (tonumber((_VERSION or ''):match('[%d.]*$')) or 0) < 5.3 then local p, m = pcall(require, 'compat53.module'); if p then _tl_compat = m end end; local ipairs = _tl_compat and _tl_compat.ipairs or ipairs; local string = _tl_compat and _tl_compat.string or string; local table = _tl_compat and _tl_compat.table or table |
2 | local queries = {Query = {}, } | 2 | local queries = {} |
3 | |||
4 | |||
5 | |||
6 | |||
7 | |||
8 | |||
9 | |||
10 | 3 | ||
11 | 4 | ||
12 | local vers = require("luarocks.core.vers") | 5 | local vers = require("luarocks.core.vers") |
13 | local util = require("luarocks.util") | 6 | local util = require("luarocks.util") |
14 | local cfg = require("luarocks.core.cfg") | 7 | local cfg = require("luarocks.core.cfg") |
15 | 8 | ||
9 | local query = require("luarocks.core.types.query") | ||
10 | |||
16 | 11 | ||
17 | 12 | ||
18 | 13 | ||
@@ -20,14 +15,14 @@ local cfg = require("luarocks.core.cfg") | |||
20 | 15 | ||
21 | local query_mt = {} | 16 | local query_mt = {} |
22 | 17 | ||
23 | query_mt.__index = queries.Query | 18 | query_mt.__index = query.Query |
24 | 19 | ||
25 | function queries.Query.type() | 20 | function query.Query.type() |
26 | return "query" | 21 | return "query" |
27 | end | 22 | end |
28 | 23 | ||
29 | 24 | ||
30 | queries.Query.arch = { | 25 | query.Query.arch = { |
31 | src = true, | 26 | src = true, |
32 | all = true, | 27 | all = true, |
33 | rockspec = true, | 28 | rockspec = true, |
@@ -36,7 +31,7 @@ queries.Query.arch = { | |||
36 | } | 31 | } |
37 | 32 | ||
38 | 33 | ||
39 | queries.Query.substring = false | 34 | query.Query.substring = false |
40 | 35 | ||
41 | 36 | ||
42 | 37 | ||
@@ -81,7 +76,7 @@ function queries.new(name, namespace, version, substring, arch, operator) | |||
81 | table.insert(self.constraints, { op = operator, version = vers.parse_version(version) }) | 76 | table.insert(self.constraints, { op = operator, version = vers.parse_version(version) }) |
82 | end | 77 | end |
83 | 78 | ||
84 | queries.Query.arch[cfg.arch] = true | 79 | query.Query.arch[cfg.arch] = true |
85 | return setmetatable(self, query_mt) | 80 | return setmetatable(self, query_mt) |
86 | end | 81 | end |
87 | 82 | ||
@@ -185,13 +180,13 @@ do | |||
185 | constraints = constraints, | 180 | constraints = constraints, |
186 | } | 181 | } |
187 | 182 | ||
188 | queries.Query.arch[cfg.arch] = true | 183 | query.Query.arch[cfg.arch] = true |
189 | return setmetatable(self, query_mt) | 184 | return setmetatable(self, query_mt) |
190 | end | 185 | end |
191 | end | 186 | end |
192 | 187 | ||
193 | function queries.from_persisted_table(tbl) | 188 | function queries.from_persisted_table(tbl) |
194 | queries.Query.arch[cfg.arch] = true | 189 | query.Query.arch[cfg.arch] = true |
195 | return setmetatable(tbl, query_mt) | 190 | return setmetatable(tbl, query_mt) |
196 | end | 191 | end |
197 | 192 | ||
@@ -200,7 +195,6 @@ end | |||
200 | 195 | ||
201 | 196 | ||
202 | function query_mt.__tostring(self) | 197 | function query_mt.__tostring(self) |
203 | |||
204 | local out = {} | 198 | local out = {} |
205 | if self.namespace then | 199 | if self.namespace then |
206 | table.insert(out, self.namespace) | 200 | table.insert(out, self.namespace) |