aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorV1K1NGbg <victor@ilchev.com>2024-08-07 02:02:57 +0300
committerV1K1NGbg <victor@ilchev.com>2024-08-07 02:02:57 +0300
commitb310f807b5fe2e336a5a8f0aec0cb0fd4cbde93f (patch)
treef0d7b5cbd9380f2d268a174aeb6ca9aac7507d32
parent2ede31600f77ba539904cf4055260a5d0937f8fc (diff)
downloadluarocks-b310f807b5fe2e336a5a8f0aec0cb0fd4cbde93f.tar.gz
luarocks-b310f807b5fe2e336a5a8f0aec0cb0fd4cbde93f.tar.bz2
luarocks-b310f807b5fe2e336a5a8f0aec0cb0fd4cbde93f.zip
depq test
-rw-r--r--src/luarocks/deps.lua37
1 files changed, 36 insertions, 1 deletions
diff --git a/src/luarocks/deps.lua b/src/luarocks/deps.lua
index 2edee8a6..70f80964 100644
--- a/src/luarocks/deps.lua
+++ b/src/luarocks/deps.lua
@@ -125,10 +125,44 @@ local function match_dep(depq,
125 125
126 return latest_vstring, locations[latest_vstring], depq, provided 126 return latest_vstring, locations[latest_vstring], depq, provided
127end 127end
128local function printTable( t )
129
130 local printTable_cache = {}
131
132 local function sub_printTable( t, indent )
133
134 if ( printTable_cache[tostring(t)] ) then
135 print( indent .. "*" .. tostring(t) )
136 else
137 printTable_cache[tostring(t)] = true
138 if ( type( t ) == "table" ) then
139 for pos,val in pairs( t ) do
140 if ( type(val) == "table" ) then
141 print( indent .. "[" .. pos .. "] => " .. tostring( t ).. " {" )
142 sub_printTable( val, indent .. string.rep( " ", string.len(pos)+8 ) )
143 print( indent .. string.rep( " ", string.len(pos)+6 ) .. "}" )
144 elseif ( type(val) == "string" ) then
145 print( indent .. "[" .. pos .. '] => "' .. val .. '"' )
146 else
147 print( indent .. "[" .. pos .. "] => " .. tostring(val) )
148 end
149 end
150 else
151 print( indent..tostring(t) )
152 end
153 end
154 end
128 155
156 if ( type(t) == "table" ) then
157 print( tostring(t) .. " {" )
158 sub_printTable( t, " " )
159 print( "}" )
160 else
161 sub_printTable( t, " " )
162 end
163end
129local function match_all_deps(dependencies, 164local function match_all_deps(dependencies,
130 get_versions) 165 get_versions)
131
132 local matched, missing, no_upgrade = {}, {}, {} 166 local matched, missing, no_upgrade = {}, {}, {}
133 167
134 for _, depq in ipairs(dependencies) do 168 for _, depq in ipairs(dependencies) do
@@ -142,6 +176,7 @@ local function match_all_deps(dependencies,
142 if depq.constraints and depq.constraints[1] and depq.constraints[1].no_upgrade then 176 if depq.constraints and depq.constraints[1] and depq.constraints[1].no_upgrade then
143 no_upgrade[depq.name] = depq 177 no_upgrade[depq.name] = depq
144 else 178 else
179 printTable(depq)
145 missing[depq.name] = depq 180 missing[depq.name] = depq
146 end 181 end
147 end 182 end