Hello community,

here is the log from the commit of package yast2-registration for 
openSUSE:Factory checked in at 2018-01-17 21:43:59
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-registration (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-registration.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-registration"

Wed Jan 17 21:43:59 2018 rev:7 rq:566467 version:4.0.17

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-registration/yast2-registration.changes    
2017-12-01 17:17:05.159955802 +0100
+++ 
/work/SRC/openSUSE:Factory/.yast2-registration.new/yast2-registration.changes   
    2018-01-17 21:44:01.583321567 +0100
@@ -1,0 +2,31 @@
+Tue Jan 16 12:39:14 UTC 2018 - [email protected]
+
+- Adjust the base product selection so it is not influenced by
+  a possibly changed repository priority, use the
+  "system-installation()" provides just like the other code in the
+  installer (related to bsc#1071742)
+- 4.0.17
+
+-------------------------------------------------------------------
+Fri Jan 12 10:07:29 UTC 2018 - [email protected]
+
+- bnc#1075723
+  - added missing part of previous patch
+- 4.0.16
+
+-------------------------------------------------------------------
+Wed Jan 10 14:36:51 UTC 2018 - [email protected]
+
+- Fix initialization to copy the profile to /tmp/profile again
+  (bsc#1075334)
+- Fix package build (dropping symlinks under test/fixtures/anchors)
+- 4.0.15
+
+-------------------------------------------------------------------
+Thu Dec 14 08:45:40 UTC 2017 - [email protected]
+
+- fate#323450
+  - added support for reading registration code from install.inf
+- 4.0.14
+
+-------------------------------------------------------------------

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

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

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

Other differences:
------------------
++++++ yast2-registration.spec ++++++
--- /var/tmp/diff_new_pack.yRHbBt/_old  2018-01-17 21:44:02.163294420 +0100
+++ /var/tmp/diff_new_pack.yRHbBt/_new  2018-01-17 21:44:02.175293858 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package yast2-registration
 #
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-registration
-Version:        4.0.13
+Version:        4.0.17
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build

++++++ yast2-registration-4.0.13.tar.bz2 -> yast2-registration-4.0.17.tar.bz2 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.0.13/package/yast2-registration.changes 
new/yast2-registration-4.0.17/package/yast2-registration.changes
--- old/yast2-registration-4.0.13/package/yast2-registration.changes    
2017-11-28 11:39:05.401523664 +0100
+++ new/yast2-registration-4.0.17/package/yast2-registration.changes    
2018-01-16 17:11:08.000000000 +0100
@@ -1,4 +1,35 @@
 -------------------------------------------------------------------
+Tue Jan 16 12:39:14 UTC 2018 - [email protected]
+
+- Adjust the base product selection so it is not influenced by
+  a possibly changed repository priority, use the
+  "system-installation()" provides just like the other code in the
+  installer (related to bsc#1071742)
+- 4.0.17
+
+-------------------------------------------------------------------
+Fri Jan 12 10:07:29 UTC 2018 - [email protected]
+
+- bnc#1075723
+  - added missing part of previous patch
+- 4.0.16
+
+-------------------------------------------------------------------
+Wed Jan 10 14:36:51 UTC 2018 - [email protected]
+
+- Fix initialization to copy the profile to /tmp/profile again
+  (bsc#1075334)
+- Fix package build (dropping symlinks under test/fixtures/anchors)
+- 4.0.15
+
+-------------------------------------------------------------------
+Thu Dec 14 08:45:40 UTC 2017 - [email protected]
+
+- fate#323450
+  - added support for reading registration code from install.inf
+- 4.0.14
+
+-------------------------------------------------------------------
 Wed Nov 22 09:52:16 UTC 2017 - [email protected]
 
 - AutoYaST fixes (bsc#1065438):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.0.13/package/yast2-registration.spec 
new/yast2-registration-4.0.17/package/yast2-registration.spec
--- old/yast2-registration-4.0.13/package/yast2-registration.spec       
2017-11-28 11:39:05.401523664 +0100
+++ new/yast2-registration-4.0.17/package/yast2-registration.spec       
2018-01-16 17:11:08.000000000 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-registration
-Version:        4.0.13
+Version:        4.0.17
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.0.13/src/clients/registration.rb 
new/yast2-registration-4.0.17/src/clients/registration.rb
--- old/yast2-registration-4.0.13/src/clients/registration.rb   2018-01-17 
21:44:02.451280940 +0100
+++ new/yast2-registration-4.0.17/src/clients/registration.rb   1970-01-01 
01:00:00.000000000 +0100
@@ -1 +0,0 @@
-symbolic link to scc.rb
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-registration-4.0.13/src/clients/scc_auto.rb 
new/yast2-registration-4.0.17/src/clients/scc_auto.rb
--- old/yast2-registration-4.0.13/src/clients/scc_auto.rb       2017-11-28 
11:39:05.401523664 +0100
+++ new/yast2-registration-4.0.17/src/clients/scc_auto.rb       2018-01-16 
17:11:08.000000000 +0100
@@ -123,6 +123,16 @@
     # (For use by autoinstallation.)
     # param [Hash] settings The structure to be imported.
     def import(settings)
+      Yast.import "AutoinstFunctions"
+
+      # merge reg code if not defined in the profile but
+      # available from other sources
+      product = Yast::AutoinstFunctions.selected_product
+      if product && !settings["reg_code"]
+        reg_codes_loader = Registration::Storage::RegCodes.instance
+        settings["reg_code"] = reg_codes_loader.reg_codes[product.short_name] 
|| ""
+      end
+
       log.debug "Importing config: #{settings}"
       @config.import(settings)
     end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.0.13/src/lib/registration/registration_codes_loader.rb 
new/yast2-registration-4.0.17/src/lib/registration/registration_codes_loader.rb
--- 
old/yast2-registration-4.0.13/src/lib/registration/registration_codes_loader.rb 
    2017-11-28 11:39:05.405523664 +0100
+++ 
new/yast2-registration-4.0.17/src/lib/registration/registration_codes_loader.rb 
    2018-01-16 17:11:08.000000000 +0100
@@ -25,6 +25,7 @@
 require "transfer/file_from_url"
 
 Yast.import "XML"
+Yast.import "Linuxrc"
 
 module Registration
   # Aids Registration::Storage::RegCodes in loading the codes
@@ -54,6 +55,18 @@
       nil
     end
 
+    # Loades registration code from /etc/install.inf
+    #
+    # Expected format is reg_code: <product>:<registration_code>
+    # for example: reg_code: sle15:abcdefghijkl
+    #
+    # @return [Hash{String => String}, nil] The key of the hash is product name
+    #                                       and the value is registration code
+    def reg_codes_from_install_inf
+      raw_reg_code = Yast::Linuxrc.InstallInf("reg_code") || ""
+      raw_reg_code.include?(":") ? [raw_reg_code.split(":", 2)].to_h : nil
+    end
+
     # @param pattern [String] template for tempfile name
     # @yieldparam actual file name
     def with_tempfile(pattern, &block)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.0.13/src/lib/registration/storage.rb 
new/yast2-registration-4.0.17/src/lib/registration/storage.rb
--- old/yast2-registration-4.0.13/src/lib/registration/storage.rb       
2017-11-28 11:39:05.405523664 +0100
+++ new/yast2-registration-4.0.17/src/lib/registration/storage.rb       
2018-01-16 17:11:08.000000000 +0100
@@ -37,7 +37,7 @@
 
       def initialize
         self.reg_codes = if Stage.initial
-          reg_codes_from_usb_stick || {}
+          reg_codes_from_usb_stick || reg_codes_from_install_inf || {}
         else
           {}
         end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.0.13/src/lib/registration/sw_mgmt.rb 
new/yast2-registration-4.0.17/src/lib/registration/sw_mgmt.rb
--- old/yast2-registration-4.0.13/src/lib/registration/sw_mgmt.rb       
2017-11-28 11:39:05.409523664 +0100
+++ new/yast2-registration-4.0.17/src/lib/registration/sw_mgmt.rb       
2018-01-16 17:11:08.000000000 +0100
@@ -34,6 +34,7 @@
 require "registration/repo_state"
 
 require "packager/product_patterns"
+require "y2packager/product_reader"
 
 module Registration
   Yast.import "AddOnProduct"
@@ -116,6 +117,8 @@
     end
 
     def self.find_base_product
+      # FIXME: refactor the code to use Y2Packager::Product
+
       # just for debugging:
       return FAKE_BASE_PRODUCT if ENV["FAKE_BASE_PRODUCT"]
 
@@ -123,28 +126,22 @@
       selected = product_selected? if Stage.initial
       installed = product_installed? if Stage.initial
 
+      # list of products defined by the "system-installation()" provides
+      system_products = 
Y2Packager::ProductReader.installation_package_mapping.keys
+      log.info("Found system-installation() products: 
#{system_products.inspect}")
+
       # during installation the products are :selected,
       # on a running system the products are :installed
       # during upgrade use the newer selected product (same as in installation)
+      # The base product must be marked by the "system-installation()" provides
+      # by some package.
       products = Pkg.ResolvableProperties("", :product, "").find_all do |p|
-        if Stage.initial && Mode.auto
-          Yast.import "AutoinstConfig"
-          # note: AutoinstConfig.selected_product should never be nil when
-          # AY let it pass here
-          p["name"] == AutoinstConfig.selected_product.name
-        elsif Stage.initial && !Mode.update
-          # during installation the type is not valid yet yet
-          # (the base product is determined by /etc/products.d/baseproduct 
symlink)
-          # use the selected product or the product from the first repository
-          selected ? p["status"] == :selected : p["source"] == 0
-        elsif Stage.initial
-          # during upgrade it depends on whether target is already initialized
-          # use the product from the medium for the self-update step
-          installed ? (p["status"] == :installed && p["type"] == "base") : 
p["source"] == 0
-        else
-          # in installed system or at upgrade the base product has valid type
-          p["status"] == :installed && p["type"] == "base"
+        if Stage.initial && !system_products.include?(p["name"])
+          log.info("Skipping product #{p["name"].inspect}, no 
system-installation() provides")
+          next false
         end
+
+        evaluate_product(p, selected, installed)
       end
 
       log.debug "Found base products: #{products}"
@@ -154,6 +151,41 @@
       products.first
     end
 
+    # Evaluate the product if it is a base product depending on the current
+    # system status.
+    # @param p [Hash] the product from pkg-bindings
+    # @param selected [Boolean,nil] is any product selected?
+    # @param installed [Boolean,nil] is any product istalled?
+    # @return [Boolean] true if it is a base product
+    def self.evaluate_product(p, selected, installed)
+      if Stage.initial && Mode.auto
+        Yast.import "AutoinstFunctions"
+        # note: AutoinstFunctions.selected_product should never be nil when
+        # AY let it pass here
+        p["name"] == AutoinstFunctions.selected_product.name
+      elsif Stage.initial && !Mode.update
+        # during installation the ["type"] value is not valid yet yet
+        # (the base product is determined by /etc/products.d/baseproduct 
symlink)
+        # use the selected or available product
+        p["status"] == (selected ? :selected : :available)
+      elsif Stage.initial
+        # during upgrade it depends on whether target is already initialized,
+        # use the product from the medium for the self-update step
+        if installed
+          p["status"] == :installed && p["type"] == "base"
+        elsif selected
+          p["status"] == :selected
+        else
+          p["status"] == :available
+        end
+      else
+        # in installed system or at upgrade the base product has valid type
+        p["status"] == :installed && p["type"] == "base"
+      end
+    end
+
+    private_class_method :evaluate_product
+
     # Any product selected to install?
     # @return [Boolean] true if at least one product is selected to install
     def self.product_selected?
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.0.13/test/fixtures/anchors/8820a2e8.0 
new/yast2-registration-4.0.17/test/fixtures/anchors/8820a2e8.0
--- old/yast2-registration-4.0.13/test/fixtures/anchors/8820a2e8.0      
2018-01-17 21:44:02.443281314 +0100
+++ new/yast2-registration-4.0.17/test/fixtures/anchors/8820a2e8.0      
1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-symbolic link to YaST_Team.pem
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.0.13/test/fixtures/anchors/8f13f82e.0 
new/yast2-registration-4.0.17/test/fixtures/anchors/8f13f82e.0
--- old/yast2-registration-4.0.13/test/fixtures/anchors/8f13f82e.0      
2018-01-17 21:44:02.431281876 +0100
+++ new/yast2-registration-4.0.17/test/fixtures/anchors/8f13f82e.0      
1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-symbolic link to YaST_Team.pem
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.0.13/test/registration_codes_loader_spec.rb 
new/yast2-registration-4.0.17/test/registration_codes_loader_spec.rb
--- old/yast2-registration-4.0.13/test/registration_codes_loader_spec.rb        
2017-11-28 11:39:05.421523664 +0100
+++ new/yast2-registration-4.0.17/test/registration_codes_loader_spec.rb        
2018-01-16 17:11:08.000000000 +0100
@@ -98,6 +98,33 @@
     end
   end
 
+  describe "#reg_codes_from_install_inf" do
+    def reg_code(value: "")
+      allow(Yast::Linuxrc)
+        .to receive(:InstallInf)
+        .with("reg_code")
+        .and_return(value)
+    end
+
+    it "returns hash with codes when option is set correctly" do
+      reg_code(value: "product:registration_code")
+
+      expect(subject.reg_codes_from_install_inf).to eq "product" => 
"registration_code"
+    end
+
+    it "returns empty hash when reg_code option is missing" do
+      reg_code
+
+      expect(subject.reg_codes_from_install_inf).to be_nil
+    end
+
+    it "returns empty hash when the reg_code's value is corrupted" do
+      reg_code(value: "missing_product_part")
+
+      expect(subject.reg_codes_from_install_inf).to be_nil
+    end
+  end
+
   describe "#reg_codes_from_xml" do
     let(:valid_fixture_codes) do
       {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-registration-4.0.13/test/spec_helper.rb 
new/yast2-registration-4.0.17/test/spec_helper.rb
--- old/yast2-registration-4.0.13/test/spec_helper.rb   2017-11-28 
11:39:05.421523664 +0100
+++ new/yast2-registration-4.0.17/test/spec_helper.rb   2018-01-16 
17:11:08.000000000 +0100
@@ -63,6 +63,19 @@
   YAML.load_file(fixtures_file(file))
 end
 
+require "yast"
+require "y2packager/product"
+def stub_product_selection
+  name = "AutoinstFunctions"
+  Yast.const_set name.to_sym, Class.new {
+    def self.selected_product
+      Y2Packager::Product.new(name: "SLES", short_name: "SLES15")
+    end
+  }
+end
+
+stub_product_selection
+
 # load data generators
 require_relative "factories"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.0.13/test/ssl_certificate_spec.rb 
new/yast2-registration-4.0.17/test/ssl_certificate_spec.rb
--- old/yast2-registration-4.0.13/test/ssl_certificate_spec.rb  2017-11-28 
11:39:05.421523664 +0100
+++ new/yast2-registration-4.0.17/test/ssl_certificate_spec.rb  2018-01-16 
17:11:08.000000000 +0100
@@ -55,10 +55,13 @@
       stub_const("Registration::SslCertificate::CA_CERTS_DIR", ca_dir.to_s)
       allow(Yast::Execute).to receive(:locally).and_call_original
       allow(FileUtils).to receive(:rm_rf).and_call_original
+      CERT_LINKS.each { |l| FileUtils.ln_sf(tmp_ca_dir.join(CERT_NAME), 
tmp_ca_dir.join(l)) }
     end
 
     after do
       FileUtils.rm_rf(ca_dir.to_s)
+      cert_links = tmp_ca_dir.children.select(&:symlink?)
+      FileUtils.rm(cert_links) unless cert_links.empty?
     end
 
     it "adds new certs under anchors to system CA certificates" do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-registration-4.0.13/test/sw_mgmt_spec.rb 
new/yast2-registration-4.0.17/test/sw_mgmt_spec.rb
--- old/yast2-registration-4.0.13/test/sw_mgmt_spec.rb  2017-11-28 
11:39:05.421523664 +0100
+++ new/yast2-registration-4.0.17/test/sw_mgmt_spec.rb  2018-01-16 
17:11:08.000000000 +0100
@@ -297,6 +297,14 @@
   end
 
   describe ".find_base_product" do
+    before do
+      # mapping of the "system-installation()" provides
+      allow(Y2Packager::ProductReader).to 
receive(:installation_package_mapping)
+        .and_return("SLES"     => "skelcd-control-SLES",
+                    "SLED"     => "skelcd-control-SLED",
+                    "SLES_SAP" => "skelcd-control-SLES_SAP")
+    end
+
     context "in installed system" do
       let(:products) { load_yaml_fixture("products_legacy_installation.yml") }
       it "returns installed products" do
@@ -310,8 +318,11 @@
     context "at installation" do
       let(:products) { load_yaml_fixture("products_sp2_update.yml") }
 
-      it "returns the selected product if a product is selected" do
+      before do
         allow(Yast::Stage).to receive(:initial).and_return(true)
+      end
+
+      it "returns the selected product if a product is selected" do
         expect(Yast::Pkg).to 
receive(:ResolvableProperties).and_return(products).exactly(3).times
         # sanity check: just make sure the fixture contains the expected data
         expect(products.any? { |p| p["status"] == :selected })
@@ -321,8 +332,6 @@
       end
 
       it "returns the product from the installation medium if no product is 
selected" do
-        allow(Yast::Stage).to receive(:initial).and_return(true)
-
         # patch the fixture so no product is selected
         products2 = products.dup
         products2[3]["status"] = :available
@@ -333,6 +342,15 @@
         # the SLES product in the list is installed
         expect(subject.find_base_product).to eq(products[3])
       end
+
+      it "ignores a selected product not marked by the `system-installation()` 
provides" do
+        products3 = [{ "name" => "foo", "status" => :selected },
+                     { "name" => "SLES", "status" => :selected }]
+
+        expect(Yast::Pkg).to 
receive(:ResolvableProperties).and_return(products3).exactly(3).times
+        # the selected product is ignored, the result is nil
+        expect(subject.find_base_product).to eq(products3[1])
+      end
     end
   end
 


Reply via email to