Hello community,

here is the log from the commit of package yast2-registration for 
openSUSE:Factory checked in at 2018-04-07 20:51:48
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-registration (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-registration.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-registration"

Sat Apr  7 20:51:48 2018 rev:16 rq:593908 version:4.0.31

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-registration/yast2-registration.changes    
2018-03-26 12:13:57.815387558 +0200
+++ 
/work/SRC/openSUSE:Factory/.yast2-registration.new/yast2-registration.changes   
    2018-04-07 20:51:52.697636936 +0200
@@ -1,0 +2,21 @@
+Thu Apr  5 16:36:49 UTC 2018 - knut.anders...@suse.com
+
+- Given a license, remember whether another one with the same
+  content was already accepted (fate#325461).
+- 4.0.31
+
+-------------------------------------------------------------------
+Tue Apr  3 15:44:53 UTC 2018 - lsle...@suse.cz
+
+- Better evaluate the product to upgrade, do not use the package
+  solver if there is only one base product to install, use some
+  fallbacks when the solver fails (bsc#1086259)
+- 4.0.30
+
+-------------------------------------------------------------------
+Tue Mar 27 14:58:42 UTC 2018 - jreidin...@suse.com
+
+- Improve text for migration targets (bsc#1079075)
+- 4.0.29
+
+-------------------------------------------------------------------

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

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

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

Other differences:
------------------
++++++ yast2-registration.spec ++++++
--- /var/tmp/diff_new_pack.IAdyjV/_old  2018-04-07 20:51:53.345613483 +0200
+++ /var/tmp/diff_new_pack.IAdyjV/_new  2018-04-07 20:51:53.349613339 +0200
@@ -17,14 +17,14 @@
 
 
 Name:           yast2-registration
-Version:        4.0.28
+Version:        4.0.31
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 Source0:        %{name}-%{version}.tar.bz2
 
-## UI::TextHelpers wrap_text
-Requires:       yast2 >= 4.0.1
+# Y2Packager::ProductLicense
+Requires:       yast2 >= 4.0.63
 # "dupAllowVendorChange" option in Pkg.SetSolverFlags()
 Requires:       yast2-pkg-bindings >= 3.1.34
 # N_() method
@@ -45,8 +45,9 @@
 Requires:       yast2-packager >= 3.1.95
 Requires:       yast2-update >= 3.1.36
 
+# Y2Packager::ProductLicense
 BuildRequires:  update-desktop-files
-BuildRequires:  yast2 >= 4.0.1
+BuildRequires:  yast2 >= 4.0.63
 BuildRequires:  yast2-devtools >= 3.1.39
 BuildRequires:  yast2-slp >= 3.1.9
 BuildRequires:  rubygem(rspec)

++++++ yast2-registration-4.0.28.tar.bz2 -> yast2-registration-4.0.31.tar.bz2 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-registration-4.0.28/Rakefile 
new/yast2-registration-4.0.31/Rakefile
--- old/yast2-registration-4.0.28/Rakefile      2018-03-22 08:40:36.000000000 
+0100
+++ new/yast2-registration-4.0.31/Rakefile      2018-04-06 09:27:49.000000000 
+0200
@@ -4,10 +4,3 @@
   # lets ignore license check for now
   conf.skip_license_check << /.*/
 end
-
-task "test:unit" => "test:unit:env"
-
-task "test:unit:env" do
-  # run tests in English locale (to avoid problems with translations)
-  ENV["LC_ALL"] = "en_US.UTF-8"
-end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.0.28/package/yast2-registration.changes 
new/yast2-registration-4.0.31/package/yast2-registration.changes
--- old/yast2-registration-4.0.28/package/yast2-registration.changes    
2018-03-22 08:40:36.000000000 +0100
+++ new/yast2-registration-4.0.31/package/yast2-registration.changes    
2018-04-06 09:27:49.000000000 +0200
@@ -1,4 +1,25 @@
 -------------------------------------------------------------------
+Thu Apr  5 16:36:49 UTC 2018 - knut.anders...@suse.com
+
+- Given a license, remember whether another one with the same
+  content was already accepted (fate#325461).
+- 4.0.31
+
+-------------------------------------------------------------------
+Tue Apr  3 15:44:53 UTC 2018 - lsle...@suse.cz
+
+- Better evaluate the product to upgrade, do not use the package
+  solver if there is only one base product to install, use some
+  fallbacks when the solver fails (bsc#1086259)
+- 4.0.30
+
+-------------------------------------------------------------------
+Tue Mar 27 14:58:42 UTC 2018 - jreidin...@suse.com
+
+- Improve text for migration targets (bsc#1079075)
+- 4.0.29
+
+-------------------------------------------------------------------
 Wed Mar 21 16:40:25 UTC 2018 - lsle...@suse.cz
 
 - Import the SMT SSL certificate at offline upgrade into
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.0.28/package/yast2-registration.spec 
new/yast2-registration-4.0.31/package/yast2-registration.spec
--- old/yast2-registration-4.0.28/package/yast2-registration.spec       
2018-03-22 08:40:36.000000000 +0100
+++ new/yast2-registration-4.0.31/package/yast2-registration.spec       
2018-04-06 09:27:49.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-registration
-Version:        4.0.28
+Version:        4.0.31
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
@@ -26,8 +26,8 @@
 Group:          System/YaST
 License:        GPL-2.0
 
-## UI::TextHelpers wrap_text
-Requires:       yast2 >= 4.0.1
+# Y2Packager::ProductLicense
+Requires:       yast2 >= 4.0.63
 # "dupAllowVendorChange" option in Pkg.SetSolverFlags()
 Requires:       yast2-pkg-bindings >= 3.1.34
 # N_() method
@@ -48,7 +48,8 @@
 Requires:       yast2-packager >= 3.1.95
 Requires:       yast2-update >= 3.1.36
 
-BuildRequires:  yast2 >= 4.0.1
+# Y2Packager::ProductLicense
+BuildRequires:  yast2 >= 4.0.63
 BuildRequires:  update-desktop-files
 BuildRequires:  yast2-devtools >= 3.1.39
 BuildRequires:  rubygem(yast-rake) >= 0.2.5
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.0.28/src/lib/registration/ui/addon_eula_dialog.rb 
new/yast2-registration-4.0.31/src/lib/registration/ui/addon_eula_dialog.rb
--- old/yast2-registration-4.0.28/src/lib/registration/ui/addon_eula_dialog.rb  
2018-03-22 08:40:36.000000000 +0100
+++ new/yast2-registration-4.0.31/src/lib/registration/ui/addon_eula_dialog.rb  
2018-04-06 09:27:49.000000000 +0200
@@ -3,6 +3,7 @@
 require "registration/eula_downloader"
 require "registration/eula_reader"
 require "registration/helpers"
+require "y2packager/product_license"
 
 module Registration
   module UI
@@ -127,9 +128,13 @@
         Dir.mktmpdir("extension-eula-") do |tmpdir|
           return :back unless download_eula(addon, tmpdir)
           eula_reader = EulaReader.new(tmpdir)
+          license = find_license(addon, eula_reader)
+          return :accepted if license && license.accepted?
 
           setup_eula_dialog(addon, eula_reader, tmpdir)
-          run_eula_dialog(eula_reader)
+          ret = run_eula_dialog(eula_reader)
+          license.accept! if ret == :accepted
+          ret
         end
       ensure
         Yast::ProductLicense.CleanUp()
@@ -140,6 +145,15 @@
       def display_optional_info(info_file)
         Yast::InstShowInfo.show_info_txt(info_file) if File.exist?(info_file)
       end
+
+      def find_license(addon, eula_reader)
+        license_file = eula_reader.licenses[Y2Packager::License::DEFAULT_LANG]
+        return nil unless license_file
+        content = Yast::SCR.Read(path(".target.string"), license_file)
+        return nil unless content
+
+        Y2Packager::ProductLicense.find(addon.identifier, content: content)
+      end
     end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.0.28/src/lib/registration/ui/migration_repos_workflow.rb
 
new/yast2-registration-4.0.31/src/lib/registration/ui/migration_repos_workflow.rb
--- 
old/yast2-registration-4.0.28/src/lib/registration/ui/migration_repos_workflow.rb
   2018-03-22 08:40:36.000000000 +0100
+++ 
new/yast2-registration-4.0.31/src/lib/registration/ui/migration_repos_workflow.rb
   2018-04-06 09:27:49.000000000 +0200
@@ -14,6 +14,7 @@
 
 require "yast"
 require "yast2/popup"
+require "y2packager/product_upgrade"
 
 require "registration/registration"
 require "registration/registration_ui"
@@ -289,7 +290,7 @@
       # on a system that is not running (offline migration)
       # @return [Symbol] workflow symbol (:next or :abort)
       def load_migration_products_offline(activations)
-        base_product = upgraded_base_product
+        base_product = Y2Packager::ProductUpgrade.new_base_product
         if !base_product
           # TRANSLATORS: Error message
           Yast::Report.Error(_("Cannot find a base product to upgrade."))
@@ -574,21 +575,6 @@
             "using the previous product. The packages from the registration " \
             "repositories can conflict with the new packages.</p>")
       end
-
-      def upgraded_base_product
-        # temporarily run the update mode to let the solver select the product 
for upgrade
-        # (this will correctly handle possible product renames)
-        Yast::Pkg.PkgUpdateAll({})
-        product = Y2Packager::Product.selected_base
-
-        # restore the initial status, the package update will be turned on 
later again
-        Yast::Pkg.PkgReset
-        changed = Yast::Pkg.GetPackages(:removed, true) + 
Yast::Pkg.GetPackages(:selected, true)
-        changed.each { |p| Yast::Pkg.PkgNeutral(p) }
-
-        log.info("Upgraded base product: #{product.inspect}")
-        product
-      end
     end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.0.28/src/lib/registration/ui/migration_selection_dialog.rb
 
new/yast2-registration-4.0.31/src/lib/registration/ui/migration_selection_dialog.rb
--- 
old/yast2-registration-4.0.28/src/lib/registration/ui/migration_selection_dialog.rb
 2018-03-22 08:40:36.000000000 +0100
+++ 
new/yast2-registration-4.0.31/src/lib/registration/ui/migration_selection_dialog.rb
 2018-04-06 09:27:49.000000000 +0200
@@ -157,14 +157,55 @@
       # @return [Array<Yast::Term>] widget content
       def migration_items
         sorted_migrations.map.with_index do |arr, idx|
-          products = arr.map do |product|
-            product.shortname || "#{product.identifier}-#{product.version}"
-          end
-
-          Item(Id(idx), products.join(", "))
+          base_product_text = base_product_text_for(arr)
+          extensions_text = extensions_text_for(arr)
+          modules_text = modules_text_for(arr)
+          text =
+            if extensions_text.empty? && modules_text.empty?
+              base_product_text
+            elsif extensions_text.empty? || modules_text.empty?
+              additional_text = extensions_text.empty? ? modules_text : 
extensions_text
+              # TRANSLATORS: Upgrade target. The first %s stands for base 
product name and
+              # the second for extensions or modules count.
+              # Example: SUSE Linux Enterprise Server 15 x86_64 including 8 
modules
+              format(_("%s including %s"), base_product_text, additional_text)
+            else
+              # TRANSLATORS: Upgrade target. The first %s stands for base 
product name,
+              # the second for modules count and the third for extensions 
count.
+              # Example: SUSE Linux Enterprise Server 15 x86_64 including 8 
modules and 2 extensions
+              format(_("%s including %s and %s"), base_product_text, 
modules_text, extensions_text)
+            end
+          Item(Id(idx), text)
         end
       end
 
+      # @return [String] textual representation of base product living in arr
+      def base_product_text_for(arr)
+        base_product = arr.find(&:base)
+        base_product.friendly_name || base_product.short_name ||
+          (base_product.identifier + "-" + base_product.version)
+      end
+
+      # @return [String] textual representation of extensions living in arr
+      def extensions_text_for(arr)
+        extensions = arr.select { |p| p.product_type == "extension" }
+        return "" if extensions.empty?
+
+        # TRANSLATORS: number of extensions to upgrade. Will be used later to
+        #   construct whole status of upgrade
+        format(n_("%i extension", "%i extensions", extensions.size), 
extensions.size)
+      end
+
+      # @return [String] textual representation of modules living in arr
+      def modules_text_for(arr)
+        modules = arr.select { |p| p.product_type == "module" }
+        return "" if modules.empty?
+
+        # TRANSLATORS: number of modules to upgrade. Will be used later to
+        #   construct whole status of upgrade
+        format(n_("%i module", "%i modules", modules.size), modules.size)
+      end
+
       # update details about the selected migration
       def update_details
         log.info "updating details"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.0.28/test/fixtures/migration_to_sles12_sp1.yml 
new/yast2-registration-4.0.31/test/fixtures/migration_to_sles12_sp1.yml
--- old/yast2-registration-4.0.28/test/fixtures/migration_to_sles12_sp1.yml     
2018-03-22 08:40:36.000000000 +0100
+++ new/yast2-registration-4.0.31/test/fixtures/migration_to_sles12_sp1.yml     
2018-04-06 09:27:49.000000000 +0200
@@ -7,3 +7,5 @@
       :release_type: 
       :friendly_name: SUSE Linux Enterprise Server SP1 x86_64
       :shortname: SLES12-SP1
+      :base: true
+      :product_type: base
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.0.28/test/migration_repos_workflow_spec.rb 
new/yast2-registration-4.0.31/test/migration_repos_workflow_spec.rb
--- old/yast2-registration-4.0.28/test/migration_repos_workflow_spec.rb 
2018-03-22 08:40:36.000000000 +0100
+++ new/yast2-registration-4.0.31/test/migration_repos_workflow_spec.rb 
2018-04-06 09:27:49.000000000 +0200
@@ -226,7 +226,7 @@
     let(:selected_base) { 
load_yaml_fixture("migration_sles15_selected_base.yml") }
 
     before do
-      allow(Y2Packager::Product).to 
receive(:selected_base).and_return(selected_base)
+      allow(Y2Packager::ProductUpgrade).to 
receive(:new_base_product).and_return(selected_base)
       allow_any_instance_of(Registration::RegistrationUI).to 
receive(:offline_migration_products)
         .and_return(offline_migrations)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.0.28/test/migration_selection_dialog_test.rb 
new/yast2-registration-4.0.31/test/migration_selection_dialog_test.rb
--- old/yast2-registration-4.0.28/test/migration_selection_dialog_test.rb       
2018-03-22 08:40:36.000000000 +0100
+++ new/yast2-registration-4.0.31/test/migration_selection_dialog_test.rb       
2018-04-06 09:27:49.000000000 +0200
@@ -15,7 +15,7 @@
 
       # check the displayed content
       expect(Yast::Wizard).to receive(:SetContents) do |_title, content, 
_help, _back, _next|
-        expected_list_item = Item(Id(0), "SLES12-SP1")
+        expected_list_item = Item(Id(0), "SUSE Linux Enterprise Server SP1 
x86_64")
 
         term = content.nested_find do |t|
           t.respond_to?(:value) && t.value == :SelectionBox &&
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-registration-4.0.28/test/registration/ui/addon_eula_dialog_test.rb 
new/yast2-registration-4.0.31/test/registration/ui/addon_eula_dialog_test.rb
--- 
old/yast2-registration-4.0.28/test/registration/ui/addon_eula_dialog_test.rb    
    1970-01-01 01:00:00.000000000 +0100
+++ 
new/yast2-registration-4.0.31/test/registration/ui/addon_eula_dialog_test.rb    
    2018-04-06 09:27:49.000000000 +0200
@@ -0,0 +1,100 @@
+#!/usr/bin/env rspec
+# 
------------------------------------------------------------------------------
+# Copyright (c) 2018 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.
+# 
------------------------------------------------------------------------------
+
+require_relative "../../spec_helper"
+require "registration/ui/addon_eula_dialog"
+
+describe Registration::UI::AddonEulaDialog do
+  subject(:dialog) { described_class.new([addon]) }
+
+  let(:addon) do
+    addon_generator("name" => "SLES", "eula_url" => 
"https://suse.com/download/SLES/eula";)
+  end
+
+  describe "#accept_eula" do
+    let(:eula_downloader) { instance_double(Registration::EulaDownloader, 
download: true) }
+    let(:eula_reader) { instance_double(Registration::EulaReader, licenses: 
licenses_files) }
+    let(:licenses_files) do
+      { Y2Packager::License::DEFAULT_LANG => "license.txt" }
+    end
+    let(:accepted?) { true }
+    let(:product_license) { instance_double(Y2Packager::ProductLicense, 
accepted?: accepted?) }
+    let(:license_content) { "content" }
+
+    before do
+      allow(Registration::EulaDownloader).to 
receive(:new).and_return(eula_downloader)
+      allow(Registration::EulaReader).to receive(:new).and_return(eula_reader)
+      allow(Y2Packager::ProductLicense).to 
receive(:find).and_return(product_license)
+      allow(Yast::SCR).to 
receive(:Read).with(Yast::Path.new(".target.string"), "license.txt")
+        .and_return(license_content)
+      allow(dialog).to receive(:setup_eula_dialog)
+      allow(dialog).to receive(:run_eula_dialog)
+    end
+
+    context "when the eula could not be downloaded" do
+      before do
+        allow(eula_downloader).to receive(:download).and_raise(StandardError)
+      end
+
+      it "returns :back" do
+        expect(dialog.send(:accept_eula, addon)).to eq(:back)
+      end
+    end
+
+    it "reads the license and asks for a already seen license with the same 
content" do
+      expect(Y2Packager::ProductLicense).to receive(:find)
+        .with(addon.identifier, content: "content").and_return(product_license)
+      dialog.send(:accept_eula, addon)
+    end
+
+    context "when the license file is not defined" do
+      let(:licenses_files) { {} }
+
+      it "does not ask for already seen licenses" do
+        expect(Y2Packager::ProductLicense).to_not receive(:find)
+        dialog.send(:accept_eula, addon)
+      end
+    end
+
+    context "when license file could not be read" do
+      let(:license_content) { nil }
+
+      it "does not ask for already seen licenses" do
+        expect(Y2Packager::ProductLicense).to_not receive(:find)
+        dialog.send(:accept_eula, addon)
+      end
+    end
+
+    context "when the license was previously accepted" do
+      let(:accepted?) { true }
+
+      it "returns :accepted" do
+        expect(dialog.send(:accept_eula, addon)).to eq(:accepted)
+      end
+
+      it "does not show the eula" do
+        expect(subject).to_not receive(:run_eula_dialog)
+        dialog.send(:accept_eula, addon)
+      end
+    end
+
+    context "when the license was not previously accepted" do
+      let(:accepted?) { false }
+
+      it "shows the eula" do
+        expect(subject).to receive(:run_eula_dialog)
+        dialog.send(:accept_eula, addon)
+      end
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-registration-4.0.28/test/spec_helper.rb 
new/yast2-registration-4.0.31/test/spec_helper.rb
--- old/yast2-registration-4.0.28/test/spec_helper.rb   2018-03-22 
08:40:36.000000000 +0100
+++ new/yast2-registration-4.0.31/test/spec_helper.rb   2018-04-06 
09:27:49.000000000 +0200
@@ -3,6 +3,9 @@
 TESTS_PATH = Pathname.new(File.dirname(__FILE__))
 FIXTURES_PATH = TESTS_PATH.join("fixtures")
 
+# run tests in English locale (to avoid problems with translations)
+ENV["LC_ALL"] = "en_US.UTF-8"
+
 if ENV["COVERAGE"]
   require "simplecov"
 


Reply via email to