Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package yast2-s390 for openSUSE:Factory 
checked in at 2021-10-25 15:17:35
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-s390 (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-s390.new.1890 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-s390"

Mon Oct 25 15:17:35 2021 rev:22 rq:927256 version:4.4.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-s390/yast2-s390.changes    2021-06-26 
21:25:42.475362704 +0200
+++ /work/SRC/openSUSE:Factory/.yast2-s390.new.1890/yast2-s390.changes  
2021-10-25 15:18:44.745724865 +0200
@@ -1,0 +2,6 @@
+Fri Oct 22 10:57:05 UTC 2021 - Martin Vidner <mvid...@suse.com>
+
+- Fix device filtering to follow major.minor semantic (jsc#SLE-17782)
+- 4.4.2
+
+-------------------------------------------------------------------

Old:
----
  yast2-s390-4.4.1.tar.bz2

New:
----
  yast2-s390-4.4.2.tar.bz2

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

Other differences:
------------------
++++++ yast2-s390.spec ++++++
--- /var/tmp/diff_new_pack.doOv0J/_old  2021-10-25 15:18:45.185725140 +0200
+++ /var/tmp/diff_new_pack.doOv0J/_new  2021-10-25 15:18:45.185725140 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-s390
-Version:        4.4.1
+Version:        4.4.2
 Release:        0
 Summary:        YaST2 - S/390 Specific Features Configuration
 License:        GPL-2.0-only

++++++ yast2-s390-4.4.1.tar.bz2 -> yast2-s390-4.4.2.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-s390-4.4.1/.github/workflows/ci.yml 
new/yast2-s390-4.4.2/.github/workflows/ci.yml
--- old/yast2-s390-4.4.1/.github/workflows/ci.yml       2021-06-25 
15:32:54.000000000 +0200
+++ new/yast2-s390-4.4.2/.github/workflows/ci.yml       2021-10-25 
09:51:56.000000000 +0200
@@ -8,7 +8,9 @@
 jobs:
   Tests:
     runs-on: ubuntu-latest
-    container: registry.opensuse.org/yast/head/containers/yast-ruby:latest
+    container:
+      image: registry.opensuse.org/yast/head/containers/yast-ruby:latest
+      options: --privileged
 
     steps:
 
@@ -37,7 +39,9 @@
 
   Rubocop:
     runs-on: ubuntu-latest
-    container: registry.opensuse.org/yast/head/containers/yast-ruby:latest
+    container:
+      image: registry.opensuse.org/yast/head/containers/yast-ruby:latest
+      options: --privileged
 
     steps:
 
@@ -49,7 +53,9 @@
 
   Package:
     runs-on: ubuntu-latest
-    container: registry.opensuse.org/yast/head/containers/yast-ruby:latest
+    container:
+      image: registry.opensuse.org/yast/head/containers/yast-ruby:latest
+      options: --privileged
 
     steps:
 
@@ -70,7 +76,9 @@
   # checks into one job avoids that overhead
   Checks:
     runs-on: ubuntu-latest
-    container: registry.opensuse.org/yast/head/containers/yast-ruby:latest
+    container:
+      image: registry.opensuse.org/yast/head/containers/yast-ruby:latest
+      options: --privileged
 
     steps:
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-s390-4.4.1/README.md 
new/yast2-s390-4.4.2/README.md
--- old/yast2-s390-4.4.1/README.md      2021-06-25 15:32:54.000000000 +0200
+++ new/yast2-s390-4.4.2/README.md      2021-10-25 09:51:56.000000000 +0200
@@ -12,3 +12,17 @@
 
 - https://www.ibm.com/developerworks/linux/linux390/documentation_dev.html
 - https://www.ibm.com/developerworks/linux/linux390/documentation_suse.html 
(for released products)
+
+## Development
+
+On your development laptop you will normally see no s390 specific devices.
+In the `test/` directory there are mock data that can be used for UI
+development. Set an environment variable to override the
+`SCR.Read(.probe.disk)` call:
+
+    YAST2_S390_PROBE_DISK=test/data/probe_disk_dasd.yml rake run"[dasd]"
+
+or
+
+    YAST2_S390_PROBE_DISK=test/data/probe_disk.yml      rake run"[zfcp]"
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-s390-4.4.1/package/yast2-s390.changes 
new/yast2-s390-4.4.2/package/yast2-s390.changes
--- old/yast2-s390-4.4.1/package/yast2-s390.changes     2021-06-25 
15:32:54.000000000 +0200
+++ new/yast2-s390-4.4.2/package/yast2-s390.changes     2021-10-25 
09:51:56.000000000 +0200
@@ -1,4 +1,10 @@
 -------------------------------------------------------------------
+Fri Oct 22 10:57:05 UTC 2021 - Martin Vidner <mvid...@suse.com>
+
+- Fix device filtering to follow major.minor semantic (jsc#SLE-17782)
+- 4.4.2
+
+-------------------------------------------------------------------
 Thu Jun 24 16:07:05 UTC 2021 - Steffen Winterfeldt <snw...@suse.com>
 
 - do not activate DASD devices after formatting (bsc#1187012)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-s390-4.4.1/package/yast2-s390.spec 
new/yast2-s390-4.4.2/package/yast2-s390.spec
--- old/yast2-s390-4.4.1/package/yast2-s390.spec        2021-06-25 
15:32:54.000000000 +0200
+++ new/yast2-s390-4.4.2/package/yast2-s390.spec        2021-10-25 
09:51:56.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-s390
-Version:        4.4.1
+Version:        4.4.2
 Release:        0
 Group:          System/YaST
 License:        GPL-2.0-only
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-s390-4.4.1/src/modules/DASDController.rb 
new/yast2-s390-4.4.2/src/modules/DASDController.rb
--- old/yast2-s390-4.4.1/src/modules/DASDController.rb  2021-06-25 
15:32:54.000000000 +0200
+++ new/yast2-s390-4.4.2/src/modules/DASDController.rb  2021-10-25 
09:51:56.000000000 +0200
@@ -31,6 +31,7 @@
 require "yast"
 require "yast2/popup"
 require "shellwords"
+require "yaml"
 
 module Yast
   class DASDControllerClass < Module
@@ -274,33 +275,24 @@
       deep_copy(@devices)
     end
 
+    # @param channel [String] "0.0.0000" "ab.c.Def0"
+    # @return [String] "0000000" "abcdef0"
+    def channel_sort_key(channel)
+      parts = channel.downcase.split(".", 3)
+      format("%02s%1s%4s", parts[0], parts[1], parts[2])
+    end
+
+    # @return {GetDevices} but filtered by filter_min and filter_max
     def GetFilteredDevices
-      min_strs = Builtins.splitstring(@filter_min, ".")
-      min_css = Builtins.tointeger(Ops.add("0x", Ops.get(min_strs, 0, "")))
-      min_lcss = Builtins.tointeger(Ops.add("0x", Ops.get(min_strs, 1, "")))
-      min_chan = Builtins.tointeger(Ops.add("0x", Ops.get(min_strs, 2, "")))
-
-      max_strs = Builtins.splitstring(@filter_max, ".")
-      max_css = Builtins.tointeger(Ops.add("0x", Ops.get(max_strs, 0, "")))
-      max_lcss = Builtins.tointeger(Ops.add("0x", Ops.get(max_strs, 1, "")))
-      max_chan = Builtins.tointeger(Ops.add("0x", Ops.get(max_strs, 2, "")))
+      min = channel_sort_key(@filter_min)
+      max = channel_sort_key(@filter_max)
 
       ret = GetDevices()
-
-      ret = Builtins.filter(ret) do |_k, d|
-        tmp_strs = Builtins.splitstring(Ops.get_string(d, "channel", ""), ".")
-        tmp_css = Builtins.tointeger(Ops.add("0x", Ops.get(tmp_strs, 0, "")))
-        tmp_lcss = Builtins.tointeger(Ops.add("0x", Ops.get(tmp_strs, 1, "")))
-        tmp_chan = Builtins.tointeger(Ops.add("0x", Ops.get(tmp_strs, 2, "")))
-        Ops.greater_or_equal(tmp_css, min_css) &&
-          Ops.greater_or_equal(tmp_lcss, min_lcss) &&
-          Ops.greater_or_equal(tmp_chan, min_chan) &&
-          Ops.less_or_equal(tmp_css, max_css) &&
-          Ops.less_or_equal(tmp_lcss, max_lcss) &&
-          Ops.less_or_equal(tmp_chan, max_chan)
+      Builtins.filter(ret) do |_k, d|
+        channel = d.fetch("channel", "")
+        key = channel_sort_key(channel)
+        min <= key && key <= max
       end
-
-      deep_copy(ret)
     end
 
     def AddDevice(d)
@@ -359,6 +351,21 @@
       deep_copy(ret)
     end
 
+    # In production, call SCR.Read(.probe.disk).
+    # For testing, point YAST2_S390_PROBE_DISK to a YAML file
+    # with the mock value.
+    # Suggesstion:
+    #   YAST2_S390_PROBE_DISK=test/data/probe_disk_dasd.yml rake run"[dasd]"
+    # @return [Array<Hash>] .probe.disk output
+    def probe_or_mock_disks
+      mock_filename = ENV["YAST2_S390_PROBE_DISK"]
+      if mock_filename
+        YAML.load(File.read(mock_filename))
+      else
+        SCR.Read(path(".probe.disk"))
+      end
+    end
+
     # Return packages needed to be installed and removed during
     # Autoinstallation to insure module has all needed software
     # installed.
@@ -370,7 +377,7 @@
     # Check if DASD subsystem is available
     # @return [Boolean] True if more than one disk
     def IsAvailable
-      disks = SCR.Read(path(".probe.disk"))
+      disks = probe_or_mock_disks
       count = disks.count { |d| d["device"] == "DASD" }
       log.info("number of probed DASD devices #{count}")
       count > 0
@@ -829,11 +836,7 @@
     # @return [Array<Hash>] Found DASD disks
     def find_disks(force_probing: false)
       return @disks if @disks && !force_probing
-      disks = Convert.convert(
-        SCR.Read(path(".probe.disk")),
-        from: "any",
-        to:   "list <map <string, any>>"
-      )
+      disks = probe_or_mock_disks
       disks = Builtins.filter(disks) do |d|
         Builtins.tolower(Ops.get_string(d, "device", "")) == "dasd"
       end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-s390-4.4.1/src/modules/ZFCPController.rb 
new/yast2-s390-4.4.2/src/modules/ZFCPController.rb
--- old/yast2-s390-4.4.1/src/modules/ZFCPController.rb  2021-06-25 
15:32:54.000000000 +0200
+++ new/yast2-s390-4.4.2/src/modules/ZFCPController.rb  2021-10-25 
09:51:56.000000000 +0200
@@ -28,6 +28,8 @@
 #
 # Representation of the configuration of controller.
 # Input and output routines.
+
+require "yaml"
 require "yast"
 
 module Yast
@@ -209,36 +211,23 @@
       deep_copy(@devices)
     end
 
+    # @param channel [String] "0.0.0000" "ab.c.Def0"
+    # @return [String] "0000000" "abcdef0"
+    def channel_sort_key(channel)
+      parts = channel.downcase.split(".", 3)
+      format("%02s%1s%4s", parts[0], parts[1], parts[2])
+    end
+
     def GetFilteredDevices
-      min_strs = Builtins.splitstring(@filter_min, ".")
-      min_css = Builtins.tointeger(Ops.add("0x", Ops.get(min_strs, 0, "")))
-      min_lcss = Builtins.tointeger(Ops.add("0x", Ops.get(min_strs, 1, "")))
-      min_chan = Builtins.tointeger(Ops.add("0x", Ops.get(min_strs, 2, "")))
-
-      max_strs = Builtins.splitstring(@filter_max, ".")
-      max_css = Builtins.tointeger(Ops.add("0x", Ops.get(max_strs, 0, "")))
-      max_lcss = Builtins.tointeger(Ops.add("0x", Ops.get(max_strs, 1, "")))
-      max_chan = Builtins.tointeger(Ops.add("0x", Ops.get(max_strs, 2, "")))
+      min = channel_sort_key(@filter_min)
+      max = channel_sort_key(@filter_max)
 
       ret = GetDevices()
-
-      ret = Builtins.filter(ret) do |_k, d|
-        tmp_strs = Builtins.splitstring(
-          Ops.get_string(d, ["detail", "controller_id"], ""),
-          "."
-        )
-        tmp_css = Builtins.tointeger(Ops.add("0x", Ops.get(tmp_strs, 0, "")))
-        tmp_lcss = Builtins.tointeger(Ops.add("0x", Ops.get(tmp_strs, 1, "")))
-        tmp_chan = Builtins.tointeger(Ops.add("0x", Ops.get(tmp_strs, 2, "")))
-        Ops.greater_or_equal(tmp_css, min_css) &&
-          Ops.greater_or_equal(tmp_lcss, min_lcss) &&
-          Ops.greater_or_equal(tmp_chan, min_chan) &&
-          Ops.less_or_equal(tmp_css, max_css) &&
-          Ops.less_or_equal(tmp_lcss, max_lcss) &&
-          Ops.less_or_equal(tmp_chan, max_chan)
+      Builtins.filter(ret) do |_k, d|
+        channel = Ops.get_string(d, ["detail", "controller_id"], "")
+        key = channel_sort_key(channel)
+        min <= key && key <= max
       end
-
-      deep_copy(ret)
     end
 
     def AddDevice(d)
@@ -705,6 +694,21 @@
 
   private
 
+    # In production, call SCR.Read(.probe.disk).
+    # For testing, point YAST2_S390_PROBE_DISK to a YAML file
+    # with the mock value.
+    # Suggesstion:
+    #   YAST2_S390_PROBE_DISK=test/data/probe_disk.yml rake run"[zfcp]"
+    # @return [Array<Hash>] .probe.disk output
+    def probe_or_mock_disks
+      mock_filename = ENV["YAST2_S390_PROBE_DISK"]
+      if mock_filename
+        YAML.load(File.read(mock_filename))
+      else
+        SCR.Read(path(".probe.disk"))
+      end
+    end
+
     # Finds the activated controllers
     #
     # Initially, it reads the activated controllers from hwinfo.
@@ -743,11 +747,7 @@
     # @return [Array<Hash>] Found zFCP disks
     def find_disks(force_probing: false)
       return @disks if @disks && !force_probing
-      disks = Convert.convert(
-        SCR.Read(path(".probe.disk")),
-        from: "any",
-        to:   "list <map <string, any>>"
-      )
+      disks = probe_or_mock_disks
       disks = Builtins.filter(disks) do |d|
         d["driver"] == "zfcp"
       end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-s390-4.4.1/test/dasd_controller_test.rb 
new/yast2-s390-4.4.2/test/dasd_controller_test.rb
--- old/yast2-s390-4.4.1/test/dasd_controller_test.rb   2021-06-25 
15:32:54.000000000 +0200
+++ new/yast2-s390-4.4.2/test/dasd_controller_test.rb   2021-10-25 
09:51:56.000000000 +0200
@@ -478,4 +478,24 @@
       expect(subject.ActivateDiag("0.0.3333", true)).to eq(nil)
     end
   end
+
+  describe "#GetFilteredDevices" do
+    it "Filters the devices (as a single large number)" do
+      import_data = { "devices" => [{ "channel" => "0.4.fa00" },
+                                    { "channel" => "0.0.fb00" },
+                                    { "channel" => "0.0.fc00" },
+                                    { "channel" => "0.0.f800" },
+                                    { "channel" => "0.0.f900" }] }
+
+      expect(subject.Import(import_data)).to eq(true)
+      subject.filter_max = subject.FormatChannel("10.0.FA00")
+      subject.filter_min = subject.FormatChannel("0.0.f900")
+      expect(subject.GetFilteredDevices()).to eq(
+        0 => { "channel" => "0.4.fa00" },
+        1 => { "channel" => "0.0.fb00" },
+        2 => { "channel" => "0.0.fc00" },
+        4 => { "channel" => "0.0.f900" }
+      )
+    end
+  end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-s390-4.4.1/test/zfcp_controller_test.rb 
new/yast2-s390-4.4.2/test/zfcp_controller_test.rb
--- old/yast2-s390-4.4.1/test/zfcp_controller_test.rb   2021-06-25 
15:32:54.000000000 +0200
+++ new/yast2-s390-4.4.2/test/zfcp_controller_test.rb   2021-10-25 
09:51:56.000000000 +0200
@@ -175,17 +175,19 @@
 
   describe "#GetFilteredDevices" do
     it "Filters the devices" do
-      import_data = { "devices" => [{ "controller_id" => "0.0.fa00" },
+      import_data = { "devices" => [{ "controller_id" => "0.4.fa00" },
                                     { "controller_id" => "0.0.fb00" },
                                     { "controller_id" => "0.0.fc00" },
                                     { "controller_id" => "0.0.f800" },
                                     { "controller_id" => "0.0.f900" }] }
 
       expect(subject.Import(import_data)).to eq(true)
-      subject.filter_max = subject.FormatChannel("0.0.FA00")
+      subject.filter_max = subject.FormatChannel("10.0.FA00")
       subject.filter_min = subject.FormatChannel("0.0.f900")
       expect(subject.GetFilteredDevices()).to eq(
-        0 => { "detail"=>{ "controller_id" => "0.0.fa00", "wwpn" => "", 
"fcp_lun" => "" } },
+        0 => { "detail"=>{ "controller_id" => "0.4.fa00", "wwpn" => "", 
"fcp_lun" => "" } },
+        1 => { "detail"=>{ "controller_id" => "0.0.fb00", "wwpn" => "", 
"fcp_lun" => "" } },
+        2 => { "detail"=>{ "controller_id" => "0.0.fc00", "wwpn" => "", 
"fcp_lun" => "" } },
         4 => { "detail"=>{ "controller_id" => "0.0.f900", "wwpn" => "", 
"fcp_lun" => "" } }
       )
     end

Reply via email to