Hello community, here is the log from the commit of package yast2 for openSUSE:Factory checked in at 2019-08-05 19:25:48 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2 (Old) and /work/SRC/openSUSE:Factory/.yast2.new.4126 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2" Mon Aug 5 19:25:48 2019 rev:457 rq:721080 version:4.2.17 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2/yast2.changes 2019-07-31 14:27:02.426238168 +0200 +++ /work/SRC/openSUSE:Factory/.yast2.new.4126/yast2.changes 2019-08-05 19:25:50.634144499 +0200 @@ -1,0 +2,7 @@ +Mon Aug 5 07:55:15 UTC 2019 - David Diaz <[email protected]> + +- Allow to know if there is a forced base product + (bsc#1124590, bsc#1143943). +- 4.2.17 + +------------------------------------------------------------------- Old: ---- yast2-4.2.16.tar.bz2 New: ---- yast2-4.2.17.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2.spec ++++++ --- /var/tmp/diff_new_pack.U3tZnw/_old 2019-08-05 19:25:51.190145082 +0200 +++ /var/tmp/diff_new_pack.U3tZnw/_new 2019-08-05 19:25:51.194145091 +0200 @@ -17,7 +17,7 @@ Name: yast2 -Version: 4.2.16 +Version: 4.2.17 Release: 0 Summary: YaST2 Main Package License: GPL-2.0-only ++++++ yast2-4.2.16.tar.bz2 -> yast2-4.2.17.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-4.2.16/library/packages/src/lib/y2packager/product.rb new/yast2-4.2.17/library/packages/src/lib/y2packager/product.rb --- old/yast2-4.2.16/library/packages/src/lib/y2packager/product.rb 2019-07-31 10:45:17.000000000 +0200 +++ new/yast2-4.2.17/library/packages/src/lib/y2packager/product.rb 2019-08-05 16:42:03.000000000 +0200 @@ -48,6 +48,13 @@ PKG_BINDINGS_ATTRS = ["name", "short_name", "display_name", "version", "arch", "category", "vendor"].freeze + # Resets cached attributes of the class + # + # @return [true] + def reset + @forced_base_product = nil + end + # Create a product from pkg-bindings hash data. # @param product [Hash] the pkg-bindings product hash # @return [Y2Packager::Product] converted product @@ -100,6 +107,26 @@ def with_status(*statuses) all.select { |p| p.status?(*statuses) } end + + # Returns, if any, the base product which must be selected + # + # A base product can be forced to be selected through the `select_product` + # element in the software section of the control.xml file (bsc#1124590, + # bsc#1143943). + # + # @return [Y2Packager::Product, nil] the forced base product or nil when + # either, it wasn't selected or the selected wasn't found among the + # available ones. + def forced_base_product + Yast.import "ProductFeatures" + + return @forced_base_product if @forced_base_product + + forced_product_name = Yast::ProductFeatures.GetStringFeature("software", "select_product") + return if forced_product_name.to_s.empty? + + @forced_base_product = available_base_products.find { |p| p.name == forced_product_name } + end end # Constructor diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-4.2.16/library/packages/test/y2packager/product_test.rb new/yast2-4.2.17/library/packages/test/y2packager/product_test.rb --- old/yast2-4.2.16/library/packages/test/y2packager/product_test.rb 2019-07-31 10:45:17.000000000 +0200 +++ new/yast2-4.2.17/library/packages/test/y2packager/product_test.rb 2019-08-05 16:42:03.000000000 +0200 @@ -3,6 +3,7 @@ require_relative "../test_helper" require "y2packager/product" +Yast.import "ProductFeatures" describe Y2Packager::Product do PRODUCT_BASE_ATTRS = { @@ -56,6 +57,71 @@ end end + describe ".forced_base_product" do + let(:select_product) { nil } + + let(:opensuse) do + instance_double(Y2Packager::Product, name: "openSUSE", installation_package: true) + end + + let(:sle) do + instance_double(Y2Packager::Product, name: "SLE", installation_package: true) + end + + before do + described_class.reset + + allow(described_class).to receive(:available_base_products) + .and_return([opensuse, sle]) + + allow(Yast::ProductFeatures).to receive(:GetStringFeature) + .with("software", "select_product") + .and_return(select_product) + end + + context "when the control file is not forcing to select a base product selected" do + it "returns nil" do + expect(described_class.forced_base_product).to be_nil + end + end + + context "when the control file is not forcing to select a base product selected" do + context "and the product is available" do + let(:select_product) { "openSUSE" } + + it "returns the prodcut" do + expect(described_class.forced_base_product).to eq(opensuse) + end + end + + context "but none available base product name match" do + let(:select_product) { "Whatever product" } + + it "returns nil" do + expect(described_class.forced_base_product).to be_nil + end + end + + context "but is empty" do + let(:select_product) { "" } + + it "returns nil" do + expect(described_class.forced_base_product).to be_nil + end + end + end + + let(:not_selected) { instance_double(Y2Packager::Product, selected?: false) } + let(:selected) { instance_double(Y2Packager::Product, selected?: true) } + + it "returns base selected packages" do + allow(described_class).to receive(:available_base_products) + .and_return([not_selected, selected]) + + expect(described_class.selected_base).to eq(selected) + end + end + describe "#==" do context "when name, arch, version and vendor match" do let(:other) { Y2Packager::Product.new(PRODUCT_BASE_ATTRS) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-4.2.16/package/yast2.changes new/yast2-4.2.17/package/yast2.changes --- old/yast2-4.2.16/package/yast2.changes 2019-07-31 10:45:17.000000000 +0200 +++ new/yast2-4.2.17/package/yast2.changes 2019-08-05 16:42:03.000000000 +0200 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Mon Aug 5 07:55:15 UTC 2019 - David Diaz <[email protected]> + +- Allow to know if there is a forced base product + (bsc#1124590, bsc#1143943). +- 4.2.17 + +------------------------------------------------------------------- Wed Jul 31 07:16:08 UTC 2019 - Imobach Gonzalez Sosa <[email protected]> - Add a dependency on hostname, as it is needed by the Hostname diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-4.2.16/package/yast2.spec new/yast2-4.2.17/package/yast2.spec --- old/yast2-4.2.16/package/yast2.spec 2019-07-31 10:45:17.000000000 +0200 +++ new/yast2-4.2.17/package/yast2.spec 2019-08-05 16:42:03.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2 -Version: 4.2.16 +Version: 4.2.17 Release: 0 Summary: YaST2 Main Package License: GPL-2.0-only
