Skip to content

Commit

Permalink
Merge pull request #1107 from yast/restore_selection_master
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Feb 6, 2024
2 parents 8f7d3f0 + fe6c10a commit 630d3f6
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
@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Tue Feb 6 16:05:37 UTC 2024 - Ladislav Slezák <lslezak@suse.com>

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

-------------------------------------------------------------------
Fri Jan 26 12:26:06 UTC 2024 - Knut Anderssen <kanderssen@suse.com>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-installation.spec
Expand Up @@ -16,7 +16,7 @@
#

Name: yast2-installation
Version: 5.0.5
Version: 5.0.6
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
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
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 630d3f6

Please sign in to comment.