aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorV1K1NGbg <victor@ilchev.com>2024-08-12 15:39:43 +0300
committerV1K1NGbg <victor@ilchev.com>2024-08-12 15:39:43 +0300
commit6297dbfd0723ef53717dfa0a9fc9ef12b2e3488c (patch)
treec9549a8f360a4d1d14889c2d8db011f35eaf5eb1
parentd822c9375552013830006cf07bcf4bdc2b83876f (diff)
downloadluarocks-6297dbfd0723ef53717dfa0a9fc9ef12b2e3488c.tar.gz
luarocks-6297dbfd0723ef53717dfa0a9fc9ef12b2e3488c.tar.bz2
luarocks-6297dbfd0723ef53717dfa0a9fc9ef12b2e3488c.zip
queries
-rw-r--r--src/luarocks/queries.lua26
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 @@
1local _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 1local _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
2local queries = {Query = {}, } 2local queries = {}
3
4
5
6
7
8
9
10 3
11 4
12local vers = require("luarocks.core.vers") 5local vers = require("luarocks.core.vers")
13local util = require("luarocks.util") 6local util = require("luarocks.util")
14local cfg = require("luarocks.core.cfg") 7local cfg = require("luarocks.core.cfg")
15 8
9local 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
21local query_mt = {} 16local query_mt = {}
22 17
23query_mt.__index = queries.Query 18query_mt.__index = query.Query
24 19
25function queries.Query.type() 20function query.Query.type()
26 return "query" 21 return "query"
27end 22end
28 23
29 24
30queries.Query.arch = { 25query.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
39queries.Query.substring = false 34query.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)
86end 81end
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
191end 186end
192 187
193function queries.from_persisted_table(tbl) 188function 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)
196end 191end
197 192
@@ -200,7 +195,6 @@ end
200 195
201 196
202function query_mt.__tostring(self) 197function 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)