Skip to content

Commit

Permalink
Fixed removing product duplicates (bsc#1128459)
Browse files Browse the repository at this point in the history
Do not remove products with different status,
they are filtered later.
  • Loading branch information
lslezak committed Mar 12, 2019
1 parent 2c99f30 commit 4fad3c5
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
5 changes: 3 additions & 2 deletions library/packages/src/lib/y2packager/product_reader.rb
Expand Up @@ -148,8 +148,9 @@ def zypp_products

# remove duplicates, there migth be different flavors ("DVD"/"POOL")
# or archs (x86_64/i586), when selecting the product to install later
# libzypp will select the correct arch automatically
products.uniq! { |p| "#{p["name"]}__#{p["version"]}" }
# libzypp will select the correct arch automatically,
# keep products with different state, they are filtered out later
products.uniq! { |p| "#{p["name"]}__#{p["version"]}__#{p["status"]}" }
log.info "Found products: #{products.map { |p| p["name"] }}"

products
Expand Down
15 changes: 14 additions & 1 deletion library/packages/test/y2packager/product_reader_test.rb
Expand Up @@ -126,16 +126,29 @@
allow(subject).to receive(:product_package).with("SLES_BCL-release")
.and_return("deps" => [{ "conflicts"=>"kernel < 4.4" },
{ "provides"=>"specialproduct(SLES_BCL)" }])
allow(Yast::Linuxrc).to receive(:InstallInf).with("specialproduct").and_return(nil)
end

it "returns available products without special products" do
allow(Yast::Linuxrc).to receive(:InstallInf).with("specialproduct").and_return(nil)
expect(subject.all_products.size).to eq(1)
end

it "returns available products with special product" do
allow(Yast::Linuxrc).to receive(:InstallInf).with("specialproduct").and_return("SLES_BCL")
expect(subject.all_products.size).to eq(2)
end

it "returns the available product also when an installed product is found" do
installed = products.first.dup
installed["status"] = :installed
available = products.first.dup
available["status"] = :available

# return the installed product first to ensure the following available duplicate is not lost
allow(Yast::Pkg).to receive(:ResolvableProperties).with("", :product, "")
.and_return([ installed, available ])

expect(subject.all_products).to_not be_empty
end
end
end
8 changes: 8 additions & 0 deletions package/yast2.changes
@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Tue Mar 12 08:38:32 UTC 2019 - lslezak@suse.cz

- Fixed product filtering in product_reader.rb, fixes problem
when upgrading SLE15-SP1 to SLE15-SP1 (usually used to fix
a broken system) (bsc#1128459)
- 4.1.62

-------------------------------------------------------------------
Fri Mar 8 08:15:47 UTC 2019 - Michal Filka <mfilka@suse.com>

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


Name: yast2
Version: 4.1.61
Version: 4.1.62
Release: 0
Summary: YaST2 - Main Package
License: GPL-2.0-only
Expand Down

0 comments on commit 4fad3c5

Please sign in to comment.