Skip to content

Commit

Permalink
Restore the selected products (bsc#1218391)
Browse files Browse the repository at this point in the history
...after reloading the package manager, properly install all products for new
modules and extensions when upgrading from SLE12

- 4.6.10
  • Loading branch information
lslezak committed Feb 6, 2024
1 parent 6b32196 commit 3da0820
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
8 changes: 8 additions & 0 deletions package/yast2-installation.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Tue Feb 6 15:14:27 UTC 2024 - Ladislav Slezák <[email protected]>

- Restore the selected products after reloading the package
manager, properly install all products for new modules and
extensions when upgrading from SLE12 (bsc#1218391)
- 4.6.10

-------------------------------------------------------------------
Wed Nov 29 16:27:50 UTC 2023 - Imobach Gonzalez Sosa <[email protected]>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-installation.spec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

Name: yast2-installation
Version: 4.6.9
Version: 4.6.10
Release: 0
Summary: YaST2 - Installation Parts
License: GPL-2.0-only
Expand Down
8 changes: 7 additions & 1 deletion src/lib/installation/upgrade_repo_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,17 @@ def activate_changes
process_repos
remove_services

# reload the package manager to activate the changes
# reload the package manager to activate the changes,
# remember the selected products/packages (ignore the dependencies selected by solver)
selected = Y2Packager::Resolvable.find(status: :selected, transact_by: :appl_high)

Yast::Pkg.SourceSaveAll
Yast::Pkg.SourceFinishAll
Yast::Pkg.SourceRestore
Yast::Pkg.SourceLoad

# restore the selection
selected.each { |s| Yast::Pkg.ResolvableInstall(s.name, s.kind) }
end

private
Expand Down
10 changes: 10 additions & 0 deletions test/lib/upgrade_repo_manager_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def self.is_registered?
allow(Yast::Pkg).to receive(:SourceFinishAll)
allow(Yast::Pkg).to receive(:SourceRestore)
allow(Yast::Pkg).to receive(:SourceLoad)
allow(Y2Packager::Resolvable).to receive(:find).and_return([])
end

it "removes the selected repositories" do
Expand Down Expand Up @@ -133,6 +134,15 @@ def self.is_registered?
expect(Yast::Pkg).to receive(:ServiceDelete).with(service1.alias)
subject.activate_changes
end

it "restores the selected products" do
product = double(name: "SLES", kind: :product)
expect(Y2Packager::Resolvable).to receive(:find)
.with(status: :selected, transact_by: :appl_high).and_return([product])
expect(Yast::Pkg).to receive(:ResolvableInstall)
.with(product.name, product.kind).and_return(true)
subject.activate_changes
end
end

describe ".create_from_old_repositories" do
Expand Down

0 comments on commit 3da0820

Please sign in to comment.