Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package yast2-registration for 
openSUSE:Factory checked in at 2022-10-22 14:12:36
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-registration (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-registration.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-registration"

Sat Oct 22 14:12:36 2022 rev:92 rq:1030397 version:4.5.6

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-registration/yast2-registration.changes    
2022-06-09 14:09:30.708344552 +0200
+++ 
/work/SRC/openSUSE:Factory/.yast2-registration.new.2275/yast2-registration.changes
  2022-10-22 14:13:11.388752611 +0200
@@ -1,0 +2,9 @@
+Wed Oct 19 08:13:54 UTC 2022 - Jos?? Iv??n L??pez Gonz??lez <jlo...@suse.com>
+
+- Add reader for products defined in a YAML file.
+- Allow forcing registration and configuring a YAML product as
+  installed product.
+- Related to jsc#PED-1380 and jsc#PM-3439.
+- 4.5.6
+
+-------------------------------------------------------------------

Old:
----
  yast2-registration-4.5.5.tar.bz2

New:
----
  yast2-registration-4.5.6.tar.bz2

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

Other differences:
------------------
++++++ yast2-registration.spec ++++++
--- /var/tmp/diff_new_pack.FpkOZf/_old  2022-10-22 14:13:11.956753957 +0200
+++ /var/tmp/diff_new_pack.FpkOZf/_new  2022-10-22 14:13:11.960753967 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-registration
-Version:        4.5.5
+Version:        4.5.6
 Release:        0
 Summary:        YaST2 - Registration Module
 License:        GPL-2.0-only

++++++ yast2-registration-4.5.5.tar.bz2 -> yast2-registration-4.5.6.tar.bz2 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.5.5/package/yast2-registration.changes 
new/yast2-registration-4.5.6/package/yast2-registration.changes
--- old/yast2-registration-4.5.5/package/yast2-registration.changes     
2022-06-08 09:56:12.000000000 +0200
+++ new/yast2-registration-4.5.6/package/yast2-registration.changes     
2022-10-21 14:41:17.000000000 +0200
@@ -1,4 +1,13 @@
 -------------------------------------------------------------------
+Wed Oct 19 08:13:54 UTC 2022 - Jos?? Iv??n L??pez Gonz??lez <jlo...@suse.com>
+
+- Add reader for products defined in a YAML file.
+- Allow forcing registration and configuring a YAML product as
+  installed product.
+- Related to jsc#PED-1380 and jsc#PM-3439.
+- 4.5.6
+
+-------------------------------------------------------------------
 Tue Jun  7 12:37:04 UTC 2022 - Imobach Gonzalez Sosa <igonzalezs...@suse.com>
 
 - Do not crash when cloning an unregistered system with
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.5.5/package/yast2-registration.spec 
new/yast2-registration-4.5.6/package/yast2-registration.spec
--- old/yast2-registration-4.5.5/package/yast2-registration.spec        
2022-06-08 09:56:12.000000000 +0200
+++ new/yast2-registration-4.5.6/package/yast2-registration.spec        
2022-10-21 14:41:17.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-registration
-Version:        4.5.5
+Version:        4.5.6
 Release:        0
 Summary:        YaST2 - Registration Module
 License:        GPL-2.0-only
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.5.5/src/lib/registration/storage.rb 
new/yast2-registration-4.5.6/src/lib/registration/storage.rb
--- old/yast2-registration-4.5.5/src/lib/registration/storage.rb        
2022-06-08 09:56:12.000000000 +0200
+++ new/yast2-registration-4.5.6/src/lib/registration/storage.rb        
2022-10-21 14:41:17.000000000 +0200
@@ -51,13 +51,15 @@
       include Singleton
 
       attr_accessor :install_updates, :email, :reg_code, :selected_addons,
-        :base_registered, :custom_url, :imported_cert_sha256_fingerprint
+        :base_registered, :custom_url, :imported_cert_sha256_fingerprint,
+        :yaml_product, :force_registration
 
       def initialize
         @email = ""
         @reg_code = ""
         @selected_addons = []
         @base_registered = false
+        @force_registration = false
       end
     end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.5.5/src/lib/registration/sw_mgmt.rb 
new/yast2-registration-4.5.6/src/lib/registration/sw_mgmt.rb
--- old/yast2-registration-4.5.5/src/lib/registration/sw_mgmt.rb        
2022-06-08 09:56:12.000000000 +0200
+++ new/yast2-registration-4.5.6/src/lib/registration/sw_mgmt.rb        
2022-10-21 14:41:17.000000000 +0200
@@ -31,6 +31,7 @@
 require "registration/helpers"
 require "registration/url_helpers"
 require "registration/repo_state"
+require "registration/storage"
 
 require "packager/product_patterns"
 require "y2packager/medium_type"
@@ -62,9 +63,17 @@
 
     ZYPP_DIR = "/etc/zypp".freeze
 
-    FAKE_BASE_PRODUCT = { "name" => "SLES", "arch" => "x86_64", "version" => 
"12-0",
-      "flavor" => "DVD", "version_version" => "12", "register_release" => "",
-      "register_target" => "sle-12-x86_64" }.freeze
+    FAKE_BASE_PRODUCT = {
+      "arch"             => "x86_64",
+      "display_name"     => "SUSE Linux Enterprise Desktop 15 SP4",
+      "flavor"           => "",
+      "name"             => "SLED",
+      "product_line"     => "sled",
+      "register_release" => "",
+      "register_target"  => "sle-15-x86_64",
+      "version"          => "15.4-0",
+      "version_version"  => "15.4"
+    }.freeze
 
     OEM_DIR = "/var/lib/suseRegister/OEM".freeze
 
@@ -192,6 +201,9 @@
 
       return online_base_product if Stage.initial && 
Y2Packager::MediumType.online?
 
+      yaml_product = Storage::InstallationOptions.instance.yaml_product
+      return yaml_product if yaml_product
+
       # use the selected product if a product has been already selected
       selected = product_selected? if Stage.initial
       installed = product_installed? if Stage.initial
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.5.5/src/lib/registration/ui/base_system_registration_dialog.rb
 
new/yast2-registration-4.5.6/src/lib/registration/ui/base_system_registration_dialog.rb
--- 
old/yast2-registration-4.5.5/src/lib/registration/ui/base_system_registration_dialog.rb
     2022-06-08 09:56:12.000000000 +0200
+++ 
new/yast2-registration-4.5.6/src/lib/registration/ui/base_system_registration_dialog.rb
     2022-10-21 14:41:17.000000000 +0200
@@ -320,8 +320,7 @@
       # widget for skipping the registration
       # @return [Yast::Term]  UI term
       def skip_option
-        # do not display it in an installed system or when already registered
-        return Empty() if Stage.normal || Registration.is_registered?
+        return Empty() if hide_skip_option?
         Left(
           RadioButton(
             Id(:skip_registration),
@@ -332,6 +331,18 @@
         )
       end
 
+      # Whether skip option should be hidden
+      #
+      # Do not display it in an installed system or when already registered or 
when registration
+      # is mandatory.
+      #
+      # @return [Boolean]
+      def hide_skip_option?
+        Stage.normal ||
+          Registration.is_registered? ||
+          Storage::InstallationOptions.instance.force_registration
+      end
+
       # part of the main dialog definition - the base product details
       # @return [Yast::Term]  UI term
       def product_details_widgets
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.5.5/src/lib/registration/yaml_products_reader.rb 
new/yast2-registration-4.5.6/src/lib/registration/yaml_products_reader.rb
--- old/yast2-registration-4.5.5/src/lib/registration/yaml_products_reader.rb   
1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-registration-4.5.6/src/lib/registration/yaml_products_reader.rb   
2022-10-21 14:41:17.000000000 +0200
@@ -0,0 +1,77 @@
+# Copyright (c) [2022] 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 "yaml"
+require "yast"
+
+module Registration
+  Yast.import "Arch"
+
+  # Reads products defined by YAML file
+  #
+  # Added for SLED registration on a WSL SLES image (jsc#PED-1380).
+  class YamlProductsReader
+    attr_reader :path
+
+    def initialize(path = DEFAULT_PATH)
+      @path = path
+    end
+
+    # @return [Array<Hash>]
+    def read
+      return [] unless yaml_exist?
+
+      YAML.load_file(path).map { |p| transform(p) }
+    end
+
+  private
+
+    DEFAULT_PATH = "/etc/YaST2/products.yaml".freeze
+    private_constant :DEFAULT_PATH
+
+    # check if yaml products are defined at all
+    def yaml_exist?
+      ::File.exist?(path)
+    end
+
+    # For all values:
+    #   - converts them to String (to allow writing "15.4" as 15.4)
+    #   - replaces $arch substring with the current architecture
+    # And also:
+    #   - replaces version with version_version as registration expects
+    #   - adds arch key if not defined
+    #   - converts value of default key to boolean
+    #
+    # @param product [Hash]
+    # @return [Hash] A new transformed hash
+    def transform(product)
+      arch = Yast::Arch.rpm_arch
+
+      res = product.map do |key, val|
+        val_s = val.to_s.gsub("$arch", arch)
+        [key, val_s]
+      end.to_h
+      res["version_version"] ||= res["version"]
+      res["arch"] ||= arch
+      res["default"] = res["default"]&.casecmp?("true") ? true : false
+
+      res
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.5.5/test/fixtures/wsl_products.yml 
new/yast2-registration-4.5.6/test/fixtures/wsl_products.yml
--- old/yast2-registration-4.5.5/test/fixtures/wsl_products.yml 1970-01-01 
01:00:00.000000000 +0100
+++ new/yast2-registration-4.5.6/test/fixtures/wsl_products.yml 2022-10-21 
14:41:17.000000000 +0200
@@ -0,0 +1,12 @@
+# TODO: references for this file,
+# describe what it is
+# https://jira.suse.com/browse/PED-1380
+- display_name: "SUSE Linux Enterprise Desktop 15 SP4"
+  name: "SLED"
+  register_target: "sle-15-$arch"
+  version: "15.4"
+- display_name: "SUSE Linux Enterprise Server 15 SP4"
+  name: "SLES"
+  register_target: "sle-15-$arch"
+  version: "15.4"
+  default: True
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.5.5/test/registration/yaml_products_reader_test.rb 
new/yast2-registration-4.5.6/test/registration/yaml_products_reader_test.rb
--- old/yast2-registration-4.5.5/test/registration/yaml_products_reader_test.rb 
1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-registration-4.5.6/test/registration/yaml_products_reader_test.rb 
2022-10-21 14:41:17.000000000 +0200
@@ -0,0 +1,49 @@
+# Copyright (c) [2022] 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 "../spec_helper"
+require "registration/yaml_products_reader"
+
+describe Registration::YamlProductsReader do
+  subject { 
described_class.new(File.expand_path("#{__dir__}/../fixtures/wsl_products.yml"))
 }
+
+  describe "#read" do
+    it "reads content of yaml file" do
+      expect(subject.read.first["name"]).to eq "SLED"
+    end
+
+    it "adds arch key if not defined" do
+      expect(subject.read.first["arch"]).to eq Yast::Arch.rpm_arch
+    end
+
+    it "converts version to version_version" do
+      expect(subject.read.first["version_version"]).to eq "15.4"
+    end
+
+    it "expands properly arch variable" do
+      expect(subject.read.first["register_target"]).to eq 
"sle-15-#{Yast::Arch.rpm_arch}"
+    end
+
+    it "converts default to boolean" do
+      products = subject.read
+      expect(products[0]["default"]).to eq(false)
+      expect(products[1]["default"]).to eq(true)
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-registration-4.5.5/test/sw_mgmt_spec.rb 
new/yast2-registration-4.5.6/test/sw_mgmt_spec.rb
--- old/yast2-registration-4.5.5/test/sw_mgmt_spec.rb   2022-06-08 
09:56:12.000000000 +0200
+++ new/yast2-registration-4.5.6/test/sw_mgmt_spec.rb   2022-10-21 
14:41:17.000000000 +0200
@@ -418,12 +418,30 @@
     end
 
     context "in installed system" do
-      let(:products) { load_resolvable("products_legacy_installation.yml") }
-      it "returns installed products" do
+      before do
         allow(Yast::Stage).to receive(:initial).and_return(false)
-        expect(Y2Packager::Resolvable).to receive(:find).and_return(products)
-        # the SLES product in the list is installed
-        expect(subject.find_base_product["name"]).to eq(products[1].name)
+        allow(Y2Packager::Resolvable).to receive(:find).and_return(products)
+        allow(Registration::Storage::InstallationOptions.instance).to 
receive(:yaml_product)
+          .and_return(yaml_product)
+      end
+
+      let(:products) { load_resolvable("products_legacy_installation.yml") }
+
+      context "if a YAML product is selected" do
+        let(:yaml_product) { { "name" => "SLES", "version" => "15.4" } }
+
+        it "returns the YAML product" do
+          expect(subject.find_base_product).to eq(yaml_product)
+        end
+      end
+
+      context "if no YAML product is selected" do
+        let(:yaml_product) { nil }
+
+        it "returns installed products" do
+          # the SLES product in the list is installed
+          expect(subject.find_base_product["name"]).to eq(products[1].name)
+        end
       end
     end
 

Reply via email to