Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package autoyast2 for openSUSE:Factory 
checked in at 2021-11-20 02:38:16
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/autoyast2 (Old)
 and      /work/SRC/openSUSE:Factory/.autoyast2.new.1895 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "autoyast2"

Sat Nov 20 02:38:16 2021 rev:308 rq:932527 version:4.4.21

Changes:
--------
--- /work/SRC/openSUSE:Factory/autoyast2/autoyast2.changes      2021-10-29 
22:34:45.255693928 +0200
+++ /work/SRC/openSUSE:Factory/.autoyast2.new.1895/autoyast2.changes    
2021-11-20 02:38:48.448846026 +0100
@@ -1,0 +2,18 @@
+Thu Nov 18 11:10:28 UTC 2021 - Knut Anderssen <kanders...@suse.com>
+
+- Add support for detecting EFI boot during autoinstallation
+  (jsc#SLE-18819)
+- 4.4.21
+
+-------------------------------------------------------------------
+Fri Nov 12 13:21:54 UTC 2021 - Imobach Gonzalez Sosa <igonzalezs...@suse.com>
+
+- bsc#1192626:
+  - Registration takes place always at the same point, no matter
+    which installation medium is being used.
+  - Adapt to the product specification API.
+- Stop AutoYaST installation when registration failed on online
+  medium (bsc#1188211, Josef Reidinger <jreidin...@suse.com>).
+- 4.4.20
+
+-------------------------------------------------------------------

Old:
----
  autoyast2-4.4.19.tar.bz2

New:
----
  autoyast2-4.4.21.tar.bz2

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

Other differences:
------------------
++++++ autoyast2.spec ++++++
--- /var/tmp/diff_new_pack.6aYeV8/_old  2021-11-20 02:38:49.000844204 +0100
+++ /var/tmp/diff_new_pack.6aYeV8/_new  2021-11-20 02:38:49.000844204 +0100
@@ -22,7 +22,7 @@
 %endif
 
 Name:           autoyast2
-Version:        4.4.19
+Version:        4.4.21
 Release:        0
 Summary:        YaST2 - Automated Installation
 License:        GPL-2.0-only
@@ -42,16 +42,18 @@
 BuildRequires:  libxslt
 BuildRequires:  rubygem(%{rb_default_ruby_abi}:rspec)
 # GPG symmetric methods and Password dialog
-BuildRequires:  yast2 >= 4.3.25
+# ProductSpec API
+BuildRequires:  yast2 >= 4.4.21
 # FileSystems.read_default_subvol_from_target
+BuildRequires:  yast2-services-manager
+BuildRequires:  yast2-transfer
+BuildRequires:  yast2-xml
+# ProductSpec API
 BuildRequires:  yast2-country
 BuildRequires:  yast2-network >= 3.1.145
-BuildRequires:  yast2-packager
-BuildRequires:  yast2-services-manager
+BuildRequires:  yast2-packager >= 4.4.13
 BuildRequires:  yast2-slp
-BuildRequires:  yast2-transfer
 BuildRequires:  yast2-update >= 3.3.0
-BuildRequires:  yast2-xml
 # Required for test suite testing one time sync
 BuildRequires:  yast2-ntp-client >= 4.0.1
 # New API for Y2Storage::PackageHandler and storage features
@@ -66,8 +68,8 @@
 
 Requires:       autoyast2-installation = %{version}
 Requires:       libxslt
-# GPG symmetric methods and Password dialog
-Requires:       yast2 >= 4.3.25
+# ProductSpec API
+Requires:       yast2 >= 4.4.21
 Requires:       yast2-core
 Requires:       yast2-country >= 3.1.13
 # Moving security module to first installation stage
@@ -120,8 +122,8 @@
 Requires:       yast2-core
 Requires:       yast2-country
 Requires:       yast2-ncurses
-# Y2Packager::MediumType
-Requires:       yast2-packager >= 4.2.25
+# ProductSpec API
+Requires:       yast2-packager >= 4.4.13
 # ServicesManagerTargetClass::BaseTargets
 Requires:       yast2-services-manager >= 3.1.10
 # Required for one time sync before installation

++++++ autoyast2-4.4.19.tar.bz2 -> autoyast2-4.4.21.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.4.19/.github/workflows/ci.yml 
new/autoyast2-4.4.21/.github/workflows/ci.yml
--- old/autoyast2-4.4.19/.github/workflows/ci.yml       2021-10-26 
14:33:02.000000000 +0200
+++ new/autoyast2-4.4.21/.github/workflows/ci.yml       2021-11-19 
13:18:52.000000000 +0100
@@ -10,7 +10,6 @@
     runs-on: ubuntu-latest
     container:
       image: registry.opensuse.org/yast/head/containers/yast-ruby:latest
-      options: --privileged
 
     steps:
 
@@ -37,7 +36,6 @@
     runs-on: ubuntu-latest
     container:
       image: registry.opensuse.org/yast/head/containers/yast-ruby:latest
-      options: --privileged
 
     steps:
 
@@ -51,7 +49,6 @@
     runs-on: ubuntu-latest
     container:
       image: registry.opensuse.org/yast/head/containers/yast-ruby:latest
-      options: --privileged
 
     steps:
 
@@ -65,7 +62,6 @@
     runs-on: ubuntu-latest
     container:
       image: registry.opensuse.org/yast/head/containers/yast-ruby:latest
-      options: --privileged
 
     steps:
 
@@ -81,7 +77,6 @@
     runs-on: ubuntu-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/autoyast2-4.4.19/package/autoyast2.changes 
new/autoyast2-4.4.21/package/autoyast2.changes
--- old/autoyast2-4.4.19/package/autoyast2.changes      2021-10-26 
14:33:02.000000000 +0200
+++ new/autoyast2-4.4.21/package/autoyast2.changes      2021-11-19 
13:18:52.000000000 +0100
@@ -1,4 +1,22 @@
 -------------------------------------------------------------------
+Thu Nov 18 11:10:28 UTC 2021 - Knut Anderssen <kanders...@suse.com>
+
+- Add support for detecting EFI boot during autoinstallation
+  (jsc#SLE-18819)
+- 4.4.21
+
+-------------------------------------------------------------------
+Fri Nov 12 13:21:54 UTC 2021 - Imobach Gonzalez Sosa <igonzalezs...@suse.com>
+
+- bsc#1192626:
+  - Registration takes place always at the same point, no matter
+    which installation medium is being used.
+  - Adapt to the product specification API.
+- Stop AutoYaST installation when registration failed on online
+  medium (bsc#1188211, Josef Reidinger <jreidin...@suse.com>).
+- 4.4.20
+
+-------------------------------------------------------------------
 Tue Oct 26 12:25:01 UTC 2021 - Jos?? Iv??n L??pez Gonz??lez <jlo...@suse.com>
 
 - Avoid internal error when checking signature (bsc#1192022).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.4.19/package/autoyast2.spec 
new/autoyast2-4.4.21/package/autoyast2.spec
--- old/autoyast2-4.4.19/package/autoyast2.spec 2021-10-26 14:33:02.000000000 
+0200
+++ new/autoyast2-4.4.21/package/autoyast2.spec 2021-11-19 13:18:52.000000000 
+0100
@@ -22,7 +22,7 @@
 %endif
 
 Name:           autoyast2
-Version:        4.4.19
+Version:        4.4.21
 Release:        0
 Summary:        YaST2 - Automated Installation
 License:        GPL-2.0-only
@@ -42,12 +42,14 @@
 BuildRequires:  libxslt
 BuildRequires:  rubygem(%{rb_default_ruby_abi}:rspec)
 # GPG symmetric methods and Password dialog
-BuildRequires:  yast2 >= 4.3.25
+# ProductSpec API
+BuildRequires:  yast2 >= 4.4.21
 # FileSystems.read_default_subvol_from_target
 BuildRequires:  yast2-xml
 BuildRequires:  yast2-transfer
 BuildRequires:  yast2-services-manager
-BuildRequires:  yast2-packager
+# ProductSpec API
+BuildRequires:  yast2-packager >= 4.4.13
 BuildRequires:  yast2-update >= 3.3.0
 BuildRequires:  yast2-network >= 3.1.145
 BuildRequires:  yast2-slp
@@ -66,8 +68,8 @@
 
 Requires:       autoyast2-installation = %{version}
 Requires:       libxslt
-# GPG symmetric methods and Password dialog
-Requires:       yast2 >= 4.3.25
+# ProductSpec API
+Requires:       yast2 >= 4.4.21
 Requires:       yast2-core
 Requires:       yast2-country >= 3.1.13
 # Moving security module to first installation stage
@@ -120,8 +122,8 @@
 Requires:       yast2-core
 Requires:       yast2-country
 Requires:       yast2-ncurses
-# Y2Packager::MediumType
-Requires:       yast2-packager >= 4.2.25
+# ProductSpec API
+Requires:       yast2-packager >= 4.4.13
 # ServicesManagerTargetClass::BaseTargets
 Requires:       yast2-services-manager >= 3.1.10
 # Required for one time sync before installation
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.4.19/src/autoyast-rnc/rules.rnc 
new/autoyast2-4.4.21/src/autoyast-rnc/rules.rnc
--- old/autoyast2-4.4.19/src/autoyast-rnc/rules.rnc     2021-10-26 
14:33:02.000000000 +0200
+++ new/autoyast2-4.4.21/src/autoyast-rnc/rules.rnc     2021-11-19 
13:18:52.000000000 +0100
@@ -49,6 +49,7 @@
     | hostname
     | hostaddress
     | hostid
+    | efi
     | karch
     | linux
     | installed_product
@@ -72,6 +73,7 @@
 custom5                   = element custom5                   { MAP, 
(match_text & match_type? & script) }
 disksize                  = element disksize                  { MAP, 
(match_text & match_type?) }
 domain                    = element domain                    { MAP, 
(match_text & match_type?) }
+efi                       = element efi                       { MAP, 
(match_text & match_type?) }
 hostname                  = element hostname                  { MAP, 
(match_text & match_type?) }
 hostaddress               = element hostaddress               { MAP, 
(match_text & match_type?) }
 hostid                    = element hostid                    { MAP, 
(match_text & match_type?) }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/autoyast2-4.4.19/src/lib/autoinstall/clients/ayast_probe.rb 
new/autoyast2-4.4.21/src/lib/autoinstall/clients/ayast_probe.rb
--- old/autoyast2-4.4.19/src/lib/autoinstall/clients/ayast_probe.rb     
2021-10-26 14:33:02.000000000 +0200
+++ new/autoyast2-4.4.21/src/lib/autoinstall/clients/ayast_probe.rb     
2021-11-19 13:18:52.000000000 +0100
@@ -75,6 +75,7 @@
         :hostaddress,
         :network,
         :domain,
+        :efi,
         :arch,
         :karch,
         :product,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/autoyast2-4.4.19/src/lib/autoinstall/clients/inst_autoinit.rb 
new/autoyast2-4.4.21/src/lib/autoinstall/clients/inst_autoinit.rb
--- old/autoyast2-4.4.19/src/lib/autoinstall/clients/inst_autoinit.rb   
2021-10-26 14:33:02.000000000 +0200
+++ new/autoyast2-4.4.21/src/lib/autoinstall/clients/inst_autoinit.rb   
2021-11-19 13:18:52.000000000 +0100
@@ -1,19 +1,16 @@
-require "autoinstall/autosetup_helpers"
-require "autoinstall/importer"
-require "y2packager/medium_type"
 require "autoinstall/ask/runner"
 require "autoinstall/ask/stage"
+require "autoinstall/autosetup_helpers"
+require "autoinstall/importer"
+require "y2packager/installation_medium"
+require "y2packager/product_spec"
 
-Yast.import "AutoInstall"
-Yast.import "AutoInstallRules"
 Yast.import "AutoinstConfig"
 Yast.import "AutoinstFunctions"
 Yast.import "AutoinstGeneral"
 Yast.import "AutoinstScripts"
-Yast.import "Call"
 Yast.import "Console"
 Yast.import "InstURL"
-Yast.import "Installation"
 Yast.import "Linuxrc"
 Yast.import "Mode"
 Yast.import "Popup"
@@ -90,21 +87,27 @@
 
         Yast::Progress.Finish
 
-        # when installing from the online installation medium we need to
-        # register the system earlier because the medium does not contain any
-        # repositories, we need the repositories from the registration server
-        if Y2Packager::MediumType.online? && !Yast::Mode.autoupgrade
-          autosetup_network if network_before_proposal?
-
-          res = register_system
-          return res if res
-        # offline registration need here to init software management according 
to picked product
-        # or autoupgrade without scc
-        elsif Y2Packager::MediumType.offline?
+        # if there are more repos, pick corresponding ones
+        if Y2Packager::InstallationMedium.contain_multi_repos?
           res = offline_product
           return res if res
         end
 
+        autosetup_network if network_before_proposal? && 
!Yast::Mode.autoupgrade
+
+        # register the system early to get repositories from registration 
server
+        if 
Yast::Profile.current.fetch_as_hash(REGISTER_SECTION)["do_registration"] &&
+            !Yast::Mode.autoupgrade
+
+          register = suse_register
+          # abort installation if registration failed and there are no install 
repo
+          return :abort if !register && 
!Y2Packager::InstallationMedium.contain_repo?
+        # report error if there are no registration and no repository on medium
+        elsif !Y2Packager::InstallationMedium.contain_repo? && 
!Yast::Mode.autoupgrade
+          report_missing_registration
+          return :abort
+        end
+
         if !(Yast::Mode.autoupgrade && Yast::AutoinstConfig.ProfileInRootPart)
           @ret = Yast::WFM.CallFunction("inst_system_analysis", [])
           return @ret if @ret == :abort
@@ -128,14 +131,13 @@
           Yast::WFM.CallFunction("fcoe-client_auto", ["Write"])
         end
 
-        if !(Y2Packager::MediumType.offline? || 
Yast::AutoinstFunctions.selected_product ||
-            Yast::Mode.autoupgrade)
+        if !(Yast::AutoinstFunctions.selected_product || 
Yast::Mode.autoupgrade)
           msg = _("None or wrong base product has been defined " \
            "in the AutoYaST configuration file. " \
            "Please check the <b>products</b> entry in the <b>software</b> 
section.<br><br>" \
            "Following base products are available:<br>")
-          Yast::AutoinstFunctions.available_base_products_hash.each do 
|product|
-            msg += "#{product[:name]} (#{product[:summary]})<br>"
+          Y2Packager::ProductSpec.base_products.each do |product|
+            msg += "#{product.name} (#{product.display_name})<br>"
           end
           Yast::Popup.LongError(msg) # No timeout because we are stopping the 
installation/upgrade.
           return :abort
@@ -366,25 +368,11 @@
         Yast::AutoinstConfig.ProfileInRootPart = true
       end
 
-      # Register system acoording to profile
-      # @return nil if all is fine or :abort if unrecoverable error found
-      def register_system
-        # check that the registration section is defined and registration is 
enabled
-        reg_section = Yast::Profile.current.fetch(REGISTER_SECTION, {})
-        reg_enabled = reg_section["do_registration"]
-
-        if !reg_enabled
-          msg = _("Registration is mandatory when using the online " \
-            "installation medium. Enable registration in " \
-            "the AutoYaST profile or use full installation medium.")
-          Yast::Popup.LongError(msg) # No timeout because we are stopping the 
installation/upgrade.
-
-          return :abort
-        end
-
-        suse_register
-
-        nil
+      def report_missing_registration
+        msg = _("Registration is mandatory when using the online " \
+          "installation medium. Enable registration in " \
+          "the AutoYaST profile or use full installation medium.")
+        Yast::Popup.LongError(msg) # No timeout because we are stopping the 
installation/upgrade.
       end
 
       # sets product and initialize it for offline installation
@@ -407,7 +395,7 @@
           log_url = Yast::URL.HidePassword(base_url)
           Yast::Packages.Initialize_StageInitial(show_popup, base_url, 
log_url, product.dir)
           # select the product to install
-          Yast::Pkg.ResolvableInstall(product.details.product, :product, "")
+          Yast::Pkg.ResolvableInstall(product.name, :product, "")
           # initialize addons and the workflow manager
           Yast::AddOnProduct.SetBaseProductURL(base_url)
           Yast::WorkflowManager.SetBaseWorkflow(false)
@@ -428,8 +416,8 @@
               "Please check the <b>products</b> entry in the <b>software</b> 
section.<br><br>" \
               "Following base products are available:<br>")
           end
-          Yast::AutoinstFunctions.available_base_products_hash.each do |p|
-            msg += "#{p[:name]} (#{p[:summary]})<br>"
+          Y2Packager::ProductSpec.base_products.each do |prod|
+            msg += "#{prod.name} (#{prod.display_name})<br>"
           end
           Yast::Popup.LongError(msg) # No timeout because we are stopping the 
installation/upgrade.
           return :abort
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/autoyast2-4.4.19/src/lib/autoinstall/clients/inst_autosetup_upgrade.rb 
new/autoyast2-4.4.21/src/lib/autoinstall/clients/inst_autosetup_upgrade.rb
--- old/autoyast2-4.4.19/src/lib/autoinstall/clients/inst_autosetup_upgrade.rb  
2021-10-26 14:33:02.000000000 +0200
+++ new/autoyast2-4.4.21/src/lib/autoinstall/clients/inst_autosetup_upgrade.rb  
2021-11-19 13:18:52.000000000 +0100
@@ -1,5 +1,6 @@
 require "autoinstall/autosetup_helpers"
 
+require "y2packager/product_spec"
 require "y2packager/product_upgrade"
 require "yast2/popup"
 
@@ -236,8 +237,8 @@
            "It can be specified in the <b>software</b>/<b>products</b> entry 
in the " \
            "AutoYaST configuration file.<br><br>" \
            "Following base products are available:<br>")
-          Yast::AutoinstFunctions.available_base_products_hash.each do 
|product|
-            msg += "#{product[:name]} (#{product[:summary]})<br>"
+          Y2Packager::ProductSpec.base_products.each do |prod|
+            msg += "#{prod.name} (#{prod.display_name})<br>"
           end
           Yast2::Popup.show(msg, richtext: true) # No timeout because we are 
stopping the upgrade.
           return :abort
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.4.19/src/lib/autoinstall/efi_detector.rb 
new/autoyast2-4.4.21/src/lib/autoinstall/efi_detector.rb
--- old/autoyast2-4.4.19/src/lib/autoinstall/efi_detector.rb    1970-01-01 
01:00:00.000000000 +0100
+++ new/autoyast2-4.4.21/src/lib/autoinstall/efi_detector.rb    2021-11-19 
13:18:52.000000000 +0100
@@ -0,0 +1,23 @@
+Yast.import "Linuxrc"
+Yast.import "Stage"
+
+module Y2Autoinstallation
+  # This class is responsible of detecting if the system was booted using EFI 
or not
+  class EFIDetector
+    EFI_VARS_DIRS = ["/sys/firmware/efi/efivars", 
"/sys/firmware/efi/vars/"].freeze
+
+    # Returns whether the system was booted using UEFI or not
+    #
+    # During the First Stage of the installation it relies on linuxrc for 
detecting the boot
+    # but in the rest of cases it checks if any of the EFI vars directories 
exist
+    #
+    # @return [Boolean] whether the system was booted using UEFI or not
+    def self.boot_efi?
+      if Yast::Stage.initial
+        Yast::Linuxrc.InstallInf("EFI") == "1"
+      else
+        EFI_VARS_DIRS.any? { |d| Dir.exist?(d) }
+      end
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.4.19/src/lib/autoinstall/y2erb.rb 
new/autoyast2-4.4.21/src/lib/autoinstall/y2erb.rb
--- old/autoyast2-4.4.19/src/lib/autoinstall/y2erb.rb   2021-10-26 
14:33:02.000000000 +0200
+++ new/autoyast2-4.4.21/src/lib/autoinstall/y2erb.rb   2021-11-19 
13:18:52.000000000 +0100
@@ -1,5 +1,6 @@
 require "yast"
 require "erb"
+require "autoinstall/efi_detector"
 
 module Y2Autoinstallation
   class Y2ERB
@@ -12,6 +13,12 @@
     class TemplateEnvironment
       include Yast::Logger
 
+      # @see Y2Autoinstallation::EFIDetector
+      # @return [Boolean] whether the system is booted using EFI or not
+      def boot_efi?
+        EFIDetector.boot_efi?
+      end
+
       def hardware
         @hardware ||= Yast::SCR.Read(Yast::Path.new(".probe"))
       end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.4.19/src/modules/AutoInstallRules.rb 
new/autoyast2-4.4.21/src/modules/AutoInstallRules.rb
--- old/autoyast2-4.4.19/src/modules/AutoInstallRules.rb        2021-10-26 
14:33:02.000000000 +0200
+++ new/autoyast2-4.4.21/src/modules/AutoInstallRules.rb        2021-11-19 
13:18:52.000000000 +0100
@@ -6,6 +6,7 @@
 # $Id$
 require "yast"
 require "autoinstall/xml_checks"
+require "autoinstall/efi_detector"
 require "yast2/popup"
 require "y2storage"
 
@@ -24,6 +25,7 @@
       Yast.import "XML"
       Yast.import "Kernel"
       Yast.import "Mode"
+      Yast.import "Linuxrc"
       Yast.import "Profile"
       Yast.import "Label"
       Yast.import "Report"
@@ -84,6 +86,7 @@
       @totaldisk = 0
       @hostid = ""
       @mac = ""
+      @efi = "no"
       @linux = 0
       @others = 0
       @xserver = ""
@@ -287,6 +290,11 @@
       Ops.set(@ATTR, "mac", @mac)
 
       #
+      # EFI Boot
+      @efi = boot_efi?
+      @ATTR["efi"] = @efi
+
+      #
       # Network
       #
       Ops.set(@ATTR, "hostaddress", hostaddress)
@@ -470,6 +478,7 @@
               "installed_product_version",
               "installed_product",
               "domain",
+              "efi",
               "network",
               "mac",
               "karch",
@@ -1072,10 +1081,17 @@
     def AutoInstallRules
       @mac = getMAC
       @hostid = getHostid
-      Builtins.y2milestone("init mac:%1 hostid:%2", @mac, @hostid)
+      @efi = boot_efi?
+      log.info "init mac:#{@mac} hostid: #{@hostid} efi: #{@efi}"
       nil
     end
 
+    # @see Y2Autoinstallation::EFIDetector
+    # @return [String] "yes" when the system is booted using EFI or "no" when 
not
+    def boot_efi?
+      Y2Autoinstallation::EFIDetector.boot_efi? ? "yes" : "no"
+    end
+
     # Regexp to extract the IP from the routes table
     HOSTADDRESS_REGEXP = /src ([\w.]+) /.freeze
 
@@ -1118,6 +1134,7 @@
     publish variable: :mac, type: "string"
     publish variable: :linux, type: "integer"
     publish variable: :others, type: "integer"
+    publish variable: :efi, type: "string"
     publish variable: :xserver, type: "string"
     publish variable: :NonLinuxPartitions, type: "list"
     publish variable: :LinuxPartitions, type: "list"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.4.19/src/modules/AutoinstFunctions.rb 
new/autoyast2-4.4.21/src/modules/AutoinstFunctions.rb
--- old/autoyast2-4.4.19/src/modules/AutoinstFunctions.rb       2021-10-26 
14:33:02.000000000 +0200
+++ new/autoyast2-4.4.21/src/modules/AutoinstFunctions.rb       2021-11-19 
13:18:52.000000000 +0100
@@ -1,6 +1,6 @@
 require "y2packager/product"
 require "y2packager/product_reader"
-require "y2packager/product_location"
+require "y2packager/product_spec"
 require "y2packager/medium_type"
 
 module Yast
@@ -18,6 +18,10 @@
       Yast.import "ProductControl"
       Yast.import "Profile"
       Yast.import "Pkg"
+
+      # Force to read the list of products from libzypp. See {#check_result} 
for
+      # further details.
+      @force_libzypp = false
     end
 
     # Determines if the second stage should be executed
@@ -81,8 +85,7 @@
     # 2) impllicitly according to software selection
     # 3) if not set explicitly and just one product is available on media - 
use it
     #
-    # @return [Y2Packager::Product|Y2Packager::ProductLocation] a base product 
or nil.
-    # The returned class depends on phase of installation and type of 
installation medium.
+    # @return [Y2Packager::ProductSpec] a base product or nil.
     def selected_product
       return @selected_product if @selected_product
 
@@ -113,35 +116,27 @@
     #
     # Evaluate all available base products and returns a list of product.
     # CAUTION: The type of the return values depend of the kind of where
-    # the product information has been read (libzypp, product location).
-    # So the type could be ProductLocation or Product.
-    # available_base_products_hash could be an alternative for this call.
+    # the product information has been read (libzypp, or product specs).
+    # So the type could be Product or ProductSpec derived class.
+    #
+    # The behaviour of this method can be affected by the `force_libzypp` 
attribute.
+    # Check {#reset_product} for further details.
     #
+    # @return [Array<Y2Packager::Product|Y2Packager::ProductSpec>] List of 
base products
     def available_base_products
-      @base_products ||= if Y2Packager::MediumType.offline? && !@force_libzypp
-        url = InstURL.installInf2Url("")
-        Y2Packager::ProductLocation
-          .scan(url)
-          .select { |p| p.details&.base }
-          .sort(&::Y2Packager::PRODUCT_SORTER)
-      else
-        Y2Packager::ProductReader.new.available_base_products(force_repos: 
@force_libzypp)
-      end
-    end
+      return @base_products if @base_products
 
-    #
-    # Evaluate all available base products and returns a list of hashes which 
contains
-    # human readable strings only.
-    #
-    # @return [Hash] an array of product hashes
-    def available_base_products_hash
-      available_base_products.map do |product|
-        if product.is_a?(Y2Packager::ProductLocation)
-          { name: product.details.product, summary: product.details.summary }
-        else
-          { name: product.name, summary: product.display_name }
-        end
+      @base_products = Y2Packager::ProductReader.new.available_base_products(
+        force_repos: @force_libzypp
+      )
+      return @base_products if @force_libzypp
+
+      libzypp_names = @base_products.map(&:name)
+      Y2Packager::ProductSpec.base_products.each do |product|
+        @base_products << product unless libzypp_names.include?(product.name)
       end
+
+      @base_products
     end
 
     # force selected product to be read from libzypp and not from product 
location
@@ -171,11 +166,7 @@
       log.info "Found base products : #{available_base_products.inspect}"
 
       products = available_base_products.select do |product|
-        if product.is_a?(Y2Packager::ProductLocation)
-          yield(product.details.product)
-        else
-          yield(product.name)
-        end
+        yield(product.name)
       end
 
       return products.first if products.size == 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.4.19/test/AutoInstallRules_test.rb 
new/autoyast2-4.4.21/test/AutoInstallRules_test.rb
--- old/autoyast2-4.4.19/test/AutoInstallRules_test.rb  2021-10-26 
14:33:02.000000000 +0200
+++ new/autoyast2-4.4.21/test/AutoInstallRules_test.rb  2021-11-19 
13:18:52.000000000 +0100
@@ -43,6 +43,7 @@
       expect(Yast::Kernel).to receive(:GetPackages).and_return([])
       expect(subject).to receive(:getNetwork).and_return("192.168.1.0")
       expect(subject).to receive(:getHostname).and_return("myhost")
+      expect(Y2Autoinstallation::EFIDetector).to 
receive(:boot_efi?).and_return(true)
       expect(Yast::SCR).to 
receive(:Read).with(Yast::Path.new(".etc.install_inf.XServer"))
       expect(Yast::Hostname).to 
receive(:CurrentDomain).and_return("mydomain.lan")
 
@@ -55,6 +56,7 @@
 
       expect(Yast::AutoInstallRules.installed_product).to eq("SUSE Linux 
Enterprise Server 12")
       expect(Yast::AutoInstallRules.installed_product_version).to eq("12")
+      expect(Yast::AutoInstallRules.efi).to eq("yes")
     end
   end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.4.19/test/AutoinstFunctions_test.rb 
new/autoyast2-4.4.21/test/AutoinstFunctions_test.rb
--- old/autoyast2-4.4.19/test/AutoinstFunctions_test.rb 2021-10-26 
14:33:02.000000000 +0200
+++ new/autoyast2-4.4.21/test/AutoinstFunctions_test.rb 2021-11-19 
13:18:52.000000000 +0100
@@ -117,73 +117,92 @@
       Y2Packager::Product.new(name: name)
     end
 
+    let(:product_spec) { instance_double(Y2Packager::ProductSpec, name: 
"openSUSE") }
+
     let(:selected_name) { "SLES" }
 
+    let(:profile) do
+      { "software" => { "products" => [selected_name] } }
+    end
+
     before(:each) do
+      allow(Yast::Profile).to 
receive(:current).and_return(Yast::ProfileHash.new(profile))
       allow(Y2Packager::ProductReader)
         .to receive(:new)
         .and_return(double(available_base_products: [base_product("SLES"), 
base_product("SLED")]))
 
+      allow(Y2Packager::ProductSpec).to 
receive(:base_products).and_return([product_spec])
+
+      subject.main
       # reset cache between tests
       subject.reset_product
     end
 
-    it "returns proper base product when explicitly selected in the profile " \
-        "and such base product exists on media" do
-      allow(Yast::Profile)
-        .to receive(:current)
-        .and_return(Yast::ProfileHash.new("software" => { "products" => 
[selected_name] }))
+    context "when the base product is explicitly selected in the profile" do
+      context "and the product exists on the media" do
+        it "returns the corresponding base product" do
+          expect(subject.selected_product.name).to eql selected_name
+        end
+      end
 
-      expect(subject.selected_product.name).to eql selected_name
-    end
+      context "and the product exists on the control file (online case)" do
+        let(:selected_name) { "openSUSE" }
+
+        it "returns the corresponding base product" do
+          subject.main
+          expect(subject.selected_product.name).to eql selected_name
+        end
+      end
 
-    it "returns nil when product is explicitly selected in the profile and " \
-        "such base product doesn't exist on media" do
-      allow(Yast::Profile)
-        .to receive(:current)
-        .and_return(
-          Yast::ProfileHash.new("software" => { "products" => { "product" => 
"Fedora" } })
-        )
+      context "and such a product does not exist on the media" do
+        let(:selected_name) { "Fedora" }
 
-      expect(subject.selected_product).to be nil
+        it "returns nil" do
+          expect(subject.selected_product).to be nil
+        end
+      end
     end
 
-    it "returns base product identified by patterns in the profile " \
-        "if such base product exists on media" do
-      allow(Yast::Profile)
-        .to receive(:current)
-        .and_return(Yast::ProfileHash.new("software" => { "patterns" => 
["sles-base-32bit"] }))
+    context "when the product is identified by a pattern" do
+      let(:profile) do
+        { "software" => { "patterns" => ["sles-base-32bit"] } }
+      end
 
-      expect(subject.selected_product.name).to eql selected_name
+      it "returns the corresponding product" do
+        expect(subject.selected_product.name).to eql selected_name
+      end
     end
 
-    it "returns base product identified by packages in the profile " \
-        "if such base product exists on media" do
-      allow(Yast::Profile)
-        .to receive(:current)
-        .and_return(Yast::ProfileHash.new("software" => { "packages" => 
["sles-release"] }))
+    context "when the product is identified by a package" do
+      let(:profile) do
+        { "software" => { "packages" => ["sles-release"] } }
+      end
 
-      expect(subject.selected_product.name).to eql selected_name
+      it "returns the corresponding product" do
+        expect(subject.selected_product.name).to eql selected_name
+      end
     end
 
-    it "returns base product if there is just one on media and " \
-        "product cannot be identified from profile" do
-      allow(Y2Packager::ProductReader)
-        .to receive(:new)
-        .and_return(double(available_base_products: [base_product("SLED")]))
-      allow(Yast::Profile)
-        .to receive(:current)
-        .and_return(Yast::ProfileHash.new("software" => {}))
+    context "when the product cannot be identified from the profile" do
+      let(:profile) do
+        { "software" => {} }
+      end
 
-      expect(subject.selected_product.name).to eql "SLED"
+      context "and only one base product exists on the media" do
+        before do
+          allow(Y2Packager::ProductReader)
+            .to receive(:new)
+            .and_return(double(available_base_products: 
[base_product("SLED")]))
+        end
+
+        it "returns the existing base product" do
+          expect(subject.selected_product.name).to eql "SLED"
+        end
+      end
     end
 
     context "when there is not a valid software section" do
-      before do
-        allow(Yast::Profile)
-          .to receive(:current)
-          .and_return(Yast::ProfileHash.new("software" => nil))
-      end
+      let(:profile) { { "software" => nil } }
 
       it "returns nil" do
         expect(subject.selected_product).to be_nil
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/autoyast2-4.4.19/test/lib/autoinstall/widgets/ask/password_field_test.rb 
new/autoyast2-4.4.21/test/lib/autoinstall/widgets/ask/password_field_test.rb
--- 
old/autoyast2-4.4.19/test/lib/autoinstall/widgets/ask/password_field_test.rb    
    2021-10-26 14:33:02.000000000 +0200
+++ 
new/autoyast2-4.4.21/test/lib/autoinstall/widgets/ask/password_field_test.rb    
    2021-11-19 13:18:52.000000000 +0100
@@ -20,6 +20,7 @@
 require_relative "../../../../test_helper"
 require "autoinstall/widgets/ask/password_field"
 require "autoinstall/ask/question"
+require "cwm/rspec"
 
 describe Y2Autoinstall::Widgets::Ask::PasswordField do
   subject { described_class.new(question) }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/autoyast2-4.4.19/test/lib/clients/inst_autoinit_test.rb 
new/autoyast2-4.4.21/test/lib/clients/inst_autoinit_test.rb
--- old/autoyast2-4.4.19/test/lib/clients/inst_autoinit_test.rb 2021-10-26 
14:33:02.000000000 +0200
+++ new/autoyast2-4.4.21/test/lib/clients/inst_autoinit_test.rb 2021-11-19 
13:18:52.000000000 +0100
@@ -22,6 +22,17 @@
 require "autoinstall/clients/inst_autoinit"
 
 describe Y2Autoinstallation::Clients::InstAutoinit do
+  let(:repo?) { true }
+  let(:do_registration) { true }
+  let(:setup_before_proposal) { false }
+
+  let(:profile) do
+    Yast::ProfileHash.new(
+      "suse_register" => { "do_registration" => do_registration },
+      "networking"    => { "setup_before_proposal" => setup_before_proposal }
+    )
+  end
+
   before do
     allow(Yast::UI).to receive(:UserInput).and_return(:next)
     allow(Yast::WFM).to receive(:CallFunction).and_return(true)
@@ -32,14 +43,22 @@
     allow(Yast::Linuxrc).to receive(:InstallInf).and_return(nil)
     allow(Yast::ProfileLocation).to receive(:Process).and_return(true)
     allow(Yast::Profile).to receive(:ReadXML).and_return(true)
-    allow(Yast::Profile).to receive(:current).and_return(Yast::ProfileHash.new)
-    allow(Yast::Mode).to receive(:autoupgrade).and_return(true)
+    allow(Yast::Profile).to receive(:current).and_return(profile)
+    allow(Yast::Mode).to receive(:autoupgrade).and_return(false)
     allow(Yast::AutoinstFunctions).to 
receive(:available_base_products).and_return([])
-    allow(Y2Packager::MediumType).to receive(:online?).and_return(true)
+    allow(Y2Packager::InstallationMedium).to 
receive(:contain_multi_repos?).and_return(false)
+    allow(Y2Packager::InstallationMedium).to 
receive(:contain_repo?).and_return(repo?)
+    allow(Y2Packager::ProductSpec).to 
receive(:base_products).and_return([sles_spec])
     Yast::AutoinstConfig.ProfileInRootPart = false
   end
 
   describe "#run" do
+    let(:sles_spec) do
+      instance_double(
+        Y2Packager::ProductSpec, name: "SLES", display_name: "SUSE Linux 
Enterprise Server"
+      )
+    end
+
     it "inits console module" do
       expect(Yast::Console).to receive(:Init)
 
@@ -97,53 +116,26 @@
       subject.run
     end
 
-    context "when using the Full medium" do
-      it "reports an error when the product is not specified" do
-        allow(Y2Packager::MediumType).to receive(:online?).and_return(false)
-        allow(Y2Packager::MediumType).to receive(:offline?).and_return(true)
-        allow(Yast::Mode).to receive(:autoupgrade).and_return(false)
+    it "reports an error when the product is not specified" do
+      allow(Yast::Mode).to receive(:autoupgrade).and_return(false)
+      allow(Yast::InstURL).to receive(:installInf2Url).and_return("")
 
-        expect(Yast::Popup).to receive(:LongError)
+      expect(Yast::Popup).to receive(:LongError)
 
-        expect(subject.run).to eq :abort
-      end
+      expect(subject.run).to eq :abort
     end
 
-    context "when using the Online medium for an installation" do
-      let(:do_registration) { false }
-      let(:setup_before_proposal) { false }
-      let(:profile) do
-        Yast::ProfileHash.new(
-          "suse_register" => { "do_registration" => do_registration },
-          "networking"    => { "setup_before_proposal" => 
setup_before_proposal }
-        )
-      end
-
-      before do
-        allow(Yast::Mode).to receive(:autoupgrade).and_return(false)
-        allow(Yast::Profile).to receive(:current).and_return(profile)
-      end
-
-      context "and the network is requested to be configured before the 
proposal" do
-        let(:setup_before_proposal) { true }
+    context "when the registration is not enabled in the profile" do
+      it "does not try to register the system" do
+        expect(Yast::WFM).to_not receive(:CallFunction)
+          .with("scc_auto", ["Import", profile["suse_register"]])
+        expect(Yast::WFM).to_not receive(:CallFunction).with("scc_auto", 
["Write"])
 
-        it "configures the network" do
-          expect(subject).to receive(:autosetup_network)
-
-          subject.run
-        end
+        subject.run
       end
 
-      context "and the registration is disabled or not present in the profile" 
do
-        let(:do_registration) { false }
-
-        it "does not try to register the system" do
-          expect(Yast::WFM).to_not receive(:CallFunction)
-            .with("scc_auto", ["Import", profile["suse_register"]])
-          expect(Yast::WFM).to_not receive(:CallFunction).with("scc_auto", 
["Write"])
-
-          subject.run
-        end
+      context "and there are not repositories in the installation medium" do
+        let(:repo?) { false }
 
         it "reports an error" do
           expect(Yast::WFM).to_not receive(:CallFunction)
@@ -158,20 +150,30 @@
           expect(subject.run).to eq :abort
         end
       end
+    end
 
-      context "and the registration is enabled according to the profile" do
-        let(:do_registration) { true }
+    context "when the registration is enabled according to the profile" do
+      let(:do_registration) { true }
 
-        it "registers the system" do
-          expect(Yast::WFM).to receive(:CallFunction)
-            .with("scc_auto", ["Import", profile["suse_register"]])
-          expect(Yast::WFM).to receive(:CallFunction).with("scc_auto", 
["Write"])
-          # fake that registration is available to avoid build requires
-          allow(subject).to 
receive(:registration_module_available?).and_return(true)
-          allow(Yast::Profile).to receive(:remove_sections)
+      it "registers the system" do
+        expect(Yast::WFM).to receive(:CallFunction)
+          .with("scc_auto", ["Import", profile["suse_register"]])
+        expect(Yast::WFM).to receive(:CallFunction).with("scc_auto", ["Write"])
+        # fake that registration is available to avoid build requires
+        allow(subject).to 
receive(:registration_module_available?).and_return(true)
+        allow(Yast::Profile).to receive(:remove_sections)
 
-          subject.run
-        end
+        subject.run
+      end
+    end
+
+    context "when the network is requested to be configured before the 
proposal" do
+      let(:setup_before_proposal) { true }
+
+      it "configures the network" do
+        expect(subject).to receive(:autosetup_network)
+
+        subject.run
       end
     end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/autoyast2-4.4.19/test/lib/clients/inst_autosetup_upgrade_test.rb 
new/autoyast2-4.4.21/test/lib/clients/inst_autosetup_upgrade_test.rb
--- old/autoyast2-4.4.19/test/lib/clients/inst_autosetup_upgrade_test.rb        
2021-10-26 14:33:02.000000000 +0200
+++ new/autoyast2-4.4.21/test/lib/clients/inst_autosetup_upgrade_test.rb        
2021-11-19 13:18:52.000000000 +0100
@@ -26,7 +26,7 @@
 
 describe Y2Autoinstallation::Clients::InstAutosetupUpgrade do
   let(:profile) do
-    {
+    Yast::ProfileHash.new(
       "general"  => {},
       "software" => {
         "products"        => ["sled"],
@@ -37,7 +37,7 @@
         "remove-products" => ["sle-desktop"]
       },
       "upgrade"  => { "stop_on_solver_conflict" => true }
-    }
+    )
   end
 
   before do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.4.19/test/lib/efi_detector_test.rb 
new/autoyast2-4.4.21/test/lib/efi_detector_test.rb
--- old/autoyast2-4.4.19/test/lib/efi_detector_test.rb  1970-01-01 
01:00:00.000000000 +0100
+++ new/autoyast2-4.4.21/test/lib/efi_detector_test.rb  2021-11-19 
13:18:52.000000000 +0100
@@ -0,0 +1,49 @@
+require_relative "../test_helper"
+require "autoinstall/efi_detector"
+
+describe Y2Autoinstallation::EFIDetector do
+  describe ".boot_efi?" do
+    let(:efi) { true }
+
+    context "when called in the initial Stage" do
+      before do
+        allow(Yast::Linuxrc).to 
receive(:InstallInf).with("EFI").and_return(efi)
+      end
+
+      context "and EFI is read as '1' from the Install.inf file" do
+        it "returns true" do
+          expect(described_class.boot_efi?)
+        end
+      end
+
+      context "and EFI is not read as '1' from the Install.inf file" do
+        let(:efi) { false }
+
+        it "returns false" do
+          expect(described_class.boot_efi?)
+        end
+      end
+    end
+
+    context "when called in normal Mode" do
+      before do
+        allow(Dir).to receive(:exist?)
+      end
+
+      described_class.const_get("EFI_VARS_DIRS").each do |dir|
+        it "returns true if '#{dir}' exists" do
+          expect(Dir).to receive(:exist?).with(dir).and_return(true)
+          expect(described_class.boot_efi?).to eq(true)
+        end
+      end
+
+      it "returns false otherwise" do
+        described_class.const_get("EFI_VARS_DIRS").each do |dir|
+          allow(Dir).to receive(:exist?).with(dir).and_return(false)
+        end
+
+        expect(described_class.boot_efi?).to eq(false)
+      end
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autoyast2-4.4.19/test/lib/y2erb_test.rb 
new/autoyast2-4.4.21/test/lib/y2erb_test.rb
--- old/autoyast2-4.4.19/test/lib/y2erb_test.rb 2021-10-26 14:33:02.000000000 
+0200
+++ new/autoyast2-4.4.21/test/lib/y2erb_test.rb 2021-11-19 13:18:52.000000000 
+0100
@@ -212,6 +212,28 @@
     allow(Yast::SCR).to receive(:Read).and_return(hardware_mock_data)
   end
 
+  describe "#boot_efi?" do
+    let(:efi) { true }
+
+    before do
+      allow(Y2Autoinstallation::EFIDetector).to 
receive(:boot_efi?).and_return(efi)
+    end
+
+    context "when the system was booted with EFI" do
+      it "returns true" do
+        expect(subject.boot_efi?).to eq(true)
+      end
+    end
+
+    context "when the system was not booted with EFI" do
+      let(:efi) { false }
+
+      it "returns false" do
+        expect(subject.boot_efi?).to eq(false)
+      end
+    end
+  end
+
   describe "#network_cards" do
     it "returns list of map" do
       expect(subject.network_cards).to be_a(Array)

Reply via email to