Hello community,

here is the log from the commit of package yast2-update for openSUSE:Factory 
checked in at 2020-10-18 16:20:44
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-update (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-update.new.3486 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-update"

Sun Oct 18 16:20:44 2020 rev:138 rq:840439 version:4.3.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-update/yast2-update.changes        
2020-06-10 00:38:02.493337932 +0200
+++ /work/SRC/openSUSE:Factory/.yast2-update.new.3486/yast2-update.changes      
2020-10-18 16:20:48.824474599 +0200
@@ -1,0 +2,7 @@
+Thu Sep 17 16:49:12 CEST 2020 - sch...@suse.de
+
+- Adding additional compatible vendors which are defined in the
+  control file (jsc#SLE-14807).
+- 4.3.1
+
+-------------------------------------------------------------------

Old:
----
  yast2-update-4.3.0.tar.bz2

New:
----
  yast2-update-4.3.1.tar.bz2

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

Other differences:
------------------
++++++ yast2-update.spec ++++++
--- /var/tmp/diff_new_pack.ACZTjr/_old  2020-10-18 16:20:49.332474825 +0200
+++ /var/tmp/diff_new_pack.ACZTjr/_new  2020-10-18 16:20:49.332474825 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package yast2-update
 #
-# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -12,17 +12,17 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
 Name:           yast2-update
-Version:        4.3.0
+Version:        4.3.1
 Release:        0
 Summary:        YaST2 - Update
 License:        GPL-2.0-only
 Group:          System/YaST
-Url:            https://github.com/yast/yast-update
+URL:            https://github.com/yast/yast-update
 
 Source0:        %{name}-%{version}.tar.bz2
 
@@ -52,8 +52,8 @@
 Requires:       yast2-installation
 # product_update_summary, product_update_warning
 Requires:       yast2-packager >= 4.2.33
-# Improved Pkg.SourceRestore()
-Requires:       yast2-pkg-bindings >= 4.2.6
+# Pkg::SetAdditionalVendors
+Requires:       yast2-pkg-bindings >= 4.3.3
 Requires:       yast2-ruby-bindings >= 1.0.0
 # nokogiri is used for parsing pam conf.
 Requires:       rubygem(%{rb_default_ruby_abi}:nokogiri)

++++++ yast2-update-4.3.0.tar.bz2 -> yast2-update-4.3.1.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-update-4.3.0/package/yast2-update.changes 
new/yast2-update-4.3.1/package/yast2-update.changes
--- old/yast2-update-4.3.0/package/yast2-update.changes 2020-06-03 
23:16:49.000000000 +0200
+++ new/yast2-update-4.3.1/package/yast2-update.changes 2020-10-09 
15:52:18.000000000 +0200
@@ -1,4 +1,11 @@
 -------------------------------------------------------------------
+Thu Sep 17 16:49:12 CEST 2020 - sch...@suse.de
+
+- Adding additional compatible vendors which are defined in the
+  control file (jsc#SLE-14807).
+- 4.3.1
+
+-------------------------------------------------------------------
 Wed Jun  3 16:12:18 UTC 2020 - Josef Reidinger <jreidin...@suse.com>
 
 - Replace anyxml agent with rubygem-nokogiri as yast2 already
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-update-4.3.0/package/yast2-update.spec 
new/yast2-update-4.3.1/package/yast2-update.spec
--- old/yast2-update-4.3.0/package/yast2-update.spec    2020-06-03 
23:16:49.000000000 +0200
+++ new/yast2-update-4.3.1/package/yast2-update.spec    2020-10-09 
15:52:18.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-update
-Version:        4.3.0
+Version:        4.3.1
 Release:        0
 Summary:        YaST2 - Update
 Group:          System/YaST
@@ -52,8 +52,8 @@
 Requires:       yast2-installation
 # product_update_summary, product_update_warning
 Requires:       yast2-packager >= 4.2.33
-# Improved Pkg.SourceRestore()
-Requires:       yast2-pkg-bindings >= 4.2.6
+# Pkg::SetAdditionalVendors
+Requires:       yast2-pkg-bindings >= 4.3.3
 Requires:       yast2-ruby-bindings >= 1.0.0
 # nokogiri is used for parsing pam conf.
 Requires:  rubygem(%{rb_default_ruby_abi}:nokogiri)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-update-4.3.0/src/modules/Update.rb 
new/yast2-update-4.3.1/src/modules/Update.rb
--- old/yast2-update-4.3.0/src/modules/Update.rb        2020-06-03 
23:16:49.000000000 +0200
+++ new/yast2-update-4.3.1/src/modules/Update.rb        2020-10-09 
15:52:18.000000000 +0200
@@ -132,6 +132,50 @@
       ret
     end
 
+    # Set vendors which are compatilbe (defined in the product description).
+    # Do not report an error if there is a vendor change while
+    # the update between these defined vendors and products.
+    def SetCompatibleVendors
+      return unless Mode.update # Update mode only
+
+      upgrade_settings = ProductFeatures.GetFeature("software", "upgrade")
+      return unless upgrade_settings
+
+      product_upgrades = upgrade_settings["product_upgrades"]
+      return unless product_upgrades
+
+      unless product_upgrades.is_a?(Array)
+        log.error("software/upgrade/product_upgrade in control.xml is not an 
array")
+        return
+      end
+
+      product_upgrades.each do |product_upgrade|
+        log.info("Set compatible vendors defined in control.xml: 
#{product_upgrade}")
+
+        if !product_upgrade["compatible_vendors"].is_a?(Array)
+          log.error("compatible_vendors are not defined.")
+          next
+        end
+        if !product_upgrade["from"] || !product_upgrade["to"]
+          log.error("The vendor setting does not define 'from' or 'to'"\
+                    "value: #{product_upgrade.inspect}")
+          next
+        end
+
+        # It will be set if there is an product upgrade which is defined in 
from/to.
+        vendors = product_upgrade["compatible_vendors"]
+        if Installation.installedVersion["name"] == product_upgrade["from"] &&
+            Installation.updateVersion["name"] == product_upgrade["to"]
+          log.info("Set defined compatible vendors in libzypp: #{vendors}")
+          Pkg.SetAdditionalVendors(vendors)
+        else
+          log.info("No upgrade from \"#{product_upgrade["from"]}\" to"\
+                   " \"#{product_upgrade["to"]}\" found.")
+          log.info("So the automatic vendor change \"#{vendors}\" is 
disabled.")
+        end
+      end
+    end
+
     # Returns whether upgrade process should silently downgrade packages if 
needed.
     # 'true' means that packages might be downgraded, 'nil' is returned when
     # the feature is not supported in the control file.
@@ -290,13 +334,12 @@
     # Set initial values for variables that user can't change.
     # They are defined in the control file.
     def InitUpdate
-      Builtins.y2milestone("Calling: InitUpdate()")
+      log.info("Calling: InitUpdate()")
 
       @silentlyDowngradePackages = SilentlyDowngradePackages()
-      Builtins.y2milestone(
-        "silentlyDowngradePackages: %1",
-        @silentlyDowngradePackages
-      )
+      log.info("silentlyDowngradePackages: #{@silentlyDowngradePackages}")
+
+      SetCompatibleVendors()
 
       nil
     end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-update-4.3.0/test/update_test.rb 
new/yast2-update-4.3.1/test/update_test.rb
--- old/yast2-update-4.3.0/test/update_test.rb  2020-06-03 23:16:49.000000000 
+0200
+++ new/yast2-update-4.3.1/test/update_test.rb  2020-10-09 15:52:18.000000000 
+0200
@@ -142,7 +142,7 @@
       Yast::Update.create_backup(name, paths)
     end
 
-    it "do not store mount prefix in tarball" do
+    it "does not store mount prefix in tarball" do
       name = "test-backup"
       paths = ["/path_with_slash"]
       expect(Yast::SCR).to receive(:Execute)
@@ -384,4 +384,96 @@
       expect(Yast::Update.IsProductSupportedForUpgrade).to be(false)
     end
   end
+
+  describe "#InitUpdate" do
+    context "installation mode" do
+      before do
+        allow(Yast::Mode).to receive(:update).and_return(false)
+      end
+
+      it "does not set compatible vendors at all" do
+        expect(Yast::Pkg).to_not receive(:SetAdditionalVendors)
+        Yast::Update.InitUpdate()
+      end
+    end
+
+    context "upgrade mode" do
+      before do
+        allow(Yast::Mode).to receive(:update).and_return(true)
+        allow(Yast::ProductFeatures).to receive(:GetFeature)
+          .with("software", "silently_downgrade_packages")
+          .and_return(true)
+        allow(Yast::Installation).to receive(:installedVersion)
+          .and_return(
+            "show" => "openSUSE Leap 15.1",
+            "name" => "openSUSE Leap",
+            "version" => "15.1",
+            "nameandversion" => "openSUSE Leap 15.1", "major" => 15,
+            "minor" => 1
+          )
+        allow(Yast::Installation).to receive(:updateVersion)
+          .and_return(
+            "show"           => "openSUSE Jump 15.2.1",
+            "name"           => "openSUSE Jump",
+            "version"        => "15.2.1",
+            "nameandversion" => "openSUSE Jump 15.2.1 15.2.1"
+          )
+      end
+
+      context "no valid product update defined" do
+        before do
+          allow(Yast::ProductFeatures).to receive(:GetFeature)
+            .with("software", "upgrade")
+            .and_return("product_upgrades" => [{
+                          "from"               => "openSUSE",
+                          "to"                 => "SLES",
+                          "compatible_vendors" => ["openSUSE", "SLES LCC"]
+                        }])
+        end
+
+        it "does not set compatible vendors at all" do
+          expect(Yast::Pkg).to_not receive(:SetAdditionalVendors)
+          Yast::Update.InitUpdate()
+        end
+      end
+
+      context "product change is defined" do
+        context "no compatible vendors are defined in the control file" do
+          before do
+            allow(Yast::ProductFeatures).to receive(:GetFeature)
+              .with("software", "upgrade")
+              .and_return("product_upgrades" => [{
+                            "from" => "openSUSE Leap",
+                            "to"   => "openSUSE Jump"
+                          }])
+          end
+
+          it "does not set compatible vendors at all" do
+            expect(Yast::Pkg).to_not receive(:SetAdditionalVendors)
+            Yast::Update.InitUpdate()
+          end
+        end
+
+        context "compatilbe vendors are defined in the control file" do
+          before do
+            allow(Yast::ProductFeatures).to receive(:GetFeature)
+              .with("software", "upgrade")
+              .and_return("product_upgrades" => [{
+                            "from"               => "openSUSE Leap",
+                            "to"                 => "openSUSE Jump",
+                            "compatible_vendors" => ["openSUSE", "SLES LCC"]
+                          }])
+          end
+
+          it "set it in the solver" do
+            expect(Yast::Pkg).to receive(:SetAdditionalVendors) do |args|
+              expect(args).to contain_exactly("openSUSE", "SLES LCC")
+            end
+            Yast::Update.InitUpdate()
+          end
+        end
+      end
+    end
+  end
+
 end


Reply via email to