Hello community, here is the log from the commit of package yast2-add-on for openSUSE:Factory checked in at 2019-12-14 12:03:06 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-add-on (Old) and /work/SRC/openSUSE:Factory/.yast2-add-on.new.4691 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-add-on" Sat Dec 14 12:03:06 2019 rev:103 rq:755185 version:4.2.13 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-add-on/yast2-add-on.changes 2019-10-16 09:09:53.296302145 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-add-on.new.4691/yast2-add-on.changes 2019-12-14 12:04:02.443397130 +0100 @@ -1,0 +2,33 @@ +Fri Dec 6 13:50:38 CET 2019 - sch...@suse.de + +- Added needed requriments to vendor.rb (bsc#1158436). +- 4.2.13 + +------------------------------------------------------------------- +Thu Dec 5 08:40:08 UTC 2019 - Ladislav Slezák <lsle...@suse.cz> + +- Do not offer add-ons on the Full medium when the system is + registered (jsc#SLE-7101) +- 4.2.12 + +------------------------------------------------------------------- +Tue Dec 3 09:40:00 UTC 2019 - Ladislav Slezák <lsle...@suse.cz> + +- Fixed crash when cloning the system (bsc#1158247) +- 4.2.11 + +------------------------------------------------------------------- +Thu Nov 21 13:36:10 UTC 2019 - sch...@suse.de + +- Using Y2Packager::Resolvable.any? and Y2Packager::Resolvable.find + in order to decrease the required memory (bsc#1132650, + bsc#1140037). +- 4.2.10 + +------------------------------------------------------------------- +Thu Nov 21 12:36:10 UTC 2019 - David Diaz <dgonza...@suse.com> + +- Handle correctly the user input when going back (bsc#1156528) +- 4.2.9 + +------------------------------------------------------------------- Old: ---- yast2-add-on-4.2.8.tar.bz2 New: ---- yast2-add-on-4.2.13.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-add-on.spec ++++++ --- /var/tmp/diff_new_pack.mvQXZ5/_old 2019-12-14 12:04:03.519396943 +0100 +++ /var/tmp/diff_new_pack.mvQXZ5/_new 2019-12-14 12:04:03.523396943 +0100 @@ -17,7 +17,7 @@ Name: yast2-add-on -Version: 4.2.8 +Version: 4.2.13 Release: 0 Summary: YaST2 - Add-On media installation code License: GPL-2.0-only ++++++ yast2-add-on-4.2.8.tar.bz2 -> yast2-add-on-4.2.13.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-add-on-4.2.8/package/yast2-add-on.changes new/yast2-add-on-4.2.13/package/yast2-add-on.changes --- old/yast2-add-on-4.2.8/package/yast2-add-on.changes 2019-10-11 10:43:58.000000000 +0200 +++ new/yast2-add-on-4.2.13/package/yast2-add-on.changes 2019-12-09 10:57:42.000000000 +0100 @@ -1,4 +1,37 @@ ------------------------------------------------------------------- +Fri Dec 6 13:50:38 CET 2019 - sch...@suse.de + +- Added needed requriments to vendor.rb (bsc#1158436). +- 4.2.13 + +------------------------------------------------------------------- +Thu Dec 5 08:40:08 UTC 2019 - Ladislav Slezák <lsle...@suse.cz> + +- Do not offer add-ons on the Full medium when the system is + registered (jsc#SLE-7101) +- 4.2.12 + +------------------------------------------------------------------- +Tue Dec 3 09:40:00 UTC 2019 - Ladislav Slezák <lsle...@suse.cz> + +- Fixed crash when cloning the system (bsc#1158247) +- 4.2.11 + +------------------------------------------------------------------- +Thu Nov 21 13:36:10 UTC 2019 - sch...@suse.de + +- Using Y2Packager::Resolvable.any? and Y2Packager::Resolvable.find + in order to decrease the required memory (bsc#1132650, + bsc#1140037). +- 4.2.10 + +------------------------------------------------------------------- +Thu Nov 21 12:36:10 UTC 2019 - David Diaz <dgonza...@suse.com> + +- Handle correctly the user input when going back (bsc#1156528) +- 4.2.9 + +------------------------------------------------------------------- Fri Oct 11 08:30:27 UTC 2019 - Ladislav Slezák <lsle...@suse.cz> - Display the human readable product names in the summary dialog diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-add-on-4.2.8/package/yast2-add-on.spec new/yast2-add-on-4.2.13/package/yast2-add-on.spec --- old/yast2-add-on-4.2.8/package/yast2-add-on.spec 2019-10-11 10:43:58.000000000 +0200 +++ new/yast2-add-on-4.2.13/package/yast2-add-on.spec 2019-12-09 10:57:42.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2-add-on -Version: 4.2.8 +Version: 4.2.13 Release: 0 Summary: YaST2 - Add-On media installation code License: GPL-2.0-only diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-add-on-4.2.8/src/clients/vendor.rb new/yast2-add-on-4.2.13/src/clients/vendor.rb --- old/yast2-add-on-4.2.8/src/clients/vendor.rb 2019-10-11 10:43:58.000000000 +0200 +++ new/yast2-add-on-4.2.13/src/clients/vendor.rb 2019-12-09 10:57:42.000000000 +0100 @@ -6,6 +6,8 @@ # Authors: Klaus Kaempf <kkae...@suse.de> # # $Id$ + +require "y2packager/resolvable" module Yast class VendorClient < Client def main @@ -98,18 +100,15 @@ else Pkg.TargetInit("/", false) - @products = Pkg.ResolvableProperties("", :product, "") - @products = [] if @products == nil - @products = Builtins.filter(@products) do |p| - Ops.get(p, "status") == :installed - end - @base = Builtins.filter(@products) do |p| - Ops.get_string(p, "category", "") == "base" + base = Y2Packager::Resolvable.find(kind: :product, + status: :installed, + category: "base") + if base.empty? + # fallback + base = Y2Packager::Resolvable.find(kind: :product, + status: :installed) end - @base = deep_copy(@products) if Builtins.size(@base) == 0 - @product = Ops.get(@base, 0, {}) - @version = Ops.get_string(@product, "version", "") - @version = Ops.get(Builtins.splitstring(@version, "-"), 0, "") # split off release + version = base[0] ? base[0].version_version : "" Builtins.y2milestone("Trying %1", @cdpath) @dirlist2 = Convert.to_list(SCR.Read(path(".target.dir"), @cdpath)) @@ -129,8 +128,7 @@ @dirlist2 = Convert.to_list(SCR.Read(path(".target.dir"), @cdpath)) if Ops.less_or_equal(Builtins.size(@dirlist2), 0) || - !(Builtins.contains(@dirlist2, "suse") || - Builtins.contains(@dirlist2, "unitedlinux")) + !(Builtins.contains(@dirlist2, "suse")) # VENDOR: vendor cd contains wrong data return wrong_cd( _("Could not find driver data on the CD-ROM.\nAborting now."), @@ -138,23 +136,12 @@ ) end - @vendordir = "/suse/" - - if Ops.greater_than( - SCR.Read(path(".target.size"), "/etc/UnitedLinux-release"), - 0 - ) - @vendordir = "/UnitedLinux/" - @version = "ul1" - end - @cdpath = Ops.add( - Ops.add(Ops.add(Ops.add(@cdpath, @vendordir), Arch.architecture), "-"), - @version + Ops.add(Ops.add(Ops.add(@cdpath, "/suse/"), Arch.architecture), "-"), + version ) end - Builtins.y2milestone("Trying %1", @cdpath) @dirlist = Convert.convert( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-add-on-4.2.8/src/include/add-on/add-on-workflow.rb new/yast2-add-on-4.2.13/src/include/add-on/add-on-workflow.rb --- old/yast2-add-on-4.2.8/src/include/add-on/add-on-workflow.rb 2019-10-11 10:43:58.000000000 +0200 +++ new/yast2-add-on-4.2.13/src/include/add-on/add-on-workflow.rb 2019-12-09 10:57:42.000000000 +0100 @@ -354,26 +354,30 @@ return :next end - all_products = Pkg.ResolvableProperties("", :product, "") + all_products = Y2Packager::Resolvable.find(kind: :product) all_products.each do |product| # Product doesn't match the new source ID - next unless @added_repos.include?(product["source"]) + next unless @added_repos.include?(product.source) # Product is not available (either `installed or `selected or ...) - if product["status"] != :available - log.info("Skipping product #{product["name"].inspect} with status " \ - "#{product["status"].inspect}") + if product.status != :available + log.info("Skipping product #{product.name} with status " \ + "#{product.status}") next end - success = Pkg.ResolvableInstall(product["name"], :product) + success = Pkg.ResolvableInstall(product.name, :product) - log.info("Selecting product '#{product["name"]}' for installation -> #{success}") + log.info("Selecting product '#{product.name}' for installation -> #{success}") end :next end def ProductSelect + # Do not use Y2Packager::Resolvable.find(kind: :product) because the + # returned Resolvables have not the variable "media". + # It is not so important because this function will be called in an + # installed system with the command "/sbin/yast2 add-on URL" only all_products = Pkg.ResolvableProperties("", :product, "") already_used_urls = {} @@ -1016,9 +1020,10 @@ Pkg.SourceReleaseAll Wizard.SetTitleIcon("yast-addon") + ret2 = RunWizard() - break if ret2 == :back + ret = ret2 if ret2 == :back return :abort if ret2 == :abort log.info "Subworkflow result: ret2: #{ret2}" @@ -1184,15 +1189,17 @@ return end + vendor = pi["product"].vendor.empty? ? _("Unknown vendor") : pi["product"].vendor + version = pi["product"].version.empty? ? _("Unknown version") : pi["product"].version rt_description = Builtins.sformat( "<p>%1\n%2\n%3\n%4</p>", Builtins.sformat( _("<b>Vendor:</b> %1<br>"), - Ops.get_locale(pi, ["product", "vendor"], _("Unknown vendor")) + vendor ), Builtins.sformat( _("<b>Version:</b> %1<br>"), - Ops.get_locale(pi, ["product", "version"], _("Unknown version")) + version ), Builtins.sformat( _("<b>Repository URL:</b> %1<br>"), @@ -1267,23 +1274,21 @@ def GetRepoInfo(this_product, all_products) ret = { "IDs" => [], "URLs" => [], "aliases" => [] } - product_arch = Ops.get_string(this_product.value, "arch", "") - product_name = Ops.get_string(this_product.value, "name", "") - product_version = Ops.get_string(this_product.value, "version", "") + product_arch = this_product.value.arch + product_name = this_product.value.name + product_version = this_product.value.version Builtins.foreach(all_products.value) do |one_product| - # if (one_product["status"]:`unknown != `available) return; - next if Ops.get_string(one_product, "arch", "") != product_arch - next if Ops.get_string(one_product, "name", "") != product_name - next if Ops.get_string(one_product, "version", "") != product_version - if Builtins.haskey(one_product, "source") && - Ops.get_integer(one_product, "source", -1) != -1 + next if one_product.arch != product_arch || + one_product.name != product_name || + one_product.version != product_version + if one_product.source != -1 Ops.set( ret, "IDs", Builtins.add( Ops.get(ret, "IDs", []), - Ops.get_integer(one_product, "source", -1) + one_product.source ) ) end @@ -1297,35 +1302,15 @@ end def GetAllProductsInfo - all_products = Pkg.ResolvableProperties("", :product, "") - - all_products = Builtins.maplist(all_products) do |one_product| - # otherwise it fills the log too much - Builtins.foreach(["license", "description"]) do |key| - if Builtins.haskey(one_product, key) - Ops.set( - one_product, - key, - Ops.add( - Builtins.substring(Ops.get_string(one_product, key, ""), 0, 40), - "..." - ) - ) - end - end - deep_copy(one_product) - end - - deep_copy(all_products) + Y2Packager::Resolvable.find(kind: :product) end def GetInstalledProducts installed_products = Builtins.filter(GetAllProductsInfo()) do |one_product| # Do not list the base product - next false if Ops.get_string(one_product, "category", "addon") == "base" + next false if one_product.category == "base" # BNC #475591: Only those `installed or `selected ones should be actually visible - Ops.get_symbol(one_product, "status", :unknown) == :installed || - Ops.get_symbol(one_product, "status", :unknown) == :selected + one_product.status == :installed || one_product.status == :selected end deep_copy(installed_products) @@ -1342,22 +1327,17 @@ Builtins.foreach(installed_products) do |one_product| # only add-on products should be listed - if Builtins.haskey(one_product, "type") && - Ops.get_string(one_product, "type", "addon") != "addon" + if one_product.type != "addon" Builtins.y2milestone( "Skipping product: %1", - Ops.get_string( - one_product, - "display_name", - Ops.get_string(one_product, "name", "") - ) + one_product.display_name.empty? ? one_product.name : one_product.display_name ) next end counter = Ops.add(counter, 1) Builtins.y2milestone( "Product: %1, Info: %2", - one_product, + one_product.name, repository_info ) if repository_info == nil @@ -1435,8 +1415,7 @@ ) ), "autoyast_product" => Ops.get_locale( - product_desc, - ["product", "name"], + product_desc["product"].name, Ops.get_locale( repo_data, "name", @@ -1463,7 +1442,7 @@ products = product_infos.map do |index, product_desc| Item(Id("product_#{index}"), - product_desc["product"]["display_name"] || product_desc["product"]["name"] || _("Unknown product"), + ui_product_name(product_desc["product"]), product_desc["info"]["URLs"].first || _("Unknown URL") ) end @@ -1504,12 +1483,7 @@ return nil end - product_name = Ops.get_locale( - pi, - ["product", "display_name"], - Ops.get_locale(pi, ["product", "name"], _("Unknown product")) - ) - + product_name = ui_product_name(pi["product"]) if !Popup.AnyQuestion( Label.WarningMsg, Builtins.sformat( @@ -1551,13 +1525,13 @@ # y2milestone ("Installed packages: %1", installed_packages); # All packages from Add-On / Repository - packages_from_repo = Pkg.ResolvableProperties("", :package, "") + packages_from_repo = Y2Packager::Resolvable.find(kind: :package) packages_from_repo = Builtins.filter(packages_from_repo) do |one_package| # Package is not at the repositories to be deleted if !Builtins.contains( src_ids, - Ops.get_integer(one_package, "source", -1) + one_package.source ) next false end @@ -1566,9 +1540,9 @@ # "name version-release arch", "version" already contains a release package_string = Builtins.sformat( "%1 %2 %3", - Ops.get_string(one_package, "name", ""), - Ops.get_string(one_package, "version", ""), - Ops.get_string(one_package, "arch", "") + one_package.name, + one_package.version, + one_package.arch, ) # The very same package (which is avaliable at the source) is also installed Builtins.contains(installed_packages, package_string) @@ -1581,15 +1555,15 @@ # Removing selected product, whatever it means # It might remove several products when they use the same name - if (Ops.get_symbol(pi, ["product", "status"], :unknown) == :installed || - Ops.get_symbol(pi, ["product", "status"], :unknown) == :selected) && - Ops.get_string(pi, ["product", "name"], "") != "" + if (pi["product"].status == :installed || + pi["product"].status == :selected) && + pi["product"].name != "" Builtins.y2milestone( "Removing product: '%1'", - Ops.get_string(pi, ["product", "name"], "") + pi["product"].name ) Pkg.ResolvableRemove( - Ops.get_string(pi, ["product", "name"], ""), + pi["product"].name, :product ) else @@ -1635,9 +1609,9 @@ # "name version-release arch", "version" already contains a release package_string = Builtins.sformat( "%1 %2 %3", - Ops.get_string(one_package, "name", ""), - Ops.get_string(one_package, "version", ""), - Ops.get_string(one_package, "arch", "") + one_package.name, + one_package.version, + one_package.arch ) # installed package is not available anymore if !Builtins.contains(available_packages, package_string) @@ -1646,21 +1620,21 @@ # it must be removed Builtins.y2milestone("Removing: %1", package_string) Pkg.ResolvableRemove( - Ops.get_string(one_package, "name", "~~~"), + one_package.name, :package ) # but if another version is present, select if for installation if Builtins.contains( available_package_names, - Ops.get_string(one_package, "name", "~~~") + one_package.name ) Builtins.y2milestone( "Installing another version of %1", - Ops.get_string(one_package, "name", "") + one_package.name, ) Pkg.ResolvableInstall( - Ops.get_string(one_package, "name", ""), + one_package.name, :package ) end @@ -1904,7 +1878,7 @@ # # @return [Symbol] the workflow symbol (:next, :back, ...) def media_type_selection - if AddOnProduct.add_on_products.empty? && Y2Packager::MediumType.offline? + if offer_media_addons? # preselect the installation repository without asking the user # for the URL when adding an add-on first time on the offline medium SourceDialogs.SetURL(InstURL.installInf2Url("")) @@ -1923,6 +1897,40 @@ private + # + # Offer the add-ons from the installation medium automatically? + # The addons are only offered when: + # - Running in the first stage + # - Using the Full installation medium + # - No other add-on has already beed added (do not offer them again when + # going back and forth) + # - The system is not registered (to not mix the add-ons from SCC and from DVD) + # + # @return [Boolean] `true` if the addons should be offered automatically + # + def offer_media_addons? + if !AddOnProduct.add_on_products.empty? || !Stage.initial || !Y2Packager::MediumType.offline? + return false + end + + # check the registration status, be careful that the registration might be + # missing in the inst-sys (like on the openSUSE Leap media) + begin + require "registration/registration" + !Registration::Registration.is_registered? + rescue LoadError + return false + end + end + + # Find the human readable product name from the product + # @param [Y2Packager::Resolvable] the product + # @return [String] a human readable product name + def ui_product_name(product) + return _("Unknown product") unless product + [product.display_name, product.name, _("Unknown product")].reject(&:empty?).first + end + # Find the human readable product name for the product ID # @param product [String] the product name (ID) # @return [String] a human readable product name or the original ID if not found diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-add-on-4.2.8/test/add-on-workflow_test.rb new/yast2-add-on-4.2.13/test/add-on-workflow_test.rb --- old/yast2-add-on-4.2.8/test/add-on-workflow_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-add-on-4.2.13/test/add-on-workflow_test.rb 2019-12-09 10:57:42.000000000 +0100 @@ -0,0 +1,66 @@ +#! /usr/bin/env rspec + +require_relative "./test_helper" + +require_relative "../src/include/add-on/add-on-workflow.rb" + +# just a dummy class for including the tested methods +class AddOnAddOnWorkflowIncludeTest + include Yast::AddOnAddOnWorkflowInclude +end + +describe Yast::AddOnAddOnWorkflowInclude do + subject { AddOnAddOnWorkflowIncludeTest.new } + + describe ".media_type_selection" do + context "Full medium installation with no add-ons yet" do + let(:registration) { double("Registration::Registration", is_registered?: registered?) } + + before do + allow(Yast::AddOnProduct).to receive(:add_on_products).and_return([]) + allow(Yast::Stage).to receive(:initial).and_return(true) + allow(Y2Packager::MediumType).to receive(:offline?).and_return(true) + allow(Yast::InstURL).to receive(:installInf2Url) + allow(Yast::SourceDialogs).to receive(:SetURL) + + allow(Yast::SourceDialogs).to receive(:GetURL) + allow(Yast::SourceDialogs).to receive(:addon_enabled) + allow(subject).to receive(:TypeDialogOpts) + + stub_const("Registration::Registration", registration) + allow(subject).to receive(:require).with("registration/registration") + end + + context "not registered" do + let(:registered?) { false } + + it "preselects the installation URL for the add-ons" do + expect(Yast::InstURL).to receive(:installInf2Url) + expect(Yast::SourceDialogs).to receive(:SetURL) + subject.media_type_selection + end + + it "returns the :finish symbol" do + expect(subject.media_type_selection).to eq(:finish) + subject.media_type_selection + + end + end + + context "registered" do + let(:registered?) { true } + + it "does not preselect the installation URL for the add-ons" do + expect(Yast::InstURL).to_not receive(:installInf2Url) + expect(Yast::SourceDialogs).to_not receive(:SetURL) + subject.media_type_selection + end + + it "returns the user input" do + allow(subject).to receive(:TypeDialogOpts).and_return(:next) + expect(subject.media_type_selection).to eq(:next) + end + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-add-on-4.2.8/test/repositories_include_test.rb new/yast2-add-on-4.2.13/test/repositories_include_test.rb --- old/yast2-add-on-4.2.8/test/repositories_include_test.rb 2019-10-11 10:43:58.000000000 +0200 +++ new/yast2-add-on-4.2.13/test/repositories_include_test.rb 2019-12-09 10:57:42.000000000 +0100 @@ -75,13 +75,14 @@ end it "returns :next" do - allow(Yast::Pkg).to receive(:ResolvableProperties).and_return([]) + allow(Y2Packager::Resolvable).to receive(:find).and_return([]) allow(Yast::Pkg).to receive(:ResolvableInstall) expect(AddonIncludeTester.InstallProduct).to eq(:next) end it "selects the available products from the added repositories" do - expect(Yast::Pkg).to receive(:ResolvableProperties).and_return([p1, p2]) + expect(Y2Packager::Resolvable).to receive(:find).and_return( + [Y2Packager::Resolvable.new(p1), Y2Packager::Resolvable.new(p2)]) expect(Yast::Pkg).to receive(:ResolvableInstall).with("product1", :product) expect(Yast::Pkg).to receive(:ResolvableInstall).with("product2", :product) @@ -89,16 +90,17 @@ end it "ignores the products from other repositories" do - expect(Yast::Pkg).to receive(:ResolvableProperties).and_return( - [p1.merge("source" => 1), p2.merge("source" => 2)]) + expect(Y2Packager::Resolvable).to receive(:find).and_return( + [Y2Packager::Resolvable.new(p1.merge("source" => 1)), Y2Packager::Resolvable.new(p2.merge("source" => 2))]) expect(Yast::Pkg).to_not receive(:ResolvableInstall) AddonIncludeTester.InstallProduct end it "ignores the already selected repositories" do - expect(Yast::Pkg).to receive(:ResolvableProperties).and_return( - [p1.merge("status" => :selected), p2.merge("status" => :selected)]) + expect(Y2Packager::Resolvable).to receive(:find).and_return( + [Y2Packager::Resolvable.new(p1.merge("status" => :selected)), + Y2Packager::Resolvable.new(p2.merge("status" => :selected))]) expect(Yast::Pkg).to_not receive(:ResolvableInstall) AddonIncludeTester.InstallProduct