Hello community,

here is the log from the commit of package yast2-packager for openSUSE:Factory 
checked in at 2014-05-06 13:40:30
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-packager (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-packager.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-packager"

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-packager/yast2-packager.changes    
2014-04-13 13:13:44.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.yast2-packager.new/yast2-packager.changes       
2014-05-06 13:40:35.000000000 +0200
@@ -1,0 +2,22 @@
+Mon Apr 28 13:55:39 CEST 2014 - [email protected]
+
+- Logging status of all changed resolvables to be able to debug
+  and reproduce reported issues better (bnc#875350)
+- 3.1.12
+
+-------------------------------------------------------------------
+Wed Apr 23 10:41:25 CEST 2014 - [email protected]
+
+- Fixed function call that identified ComputeSystemPatternList
+  function as a constant (bnc#874725)
+- 3.1.11
+
+-------------------------------------------------------------------
+Fri Apr 18 13:29:58 CEST 2014 - [email protected]
+
+- Removed obsolete Product.patterns functionality and replaced
+  by new definition in control file software->default_patterns;
+  with little refactoring (bnc#873923)
+- 3.1.10
+
+-------------------------------------------------------------------

Old:
----
  yast2-packager-3.1.9.tar.bz2

New:
----
  yast2-packager-3.1.12.tar.bz2

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

Other differences:
------------------
++++++ yast2-packager.spec ++++++
--- /var/tmp/diff_new_pack.Z27zZM/_old  2014-05-06 13:40:36.000000000 +0200
+++ /var/tmp/diff_new_pack.Z27zZM/_new  2014-05-06 13:40:36.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-packager
-Version:        3.1.9
+Version:        3.1.12
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build

++++++ yast2-packager-3.1.9.tar.bz2 -> yast2-packager-3.1.12.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.12/package/yast2-packager.changes
--- old/yast2-packager-3.1.9/package/yast2-packager.changes     2014-04-11 
16:29:40.000000000 +0200
+++ new/yast2-packager-3.1.12/package/yast2-packager.changes    2014-04-28 
16:09:49.000000000 +0200
@@ -1,4 +1,26 @@
 -------------------------------------------------------------------
+Mon Apr 28 13:55:39 CEST 2014 - [email protected]
+
+- Logging status of all changed resolvables to be able to debug
+  and reproduce reported issues better (bnc#875350)
+- 3.1.12
+
+-------------------------------------------------------------------
+Wed Apr 23 10:41:25 CEST 2014 - [email protected]
+
+- Fixed function call that identified ComputeSystemPatternList
+  function as a constant (bnc#874725)
+- 3.1.11
+
+-------------------------------------------------------------------
+Fri Apr 18 13:29:58 CEST 2014 - [email protected]
+
+- 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 - [email protected]
 
 - 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.12/package/yast2-packager.spec
--- old/yast2-packager-3.1.9/package/yast2-packager.spec        2014-04-11 
16:29:40.000000000 +0200
+++ new/yast2-packager-3.1.12/package/yast2-packager.spec       2014-04-28 
16:09:49.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-packager
-Version:        3.1.9
+Version:        3.1.12
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-packager-3.1.9/src/clients/inst_rpmcopy.rb 
new/yast2-packager-3.1.12/src/clients/inst_rpmcopy.rb
--- old/yast2-packager-3.1.9/src/clients/inst_rpmcopy.rb        2014-04-11 
16:29:40.000000000 +0200
+++ new/yast2-packager-3.1.12/src/clients/inst_rpmcopy.rb       2014-04-28 
16:09:49.000000000 +0200
@@ -153,6 +153,9 @@
       # move the progress to the packages stage
       SlideShow.MoveToStage("packages")
 
+      # bnc#875350: Log the current user/app_high software selection
+      Packages.log_software_selection
+
       # install packages from CD current_cd_no to CD maxnumbercds
       @result = InstallPackagesFromMedia(@current_cd_no, @maxnumbercds)
 
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.12/src/modules/Packages.rb
--- old/yast2-packager-3.1.9/src/modules/Packages.rb    2014-04-11 
16:29:40.000000000 +0200
+++ new/yast2-packager-3.1.12/src/modules/Packages.rb   2014-04-28 
16:09:49.000000000 +0200
@@ -9,6 +9,11 @@
 
 module Yast
   class PackagesClass < Module
+    include Yast::Logger
+
+    # All known types of resolvables
+    RESOLVABLE_TYPES = [:product, :patch, :package, :pattern, :language]
+
     def main
       Yast.import "UI"
       Yast.import "Pkg"
@@ -1980,43 +1985,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 +2372,71 @@
       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
+
+    # Log only resolvables with resolvable["status"] matching these below
+    LOG_RESOLVABLE_STATUS = [:selected, :removed]
+
+    # Log only resolvables with resolvable["transact_by"] matching these below
+    LOG_RESOLVABLE_TRANSACT_BY = [:user, :app_high]
+
+    # Reads the current user selection and dumps it to log
+    def log_software_selection
+      log.info "-" * 10 << " Transaction Status Begin " << "-" * 10
+
+      RESOLVABLE_TYPES.each do |type|
+        resolvables = Pkg.ResolvableProperties("", type, "")
+        resolvables.select!{ |r| LOG_RESOLVABLE_TRANSACT_BY.include? 
r["transact_by"] }
+
+        LOG_RESOLVABLE_TRANSACT_BY.each do |transact_by|
+          changed_resolvables = resolvables.select{ |r| r["transact_by"] == 
transact_by}
+          next if changed_resolvables.empty?
+
+          decided_resolvables = changed_resolvables.select{ |r| 
LOG_RESOLVABLE_STATUS.include? r["status"] }
+          log_resolvables("Resolvables of type #{type} set by 
#{transact_by}:", decided_resolvables)
+
+          locked_resolvables = changed_resolvables.select{ |r| r["locked"] }
+          log_resolvables("Locked resolvables of type #{type} set by 
#{transact_by}:", locked_resolvables)
+        end
+      end
+
+      log.info "-" * 10 << " Transaction Status End " << "-" * 10
+      nil
+    end
+
+  private
+
+    def log_resolvables(text, resolvables)
+      return if resolvables.empty?
+
+      log.info text
+
+      resolvables.each do |r|
+        r_info = {:name => r["name"], :version => r["version"], :arch => 
r["arch"], :status => r["status"]}
+        log.info "- #{r_info}"
+      end
+    end
+
+    # 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 +2476,8 @@
     publish :function => :InitializeCatalogs, :type => "void ()"
     publish :function => :InitFailed, :type => "boolean ()"
     publish :function => :SelectKernelPackages, :type => "void ()"
+    publish :function => :default_patterns, :type => "list <string> ()"
+    publish :function => :log_software_selection, :type => "void ()"
   end
 
   Packages = PackagesClass.new
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-packager-3.1.9/test/data/zypp/products.yml 
new/yast2-packager-3.1.12/test/data/zypp/products.yml
--- old/yast2-packager-3.1.9/test/data/zypp/products.yml        1970-01-01 
01:00:00.000000000 +0100
+++ new/yast2-packager-3.1.12/test/data/zypp/products.yml       2014-04-28 
16:09:49.000000000 +0200
@@ -0,0 +1,109 @@
+---
+- arch: x86_64
+  category: base
+  description: openSUSE is a distribution by the openSUSE.org project.
+  display_name: openSUSE (INSTALLED)
+  download_size: 0
+  flags: []
+  flavor: dvd-promo
+  inst_size: 0
+  locked: false
+  medium_nr: 0
+  name: openSUSE
+  product_file: /etc/products.d/openSUSE.prod
+  register_release: ''
+  register_target: openSUSE-13.1-x86_64
+  relnotes_url: 
http://doc.opensuse.org/release-notes/x86_64/openSUSE/13.1/release-notes-openSUSE.rpm
+  relnotes_urls:
+  - 
http://doc.opensuse.org/release-notes/x86_64/openSUSE/13.1/release-notes-openSUSE.rpm
+  short_name: openSUSE
+  source: -1
+  status: :installed
+  summary: openSUSE (installed on the system)
+  transact_by: :solver
+  type: base
+  update_urls: []
+  upgrades: []
+  vendor: openSUSE
+  version: 13.1-1.10
+- arch: x86_64
+  category: base
+  description: openSUSE is a distribution by the openSUSE.org project.
+  display_name: openSUSE (LOCKED)
+  download_size: 0
+  flags: []
+  flavor: dvd-promo
+  inst_size: 0
+  locked: true
+  medium_nr: 0
+  name: openSUSE-locked
+  product_file: /etc/products.d/openSUSE.prod
+  register_release: ''
+  register_target: openSUSE-13.1-x86_64
+  relnotes_url: 
http://doc.opensuse.org/release-notes/x86_64/openSUSE/13.1/release-notes-openSUSE.rpm
+  relnotes_urls:
+  - 
http://doc.opensuse.org/release-notes/x86_64/openSUSE/13.1/release-notes-openSUSE.rpm
+  short_name: openSUSE
+  source: -1
+  status: :installed
+  summary: openSUSE (installed on the system)
+  transact_by: :user
+  type: base
+  update_urls: []
+  upgrades: []
+  vendor: openSUSE
+  version: 12.6-1.1.1.1
+- arch: x86_64
+  category: base
+  description: openSUSE is a distribution by the openSUSE.org project.
+  display_name: openSUSE (selected for installation)
+  download_size: 0
+  flags: []
+  flavor: dvd-promo
+  inst_size: 0
+  locked: false
+  medium_nr: 0
+  name: openSUSE
+  product_file: /etc/products.d/openSUSE.prod
+  register_release: ''
+  register_target: openSUSE-13.1-x86_64
+  relnotes_url: 
http://doc.opensuse.org/release-notes/x86_64/openSUSE/13.1/release-notes-openSUSE.rpm
+  relnotes_urls:
+  - 
http://doc.opensuse.org/release-notes/x86_64/openSUSE/13.1/release-notes-openSUSE.rpm
+  short_name: openSUSE
+  source: 0
+  status: :selected
+  summary: openSUSE (selected for removal)
+  transact_by: :user
+  type: base
+  update_urls: []
+  upgrades: []
+  vendor: openSUSE
+  version: 13.1-1.10
+- arch: x86_64
+  category: base
+  description: openSUSE is a distribution by the openSUSE.org project.
+  display_name: openSUSE (SELECTED)
+  download_size: 0
+  flags: []
+  flavor: dvd-promo
+  inst_size: 0
+  locked: false
+  medium_nr: 0
+  name: openSUSE
+  product_file: /etc/products.d/openSUSE.prod
+  register_release: ''
+  register_target: openSUSE-13.1-x86_64
+  relnotes_url: 
http://doc.opensuse.org/release-notes/x86_64/openSUSE/13.1/release-notes-openSUSE.rpm
+  relnotes_urls:
+  - 
http://doc.opensuse.org/release-notes/x86_64/openSUSE/13.1/release-notes-openSUSE.rpm
+  short_name: openSUSE
+  source: 0
+  status: :removed
+  summary: openSUSE (selected for installation)
+  transact_by: :app_high
+  type: base
+  update_urls: []
+  upgrades: []
+  vendor: openSUSE
+  version: 13.0-1.1
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.12/test/packages_test.rb
--- old/yast2-packager-3.1.9/test/packages_test.rb      2014-04-11 
16:29:40.000000000 +0200
+++ new/yast2-packager-3.1.12/test/packages_test.rb     2014-04-28 
16:09:49.000000000 +0200
@@ -3,10 +3,33 @@
 ENV["Y2DIR"] = File.expand_path("../../src", __FILE__)
 
 require "yast"
+require "yaml"
+
+include Yast::Logger
 
 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
+)
+
+# Path to a test data - service file - mocking the default data path
+DATA_PATH = File.join(File.expand_path(File.dirname(__FILE__)), "data")
+
+def load_zypp(file_name)
+  file_name = File.join(DATA_PATH, "zypp", file_name)
+  log.info "Loading file: #{file_name}"
+  YAML.load_file(file_name)
+end
+
+PRODUCTS_FROM_ZYPP = load_zypp('products.yml').freeze
 
 describe Yast::Packages do
   describe "#kernelCmdLinePackages" do
@@ -16,40 +39,152 @@
       Yast::Product.stub(:Product).and_return(nil)
     end
 
-    it "returns biosdevname within the list of packages as required by Kernel 
params" do
-      Yast::SCR.stub(:Read).with(
-        Yast::Path.new(".target.string"),
-        "/proc/cmdline"
-      ).and_return("install=cd:// vga=0x314 biosdevname=1")
-      expect(Yast::Packages.kernelCmdLinePackages.include?("biosdevname")).to 
be_true
-    end
-
-    it "does not return biosdevname within the list of packages as not 
required by Kernel params" do
-      Yast::SCR.stub(:Read).with(
-        Yast::Path.new(".target.string"),
-        "/proc/cmdline"
-      ).and_return("install=cd:// vga=0x314 biosdevname=0")
-      expect(Yast::Packages.kernelCmdLinePackages.include?("biosdevname")).to 
be_false
-    end
-
-    it "returns biosdevname within the list of packages if biosdevname not 
specified as Kernel parameter and if running on a Dell system" do
-      Yast::SCR.stub(:Read).with(
-        Yast::Path.new(".target.string"),
-        "/proc/cmdline"
-      ).and_return("install=cd:// vga=0x314")
-      # 0 means `grep` succeeded
-      Yast::SCR.stub(:Execute).and_return(0)
-      expect(Yast::Packages.kernelCmdLinePackages.include?("biosdevname")).to 
be_true
-    end
-
-    it "does not return biosdevname within the list of packages if biosdevname 
not specified as Kernel parameter and if not running on a Dell system" do
-      Yast::SCR.stub(:Read).with(
-        Yast::Path.new(".target.string"),
-        "/proc/cmdline"
-      ).and_return("install=cd:// vga=0x314")
-      # 1 means `grep` has not succeeded
-      Yast::SCR.stub(:Execute).and_return(1)
-      expect(Yast::Packages.kernelCmdLinePackages.include?("biosdevname")).to 
be_false
+    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(
+          SCR_STRING_PATH,"/proc/cmdline"
+        ).and_return("install=cd:// vga=0x314 biosdevname=1")
+        
expect(Yast::Packages.kernelCmdLinePackages.include?("biosdevname")).to be_true
+      end
+
+      it "does not return biosdevname within the list of required packages" do
+        Yast::SCR.stub(:Read).with(
+          SCR_STRING_PATH,"/proc/cmdline"
+        ).and_return("install=cd:// vga=0x314 biosdevname=0")
+        
expect(Yast::Packages.kernelCmdLinePackages.include?("biosdevname")).to be_false
+      end
+    end
+
+    context "when biosdevname behavior not defined on the Kernel command line" 
do
+      context "and running on a Dell system" do
+        it "returns biosdevname within the list of packages" do
+          Yast::SCR.stub(:Read).with(
+            Yast::Path.new(".target.string"),
+            "/proc/cmdline"
+          ).and_return("install=cd:// vga=0x314")
+          # 0 means `grep` succeeded
+          Yast::SCR.stub(:Execute).with(SCR_BASH_PATH, 
CHECK_FOR_DELL_SYSTEM).and_return(0)
+          
expect(Yast::Packages.kernelCmdLinePackages.include?("biosdevname")).to be_true
+        end
+      end
+
+      context "and running on a non-Dell system" do
+        it "does not return biosdevname within the list of packages" do
+          Yast::SCR.stub(:Read).with(
+            Yast::Path.new(".target.string"),
+            "/proc/cmdline"
+          ).and_return("install=cd:// vga=0x314")
+          # 1 means `grep` has not succeeded
+          Yast::SCR.stub(:Execute).with(SCR_BASH_PATH, 
CHECK_FOR_DELL_SYSTEM).and_return(1)
+          
expect(Yast::Packages.kernelCmdLinePackages.include?("biosdevname")).to be_false
+        end
+      end
+    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
+
+  describe "#log_software_selection" do
+    it "logs all currently changed resolvables set by user or application 
(excluding solver)" do
+      Yast::Pkg.stub(:ResolvableProperties).and_return([])
+      Yast::Pkg.stub(:ResolvableProperties).with("", :product, 
"").and_return(PRODUCTS_FROM_ZYPP.dup)
+
+      expect(Yast::Y2Logger.instance).to receive(:info) do |msg|
+        expect(msg).to match(/(transaction status 
[begin|end]|(locked)?resolvables of type .* set by .*|:name=>.*:version=>)/i)
+      end.exactly(8).times.and_call_original
+
+      expect(Yast::Packages.log_software_selection).to be_nil
     end
   end
 end

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to