Hello community, here is the log from the commit of package yast2-packager for openSUSE:Factory checked in at 2019-03-28 22:47:02 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-packager (Old) and /work/SRC/openSUSE:Factory/.yast2-packager.new.25356 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-packager" Thu Mar 28 22:47:02 2019 rev:370 rq:689113 version:4.2.1 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-packager/yast2-packager.changes 2019-03-21 09:52:04.790808660 +0100 +++ /work/SRC/openSUSE:Factory/.yast2-packager.new.25356/yast2-packager.changes 2019-03-28 22:47:03.607071548 +0100 @@ -1,0 +2,21 @@ +Wed Mar 27 15:27:36 UTC 2019 - David Díaz <[email protected]> + +- Fix malformed rpm commands (bsc#1129422). +- The same changes were originally made for SP1, 4.1.35. +- 4.2.1 + +------------------------------------------------------------------- +Tue Mar 26 17:27:18 CET 2019 - [email protected] + +- Fix: Checking if the proposal has been changed (right sorting). + (bsc#1125718) +- 4.2.0 + +------------------------------------------------------------------- +Mon Mar 25 15:34:46 UTC 2019 - Stefan Hundhammer <[email protected]> + +- Use correct method name mount_path, not nonexistent mountpoint + (bsc#1130287) +- 4.1.34 + +------------------------------------------------------------------- Old: ---- yast2-packager-4.1.33.tar.bz2 New: ---- yast2-packager-4.2.1.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-packager.spec ++++++ --- /var/tmp/diff_new_pack.XhpHaM/_old 2019-03-28 22:47:05.371071280 +0100 +++ /var/tmp/diff_new_pack.XhpHaM/_new 2019-03-28 22:47:05.407071274 +0100 @@ -17,7 +17,7 @@ Name: yast2-packager -Version: 4.1.33 +Version: 4.2.1 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ yast2-packager-4.1.33.tar.bz2 -> yast2-packager-4.2.1.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-4.1.33/package/yast2-packager.changes new/yast2-packager-4.2.1/package/yast2-packager.changes --- old/yast2-packager-4.1.33/package/yast2-packager.changes 2019-03-19 17:23:54.000000000 +0100 +++ new/yast2-packager-4.2.1/package/yast2-packager.changes 2019-03-27 16:34:29.000000000 +0100 @@ -1,4 +1,25 @@ ------------------------------------------------------------------- +Wed Mar 27 15:27:36 UTC 2019 - David Díaz <[email protected]> + +- Fix malformed rpm commands (bsc#1129422). +- The same changes were originally made for SP1, 4.1.35. +- 4.2.1 + +------------------------------------------------------------------- +Tue Mar 26 17:27:18 CET 2019 - [email protected] + +- Fix: Checking if the proposal has been changed (right sorting). + (bsc#1125718) +- 4.2.0 + +------------------------------------------------------------------- +Mon Mar 25 15:34:46 UTC 2019 - Stefan Hundhammer <[email protected]> + +- Use correct method name mount_path, not nonexistent mountpoint + (bsc#1130287) +- 4.1.34 + +------------------------------------------------------------------- Fri Mar 15 15:51:00 CET 2019 - [email protected] - AutoYaST: Disabling local repositories in second stage only. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-4.1.33/package/yast2-packager.spec new/yast2-packager-4.2.1/package/yast2-packager.spec --- old/yast2-packager-4.1.33/package/yast2-packager.spec 2019-03-19 17:23:54.000000000 +0100 +++ new/yast2-packager-4.2.1/package/yast2-packager.spec 2019-03-27 16:34:29.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2-packager -Version: 4.1.33 +Version: 4.2.1 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-4.1.33/src/clients/sw_single.rb new/yast2-packager-4.2.1/src/clients/sw_single.rb --- old/yast2-packager-4.1.33/src/clients/sw_single.rb 2019-03-19 17:23:54.000000000 +0100 +++ new/yast2-packager-4.2.1/src/clients/sw_single.rb 2019-03-27 16:34:29.000000000 +0100 @@ -215,7 +215,7 @@ if Ops.greater_than(SCR.Read(path(".target.size"), package), 0) out = SCR.Execute( path(".target.bash_output"), - "/bin/rpm -q --qf '%%{NAME}' -p #{package.shellescape}" + "/bin/rpm -q --qf '%{NAME}' -p #{package.shellescape}" ) if Ops.get_integer(out, "exit", -1).nonzero? @@ -234,7 +234,7 @@ # is it a source package? out = SCR.Execute( path(".target.bash_output"), - "/bin/rpm -q --qf '%%{SOURCEPACKAGE}' -p #{package.shellescape}" + "/bin/rpm -q --qf '%{SOURCEPACKAGE}' -p #{package.shellescape}" ) if Ops.get_integer(out, "exit", -1).nonzero? # error message diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-4.1.33/src/modules/Packages.rb new/yast2-packager-4.2.1/src/modules/Packages.rb --- old/yast2-packager-4.1.33/src/modules/Packages.rb 2019-03-19 17:23:54.000000000 +0100 +++ new/yast2-packager-4.2.1/src/modules/Packages.rb 2019-03-27 16:34:29.000000000 +0100 @@ -16,6 +16,7 @@ include ERB::Util attr_reader :missing_remote_packages, :missing_remote_kind + attr_accessor :cached_proposal # All known types of resolvables RESOLVABLE_TYPES = [:product, :patch, :package, :pattern, :language].freeze @@ -88,15 +89,11 @@ @init_error = nil # cache for the proposed summary - @cached_proposal = nil + @cached_proposal_summary = nil # the selection used for the cached proposal # the default values 'nil' say that the proposal hasn't been called yet - @cached_proposal_packages = nil - @cached_proposal_patterns = nil - @cached_proposal_products = nil - @cached_proposal_patches = nil - @cached_proposal_languages = nil + @cached_proposal = nil @install_sources = false # Installing source packages ? @timestamp = 0 # last time of getting the target map @@ -161,12 +158,7 @@ def ResetProposalCache Builtins.y2milestone("Reseting the software proposal cache") - @cached_proposal_packages = nil - @cached_proposal_patterns = nil - @cached_proposal_products = nil - @cached_proposal_patches = nil - @cached_proposal_languages = nil - + @cached_proposal = nil nil end @@ -529,7 +521,7 @@ delim = summary.fetch("warning", "").empty? ? "" : "<BR>" if Builtins.contains( @basic_dirs, - failed_mount.mountpoint + failed_mount.mount_path ) Ops.set( summary, @@ -542,7 +534,7 @@ "Error: Cannot check free space in basic directory %1 (device %2), " \ "cannot start installation." ), - failed_mount.mountpoint, + failed_mount.mount_path, fs_dev_name(failed_mount) ) ) @@ -562,7 +554,7 @@ _( "Warning: Cannot check free space in directory %1 (device %2)." ), - failed_mount.mountpoint, + failed_mount.mount_path, fs_dev_name(failed_mount) ) ) @@ -2030,59 +2022,23 @@ # if the cache is valid and reset or reinitialization is not required # then the cached proposal can be used - if !@cached_proposal.nil? && force_reset == false && reinit == false - # selected packages - selected_packages = Pkg.GetPackages(:selected, false) - - # selected patterns - selected_patterns = Builtins.filter( - Pkg.ResolvableProperties("", :pattern, "") - ) do |p| - Ops.get_symbol(p, "status", :unknown) == :selected - end - - # selected products - selected_products = Builtins.filter( - Pkg.ResolvableProperties("", :product, "") - ) do |p| - Ops.get_symbol(p, "status", :unknown) == :selected - end - - # selected patches - selected_patches = Builtins.filter( - Pkg.ResolvableProperties("", :patch, "") - ) do |p| - Ops.get_symbol(p, "status", :unknown) == :selected - end - - # selected languages - selected_languages = Convert.convert( - Builtins.union([Pkg.GetPackageLocale], Pkg.GetAdditionalLocales), - from: "list", - to: "list <string>" - ) + if !@cached_proposal_summary.nil? && force_reset == false && reinit == false - # if the package selection has not been changed the cache is up to date - if selected_packages == @cached_proposal_packages && - selected_patterns == @cached_proposal_patterns && - selected_products == @cached_proposal_products && - selected_patches == @cached_proposal_patches && - selected_languages == @cached_proposal_languages + # if the package, pattern,... selection has not been changed the cache is up to date + if !proposal_changed? Builtins.y2milestone("using cached software proposal") - return deep_copy(@cached_proposal) + return deep_copy(@cached_proposal_summary) # do not show the error message during the first proposal # (and the only way to change to software selection manually -> software_proposal/AskUser) # # 'nil' is the default value # See also ResetProposalCache() - elsif !@cached_proposal_packages.nil? && - !@cached_proposal_patterns.nil? && - !@cached_proposal_products.nil? && - !@cached_proposal_patches.nil? && - !@cached_proposal_languages.nil? - Builtins.y2error( - "invalid cache: the software selection has been chaged" + elsif !cached_proposal.nil? + log.error( + "invalid cache: the software selection has been changed" ) + log_proposal_diff + # bnc #436925 Report.Message( _( @@ -2162,33 +2118,12 @@ # Question: is `desktop appropriate for SLE? ret = Summary([:product, :pattern, :size, :desktop], false) - # TODO: simple proposal - # cache the proposal - @cached_proposal = deep_copy(ret) + # cache the proposal summary + @cached_proposal_summary = deep_copy(ret) # remember the status - @cached_proposal_packages = Pkg.GetPackages(:selected, false) - @cached_proposal_patterns = Builtins.filter( - Pkg.ResolvableProperties("", :pattern, "") - ) do |p| - Ops.get_symbol(p, "status", :unknown) == :selected - end - @cached_proposal_products = Builtins.filter( - Pkg.ResolvableProperties("", :product, "") - ) do |p| - Ops.get_symbol(p, "status", :unknown) == :selected - end - @cached_proposal_patches = Builtins.filter( - Pkg.ResolvableProperties("", :patch, "") - ) do |p| - Ops.get_symbol(p, "status", :unknown) == :selected - end - @cached_proposal_languages = Convert.convert( - Builtins.union([Pkg.GetPackageLocale], Pkg.GetAdditionalLocales), - from: "list", - to: "list <string>" - ) + @cached_proposal = current_proposal UI.CloseDialog @@ -2420,6 +2355,42 @@ private + def fetch_selected(category) + items = Pkg.ResolvableProperties("", category, "").select { |i| i["status"] == :selected } + items.map { |i| i["name"] }.sort + end + + # Current package, pattern, product, patch and language selection. + # + # @return [Hash] selected packages, patterns, products,... + def current_proposal + { "packages" => Pkg.GetPackages(:selected, false).sort, + "patterns" => fetch_selected(:pattern), + "products" => fetch_selected(:product), + "patches" => fetch_selected(:patch), + "languages" => [Pkg.GetPackageLocale].concat(Pkg.GetAdditionalLocales).compact.sort } + end + + # Checking if there have been changes around package, pattern, product, + # patch and language selection. + # + # @return [Boolean] changed ? + def proposal_changed? + current_proposal != cached_proposal + end + + # + # Log changed proposal + # + def log_proposal_diff + current_proposal.each do |kind, current| + if current != cached_proposal[kind] + log.info("New #{kind}: #{current - cached_proposal[kind]}") + log.info("Removed #{kind}: #{cached_proposal[kind] - current}") + end + end + end + # Reads product feature defined by parameters, logs what it gets # and returns list of items split by whitespaces # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-4.1.33/test/packages_test.rb new/yast2-packager-4.2.1/test/packages_test.rb --- old/yast2-packager-4.1.33/test/packages_test.rb 2019-03-19 17:23:54.000000000 +0100 +++ new/yast2-packager-4.2.1/test/packages_test.rb 2019-03-27 16:34:29.000000000 +0100 @@ -1728,4 +1728,45 @@ expect(subject.sourceAccessPackages.sort).to eq(["cifs-mount", "nfs-client"]) end end + + describe "#proposal_changed?" do + before do + allow(Yast::Pkg).to receive(:ResolvableProperties).with("", :patch, "") + .and_return([]) + + allow(Yast::Pkg).to receive(:ResolvableProperties).with("", :pattern, "") + .and_return( + [pattern("name" => "minimal_base", "status" => :selected), + pattern("name" => "base", "status" => :selected)] + ) + allow(Yast::Pkg).to receive(:ResolvableProperties).with("", :product, "") + .and_return([product("name" => "SLES", "status" => :selected)]) + allow(Yast::Pkg).to receive(:GetAdditionalLocales).and_return([]) + allow(Yast::Pkg).to receive(:GetPackageLocale).and_return("en_US") + + subject.cached_proposal = { "packages" => ["SUSEConnect 0.3.16 5.13 x86_64", + "aaa_base 84.87+git20180409.04c9dae 3.3.2 x86_64", + "bash 4.4 9.7.1 x86_64"], + "patterns" => ["base", "minimal_base"], + "products" => ["SLES"], "patches" => [], "languages" => ["en_US"] } + end + + context "current selection has not been changed" do + it "returns false" do + allow(Yast::Pkg).to receive(:GetPackages) + .and_return(["aaa_base 84.87+git20180409.04c9dae 3.3.2 x86_64", + "bash 4.4 9.7.1 x86_64", "SUSEConnect 0.3.16 5.13 x86_64"]) + expect(Yast::Packages.send(:proposal_changed?)).to eq false + end + end + + context "package selection has been changed" do + it "returns true" do + allow(Yast::Pkg).to receive(:GetPackages) + .and_return(["aaa_base 84.87+git20180409.04c9dae 3.3.2 x86_64", + "bash 4.4 9.7.1 x86_64"]) + expect(Yast::Packages.send(:proposal_changed?)).to eq true + end + end + end end
