Hello community,

here is the log from the commit of package yast2-packager for openSUSE:Factory 
checked in at 2014-05-17 22:01:58
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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-05-06 13:40:35.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.yast2-packager.new/yast2-packager.changes       
2014-05-17 22:02:03.000000000 +0200
@@ -1,0 +2,43 @@
+Fri May 16 15:41:44 CEST 2014 - loci...@suse.com
+
+- Added support for software->optional_default_patterns to handle
+  selecting optional patterns without reporting if they are missing
+  (bnc#876760)
+- 3.1.18
+
+-------------------------------------------------------------------
+Fri May 16 12:31:52 UTC 2014 - jreidin...@suse.com
+
+- Fix preffering DVD during installation (bnc#865819,bnc#780617)
+- 3.1.17
+
+-------------------------------------------------------------------
+Thu May 15 12:08:05 UTC 2014 - lsle...@suse.cz
+
+- ProductLicense - allow setting the dialog title and display an
+  optional heading (needed for displaying the EULA for addons from
+  registration server)
+- 3.1.16
+
+-------------------------------------------------------------------
+Thu May 15 11:44:30 UTC 2014 - lsle...@suse.cz
+
+- fixed wrong constant name resulting in a crash during
+  installation
+- 3.1.15
+
+-------------------------------------------------------------------
+Tue May 13 17:44:20 UTC 2014 - lsle...@suse.cz
+
+- add-on protocol dialog: display a global checkbox when selecting
+  an add-on during registration (bnc#870625)
+- 3.1.14
+
+-------------------------------------------------------------------
+Tue May 13 15:04:11 CEST 2014 - loci...@suse.com
+
+- Selecting missing default patterns now reports an error instead
+  of raising an exception (bnc#875799)
+- 3.1.13
+
+-------------------------------------------------------------------

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

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

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

Other differences:
------------------
++++++ yast2-packager.spec ++++++
--- /var/tmp/diff_new_pack.nstYUw/_old  2014-05-17 22:02:03.000000000 +0200
+++ /var/tmp/diff_new_pack.nstYUw/_new  2014-05-17 22:02:03.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-packager
-Version:        3.1.12
+Version:        3.1.18
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build

++++++ yast2-packager-3.1.12.tar.bz2 -> yast2-packager-3.1.18.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-packager-3.1.12/package/yast2-packager.changes 
new/yast2-packager-3.1.18/package/yast2-packager.changes
--- old/yast2-packager-3.1.12/package/yast2-packager.changes    2014-04-28 
16:09:49.000000000 +0200
+++ new/yast2-packager-3.1.18/package/yast2-packager.changes    2014-05-16 
16:10:15.000000000 +0200
@@ -1,4 +1,47 @@
 -------------------------------------------------------------------
+Fri May 16 15:41:44 CEST 2014 - loci...@suse.com
+
+- Added support for software->optional_default_patterns to handle
+  selecting optional patterns without reporting if they are missing
+  (bnc#876760)
+- 3.1.18
+
+-------------------------------------------------------------------
+Fri May 16 12:31:52 UTC 2014 - jreidin...@suse.com
+
+- Fix preffering DVD during installation (bnc#865819,bnc#780617)
+- 3.1.17
+
+-------------------------------------------------------------------
+Thu May 15 12:08:05 UTC 2014 - lsle...@suse.cz
+
+- ProductLicense - allow setting the dialog title and display an
+  optional heading (needed for displaying the EULA for addons from
+  registration server)
+- 3.1.16
+
+-------------------------------------------------------------------
+Thu May 15 11:44:30 UTC 2014 - lsle...@suse.cz
+
+- fixed wrong constant name resulting in a crash during
+  installation
+- 3.1.15
+
+-------------------------------------------------------------------
+Tue May 13 17:44:20 UTC 2014 - lsle...@suse.cz
+
+- add-on protocol dialog: display a global checkbox when selecting
+  an add-on during registration (bnc#870625)
+- 3.1.14
+
+-------------------------------------------------------------------
+Tue May 13 15:04:11 CEST 2014 - loci...@suse.com
+
+- Selecting missing default patterns now reports an error instead
+  of raising an exception (bnc#875799)
+- 3.1.13
+
+-------------------------------------------------------------------
 Mon Apr 28 13:55:39 CEST 2014 - loci...@suse.com
 
 - Logging status of all changed resolvables to be able to debug
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-packager-3.1.12/package/yast2-packager.spec 
new/yast2-packager-3.1.18/package/yast2-packager.spec
--- old/yast2-packager-3.1.12/package/yast2-packager.spec       2014-04-28 
16:09:49.000000000 +0200
+++ new/yast2-packager-3.1.18/package/yast2-packager.spec       2014-05-16 
16:10:15.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-packager
-Version:        3.1.12
+Version:        3.1.18
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-packager-3.1.12/src/clients/inst_kickoff.rb 
new/yast2-packager-3.1.18/src/clients/inst_kickoff.rb
--- old/yast2-packager-3.1.12/src/clients/inst_kickoff.rb       2014-04-28 
16:09:49.000000000 +0200
+++ new/yast2-packager-3.1.18/src/clients/inst_kickoff.rb       2014-05-16 
16:10:15.000000000 +0200
@@ -63,10 +63,6 @@
         end
       end
 
-      # prefer CD/DVD media to download during installation/update
-      Builtins.y2milestone("Prefer CD/DVD media to download")
-      Pkg.SetZConfig({ "download_media_prefer_download" => false })
-
       # copy the credential files, libzypp loads them from target
       zypp_dir = "/etc/zypp"
       credentials_d = zypp_dir + "/credentials.d"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-packager-3.1.12/src/modules/Packages.rb 
new/yast2-packager-3.1.18/src/modules/Packages.rb
--- old/yast2-packager-3.1.12/src/modules/Packages.rb   2014-04-28 
16:09:49.000000000 +0200
+++ new/yast2-packager-3.1.18/src/modules/Packages.rb   2014-05-16 
16:10:15.000000000 +0200
@@ -1774,6 +1774,12 @@
     def Initialize_StageInitial(show_popup, base_url, log_url)
       initial_repository = nil
       ImportGPGKeys()
+
+      # prefer CD/DVD media to download during installation/update
+      # (BNC#780617,865819)
+      Builtins.y2milestone("Prefer CD/DVD media to download")
+      Pkg.SetZConfig({ "download_media_prefer_download" => false })
+
       while initial_repository == nil
         initial_repository = Pkg.SourceCreateBase(base_url, "")
         if initial_repository == -1 || initial_repository == nil
@@ -1989,7 +1995,7 @@
     #
     # @param [Boolean] reselect whether to re-select all already selected 
patterns
     def SelectSystemPatterns(reselect)
-      patterns = patterns_to_install
+      patterns = patterns_to_install.dup
       log.info "Selecting system patterns #{patterns}"
 
       if !reselect
@@ -1997,8 +2003,8 @@
           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"
+            report_missing_pattern(pattern_name)
+            next
           elsif prop["status"] == :available && prop["transact_by"] == :user
             log.info "Skipping pattern #{pattern_name} deselected by user"
           else
@@ -2008,8 +2014,7 @@
       else
         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?
+          report_missing_pattern(pattern_name) if descrs.empty?
           descrs.any?{ |descr| descr["status"] == :selected }
         end
 
@@ -2377,9 +2382,15 @@
     #
     # @return [Array] list of patterns
     def default_patterns
-      patterns = ProductFeatures.GetStringFeature("software", 
"default_patterns")
-      log.info "Default patterns: #{patterns}"
-      patterns.split(/[, \n]/).reject(&:empty?)
+      product_feature_items("software", "default_patterns")
+    end
+
+    # Reads software->optional_default_patterns and returns lisf of patterns 
that should
+    # be selected for installation by default (if they exist)
+    #
+    # @return [Array] list of patterns
+    def optional_default_patterns
+      product_feature_items("software", "optional_default_patterns")
     end
 
     # Log only resolvables with resolvable["status"] matching these below
@@ -2414,6 +2425,18 @@
 
   private
 
+    # Reads product feature defined by parameters, logs what it gets
+    # and returns list of items split by whitespaces
+    #
+    # @param [String] section in control file
+    # @param [String] feature in section
+    # @return [Array] of items
+    def product_feature_items(section, feature)
+      feature_items = ProductFeatures.GetStringFeature(section, feature)
+      log.info "Product feature #{section}->#{feature} items: 
#{feature_items.inspect}"
+      feature_items.strip.split
+    end
+
     def log_resolvables(text, resolvables)
       return if resolvables.empty?
 
@@ -2427,16 +2450,29 @@
 
     # Computes all patterns that are expected to be selected for default 
installation
     def patterns_to_install
-      patterns = ComputeSystemPatternList()
+      patterns = ComputeSystemPatternList().dup
 
       # autoinstallation has patterns specified in the profile
       if !Mode.autoinst
-        default_patterns.inject(patterns, :<<)
+        (default_patterns | optional_default_patterns).inject(patterns, :<<)
       end
 
       patterns
     end
 
+    def report_missing_pattern(pattern_name)
+      if optional_default_patterns.include?(pattern_name)
+        log.info "Optional pattern #{pattern_name} does not exist, skipping..."
+      else
+        log.error "Pattern #{pattern_name} does not exist"
+        # Error message, %{pattern_name} is replaced with the missing pattern 
name in runtime
+        Report.Error(_(
+          "Failed to select default product pattern %{pattern_name}.\n" +
+          "Pattern has not been found."
+        ) % {:pattern_name => pattern_name})
+      end
+    end
+
     publish :variable => :install_sources, :type => "boolean"
     publish :variable => :timestamp, :type => "integer"
     publish :variable => :metadir, :type => "string"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-packager-3.1.12/src/modules/ProductLicense.rb 
new/yast2-packager-3.1.18/src/modules/ProductLicense.rb
--- old/yast2-packager-3.1.12/src/modules/ProductLicense.rb     2014-04-28 
16:09:49.000000000 +0200
+++ new/yast2-packager-3.1.18/src/modules/ProductLicense.rb     2014-05-16 
16:10:15.000000000 +0200
@@ -13,6 +13,8 @@
 
 module Yast
   class ProductLicenseClass < Module
+    attr_accessor :license_patterns
+
     def main
       Yast.import "Pkg"
       Yast.import "UI"
@@ -1297,6 +1299,19 @@
     #   has been already accepetd, ask user to accept it again (because of 
'going back'
     #   in the installation proposal).
     def AskLicensesAgreement(dirs, patterns, action, enable_back, 
base_product, require_agreement)
+      # dialog caption
+      caption = _("License Agreement")
+      heading = nil
+
+      AskLicensesAgreementWithHeading(dirs, patterns, action, enable_back,
+          base_product, require_agreement, caption, heading)
+    end
+
+    # @see {AskLicensesAgreement} for details
+    # @param caption [String] custom dialog title
+    # @param heading [String] optional heading displayed above the license text
+    def AskLicensesAgreementWithHeading(dirs, patterns, action, enable_back,
+          base_product, require_agreement, caption, heading)
       dirs = deep_copy(dirs)
       patterns = deep_copy(patterns)
       if dirs == nil || dirs == []
@@ -1306,13 +1321,6 @@
         return :auto
       end
 
-      init_ret = nil
-
-      if init_ret == :auto || init_ret == :accepted
-        Builtins.y2milestone("Returning %1", init_ret)
-        return init_ret
-      end
-
       created_new_dialog = false
 
       # #459391
@@ -1325,9 +1333,6 @@
         created_new_dialog = true
       end
 
-      # dialog caption
-      caption = _("License Agreement")
-
       license_idents = []
 
       # initial loop
@@ -1335,7 +1340,13 @@
 
       licenses = []
       counter = -1
-      contents = VBox()
+      contents = VBox(
+        heading ? VBox(
+          VSpacing(0.5),
+          Left(Heading(heading)),
+          VSpacing(0.5)
+        ) : Empty()
+      )
       # If acceptance is not needed, there's no need to disable the button
       # by default
       default_next_button_state = true
@@ -1432,7 +1443,7 @@
       CleanUpLicense(@tmpdir)
 
       # bugzilla #303922
-      Wizard.CloseDialog if created_new_dialog || !Stage.initial
+      Wizard.CloseDialog if created_new_dialog
 
       CleanUp()
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-packager-3.1.12/src/modules/SourceDialogs.rb 
new/yast2-packager-3.1.18/src/modules/SourceDialogs.rb
--- old/yast2-packager-3.1.12/src/modules/SourceDialogs.rb      2014-04-28 
16:09:49.000000000 +0200
+++ new/yast2-packager-3.1.18/src/modules/SourceDialogs.rb      2014-05-16 
16:10:15.000000000 +0200
@@ -16,6 +16,48 @@
 
 module Yast
   class SourceDialogsClass < Module
+    # to use N_ in the class constant
+    extend Yast::I18n
+
+    # display a global enable/disable checkbox in URL type dialog
+    attr_accessor :display_addon_checkbox
+    # the status of the global checkbox
+    attr_reader :addon_enabled
+
+    # widget ID => translatable label (needs to be translated by _())
+    WIDGET_LABELS = {
+      # radio button
+      :slp               => N_("&Scan Using SLP..."),
+      # radio button
+      :comm_repos        => N_("Commun&ity Repositories"),
+      # radio button
+      :specify_url       => N_("Specify &URL..."),
+      # radio button
+      :ftp               => N_("&FTP..."),
+      # radio button
+      :http              => N_("&HTTP..."),
+      # radio button
+      :https             => N_("HTT&PS..."),
+      # radio button
+      :samba             => N_("&SMB/CIFS"),
+      # radio button
+      :nfs               => N_("&NFS..."),
+      # radio button
+      :cd                => N_("&CD..."),
+      # radio button
+      :dvd               => N_("&DVD..."),
+      # radio button
+      :hd                => N_("&Hard Disk..."),
+      # radio button
+      :usb               => N_("&USB Mass Storage (USB Stick, Disk)..."),
+      # radio button
+      :local_dir         => N_("&Local Directory..."),
+      # radio button
+      :local_iso         => N_("&Local ISO Image..."),
+      # check box
+      :download_metadata => N_("&Download repository description files"),
+    }
+
     def main
       Yast.import "Pkg"
       Yast.import "UI"
@@ -53,6 +95,9 @@
       # Allow HTTPS for next repository dialog?
       @_allow_https = true
 
+      # display a check box in type selection dialog in the next run
+      @display_addon_checkbox = false
+
       # CD/DVD device name to use (e.g. /dev/sr1) in case of multiple
       # devices in the system. Empty string means use the default.
       @cd_device_name = ""
@@ -1008,7 +1053,7 @@
 
       Builtins.foreach(devices) do |dev|
         ret = dev if Builtins.regexpmatch(dev, "^/dev/disk/by-id/")
-      end 
+      end
 
 
       ret
@@ -1049,7 +1094,7 @@
             "partitions" => DetectPartitions(dev_id)
           }
         )
-      end 
+      end
 
 
       Builtins.y2milestone("Disk configuration: %1", ret)
@@ -1086,7 +1131,7 @@
           found = found || part == selected
           ret = Builtins.add(ret, Item(Id(part), disk_label, part == selected))
         end
-      end 
+      end
 
 
       if !found && Builtins.regexpmatch(selected, "^/dev/disk/by-id/usb-")
@@ -1866,7 +1911,7 @@
         if Ops.get_string(cmd_run, "stdout", "") != ""
           Builtins.y2error("Checking the network failed")
           ret = true
-        end 
+        end
         # some devices are listed
       elsif Ops.get_string(cmd_run, "stdout", "") != nil &&
           Ops.get_string(cmd_run, "stdout", "") != ""
@@ -1897,6 +1942,20 @@
       end
     end
 
+    def addon_checkbox_term
+      @display_addon_checkbox ?
+        VBox(
+          Left(CheckBox(Id(:add_addon), Opt(:notify),
+              _("I would like to install an Add On Product"), false)),
+          VSpacing(1),
+        ) :
+        Empty()
+    end
+
+    def addon_spacing_term
+      @display_addon_checkbox ? HSpacing(3) : Empty()
+    end
+
     def SelectRadioWidgetOpt(download_widget)
       contents = HBox(
         HStretch(),
@@ -1905,58 +1964,40 @@
             Id(:type),
             VBox(
               VStretch(),
-              # radio button
-              Left(RadioButton(Id(:slp), _("&Scan Using SLP..."))),
-              # bnc #428370, No need to offer community repositories if not 
defined
-              CRURLDefined() ?
-                # radio button
-                Left(RadioButton(Id(:comm_repos), _("Commun&ity 
Repositories"))) :
-                Empty(),
-              VSpacing(0.4),
-              # radio button
-              Left(RadioButton(Id(:specify_url), _("Specify &URL..."))),
-              VSpacing(0.4),
-              # radio button
-              Left(RadioButton(Id(:ftp), _("&FTP..."))),
-              # radio button
-              Left(RadioButton(Id(:http), _("&HTTP..."))),
-              # radio button
-              Left(RadioButton(Id(:https), _("HTT&PS..."))),
-              # radio button
-              Left(RadioButton(Id(:samba), _("&SMB/CIFS"))),
-              # radio button
-              Left(RadioButton(Id(:nfs), _("&NFS..."))),
-              # radio button
-              Left(RadioButton(Id(:cd), _("&CD..."))),
-              # radio button
-              Left(RadioButton(Id(:dvd), _("&DVD..."))),
-              # radio button
-              Left(RadioButton(Id(:hd), _("&Hard Disk..."))),
-              # radio button
-              Left(
-                RadioButton(
-                  Id(:usb),
-                  _("&USB Mass Storage (USB Stick, Disk)...")
-                )
-              ),
-              # radio button
-              Left(RadioButton(Id(:local_dir), _("&Local Directory..."))),
-              # radio button
-              Left(RadioButton(Id(:local_iso), _("&Local ISO Image..."))),
-              # check box
-              download_widget ?
+              addon_checkbox_term,
+              HBox(
+                addon_spacing_term,
                 VBox(
-                  VSpacing(2),
-                  Left(
-                    CheckBox(
-                      Id(:download_metadata),
-                      _("&Download repository description files"),
-                      @_download_metadata
-                    )
-                  )
-                ) :
-                Empty(),
-              VStretch()
+                  # radio button
+                  Left(RadioButton(Id(:slp), _(WIDGET_LABELS[:slp]))),
+                  # bnc #428370, No need to offer community repositories if 
not defined
+                  CRURLDefined() ?
+                    # radio button
+                    Left(RadioButton(Id(:comm_repos), 
_(WIDGET_LABELS[:comm_repos]))) :
+                    Empty(),
+                  VSpacing(0.4),
+                  Left(RadioButton(Id(:specify_url), 
_(WIDGET_LABELS[:specify_url]))),
+                  VSpacing(0.4),
+
+                  *[:ftp, :http, :https, :samba, :nfs, :cd, :dvd, :hd, :usb,
+                    :local_dir, :local_iso].map do |id|
+                    Left(RadioButton(Id(id), _(WIDGET_LABELS[id])))
+                  end,
+                  download_widget ?
+                    VBox(
+                      VSpacing(2),
+                      Left(
+                        CheckBox(
+                          Id(:download_metadata),
+                          _(WIDGET_LABELS[:download_metadata]),
+                          @_download_metadata
+                        )
+                      )
+                    ) :
+                    Empty(),
+                  VStretch()
+                )
+              )
             )
           )
         ),
@@ -1974,35 +2015,31 @@
               Id(:type),
               VBox(
                 VStretch(),
-                # radio button
-                Left(RadioButton(Id(:specify_url), _("Specify &URL..."))),
-                VSpacing(0.4),
-                # radio button
-                Left(RadioButton(Id(:cd), _("&CD..."))),
-                # radio button
-                Left(RadioButton(Id(:dvd), _("&DVD..."))),
-                # radio button
-                Left(RadioButton(Id(:hd), _("&Hard Disk..."))),
-                # radio button
-                Left(RadioButton(Id(:usb), _("&USB Stick or Disk..."))),
-                # radio button
-                Left(RadioButton(Id(:local_dir), _("&Local Directory..."))),
-                # radio button
-                Left(RadioButton(Id(:local_iso), _("&Local ISO Image..."))),
-                # check box
-                download_widget ?
+                addon_checkbox_term,
+                HBox(
+                  addon_spacing_term,
                   VBox(
-                    VSpacing(2),
-                    Left(
-                      CheckBox(
-                        Id(:download_metadata),
-                        _("&Download repository description files"),
-                        @_download_metadata
-                      )
-                    )
-                  ) :
-                  Empty(),
-                VStretch()
+                    Left(RadioButton(Id(:specify_url),
+                        _(WIDGET_LABELS[:specify_url]))),
+                    VSpacing(0.4),
+                    *[:cd, :dvd, :hd, :usb, :local_dir, :local_iso].map do |id|
+                      Left(RadioButton(Id(id), _(WIDGET_LABELS[id])))
+                    end,
+                    download_widget ?
+                      VBox(
+                        VSpacing(2),
+                        Left(
+                          CheckBox(
+                            Id(:download_metadata),
+                            _(WIDGET_LABELS[:download_metadata]),
+                            @_download_metadata
+                          )
+                        )
+                      ) :
+                      Empty(),
+                    VStretch()
+                  )
+                )
               )
             )
           ),
@@ -2111,6 +2148,7 @@
       @_url = "" if Ops.get(event, "ID") == :back
 
       if !(Ops.get(event, "ID") == :next || Ops.get(event, "ID") == :ok)
+        RefreshTypeWidgets() if event["ID"] == :add_addon
         return nil
       end
 
@@ -2132,6 +2170,7 @@
       @_url = ""
       @_plaindir = false
       @_repo_name = ""
+      @addon_enabled = UI.WidgetExists(:add_addon) ?  
UI.QueryWidget(:add_addon, :Value) : nil
 
       selected = Convert.to_symbol(UI.QueryWidget(Id(:type), :CurrentButton))
 
@@ -2231,9 +2270,21 @@
 
       UI.ChangeWidget(Id(:type), :CurrentButton, current) if current != nil
 
+      RefreshTypeWidgets()
+
       nil
     end
 
+    def RefreshTypeWidgets
+      if UI.WidgetExists(:add_addon)
+        enabled = UI.QueryWidget(Id(:add_addon), :Value)
+
+        WIDGET_LABELS.keys.each do |widget|
+          UI.ChangeWidget(Id(widget), :Enabled, enabled) if 
UI.WidgetExists(widget)
+        end
+      end
+    end
+
     def SelectWidget
       {
         "widget"            => :func,
@@ -2485,7 +2536,7 @@
       ret = CWM.Run(w, {})
       Builtins.y2milestone("Ret: %1", ret)
       UI.CloseDialog
-      "" 
+      ""
       #    if (ret == `ok)
       #        return GetURL ();
       #    else
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-packager-3.1.12/test/packages_test.rb 
new/yast2-packager-3.1.18/test/packages_test.rb
--- old/yast2-packager-3.1.12/test/packages_test.rb     2014-04-28 
16:09:49.000000000 +0200
+++ new/yast2-packager-3.1.18/test/packages_test.rb     2014-05-16 
16:10:15.000000000 +0200
@@ -32,6 +32,10 @@
 PRODUCTS_FROM_ZYPP = load_zypp('products.yml').freeze
 
 describe Yast::Packages do
+  before(:each) do
+    log.info "--- test ---"
+  end
+
   describe "#kernelCmdLinePackages" do
     before(:each) do
       # default value
@@ -93,21 +97,40 @@
 
     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  ")
+        Yast::ProductFeatures.stub(:GetStringFeature).with("software", 
"default_patterns").and_return("  a    b\t c d\t  ")
         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  ")
+        Yast::ProductFeatures.stub(:GetStringFeature).with("software", 
"default_patterns").and_return("  a b \n c\nd  ")
         expect(Yast::Packages.default_patterns).to eq(["a", "b", "c", "d"])
       end
     end
   end
 
+  describe "#optional_default_patterns" do
+    context "software->optional_default_patterns is not defined in control 
file" do
+      it "returns empty list" do
+        Yast::ProductFeatures.stub(:GetStringFeature).with("software", 
"optional_default_patterns").and_return("")
+        expect(Yast::Packages.optional_default_patterns).to be_empty
+      end
+    end
+
+    context "software->optional_default_patterns is filled with list of 
patterns" do
+      it "returns list of patterns" do
+        Yast::ProductFeatures.stub(:GetStringFeature).with("software", 
"optional_default_patterns").and_return("a b c d")
+        expect(Yast::Packages.optional_default_patterns).to eq(["a", "b", "c", 
"d"])
+
+        Yast::ProductFeatures.stub(:GetStringFeature).with("software", 
"optional_default_patterns").and_return("  a    b\t c d\t  ")
+        expect(Yast::Packages.optional_default_patterns).to eq(["a", "b", "c", 
"d"])
+
+        Yast::ProductFeatures.stub(:GetStringFeature).with("software", 
"optional_default_patterns").and_return("  a b \n c\nd  ")
+        expect(Yast::Packages.optional_default_patterns).to eq(["a", "b", "c", 
"d"])
+      end
+    end
+  end
+
   DEFAULT_PATTERN = {
     "name" => "name",
     "version" => "1.0.0",
@@ -167,11 +190,38 @@
       end
     end
 
-    it "raises an exception if pattern is not found" do
-      Yast::Packages.stub(:patterns_to_install).and_return(["p1", "p2", "p3"])
+    it "reports an error if pattern is not found" do
+      default_patterns = ["p1", "p2", "p3"]
+
+      Yast::Packages.stub(:patterns_to_install).and_return(default_patterns)
+      Yast::Pkg.stub(:ResolvableProperties).and_return([])
+      Yast::Report.stub(:Error).and_return(nil)
+
+      # Called twice with reselect=true/false
+      Yast::Packages.SelectSystemPatterns(true)
+      Yast::Packages.SelectSystemPatterns(false)
+
+      expect(Yast::Report).to have_received(:Error).with(/pattern 
p[1-3]/i).exactly(2 * default_patterns.size).times
+    end
+
+    it "does not report an error but logs it if optional pattern is not found" 
do
+      optional_default_patterns = ["p3", "p4"]
+
+      # No default patterns, all are optional
+      Yast::Packages.stub(:default_patterns).and_return([])
+      
Yast::Packages.stub(:optional_default_patterns).and_return(optional_default_patterns)
+      Yast::Packages.stub(:ComputeSystemPatternList).and_return([])
       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)
+
+      expect(Yast::Report).not_to receive(:Error)
+
+      expect(Yast::Y2Logger.instance).to receive(:info) do |msg|
+        expect(msg).to match(/optional pattern p[3-4] does not 
exist/i).exactly(4).times
+      end.at_least(4).times.and_call_original
+
+      # Called twice with reselect=true/false
+      Yast::Packages.SelectSystemPatterns(true)
+      Yast::Packages.SelectSystemPatterns(false)
     end
   end
 

-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to