Hello community,

here is the log from the commit of package yast2-network for openSUSE:Leap:15.2 
checked in at 2020-04-21 19:06:37
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2/yast2-network (Old)
 and      /work/SRC/openSUSE:Leap:15.2/.yast2-network.new.2738 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-network"

Tue Apr 21 19:06:37 2020 rev:126 rq:795134 version:4.2.66

Changes:
--------
--- /work/SRC/openSUSE:Leap:15.2/yast2-network/yast2-network.changes    
2020-04-08 12:47:52.214326934 +0200
+++ /work/SRC/openSUSE:Leap:15.2/.yast2-network.new.2738/yast2-network.changes  
2020-04-21 19:08:06.800060961 +0200
@@ -1,0 +2,8 @@
+Thu Apr 16 07:19:26 UTC 2020 - Knut Anderssen <kanders...@suse.com>
+
+- Do not try to install kernel packages anymore since ISDN support
+  was already dropped which was the most common use case. Removed
+  also hardware methods used mainly for ISDN config. (bsc#1151187)
+- 4.2.66
+
+-------------------------------------------------------------------

Old:
----
  yast2-network-4.2.65.tar.bz2

New:
----
  yast2-network-4.2.66.tar.bz2

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

Other differences:
------------------
++++++ yast2-network.spec ++++++
--- /var/tmp/diff_new_pack.pjAmPp/_old  2020-04-21 19:08:07.468062321 +0200
+++ /var/tmp/diff_new_pack.pjAmPp/_new  2020-04-21 19:08:07.468062321 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-network
-Version:        4.2.65
+Version:        4.2.66
 Release:        0
 Summary:        YaST2 - Network Configuration
 License:        GPL-2.0-only

++++++ yast2-network-4.2.65.tar.bz2 -> yast2-network-4.2.66.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.2.65/CONTRIBUTING.md 
new/yast2-network-4.2.66/CONTRIBUTING.md
--- old/yast2-network-4.2.65/CONTRIBUTING.md    2020-04-02 15:02:55.000000000 
+0200
+++ new/yast2-network-4.2.66/CONTRIBUTING.md    1970-01-01 01:00:00.000000000 
+0100
@@ -1,89 +0,0 @@
-YaST Contribution Guidelines
-============================
-
-YaST is an open source project and as such it welcomes all kinds of
-contributions. If you decide to contribute, please follow these guidelines to
-ensure the process is effective and pleasant both for you and the YaST 
maintainers.
-
-There are two main forms of contribution: reporting bugs and performing code
-changes.
-
-Bug Reports
------------
-
-If you find a problem, please report it either using
-[Bugzilla](https://bugzilla.suse.com/enter_bug.cgi?format=guided&product=openSUSE+Factory&component=YaST2)
-or [GitHub issues](../../issues). (For Bugzilla, use the [simplified
-registration](https://secure-www.novell.com/selfreg/jsp/createSimpleAccount.jsp)
-if you don't have an account yet.)
-
-When creating a bug report, please follow our [bug reporting
-guidelines](http://en.opensuse.org/openSUSE:Report_a_YaST_bug).
-
-We can't guarantee that every bug will be fixed, but we'll try.
-
-Code Changes
-------------
-
-We welcome all kinds of code contributions, from simple bug fixes to 
significant
-refactorings and implementation of new features. However, before making any
-non-trivial contribution, get in touch with us first — this can prevent wasted
-effort on both sides. Also, have a look at our [development
-documentation](http://en.opensuse.org/openSUSE:YaST_development).
-
-To send us your code change, use GitHub pull requests. The workflow is as
-follows:
-
-  1. Fork the project.
-
-  2. Create a topic branch based on `master`.
-
-  3. Implement your change, including tests (if possible). Make sure you adhere
-     to the [Ruby style
-     guide](https://github.com/SUSE/style-guides/blob/master/Ruby.md).
-
-  4. Update the package version (in `packages/*.spec`, usually by
-     `rake version:bump`) and add a new entry to the `package/*.changes` file
-     (by `osc vc package`).  
-     For bigger changes or changes which need longer discussion it is advised 
to
-     add this as a separate last commit so it can be easily updated when 
another
-     change is merged in the meantime.
-
-  5. Make sure your change didn't break anything by building the RPM package
-     (`rake osc:build`). The build process includes running the full testsuite.
-
-  6. Publish the branch and create a pull request.
-
-  7. YaST developers will review your change and possibly point out issues.
-     Adapt the code under their guidance until they are all resolved.
-
-  8. Finally, the pull request will get merged or rejected.
-
-See also [GitHub's guide on
-contributing](https://help.github.com/articles/fork-a-repo).
-
-If you want to do multiple unrelated changes, use separate branches and pull
-requests.
-
-### Commits
-
-Each commit in the pull request should do only one thing, which is clearly
-described by its commit message. Especially avoid mixing formatting changes and
-functional changes into one commit. When writing commit messages, adhere to
-[widely used
-conventions](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
-
-If your commit is related to a bug in Bugzilla or an issue on GitHub, make sure
-you mention it in the commit message for cross-reference. Use format like
-bnc#775814 or gh#yast/yast-foo#42. See also [GitHub
-autolinking](https://help.github.com/articles/github-flavored-markdown#references)
-and [openSUSE abbreviation
-reference](http://en.opensuse.org/openSUSE:Packaging_Patches_guidelines#Current_set_of_abbreviations).
-
-Additional Information
-----------------------
-
-If you have any question, feel free to ask at the [development mailing
-list](http://lists.opensuse.org/yast-devel/) or at the
-[#yast](http://webchat.freenode.net/?channels=%23yast) IRC channel on freenode.
-We'll do our best to provide a timely and accurate answer.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.2.65/package/yast2-network.changes 
new/yast2-network-4.2.66/package/yast2-network.changes
--- old/yast2-network-4.2.65/package/yast2-network.changes      2020-04-02 
15:02:55.000000000 +0200
+++ new/yast2-network-4.2.66/package/yast2-network.changes      2020-04-17 
10:42:54.000000000 +0200
@@ -1,4 +1,12 @@
 -------------------------------------------------------------------
+Thu Apr 16 07:19:26 UTC 2020 - Knut Anderssen <kanders...@suse.com>
+
+- Do not try to install kernel packages anymore since ISDN support
+  was already dropped which was the most common use case. Removed
+  also hardware methods used mainly for ISDN config. (bsc#1151187)
+- 4.2.66
+
+-------------------------------------------------------------------
 Thu Apr  2 11:33:49 UTC 2020 - Imobach Gonzalez Sosa <igonzalezs...@suse.com>
 
 - AutoYaST: Do not try to activate network devices that are already
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.2.65/package/yast2-network.spec 
new/yast2-network-4.2.66/package/yast2-network.spec
--- old/yast2-network-4.2.65/package/yast2-network.spec 2020-04-02 
15:02:55.000000000 +0200
+++ new/yast2-network-4.2.66/package/yast2-network.spec 2020-04-17 
10:42:54.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-network
-Version:        4.2.65
+Version:        4.2.66
 Release:        0
 Summary:        YaST2 - Network Configuration
 License:        GPL-2.0-only
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.2.65/src/include/network/hardware.rb 
new/yast2-network-4.2.66/src/include/network/hardware.rb
--- old/yast2-network-4.2.65/src/include/network/hardware.rb    2020-04-02 
15:02:55.000000000 +0200
+++ new/yast2-network-4.2.66/src/include/network/hardware.rb    1970-01-01 
01:00:00.000000000 +0100
@@ -1,97 +0,0 @@
-# ***************************************************************************
-#
-# Copyright (c) 2012 Novell, Inc.
-# All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of version 2 of the GNU General Public License as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, contact Novell, Inc.
-#
-# To contact Novell about this file by physical or electronic mail,
-# you may find current contact information at www.novell.com
-#
-# **************************************************************************
-# File:  modules/ISDN.ycp
-# Package:  Network configuration
-# Summary:  ISDN data
-# Authors:  Michal Svec  <ms...@suse.cz>
-#    Karsten Keil <kk...@suse.de>
-#
-#
-# Representation of the configuration of ISDN.
-# Input and output routines.
-module Yast
-  module NetworkHardwareInclude
-    def initialize_network_hardware(include_target)
-      textdomain "network"
-
-      Yast.import "Arch"
-      Yast.import "Confirm"
-      Yast.import "Map"
-      Yast.include include_target, "network/routines.rb"
-    end
-
-    # Select the given hardware item or clean up structures (item == nil)
-    # @param [Fixnum] which item to be chosen
-    def FindHardware(hardware, which)
-      sel = {}
-
-      if !which.nil?
-        sel = Ops.get_map(hardware, which, {})
-
-        if Ops.greater_than(which, Builtins.size(hardware)) ||
-            Ops.less_than(which, 0)
-          Builtins.y2error(
-            "Item not found in Hardware: %1 (%2)",
-            which,
-            Builtins.size(hardware)
-          )
-        end
-      end
-
-      sel
-    end
-
-    # Select the given hardware item
-    # SelectHardware is a "virtual method", that is named SelectHW in 
"subclasses"
-    # like Lan and Modem.
-    # @param [Hash] sel item to be chosen
-    def SelectHardwareMap(sel)
-      sel = deep_copy(sel)
-      # common stuff
-      @description = Ops.get_string(sel, "name", "")
-      @type = Ops.get_string(sel, "type", "eth")
-      @hotplug = Ops.get_string(sel, "hotplug", "")
-
-      #    unique = sel["udi"]:"";
-      @Requires = Ops.get_list(sel, "requires", [])
-      # #44977: Requires now contain the appropriate kernel packages
-      # but they are handled differently due to multiple kernel flavors
-      # (see Package::InstallKernel)
-      # Leave only those not starting with "kernel".
-      @Requires = Builtins.filter(@Requires) do |r|
-        Builtins.search(r, "kernel") != 0
-      end
-      Builtins.y2milestone("requires=%1", @Requires)
-
-      # FIXME: devname
-      @hotplug = ""
-
-      deep_copy(sel)
-    end
-
-    # Select the given hardware item or clean up structures (item == nil)
-    # @param [Fixnum] which item to be chosen
-    def SelectHardware(hardware, which)
-      SelectHardwareMap(FindHardware(hardware, which))
-    end
-  end
-end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.2.65/src/modules/Lan.rb 
new/yast2-network-4.2.66/src/modules/Lan.rb
--- old/yast2-network-4.2.65/src/modules/Lan.rb 2020-04-02 15:02:55.000000000 
+0200
+++ new/yast2-network-4.2.66/src/modules/Lan.rb 2020-04-17 10:42:54.000000000 
+0200
@@ -606,7 +606,7 @@
 
     # Convert data from autoyast to structure used by module.
     # @param [Hash] input autoyast settings
-    # @return native network settings
+    # @return [Hash] native network settings
     # FIXME: massive refactoring required
     def FromAY(input)
       input = deep_copy(input)
@@ -641,7 +641,7 @@
 
     # Import data.
     # It expects data described networking.rnc
-    # and then passed through {Lan#FromAY}.
+    # and then passed through {#FromAY}.
     # Most prominently, instead of a flat list called "interfaces"
     # we import a 2-level map of typed "devices"
     # @param [Hash] settings settings to be imported
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.2.65/src/modules/LanItems.rb 
new/yast2-network-4.2.66/src/modules/LanItems.rb
--- old/yast2-network-4.2.65/src/modules/LanItems.rb    2020-04-02 
15:02:55.000000000 +0200
+++ new/yast2-network-4.2.66/src/modules/LanItems.rb    2020-04-17 
10:42:54.000000000 +0200
@@ -100,8 +100,6 @@
       @tunnel_set_owner = ""
       @tunnel_set_group = ""
 
-      Yast.include self, "network/hardware.rb"
-
       # this is the map of kernel modules vs. requested firmware
       # non-empty keys are firmware packages shipped by SUSE
       @request_firmware = 
YAML.load_file(Directory.find_data_file("network/firmwares.yml"))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.2.65/src/modules/NetHwDetection.rb 
new/yast2-network-4.2.66/src/modules/NetHwDetection.rb
--- old/yast2-network-4.2.65/src/modules/NetHwDetection.rb      2020-04-02 
15:02:55.000000000 +0200
+++ new/yast2-network-4.2.66/src/modules/NetHwDetection.rb      2020-04-17 
10:42:54.000000000 +0200
@@ -55,6 +55,7 @@
 # </ul>
 #
 require "yast"
+require "yast2/execute"
 require "shellwords"
 
 module Yast
@@ -67,17 +68,7 @@
       Yast.import "Package"
       Yast.import "String"
 
-      # yuck, FIXME
-      # this is here just because network/hardware.ycp references it
-      # because of detection and module loading (StartEthInterface)
-      # general stuff
-      @description = ""
-      @type = ""
-      @unique = ""
-      @hotplug = ""
-      @Requires = []
-
-      Yast.include self, "network/hardware.rb"
+      Yast.include self, "network/routines.rb"
 
       # Detection result
       # (in dhcpcd-<i>interface</i>.info format)
@@ -95,50 +86,17 @@
     # WATCH OUT, this is the place where modules are loaded
     # @return true if success
     def LoadNetModules
-      Builtins.y2milestone("Network detection prepare")
+      log.info "Network detection prepare"
 
       hardware = ReadHardware("netcard")
 
-      Builtins.y2debug("Hardware=%1", hardware)
-      return false if Ops.less_than(Builtins.size(hardware), 1)
+      log.debug("Hardware=#{hardware.inspect}")
+      return false if hardware.empty?
 
-      needed_modules = Builtins.listmap(hardware) do |h|
-        # Formerly we simply modprobed the first module of the first
-        # driver, if it was not already loaded.  But if the user
-        # configured the card to use the second driver and unloads it
-        # and wants to load the first, it will not work because the
-        # first driver is already loaded but not bound to the device
-        # (the second one took it). N#59794#c31
-        # We will only load a driver if there's no driver for the card active.
-        active_driver = Builtins.find(Ops.get_list(h, "drivers", [])) do |d|
-          Ops.get_boolean(d, "active", false)
-        end
-        { Ops.get_string(h, "module", "") => active_driver.nil? }
-        # TODO: list of todos
-        # 1: choose which driver to load
-        # 2: load all its modules: no cards use multiple modules
-        # 3: either modprobe or insmod: ISA history
-      end
-      needed_modules = Builtins.filter(needed_modules) do |m, load|
-        load && !m.nil? && m != "" &&
-          SCR.Execute(
-            path(".target.bash"),
-            Builtins.sformat("/usr/bin/grep ^%1 /proc/modules", m.shellescape)
-          ) != 0
-      end
-      @detection_modules = Builtins.maplist(needed_modules) { |m, _a| m }
-      Package.InstallKernel(Builtins.maplist(@detection_modules) do |m|
-        Ops.add(m, ".ko")
-      end)
-      Builtins.foreach(@detection_modules) do |mod|
-        Builtins.y2milestone("Loading module: %1", mod)
-        SCR.Execute(
-          path(".target.bash"),
-          Builtins.sformat("/usr/sbin/modprobe --use-blacklist %1 2>&1", 
mod.shellescape)
-        )
-      end
+      @detection_modules = needed_modules(hardware).dup
+      @detection_modules.each { |name| load_module(name) }
 
-      Builtins.y2milestone("Network detection prepare (end)")
+      log.info("Network detection prepare (end)")
 
       true
     end
@@ -246,17 +204,59 @@
       String.CutBlanks(hnent)
     end
 
-    publish variable: :description, type: "string"
-    publish variable: :type, type: "string"
-    publish variable: :unique, type: "string"
-    publish variable: :hotplug, type: "string"
-    publish variable: :Requires, type: "list <string>"
     publish variable: :result, type: "map"
     publish variable: :running, type: "boolean"
     publish function: :Start, type: "boolean ()"
     publish function: :Stop, type: "boolean ()"
     publish function: :DuplicateIP, type: "boolean (string)"
     publish function: :ResolveIP, type: "string (string)"
+
+  private
+
+    # Check which modules need to be modprobed returning the ones which are not
+    # active according to hwinfo and which are still not loaded
+    #
+    # @param netcards_hwinfo [Array<Hash>] network devices info
+    # @return [Array<String>]
+    def needed_modules(netcards_hwinfo)
+      netcards_hwinfo.each_with_object([]) do |h, modules|
+        name = h.fetch("module", "")
+        next if name.empty?
+
+        modules << name if !active_driver?(h) && !already_loaded?(name)
+      end
+    end
+
+    # Convenience method to check whether a given module is already loaded or
+    # not
+    #
+    # @param name [String] module name
+    # @return [Boolean] whether a given module is already loaded or not
+    def already_loaded?(name)
+      cmd = ["/usr/bin/grep", "^#{name}", "/proc/modules"]
+
+      _output, status = Yast::Execute.stdout.on_target(*cmd, 
allowed_exitstatus: 0..255)
+      status&.zero?
+    end
+
+    # Convenience method to check wheter a driver is already active or not
+    # according to the given hwinfo
+    #
+    # @param netcard_hwinfo [Array<Hash>] netcard hardware info
+    # @return [Boolean] whether the netcard driver is active or not
+    def active_driver?(netcard_hwinfo)
+      netcard_hwinfo.fetch("drivers", []).any? { |d| d["active"] }
+    end
+
+    # Convenience method to modprobe the given module
+    #
+    # @param name [String] module to be modprobed
+    def load_module(name)
+      cmd = ["/usr/sbin/modprobe", "--use-blacklist", name]
+
+      log.info("Loading module: #{name}")
+      Yast::Execute.stdout.on_target(*cmd, allowed_exitstatus: 0..1)
+    end
   end
 
   NetHwDetection = NetHwDetectionClass.new
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-network-4.2.65/test/net_hw_detection_test.rb 
new/yast2-network-4.2.66/test/net_hw_detection_test.rb
--- old/yast2-network-4.2.65/test/net_hw_detection_test.rb      1970-01-01 
01:00:00.000000000 +0100
+++ new/yast2-network-4.2.66/test/net_hw_detection_test.rb      2020-04-17 
10:42:54.000000000 +0200
@@ -0,0 +1,96 @@
+#!/usr/bin/env rspec
+
+# Copyright (c) [2020] SUSE LLC
+#
+# All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of version 2 of the GNU General Public License as published
+# by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, contact SUSE LLC.
+#
+# To contact SUSE LLC about this file by physical or electronic mail, you may
+# find current contact information at www.suse.com.
+
+require_relative "test_helper"
+
+Yast.import "NetHwDetection"
+
+describe "NetHwDetection" do
+  subject { Yast::NetHwDetection }
+  let(:hwinfo) { [] }
+
+  before do
+    allow(subject).to receive(:ReadHardware).with("netcard").and_return(hwinfo)
+  end
+
+  describe "#LoadNetModules" do
+    it "reads the hwinfo of the network cards present in the system" do
+      expect(subject).to receive(:ReadHardware).with("netcard")
+      subject.LoadNetModules
+    end
+
+    context "when the system does not have network cards" do
+      it "returns false" do
+        expect(subject.LoadNetModules).to eq(false)
+      end
+    end
+
+    context "when there is some network card which driver is not active" do
+      let(:loaded) { true }
+
+      before do
+        allow(subject).to 
receive(:already_loaded?).with("qeth").and_return(loaded)
+      end
+
+      let(:hwinfo) do
+        [
+          {
+            "active" => false, "bus" => "none", "busid" => "", "dev_name" => 
"", "driver" => "",
+            "drivers" => [{ "active" => false, "modprobe" => true, "modules" 
=> [["qeth", ""]] }],
+            "link" => nil, "mac" => "", "modalias" => "", "module" => "qeth",
+            "name" => "OSA Express Network card", "num" => 0, "options" => "",
+            "permanent_mac" => "", "requires" => [], "sysfs_id" => "", "type" 
=> "qeth",
+            "udi" => "", "unique" => "rdCR.n_7QNeEnh23", "wl_auth_modes" => 
nil,
+            "wl_bitrates" => nil, "wl_channels" => nil, "wl_enc_modes" => nil
+          },
+          {
+            "active" => true, "bus" => "Virtio", "busid" => "virtio0", 
"dev_name" => "eth0",
+            "drivers" => [
+              { "active" => true, "modprobe" => true, "modules" => 
[["virtio_net", ""]] }
+            ], "driver" => "virtio_net", "link" => false, "mac" => 
"52:54:00:12:34:56",
+            "modalias" => "virtio:d00000001v00001AF4", "module" => 
"virtio_net",
+            "name" => "Ethernet Card 0", "num" => 1, "options" => "",
+            "parent_busid" => "0000:00:02.0", "permanent_mac" => 
"52:54:00:12:34:56",
+            "requires" => [], "sysfs_id" => "/devices/pci0000:00/0000:00 
=>02.0/virtio0",
+            "type" => "eth", "udi" => "", "unique" => "Prmq.VIRhsc57kTD", 
"wl_auth_modes" => nil,
+            "wl_bitrates" => nil, "wl_channels" => nil, "wl_enc_modes" => nil
+          }
+        ]
+      end
+
+      context "and the driver module is not loaded" do
+        let(:loaded) { false }
+
+        it "modprobes the inactive driver" do
+          expect(subject).to receive(:load_module).with("qeth")
+          subject.LoadNetModules
+        end
+      end
+
+      context "and the driver was already loaded" do
+        it "does not try to modprobe the module" do
+          expect(subject).to_not receive(:load_module)
+          subject.LoadNetModules
+        end
+      end
+    end
+  end
+end


Reply via email to