aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorV1K1NGbg <victor@ilchev.com>2024-08-07 01:42:32 +0300
committerV1K1NGbg <victor@ilchev.com>2024-08-07 01:42:32 +0300
commit2ede31600f77ba539904cf4055260a5d0937f8fc (patch)
treef1d4102a2dc9f2c8c19522298c1bc29b758a3fb5
parentb49baa4c0dd1584902dd904b740f4505eb9a7cb7 (diff)
downloadluarocks-2ede31600f77ba539904cf4055260a5d0937f8fc.tar.gz
luarocks-2ede31600f77ba539904cf4055260a5d0937f8fc.tar.bz2
luarocks-2ede31600f77ba539904cf4055260a5d0937f8fc.zip
deps
-rw-r--r--src/luarocks/deps.lua24
-rw-r--r--src/luarocks/deps.tl24
2 files changed, 24 insertions, 24 deletions
diff --git a/src/luarocks/deps.lua b/src/luarocks/deps.lua
index 3e2ff522..2edee8a6 100644
--- a/src/luarocks/deps.lua
+++ b/src/luarocks/deps.lua
@@ -97,16 +97,16 @@ end
97 97
98 98
99 99
100local function match_dep(dep, 100local function match_dep(depq,
101 get_versions) 101 get_versions)
102 102
103 local versions, locations, lockversion, provided = get_versions(dep) 103 local versions, locations, lockversion, provided = get_versions(depq)
104 104
105 local latest_version 105 local latest_version
106 local latest_vstring 106 local latest_vstring
107 for _, vstring in ipairs(versions) do 107 for _, vstring in ipairs(versions) do
108 local version = vers.parse_version(vstring) 108 local version = vers.parse_version(vstring)
109 if vers.match_constraints(version, dep.constraints) then 109 if vers.match_constraints(version, depq.constraints) then
110 if not latest_version or version > latest_version then 110 if not latest_version or version > latest_version then
111 latest_version = version 111 latest_version = version
112 latest_vstring = vstring 112 latest_vstring = vstring
@@ -119,11 +119,11 @@ local function match_dep(dep,
119 if latest_vstring and latest_vstring ~= lockversion then 119 if latest_vstring and latest_vstring ~= lockversion then
120 latest_matching_msg = " (latest matching is " .. latest_vstring .. ")" 120 latest_matching_msg = " (latest matching is " .. latest_vstring .. ")"
121 end 121 end
122 util.printout("Forcing " .. dep.name .. " to pinned version " .. lockversion .. latest_matching_msg) 122 util.printout("Forcing " .. depq.name .. " to pinned version " .. lockversion .. latest_matching_msg)
123 return nil, nil, queries.new(dep.name, dep.namespace, lockversion) 123 return nil, nil, queries.new(depq.name, depq.namespace, lockversion)
124 end 124 end
125 125
126 return latest_vstring, locations[latest_vstring], dep, provided 126 return latest_vstring, locations[latest_vstring], depq, provided
127end 127end
128 128
129local function match_all_deps(dependencies, 129local function match_all_deps(dependencies,
@@ -131,18 +131,18 @@ local function match_all_deps(dependencies,
131 131
132 local matched, missing, no_upgrade = {}, {}, {} 132 local matched, missing, no_upgrade = {}, {}, {}
133 133
134 for _, dep in ipairs(dependencies) do 134 for _, depq in ipairs(dependencies) do
135 local found, _, provided 135 local found, _, provided
136 found, _, dep, provided = match_dep(dep, get_versions) 136 found, _, depq, provided = match_dep(depq, get_versions)
137 if found then 137 if found then
138 if not provided then 138 if not provided then
139 matched[dep] = { name = dep.name, version = found } 139 matched[depq] = { name = depq.name, version = found }
140 end 140 end
141 else 141 else
142 if dep.constraints[1] and dep.constraints[1].no_upgrade then 142 if depq.constraints and depq.constraints[1] and depq.constraints[1].no_upgrade then
143 no_upgrade[dep.name] = dep 143 no_upgrade[depq.name] = depq
144 else 144 else
145 missing[dep.name] = dep 145 missing[depq.name] = depq
146 end 146 end
147 end 147 end
148 end 148 end
diff --git a/src/luarocks/deps.tl b/src/luarocks/deps.tl
index 53dac145..7e6e39c8 100644
--- a/src/luarocks/deps.tl
+++ b/src/luarocks/deps.tl
@@ -97,16 +97,16 @@ end
97-- 2. nil 97-- 2. nil
98-- 3. either 'dep' or an alternative query to be used 98-- 3. either 'dep' or an alternative query to be used
99-- 4. false 99-- 4. false
100local function match_dep(dep: Query, 100local function match_dep(depq: Query,
101 get_versions: function(Query): {string}, {string: string | Tree}, string, boolean): string, string | Tree, Query, boolean 101 get_versions: function(Query): {string}, {string: string | Tree}, string, boolean): string, string | Tree, Query, boolean
102 102
103 local versions, locations, lockversion, provided = get_versions(dep) 103 local versions, locations, lockversion, provided = get_versions(depq)
104 104
105 local latest_version: Version 105 local latest_version: Version
106 local latest_vstring: string 106 local latest_vstring: string
107 for _, vstring in ipairs(versions) do 107 for _, vstring in ipairs(versions) do
108 local version = vers.parse_version(vstring) 108 local version = vers.parse_version(vstring)
109 if vers.match_constraints(version, dep.constraints) then 109 if vers.match_constraints(version, depq.constraints) then
110 if not latest_version or version > latest_version then 110 if not latest_version or version > latest_version then
111 latest_version = version 111 latest_version = version
112 latest_vstring = vstring 112 latest_vstring = vstring
@@ -119,11 +119,11 @@ local function match_dep(dep: Query,
119 if latest_vstring and latest_vstring ~= lockversion then 119 if latest_vstring and latest_vstring ~= lockversion then
120 latest_matching_msg = " (latest matching is " .. latest_vstring .. ")" 120 latest_matching_msg = " (latest matching is " .. latest_vstring .. ")"
121 end 121 end
122 util.printout("Forcing " .. dep.name .. " to pinned version " .. lockversion .. latest_matching_msg) 122 util.printout("Forcing " .. depq.name .. " to pinned version " .. lockversion .. latest_matching_msg)
123 return nil, nil, queries.new(dep.name, dep.namespace, lockversion) 123 return nil, nil, queries.new(depq.name, depq.namespace, lockversion)
124 end 124 end
125 125
126 return latest_vstring, locations[latest_vstring], dep, provided 126 return latest_vstring, locations[latest_vstring], depq, provided
127end 127end
128 128
129local function match_all_deps(dependencies: {Query}, 129local function match_all_deps(dependencies: {Query},
@@ -131,18 +131,18 @@ local function match_all_deps(dependencies: {Query},
131 131
132 local matched, missing, no_upgrade = {}, {}, {} 132 local matched, missing, no_upgrade = {}, {}, {}
133 133
134 for _, dep in ipairs(dependencies) do 134 for _, depq in ipairs(dependencies) do
135 local found, _, provided: string, string | Tree, boolean 135 local found, _, provided: string, string | Tree, boolean
136 found, _, dep, provided = match_dep(dep, get_versions) 136 found, _, depq, provided = match_dep(depq, get_versions)
137 if found then 137 if found then
138 if not provided then 138 if not provided then
139 matched[dep] = {name = dep.name, version = found} as Result 139 matched[depq] = {name = depq.name, version = found} as Result
140 end 140 end
141 else 141 else
142 if dep.constraints[1] and dep.constraints[1].no_upgrade then 142 if depq.constraints and depq.constraints[1] and depq.constraints[1].no_upgrade then
143 no_upgrade[dep.name] = dep 143 no_upgrade[depq.name] = depq
144 else 144 else
145 missing[dep.name] = dep 145 missing[depq.name] = depq
146 end 146 end
147 end 147 end
148 end 148 end