Verified Commit 81c8fa89 authored by Karel Koci's avatar Karel Koci 🤘
Browse files

WIP

parent f92ac353
Pipeline #82614 failed with stages
in 6 minutes and 30 seconds
......@@ -443,7 +443,8 @@ replan::
When this is set it interrupts the update after this package is set up. This
causes updater to run planning again as soon as the change is made. This
should be used only for packages containing updater itself or closely related
packages.
packages. If there are multiple packages specifying immediate replan then
replan happens on last package specifying it.
abi_change::
The package changed its ABI (or some other interface) and some other packages
need to be reinstalled. If this is set to `true` and the package is installed or
......
......@@ -773,7 +773,7 @@ function filter_required(status, requests, allow_replan)
local install, unused = check_install_version(status, requests)
install = check_abi_change(requests, install)
local result = {}
local replan = false -- If we are requested to replan after some package, drop the rest of the plan
local replan = 0 -- If we are requested to replan after some package, drop the rest of the plan
for _, request in ipairs(requests) do
if install[request.name] then
local req = request
......@@ -784,15 +784,17 @@ function filter_required(status, requests, allow_replan)
end
table.insert(result, req)
if request.modifier.replan == "immediate" and allow_replan then
replan = true
break
replan = #result
end
end
end
if not replan and not opmode.no_removal then
-- We don't remove unused packages just yet if we do immediate replan, we do it after the replanning.
if not opmode.no_removal then
utils.arr_append(result, check_removal(status, unused))
end
while replan > 0 and replan < #result do
-- Remove all requests after last replan
result[#result] = nil
end
return result
end
......
......@@ -1809,6 +1809,79 @@ function test_replan_order()
assert_table_equal(expected, planner.required_pkgs(pkgs, requests))
end
-- Replan should happen after last package requesting replan
function test_replan_later_order()
local pkgs = {
pkg = {
candidates = {{Package = 'pkg', deps = {}, repo = def_repo}},
modifier = {}
},
pkgreplan1 = {
candidates = {{Package = 'pkgreplan1', deps = {}, repo = def_repo}},
modifier = {
deps = 'dep',
replan = "immediate"
}
},
pkgreplan2 = {
candidates = {{Package = 'pkgreplan2', deps = {}, repo = def_repo}},
modifier = {
deps = 'dep',
replan = "immediate"
}
},
dep = {
candidates = {{Package = 'dep', deps = {}, repo = def_repo}},
modifier = {}
}
}
local requests = {
{
tp = 'install',
package = {
tp = 'package',
name = 'pkg',
},
priority = 50
},
{
tp = 'install',
package = {
tp = 'package',
name = 'pkgreplan',
},
priority = 50
}
}
local expected = {
{
action = "require",
package = {Package = 'dep', deps = {}, repo = def_repo},
modifier = {},
critical = false,
name = "dep"
},
{
action = "require",
package = {Package = 'pkgreplan', deps = {}, repo = def_repo},
modifier = {
deps = 'dep',
replan = "immediate"
},
critical = false,
name = "pkgreplan"
},
{
action = "require",
package = {Package = 'pkg', deps = {}, repo = def_repo},
modifier = {},
critical = false,
name = "pkg"
}
}
assert_table_equal(expected, planner.required_pkgs(pkgs, requests))
end
function test_sort_requests()
local requests = {
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment