[yast-commit] [ci_new_pac] JFYI yast2-packager -> sle12
Script 'mail_helper' called by ro Hello packager, This is just FYI. Your package was checked in in distribution "sle12" by autobuild-member: ro. Here comes the log... ---------------------------%<------------------------------ Hi, here is the log from ci_new_pac /mounts/work_src_done/SLE12/yast2-packager -> sle12 ## BNC# 873923 : "Really move PATTERNS from content to control file" (ASSIGNED/) Changes: -------- --- /work/SRC/SUSE:SLE-12:GA/yast2-packager/yast2-packager.changes 2014-04-14 11:35:42.000000000 +0200 +++ /mounts/work_src_done/SLE12/yast2-packager/yast2-packager.changes 2014-04-18 14:58:21.000000000 +0200 @@ -1,0 +2,8 @@ +Fri Apr 18 13:29:58 CEST 2014 - locilka@suse.com + +- Removed obsolete Product.patterns functionality and replaced + by new definition in control file software->default_patterns; + with little refactoring (bnc#873923) +- 3.1.10 + +------------------------------------------------------------------- calling whatdependson for sle12-i586 Packages directly triggered for rebuild: - yast2-packager - at least 26 other packages ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/SUSE:SLE-12:GA/yast2-packager (Old) and /mounts/work_src_done/SLE12/yast2-packager (BS:build ID:36565 MAIL:yast-commit@opensuse.org) (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "yast2-packager", Maintainer is "yast-commit@opensuse.org" Old: ---- yast2-packager-3.1.9.tar.bz2 New: ---- yast2-packager-3.1.10.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-packager.spec ++++++ --- /var/tmp/diff_new_pack.mps8Ny/_old 2014-04-22 12:35:03.000000000 +0200 +++ /var/tmp/diff_new_pack.mps8Ny/_new 2014-04-22 12:35:03.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-packager -Version: 3.1.9 +Version: 3.1.10 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ yast2-packager-3.1.9.tar.bz2 -> yast2-packager-3.1.10.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-3.1.9/package/yast2-packager.changes new/yast2-packager-3.1.10/package/yast2-packager.changes --- old/yast2-packager-3.1.9/package/yast2-packager.changes 2014-04-14 09:58:45.000000000 +0200 +++ new/yast2-packager-3.1.10/package/yast2-packager.changes 2014-04-18 14:53:27.000000000 +0200 @@ -1,4 +1,12 @@ ------------------------------------------------------------------- +Fri Apr 18 13:29:58 CEST 2014 - locilka@suse.com + +- Removed obsolete Product.patterns functionality and replaced + by new definition in control file software->default_patterns; + with little refactoring (bnc#873923) +- 3.1.10 + +------------------------------------------------------------------- Fri Apr 11 16:07:19 CEST 2014 - locilka@suse.cz - Test for Packages rewritten in RSpec to fix the build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-3.1.9/package/yast2-packager.spec new/yast2-packager-3.1.10/package/yast2-packager.spec --- old/yast2-packager-3.1.9/package/yast2-packager.spec 2014-04-14 09:58:45.000000000 +0200 +++ new/yast2-packager-3.1.10/package/yast2-packager.spec 2014-04-18 14:53:27.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-packager -Version: 3.1.9 +Version: 3.1.10 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-3.1.9/src/modules/Packages.rb new/yast2-packager-3.1.10/src/modules/Packages.rb --- old/yast2-packager-3.1.9/src/modules/Packages.rb 2014-04-14 09:58:45.000000000 +0200 +++ new/yast2-packager-3.1.10/src/modules/Packages.rb 2014-04-18 14:53:27.000000000 +0200 @@ -9,6 +9,8 @@ module Yast class PackagesClass < Module + include Yast::Logger + def main Yast.import "UI" Yast.import "Pkg" @@ -1980,43 +1982,39 @@ ret end - # Select system patterns - # @param [Boolean] reselect boolean true to select only those which are alrady selected + # Selects system-specific and default patterns for installation + # + # @param [Boolean] reselect whether to re-select all already selected patterns def SelectSystemPatterns(reselect) - system_patterns = ComputeSystemPatternList() + patterns = patterns_to_install + log.info "Selecting system patterns #{patterns}" - # autoinstallation has patterns specified in the profile - if !Mode.autoinst - system_patterns = Convert.convert( - Builtins.toset(Builtins.merge(system_patterns, Product.patterns)), - :from => "list", - :to => "list <string>" - ) - end if !reselect - Builtins.y2milestone("Selecting system patterns %1", system_patterns) - Builtins.foreach(system_patterns) do |p| - prop = Ops.get(Pkg.ResolvableProperties(p, :pattern, ""), 0, {}) - if Ops.get(prop, "status") == :available && - Ops.get(prop, "transact_by") == :user - Builtins.y2milestone("Ignoring deselected pattern '%1'", p) + patterns.each do |pattern_name| + prop = Pkg.ResolvableProperties(pattern_name, :pattern, "").first + + if prop.nil? + # It comes from product definition which has to be in order + raise "Pattern #{pattern_name} does not exist" + elsif prop["status"] == :available && prop["transact_by"] == :user + log.info "Skipping pattern #{pattern_name} deselected by user" else - Pkg.ResolvableInstall(p, :pattern) + Pkg.ResolvableInstall(pattern_name, :pattern) end end else - Builtins.y2milestone("Re-selecting system patterns %1", system_patterns) - pats = Builtins.filter(system_patterns) do |p| - descrs = Pkg.ResolvableProperties(p, :pattern, "") - descrs = Builtins.filter(descrs) do |descr| - Ops.get(descr, "status") == :selected - end - Ops.greater_than(Builtins.size(descrs), 0) + patterns.select! do |pattern_name| + descrs = Pkg.ResolvableProperties(pattern_name, :pattern, "") + # It comes from product definition which has to be in order + raise "Pattern #{pattern_name} does not exist" if descrs.empty? + descrs.any?{ |descr| descr["status"] == :selected } end - Builtins.y2milestone("Selected patterns to be reselected: %1", pats) - Builtins.foreach(pats) do |p| - Pkg.ResolvableRemove(p, :pattern) - Pkg.ResolvableInstall(p, :pattern) + + log.info "Selected patterns to be reselected: #{patterns}" + + patterns.each do |pattern_name| + Pkg.ResolvableRemove(pattern_name, :pattern) + Pkg.ResolvableInstall(pattern_name, :pattern) end end @@ -2371,6 +2369,30 @@ nil end + # Reads software->default_patterns and returns lisf of patterns that should + # be selected for installation by default + # + # @return [Array] list of patterns + def default_patterns + patterns = ProductFeatures.GetStringFeature("software", "default_patterns") + log.info "Default patterns: #{patterns}" + patterns.split(/[, \n]/).reject(&:empty?) + end + + private + + # Computes all patterns that are expected to be selected for default installation + def patterns_to_install + patterns = ComputeSystemPatternList + + # autoinstallation has patterns specified in the profile + if !Mode.autoinst + default_patterns.inject(patterns, :<<) + end + + patterns + end + publish :variable => :install_sources, :type => "boolean" publish :variable => :timestamp, :type => "integer" publish :variable => :metadir, :type => "string" @@ -2410,6 +2432,7 @@ publish :function => :InitializeCatalogs, :type => "void ()" publish :function => :InitFailed, :type => "boolean ()" publish :function => :SelectKernelPackages, :type => "void ()" + publish :function => :default_patterns, :type => "list <string> ()" end Packages = PackagesClass.new diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-3.1.9/test/packages_test.rb new/yast2-packager-3.1.10/test/packages_test.rb --- old/yast2-packager-3.1.9/test/packages_test.rb 2014-04-14 09:58:45.000000000 +0200 +++ new/yast2-packager-3.1.10/test/packages_test.rb 2014-04-18 14:53:28.000000000 +0200 @@ -7,6 +7,15 @@ Yast.import "Packages" Yast.import "SCR" Yast.import "Product" +Yast.import "ProductFeatures" + +SCR_STRING_PATH = Yast::Path.new(".target.string") +SCR_BASH_PATH = Yast::Path.new(".target.bash") + +CHECK_FOR_DELL_SYSTEM = Regexp.new( + 'hwinfo .*bios .*grep .*vendor:.*dell inc', + Regexp::IGNORECASE +) describe Yast::Packages do describe "#kernelCmdLinePackages" do @@ -16,14 +25,6 @@ Yast::Product.stub(:Product).and_return(nil) end - SCR_STRING_PATH = Yast::Path.new(".target.string") - SCR_BASH_PATH = Yast::Path.new(".target.bash") - - CHECK_FOR_DELL_SYSTEM = Regexp.new( - 'hwinfo .*bios .*grep .*vendor:.*dell inc', - Regexp::IGNORECASE - ) - context "when biosdevname behavior explicitly defined on the Kenel command line" do it "returns biosdevname within the list of required packages" do Yast::SCR.stub(:Read).with( @@ -67,4 +68,96 @@ end end + + describe "#default_patterns" do + context "software->default_patterns is not defined in control file" do + it "returns empty list" do + Yast::ProductFeatures.stub(:GetStringFeature).with("software", "default_patterns").and_return("") + expect(Yast::Packages.default_patterns).to be_empty + end + end + + context "software->default_patterns is filled with list of patterns" do + it "returns list of patterns" do + Yast::ProductFeatures.stub(:GetStringFeature).with("software", "default_patterns").and_return("a,b,c,d") + expect(Yast::Packages.default_patterns).to eq(["a", "b", "c", "d"]) + + Yast::ProductFeatures.stub(:GetStringFeature).with("software", "default_patterns").and_return("a b c d") + expect(Yast::Packages.default_patterns).to eq(["a", "b", "c", "d"]) + + Yast::ProductFeatures.stub(:GetStringFeature).with("software", "default_patterns").and_return(" a ,b , c,d ") + expect(Yast::Packages.default_patterns).to eq(["a", "b", "c", "d"]) + + Yast::ProductFeatures.stub(:GetStringFeature).with("software", "default_patterns").and_return(" a ,b \n, c\n,d ") + expect(Yast::Packages.default_patterns).to eq(["a", "b", "c", "d"]) + end + end + end + + DEFAULT_PATTERN = { + "name" => "name", + "version" => "1.0.0", + "status" => :available, + "transact_by" => :app_high, + } + + def pattern(properties = {}) + DEFAULT_PATTERN.merge(properties) + end + + describe "#SelectSystemPatterns" do + context "if this is the initial run or it is being reinitialized" do + context "and patterns are not unselected by user" do + it "selects patterns for installation" do + Yast::Packages.stub(:patterns_to_install).and_return(["p1", "p2", "p3"]) + Yast::Pkg.stub(:ResolvableProperties).and_return( + [pattern({ "name" => "p1" })], + [pattern({ "name" => "p2" })], + [pattern({ "name" => "p3" })] + ) + + allow(Yast::Pkg).to receive(:ResolvableInstall).with(/\Ap[1-3]/, :pattern).exactly(3).times.and_return(true) + Yast::Packages.SelectSystemPatterns(false) + end + end + + context "and some patterns are already unselected by user" do + it "selects patterns for installation that were not unselected by user already" do + Yast::Packages.stub(:patterns_to_install).and_return(["p1", "p2", "p3"]) + Yast::Pkg.stub(:ResolvableProperties).and_return( + [pattern({ "name" => "p1", "transact_by" => :user })], + [pattern({ "name" => "p2", "transact_by" => :user })], + [pattern({ "name" => "p3" })] + ) + + expect(Yast::Pkg).not_to receive(:ResolvableInstall).with("p1", :pattern) + expect(Yast::Pkg).not_to receive(:ResolvableInstall).with("p2", :pattern) + expect(Yast::Pkg).to receive(:ResolvableInstall).with("p3", :pattern).once.and_return(true) + Yast::Packages.SelectSystemPatterns(false) + end + end + end + + context "if this is a subsequent run" do + it "re-selects all patterns already selected for installation" do + Yast::Packages.stub(:patterns_to_install).and_return(["p1", "p2", "p3"]) + Yast::Pkg.stub(:ResolvableProperties).and_return( + [pattern({ "name" => "p1", "transact_by" => :user, "status" => :selected })], + [pattern({ "name" => "p2", "transact_by" => :user, "status" => :selected })], + [pattern({ "name" => "p3" })] + ) + + expect(Yast::Pkg).to receive(:ResolvableRemove).with(/\Ap[1-2]/, :pattern).twice.and_return(true) + expect(Yast::Pkg).not_to receive(:ResolvableInstall).with("p3", :pattern) + Yast::Packages.SelectSystemPatterns(true) + end + end + + it "raises an exception if pattern is not found" do + Yast::Packages.stub(:patterns_to_install).and_return(["p1", "p2", "p3"]) + Yast::Pkg.stub(:ResolvableProperties).and_return([]) + expect{ Yast::Packages.SelectSystemPatterns(false) }.to raise_error(/pattern/i) + expect{ Yast::Packages.SelectSystemPatterns(true) }.to raise_error(/pattern/i) + end + end end continue with "q"... Checked in at Tue Apr 22 12:35:14 CEST 2014 by ro Remember to have fun... -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
ro