diff options
author | V1K1NGbg <victor@ilchev.com> | 2024-08-07 12:03:27 +0300 |
---|---|---|
committer | V1K1NGbg <victor@ilchev.com> | 2024-08-07 12:03:27 +0300 |
commit | cef57f360161992b31c9d8c8295a93a0899575ad (patch) | |
tree | 560faafd3466f34a70f3340410c7e80ee70b45a5 | |
parent | d0ad534174dce8de546249b100dfac347bf45bec (diff) | |
download | luarocks-cef57f360161992b31c9d8c8295a93a0899575ad.tar.gz luarocks-cef57f360161992b31c9d8c8295a93a0899575ad.tar.bz2 luarocks-cef57f360161992b31c9d8c8295a93a0899575ad.zip |
queries and results fix
-rw-r--r-- | src/luarocks/core/types/query.tl (renamed from src/luarocks/core/types/query.d.tl) | 0 | ||||
-rw-r--r-- | src/luarocks/core/types/result.tl (renamed from src/luarocks/core/types/result.d.tl) | 0 | ||||
-rw-r--r-- | src/luarocks/queries.tl | 18 | ||||
-rw-r--r-- | src/luarocks/results.tl | 10 |
4 files changed, 14 insertions, 14 deletions
diff --git a/src/luarocks/core/types/query.d.tl b/src/luarocks/core/types/query.tl index b23579af..b23579af 100644 --- a/src/luarocks/core/types/query.d.tl +++ b/src/luarocks/core/types/query.tl | |||
diff --git a/src/luarocks/core/types/result.d.tl b/src/luarocks/core/types/result.tl index a23339d4..a23339d4 100644 --- a/src/luarocks/core/types/result.d.tl +++ b/src/luarocks/core/types/result.tl | |||
diff --git a/src/luarocks/queries.tl b/src/luarocks/queries.tl index b6e7a392..7729ab5f 100644 --- a/src/luarocks/queries.tl +++ b/src/luarocks/queries.tl | |||
@@ -6,8 +6,8 @@ local vers = require("luarocks.core.vers") | |||
6 | local util = require("luarocks.util") | 6 | local util = require("luarocks.util") |
7 | local cfg = require("luarocks.core.cfg") | 7 | local cfg = require("luarocks.core.cfg") |
8 | 8 | ||
9 | local type q = require("luarocks.core.types.query") | 9 | local query = require("luarocks.core.types.query") |
10 | local type Query = q.Query | 10 | local type Query = query.Query |
11 | 11 | ||
12 | local type ver = require("luarocks.core.types.version") | 12 | local type ver = require("luarocks.core.types.version") |
13 | local type Version = ver.Version | 13 | local type Version = ver.Version |
@@ -15,14 +15,14 @@ local type Constraint = ver.Constraint | |||
15 | 15 | ||
16 | local query_mt: metatable<Query> = {} | 16 | local query_mt: metatable<Query> = {} |
17 | 17 | ||
18 | query_mt.__index = q.Query | 18 | query_mt.__index = query.Query |
19 | 19 | ||
20 | function q.Query.type(): string --? remove later | 20 | function query.Query.type(): string --? remove later |
21 | return "query" | 21 | return "query" |
22 | end | 22 | end |
23 | 23 | ||
24 | -- Fallback default value for the `arch` field, if not explicitly set. | 24 | -- Fallback default value for the `arch` field, if not explicitly set. |
25 | q.Query.arch = { | 25 | query.Query.arch = { |
26 | src = true, | 26 | src = true, |
27 | all = true, | 27 | all = true, |
28 | rockspec = true, | 28 | rockspec = true, |
@@ -31,7 +31,7 @@ q.Query.arch = { | |||
31 | } | 31 | } |
32 | 32 | ||
33 | -- Fallback default value for the `substring` field, if not explicitly set. | 33 | -- Fallback default value for the `substring` field, if not explicitly set. |
34 | q.Query.substring = false | 34 | query.Query.substring = false |
35 | 35 | ||
36 | --- Convert the arch field of a query table to table format. | 36 | --- Convert the arch field of a query table to table format. |
37 | -- @param input string, table or nil | 37 | -- @param input string, table or nil |
@@ -76,7 +76,7 @@ function queries.new(name: string, namespace?: string, version?: string, substri | |||
76 | table.insert(self.constraints, { op = operator, version = vers.parse_version(version)}) | 76 | table.insert(self.constraints, { op = operator, version = vers.parse_version(version)}) |
77 | end | 77 | end |
78 | 78 | ||
79 | q.Query.arch[cfg.arch] = true | 79 | query.Query.arch[cfg.arch] = true |
80 | return setmetatable(self, query_mt) | 80 | return setmetatable(self, query_mt) |
81 | end | 81 | end |
82 | 82 | ||
@@ -180,13 +180,13 @@ do | |||
180 | constraints = constraints, | 180 | constraints = constraints, |
181 | } | 181 | } |
182 | 182 | ||
183 | q.Query.arch[cfg.arch] = true | 183 | query.Query.arch[cfg.arch] = true |
184 | return setmetatable(self, query_mt) | 184 | return setmetatable(self, query_mt) |
185 | end | 185 | end |
186 | end | 186 | end |
187 | 187 | ||
188 | function queries.from_persisted_table(tbl: Query): Query | 188 | function queries.from_persisted_table(tbl: Query): Query |
189 | q.Query.arch[cfg.arch] = true | 189 | query.Query.arch[cfg.arch] = true |
190 | return setmetatable(tbl, query_mt) | 190 | return setmetatable(tbl, query_mt) |
191 | end | 191 | end |
192 | 192 | ||
diff --git a/src/luarocks/results.tl b/src/luarocks/results.tl index cefc5ea2..e6c849a6 100644 --- a/src/luarocks/results.tl +++ b/src/luarocks/results.tl | |||
@@ -6,14 +6,14 @@ local util = require("luarocks.util") | |||
6 | local type q = require("luarocks.core.types.query") | 6 | local type q = require("luarocks.core.types.query") |
7 | local type Query = q.Query | 7 | local type Query = q.Query |
8 | 8 | ||
9 | local type r = require("luarocks.core.types.result") | 9 | local type result = require("luarocks.core.types.result") |
10 | local type Result = r.Result | 10 | local type Result = result.Result |
11 | 11 | ||
12 | local result_mt: metatable<Result> = {} | 12 | local result_mt: metatable<Result> = {} |
13 | 13 | ||
14 | result_mt.__index = r.Result | 14 | result_mt.__index = result.Result |
15 | 15 | ||
16 | function r.Result.type(): string --? remove later | 16 | function result.Result.type(): string --? remove later |
17 | return "result" | 17 | return "result" |
18 | end | 18 | end |
19 | 19 | ||
@@ -57,7 +57,7 @@ end | |||
57 | --- Returns true if the result satisfies a given query. | 57 | --- Returns true if the result satisfies a given query. |
58 | -- @param query: a query. | 58 | -- @param query: a query. |
59 | -- @return boolean. | 59 | -- @return boolean. |
60 | function r.Result:satisfies(query: Query): boolean | 60 | function result.Result:satisfies(query: Query): boolean |
61 | return match_name(query, self.name) | 61 | return match_name(query, self.name) |
62 | and (query.arch[self.arch] or query.arch["any"]) | 62 | and (query.arch[self.arch] or query.arch["any"]) |
63 | and ((not query.namespace) or (query.namespace == self.namespace)) | 63 | and ((not query.namespace) or (query.namespace == self.namespace)) |