Hello community,

here is the log from the commit of package yast2-packager for 
openSUSE:Leap:15.2 checked in at 2020-03-02 17:21:23
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2/yast2-packager (Old)
 and      /work/SRC/openSUSE:Leap:15.2/.yast2-packager.new.26092 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-packager"

Mon Mar  2 17:21:23 2020 rev:139 rq:779789 version:4.2.52

Changes:
--------
--- /work/SRC/openSUSE:Leap:15.2/yast2-packager/yast2-packager.changes  
2020-02-27 06:41:38.821627562 +0100
+++ 
/work/SRC/openSUSE:Leap:15.2/.yast2-packager.new.26092/yast2-packager.changes   
    2020-03-02 17:21:24.374070180 +0100
@@ -1,0 +2,7 @@
+Tue Feb 25 09:00:30 UTC 2020 - Ladislav Slezák <[email protected]>
+
+- Preselect the default modules in the offline installation
+  (jsc#SLE-8040, jsc#SLE-11455)
+- 4.2.52
+
+-------------------------------------------------------------------

Old:
----
  yast2-packager-4.2.51.tar.bz2

New:
----
  yast2-packager-4.2.52.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ yast2-packager.spec ++++++
--- /var/tmp/diff_new_pack.raLaMJ/_old  2020-03-02 17:21:24.954071297 +0100
+++ /var/tmp/diff_new_pack.raLaMJ/_new  2020-03-02 17:21:24.962071313 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-packager
-Version:        4.2.51
+Version:        4.2.52
 Release:        0
 Summary:        YaST2 - Package Library
 License:        GPL-2.0-or-later

++++++ yast2-packager-4.2.51.tar.bz2 -> yast2-packager-4.2.52.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-packager-4.2.51/package/yast2-packager.changes 
new/yast2-packager-4.2.52/package/yast2-packager.changes
--- old/yast2-packager-4.2.51/package/yast2-packager.changes    2020-02-19 
18:10:47.000000000 +0100
+++ new/yast2-packager-4.2.52/package/yast2-packager.changes    2020-02-25 
10:55:11.000000000 +0100
@@ -1,4 +1,11 @@
 -------------------------------------------------------------------
+Tue Feb 25 09:00:30 UTC 2020 - Ladislav Slezák <[email protected]>
+
+- Preselect the default modules in the offline installation
+  (jsc#SLE-8040, jsc#SLE-11455)
+- 4.2.52
+
+-------------------------------------------------------------------
 Wed Feb 19 15:34:23 UTC 2020 - José Iván López González <[email protected]>
 
 - Media checker does not complain because sha checksums
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-packager-4.2.51/package/yast2-packager.spec 
new/yast2-packager-4.2.52/package/yast2-packager.spec
--- old/yast2-packager-4.2.51/package/yast2-packager.spec       2020-02-19 
18:10:47.000000000 +0100
+++ new/yast2-packager-4.2.52/package/yast2-packager.spec       2020-02-25 
10:55:11.000000000 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-packager
-Version:        4.2.51
+Version:        4.2.52
 Release:        0
 Summary:        YaST2 - Package Library
 License:        GPL-2.0-or-later
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-packager-4.2.51/src/lib/y2packager/dialogs/addon_selector.rb 
new/yast2-packager-4.2.52/src/lib/y2packager/dialogs/addon_selector.rb
--- old/yast2-packager-4.2.51/src/lib/y2packager/dialogs/addon_selector.rb      
2020-02-19 18:10:47.000000000 +0100
+++ new/yast2-packager-4.2.52/src/lib/y2packager/dialogs/addon_selector.rb      
2020-02-25 10:55:11.000000000 +0100
@@ -17,6 +17,7 @@
 
 Yast.import "AddOnProduct"
 Yast.import "Mode"
+Yast.import "ProductFeatures"
 Yast.import "Report"
 Yast.import "Stage"
 Yast.import "UI"
@@ -234,18 +235,49 @@
         erb.result(binding)
       end
 
-      # return a list of the preselected products
-      # during upgrade we want to preselect the installed products
+      # return a list of the preselected products depending on the 
installation mode
       # @return [Array<Y2Packager::ProductLocation>] the products
       def preselected_products
-        return [] unless Yast::Mode.update
+        # at upgrade preselect the installed addons
+        return preselected_upgrade_products if Yast::Mode.update
+        # in installation preselect the defaults defined in the 
control.xml/installation.xml
+        return preselected_installation_products if Yast::Mode.installation
 
+        # in other modes (e.g. installed system) do not preselect anything
+        []
+      end
+
+      # return a list of the preselected products at upgrade,
+      # preselect the installed products
+      # @return [Array<Y2Packager::ProductLocation>] the products
+      def preselected_upgrade_products
         missing_products = Yast::AddOnProduct.missing_upgrades
         # installed but not selected yet products (to avoid duplicates)
         products.select do |p|
           missing_products.include?(p.details&.product)
         end
       end
+
+      # return a list of the preselected products at installation,
+      # preselect the default products specified in the 
control.xml/installation.xml,
+      # the already selected products are ignored
+      # @return [Array<Y2Packager::ProductLocation>] the products
+      def preselected_installation_products
+        default_modules = Yast::ProductFeatures.GetFeature("software", 
"default_modules")
+        return [] unless default_modules
+
+        log.info("Defined default modules: #{default_modules.inspect}")
+        # skip the already selected products (to avoid duplicates)
+        selected_products = Y2Packager::Resolvable.find(kind: :product, 
status: :selected)
+          .map(&:name)
+        default_modules -= selected_products
+        log.info("Using default modules: #{default_modules.inspect}")
+
+        # select the default products
+        products.select do |p|
+          default_modules.include?(p.details&.product)
+        end
+      end
     end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-packager-4.2.51/test/addon_selector_test.rb 
new/yast2-packager-4.2.52/test/addon_selector_test.rb
--- old/yast2-packager-4.2.51/test/addon_selector_test.rb       2020-02-19 
18:10:47.000000000 +0100
+++ new/yast2-packager-4.2.52/test/addon_selector_test.rb       2020-02-25 
10:55:11.000000000 +0100
@@ -3,13 +3,24 @@
 require_relative "./test_helper"
 
 require "y2packager/product_location"
+require "y2packager/product_location_details"
 require "y2packager/dialogs/addon_selector"
 
 describe Y2Packager::Dialogs::AddonSelector do
   let(:media_products) do
-    prods = [["SLE-15-Module-Basesystem 15.0-0", "/Basesystem"],
-             ["SLE-15-Module-Legacy 15.0-0", "/Legacy"]]
-    prods.map { |r| Y2Packager::ProductLocation.new(r[0], r[1]) }
+    prods = [
+      [
+        "SLE-15-Module-Basesystem 15.0-0",
+        "/Basesystem",
+        Y2Packager::ProductLocationDetails.new(product: 
"sle-module-basesystem")
+      ],
+      [
+        "SLE-15-Module-Legacy 15.0-0",
+        "/Legacy",
+        Y2Packager::ProductLocationDetails.new(product: "sle-module-legacy")
+      ]
+    ]
+    prods.map { |r| Y2Packager::ProductLocation.new(r[0], r[1], product: r[2]) 
}
   end
 
   subject { described_class.new(media_products) }
@@ -87,4 +98,39 @@
       end
     end
   end
+
+  describe "#create_dialog" do
+    context "in installation" do
+      before do
+        allow(Yast::Stage).to receive(:initial).and_return(true)
+        allow(Yast::Mode).to receive(:installation).and_return(true)
+      end
+
+      it "preselects the default products from control.xml" do
+        # mock the control.xml default
+        expect(Yast::ProductFeatures).to receive(:GetFeature)
+          .with("software", 
"default_modules").and_return(["sle-module-basesystem"])
+
+        allow(Y2Packager::Resolvable).to receive(:find)
+          .with(kind: :product, status: :selected).and_return([])
+
+        expect(Yast::Wizard).to receive(:SetContents) do |_title, content, 
_help, _back, _next|
+          # find the MultiSelectionBox term in the UI definition
+          term = content.nested_find do |t|
+            t.respond_to?(:value) && t.value == :MultiSelectionBox
+          end
+
+          # verify that the Basesystem module is preselected
+          expect(term.params[3][0].params[1]).to eq("SLE-15-Module-Basesystem 
15.0-0")
+          expect(term.params[3][0].params[2]).to eq(true)
+
+          # verify that the Legacy module is NOT preselected
+          expect(term.params[3][1].params[1]).to eq("SLE-15-Module-Legacy 
15.0-0")
+          expect(term.params[3][1].params[2]).to eq(false)
+        end
+
+        subject.create_dialog
+      end
+    end
+  end
 end


Reply via email to