Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/SLE-15-SP4' into huha-install-…
Browse files Browse the repository at this point in the history
…inf-master
  • Loading branch information
shundhammer committed Apr 27, 2022
2 parents fb65bf8 + 7d0088e commit 574d2ff
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 2 deletions.
11 changes: 11 additions & 0 deletions package/yast2-packager.changes
@@ -1,3 +1,14 @@
-------------------------------------------------------------------
Wed Apr 27 13:31:36 UTC 2022 - Stefan Hundhammer <shundhammer@suse.com>

- Don't rely on install.inf availability #(bsc#1198560)
- 4.5.2

-------------------------------------------------------------------
Wed Apr 27 11:24:44 UTC 2022 - Ladislav Slezák <lslezak@suse.cz>

- Fixed migration summary in Leap -> SLES migration (bsc#1198562)

-------------------------------------------------------------------
Thu Apr 7 11:28:48 UTC 2022 - Stefan Hundhammer <shundhammer@suse.com>

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


Name: yast2-packager
Version: 4.5.1
Version: 4.5.2
Release: 0
Summary: YaST2 - Package Library
License: GPL-2.0-or-later
Expand Down
10 changes: 9 additions & 1 deletion src/lib/y2packager/product_spec_reader.rb
Expand Up @@ -27,6 +27,7 @@ module Y2Packager
class ProductSpecReader
include Yast::Logger
Yast.import "Mode"
Yast.import "Linuxrc"

# Returns the list of product specifications.
#
Expand All @@ -35,7 +36,7 @@ def products
# products_from_control || products_from_offline || products_from_libzypp

# online migration (in installed system)
return products_from_libzypp if Yast::Mode.normal
return products_from_libzypp if Yast::Mode.normal || !install_inf?

if InstallationMedium.contain_multi_repos?
products_from_multi_repos
Expand Down Expand Up @@ -70,5 +71,12 @@ def products_from_libzypp
log.info "Products from libzypp: #{libzypp_products.map(&:name).join(", ")}"
libzypp_products
end

# Is information from an install.inf file available?
#
# @return [Boolean]
def install_inf?
!Yast::Linuxrc.keys.empty?
end
end
end
6 changes: 6 additions & 0 deletions src/modules/AddOnProduct.rb
Expand Up @@ -41,8 +41,14 @@ class AddOnProductClass < Module
"sle-sdk" => ["sle-module-development-tools"],
# openSUSE => SLES migration
"openSUSE" => ["SLES"],
# openSUSE 15.3+ => SLES migration
"Leap" => ["SLES"],
# the IBM tools have been renamed in SLE12->SLE15 upgrade
"ibm-dlpar-utils" => ["ibm-power-tools"]

# NOTE: if you change anything here then check
# https://github.com/yast/yast-packager/blob/master/src/lib/y2packager/product_upgrade.rb#L27
# maybe it needs an update as well...
}.freeze

# @return [Hash] Product renames added externally through the #add_rename method
Expand Down
15 changes: 15 additions & 0 deletions test/lib/product_spec_reader_test.rb
Expand Up @@ -38,6 +38,9 @@
let(:full_products) { [instance_double(Y2Packager::ProductSpec, name: "SLES")] }
let(:control_products) { [instance_double(Y2Packager::ProductSpec, name: "SLED")] }
let(:libzypp_products) { [instance_double(Y2Packager::ProductSpec, name: "SLE-HA")] }
let(:linuxrc_fake) { { foo: "bar" } }
let(:linuxrc_empty) { {} }
let(:linuxrc_keys) { linuxrc_fake }

describe "#products" do
before do
Expand All @@ -47,6 +50,7 @@
allow(Y2Packager::InstallationMedium).to receive(:contain_repo?).and_return(false)
allow(Y2Packager::InstallationMedium).to receive(:contain_multi_repos?).and_return(false)
allow(Yast::Mode).to receive(:normal).and_return(false)
allow(Yast::Linuxrc).to receive(:keys).and_return(linuxrc_keys)
end

context "when medium does not contain any repository" do
Expand Down Expand Up @@ -85,5 +89,16 @@
expect(reader.products).to eq(libzypp_products)
end
end

context "without /etc/install.inf" do
let(:linuxrc_keys) { linuxrc_empty }
before do
allow(Yast::Mode).to receive(:normal).and_return(false)
end

it "returns the libzypp products" do
expect(reader.products).to eq(libzypp_products)
end
end
end
end

0 comments on commit 574d2ff

Please sign in to comment.