Hello community,

here is the log from the commit of package yast2-storage for openSUSE:Factory 
checked in at 2017-02-07 11:57:39
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-storage (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-storage.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-storage"

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-storage/yast2-storage.changes      
2017-02-03 20:07:55.938504598 +0100
+++ /work/SRC/openSUSE:Factory/.yast2-storage.new/yast2-storage.changes 
2017-02-07 11:57:40.858803606 +0100
@@ -1,0 +2,12 @@
+Thu Feb  2 16:42:01 CET 2017 - shundham...@suse.de
+
+- Move snapshots check box to "edit partition" dialog (Fate#321094)
+- 3.2.7
+
+-------------------------------------------------------------------
+Mon Jan 30 16:26:43 CET 2017 - mvid...@suse.com
+
+- Implement simple_mode -> label_proposal (FATE#322328)
+- 3.2.6
+
+-------------------------------------------------------------------

Old:
----
  yast2-storage-3.2.5.tar.bz2

New:
----
  yast2-storage-3.2.7.tar.bz2

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

Other differences:
------------------
++++++ yast2-storage.spec ++++++
--- /var/tmp/diff_new_pack.HU1eUu/_old  2017-02-07 11:57:42.634551857 +0100
+++ /var/tmp/diff_new_pack.HU1eUu/_new  2017-02-07 11:57:42.638551290 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-storage
-Version:        3.2.5
+Version:        3.2.7
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build

++++++ yast2-storage-3.2.5.tar.bz2 -> yast2-storage-3.2.7.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-storage-3.2.5/package/yast2-storage.changes 
new/yast2-storage-3.2.7/package/yast2-storage.changes
--- old/yast2-storage-3.2.5/package/yast2-storage.changes       2017-01-27 
10:37:24.766924265 +0100
+++ new/yast2-storage-3.2.7/package/yast2-storage.changes       2017-02-02 
22:01:49.977603628 +0100
@@ -1,4 +1,16 @@
 -------------------------------------------------------------------
+Thu Feb  2 16:42:01 CET 2017 - shundham...@suse.de
+
+- Move snapshots check box to "edit partition" dialog (Fate#321094)
+- 3.2.7
+
+-------------------------------------------------------------------
+Mon Jan 30 16:26:43 CET 2017 - mvid...@suse.com
+
+- Implement simple_mode -> label_proposal (FATE#322328)
+- 3.2.6
+
+-------------------------------------------------------------------
 Wed Jan 25 18:16:05 CET 2017 - shundham...@suse.de
 
 - Don't force separate /boot partition in expert partitioner
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-storage-3.2.5/package/yast2-storage.spec 
new/yast2-storage-3.2.7/package/yast2-storage.spec
--- old/yast2-storage-3.2.5/package/yast2-storage.spec  2017-01-27 
10:37:24.766924265 +0100
+++ new/yast2-storage-3.2.7/package/yast2-storage.spec  2017-02-02 
22:01:49.977603628 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-storage
-Version:        3.2.5
+Version:        3.2.7
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-storage-3.2.5/src/clients/partitions_proposal.rb 
new/yast2-storage-3.2.7/src/clients/partitions_proposal.rb
--- old/yast2-storage-3.2.5/src/clients/partitions_proposal.rb  2017-01-27 
10:37:24.770924265 +0100
+++ new/yast2-storage-3.2.7/src/clients/partitions_proposal.rb  2017-02-02 
22:01:49.981603628 +0100
@@ -30,6 +30,10 @@
 #                      See also file proposal-API.txt for details.
 module Yast
   class PartitionsProposalClient < Client
+    class << self
+      attr_accessor :modified
+    end
+
     def main
       textdomain "storage"
 
@@ -108,6 +112,19 @@
           )
           Ops.set(@ret, "warning_level", :blocker)
         end
+
+        if @param["simple_mode"]
+          self.class.modified = false if self.class.modified.nil?
+          item = if self.class.modified
+                   # A custom configuration
+                   _("Custom")
+                 else
+                   # A standard configuration
+                   _("Standard")
+                 end
+          @ret["label_proposal"] = [item]
+        end
+
         Storage.HandleProposalPackages
       elsif @func == "AskUser"
         @has_next = Ops.get_boolean(@param, "has_next", false)
@@ -207,6 +224,7 @@
 
         # Fill return map
         Storage.HandleProposalPackages
+        self.class.modified = true if @result == :next
         @ret = { "workflow_sequence" => @result }
       elsif @func == "Description"
         # Fill return map.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-storage-3.2.5/src/include/partitioning/custom_part_dialogs.rb 
new/yast2-storage-3.2.7/src/include/partitioning/custom_part_dialogs.rb
--- old/yast2-storage-3.2.5/src/include/partitioning/custom_part_dialogs.rb     
2017-01-27 10:37:24.770924265 +0100
+++ new/yast2-storage-3.2.7/src/include/partitioning/custom_part_dialogs.rb     
2017-02-02 22:01:49.981603628 +0100
@@ -1046,17 +1046,32 @@
           _("File &System"),
           filesystems
         ),
-        PushButton(
-          Id(:fs_options),
-          Opt(:hstretch),
-          # button text
-          _("O&ptions...")
-        )
+        ReplacePoint(Id(:rep_fs_options), Empty())
+      )
+    end
+
+
+    def FsOptionsButton
+      PushButton(
+        Id(:fs_options),
+        Opt(:hstretch),
+        # button text
+        _("O&ptions...")
       )
     end
 
 
-    def CryptButton(new_val)
+    def EnableSnapshotsCheckBox
+      Left(
+        CheckBox(
+          Id(:snapshots),
+          # Translators: checkbox text
+          _("Enable Snapshots")
+        )
+      )
+    end
+
+    def CryptCheckBox(new_val)
       new_val = deep_copy(new_val)
       cr = Ops.get_symbol(new_val, "enc_type", :none) != :none
 
@@ -1198,7 +1213,7 @@
               )
             ),
             HBox(HSpacing(2), FileSystemsComboBox(new_val, file_systems)),
-            CryptButton(new_val),
+            CryptCheckBox(new_val),
             VSpacing(0.5)
           )
         )
@@ -1582,19 +1597,6 @@
         )
       )
 
-      if Mode.installation() && snapshots_supported?(new_partition)
-        contents = Builtins.add(contents, VSpacing(0.5))
-        contents = Builtins.add(contents,
-          Left(
-            CheckBox(
-              Id(:snapshots),
-              # TRANSLATOR: checkbox text
-              _("Enable Snapshots")
-            )
-          )
-        )
-      end
-
       UI.OpenDialog(
         Opt(:decorated),
         VBox(
@@ -1614,8 +1616,6 @@
         )
       )
 
-      UI.ChangeWidget(Id(:snapshots), :Value, initial_userdata["/"] == 
"snapshots")
-
       UI.ChangeWidget(:help, :HelpText, helptext)
 
       ret = :ok
@@ -1674,7 +1674,7 @@
                 svtmp
               )
               Popup.Message(tmp)
-              pth = svtmp + pth  
+              pth = svtmp + pth
             end
             if Builtins.contains(SubvolNames(new_partition), pth)
               Popup.Message(
@@ -1696,15 +1696,6 @@
           UI.ChangeWidget(Id(:subvol), :Items, items)
           UI.ChangeWidget(Id(:new_path), :Value, "")
 
-        when :ok
-          val = UI.QueryWidget(Id(:snapshots), :Value)
-          if val
-            initial_userdata["/"] = "snapshots"
-          else
-            initial_userdata.delete("/")
-          end
-          Ops.set(new_partition, "userdata", initial_userdata)
-
         when :cancel
           if changed
             if Popup.YesNo(
@@ -1729,13 +1720,5 @@
       )
       deep_copy(new_partition)
     end
-
-    # Checks whether Btrfs snapshots are supported for the partition
-    #
-    # @param partition [Hash] map representing the partition
-    # @return [Boolean]
-    def snapshots_supported?(partition)
-      partition["mount"] == "/"
-    end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-storage-3.2.5/src/include/partitioning/custom_part_lib.rb 
new/yast2-storage-3.2.7/src/include/partitioning/custom_part_lib.rb
--- old/yast2-storage-3.2.5/src/include/partitioning/custom_part_lib.rb 
2017-01-27 10:37:24.770924265 +0100
+++ new/yast2-storage-3.2.7/src/include/partitioning/custom_part_lib.rb 
2017-02-02 22:01:49.981603628 +0100
@@ -432,6 +432,100 @@
       ret
     end
 
+    # Checks whether Btrfs snapshots are supported for the partition
+    #
+    # @param partition [Hash] hash representing the partition
+    # @return [Boolean]
+    #
+    def snapshots_supported?(partition)
+      partition["mount"] == "/"
+    end
+
+    # Checks whether Btrfs snapshots are currently enabled for the partition
+    #
+    # @param partition [Hash] hash representing the partition
+    # @return [Boolean]
+    #
+    def snapshots_enabled?(partition)
+      mount_point = partition["mount"]
+      userdata = partition["userdata"] || {}
+      log.info("snapshots_enabled? mount point: #{mount_point} userdata: 
#{userdata}")
+      return false if mount_point != "/"
+      userdata[mount_point] == "snapshots"
+    end
+
+
+    # Switch between the "Options" button or the "Enable Snapshots" check box.
+    #
+    # This can be done since we don't support any other Btrfs options: In that
+    # case, the "Options" button is always disabled anyway, so we replace it
+    # with that check box.
+    #
+    # @param used_fs [Symbol] the new filesystem the user selected
+    # @param partition [Hash] hash representing the partition
+    #
+    def switch_options_or_snapshots(used_fs, partition)
+      using_btrfs = used_fs == :btrfs
+      if UI.WidgetExists(Id(:subvol_rp))
+        UI.ReplaceWidget(Id(:subvol_rp), SubvolPart(using_btrfs))
+        if UI.WidgetExists(Id(:subvol))
+          UI.ChangeWidget(Id(:subvol), :Enabled, using_btrfs)
+        end
+      end
+      if using_btrfs && Mode.installation()
+        if !UI.WidgetExists(Id(:snapshots))
+          UI.ReplaceWidget(Id(:rep_fs_options), EnableSnapshotsCheckBox())
+        end
+        enable_disable_snapshots_checkbox(partition)
+      else
+        if !UI.WidgetExists(Id(:fs_options))
+          UI.ReplaceWidget(Id(:rep_fs_options), FsOptionsButton())
+        end
+      end
+    end
+
+
+    # Enable or disable the "Enable Snapshots" check box depending on the
+    # partition.
+    #
+    # @param partition [Hash] hash representing the partition
+    #
+    def enable_disable_snapshots_checkbox(partition)
+      if UI.WidgetExists(Id(:snapshots))
+        UI.ChangeWidget(Id(:snapshots), :Enabled, 
snapshots_supported?(partition))
+        UI.ChangeWidget(Id(:snapshots), :Value, snapshots_enabled?(partition))
+      end
+    end
+
+    # Apply the current value of the "Enable Snapshots" button to the current
+    # partition.
+    #
+    # @param partition [Hash] hash representing the partition
+    # @return partition [Hash] modified map
+    #
+    def apply_snapshots_checkbox_value(partition)
+      snapshots = false;
+      if UI.WidgetExists(Id(:snapshots)) && UI.QueryWidget(Id(:snapshots), 
:Enabled) == true
+        snapshots = UI.QueryWidget(Id(:snapshots), :Value)
+      end
+      if snapshots
+        # That hash in "userdata" is not used for anything else at the time
+        # being (in the context of partitions; snapshots are another matter),
+        # so it's safe to overwrite it completely.
+        #
+        # It is also safe to assume a mount point "/" since in all other cases
+        # the check box should be disabled (which we check) or not there at
+        # all.
+        partition["userdata"] = {"/" => "snapshots" }
+        log.info("apply_snapshots_checkbox_value: Enabling snapshots for /")
+      else
+        # Similar to above: It is safe to delete the entire hash in this 
"userdata" key.
+        partition.delete("userdata")
+        log.info("apply_snapshots_checkbox_value: No snapshots - deleting 
userdata")
+      end
+      partition
+    end
+
 
     def HandleFsChanged(init, new, old_fs, file_systems)
       new = deep_copy(new)
@@ -440,20 +534,12 @@
       not_used_mp = []
       used_fs = Ops.get_symbol(new, "used_fs", :unknown)
       selected_fs = Ops.get_map(file_systems, used_fs, {})
-      Builtins.y2milestone(
-        "HandleFsChanged init:%1 used_fs:%2 old_fs:%3 new:%4",
-        init,
-        used_fs,
-        old_fs,
-        new
-      )
+      log.info("HandleFsChanged init: #{init} used_fs: #{used_fs} old_fs: 
#{old_fs} new: #{new}")
 
       if !init && used_fs != old_fs
-        Builtins.y2milestone(
-          "HandleFsChanged IsUnsupported:%1",
-          FileSystems.IsUnsupported(used_fs)
-        )
-        if FileSystems.IsUnsupported(Ops.get_symbol(new, "used_fs", :unknown))
+        is_unsupported = FileSystems.IsUnsupported(used_fs)
+        log.info("HandleFsChanged IsUnsupported: #{is_unsupported}")
+        if is_unsupported
           # warning message, %1 is replaced by fs name (e.g. Ext3)
           message = Builtins.sformat(
             _(
@@ -491,26 +577,17 @@
         end
       end
 
-      if !init && apply_change && UI.WidgetExists(Id(:subvol_rp))
-        sv = Ops.get_symbol(new, "used_fs", :unknown) == :btrfs
-        Builtins.y2milestone("HandleFsChanged sv:%1", sv)
-        UI.ReplaceWidget(Id(:subvol_rp), SubvolPart(sv))
-        if UI.WidgetExists(Id(:subvol))
-          UI.ChangeWidget(Id(:subvol), :Enabled, sv)
-        end
-      end
-
       if apply_change
         #//////////////////////////////////////////////
         # switch between swap and other mountpoints
         mount = Convert.to_string(UI.QueryWidget(Id(:mount_point), :Value))
-        Ops.set(new, "mount", mount)
+        new["mount"] = mount
         if used_fs == :swap
           not_used_mp = Ops.get_list(selected_fs, :mountpoints, [])
           if mount != "swap" &&
-              (Ops.get_symbol(new, "type", :primary) != :lvm || mount != "")
-            Ops.set(new, "mount", "swap")
-            Ops.set(new, "inactive", true)
+             (Ops.get_symbol(new, "type", :primary) != :lvm || mount != "")
+            new["mount"] = "swap"
+            new["inactive"] = true
           end
         else
           not_used_mp = notUsedMountpoints(
@@ -528,9 +605,10 @@
               !Builtins.contains(FileSystems.system_m_points, mp)
             end
           end
-          Ops.set(new, "mount", "") if mount == "swap"
+          new["mount"] = "" if mount == "swap"
         end
-        # UI::ReplaceWidget(`id(`mount_dlg_rp), MountDlg( new, not_used_mp));
+        switch_options_or_snapshots(used_fs, new)
+
         UI.ChangeWidget(
           Id(:mount_point),
           :Value,
@@ -611,7 +689,6 @@
     #     (like the list of subvolumes) with the expert partitioner default 
values.
     #     Useful when creating a partition for the first time
     def HandlePartWidgetChanges(init, ret, file_systems, old, new, 
force_defaults: false)
-      ret = deep_copy(ret)
       file_systems = deep_copy(file_systems)
       old = deep_copy(old)
       new = deep_copy(new)
@@ -634,20 +711,24 @@
           new = Builtins.filter(new) { |key, value| key != "fstopt" }
         end
       end
-      if !init && ret == :mount_point
-        mp = Convert.to_string(UI.QueryWidget(Id(:mount_point), :Value))
-        if Ops.get_string(new, "mount", "") != mp
-          oldfst = FileSystems.DefaultFstabOptions(new)
-          Ops.set(new, "mount", mp)
-          newfst = FileSystems.DefaultFstabOptions(new)
-          if oldfst != newfst
-            # Default fstab options have changed, set new default, bnc#774499
-            Ops.set(new, "fstopt", newfst)
+      if ret == :mount_point
+        enable_disable_snapshots_checkbox(new)
+        if !init
+          mp = Convert.to_string(UI.QueryWidget(Id(:mount_point), :Value))
+          if Ops.get_string(new, "mount", "") != mp
+            oldfst = FileSystems.DefaultFstabOptions(new)
+            new["mount"] = mp
+            enable_disable_snapshots_checkbox(new)
+            newfst = FileSystems.DefaultFstabOptions(new)
+            if oldfst != newfst
+              # Default fstab options have changed, set new default, bnc#774499
+              Ops.set(new, "fstopt", newfst)
+            end
+            new = HandleSubvol(new)
+          end
+          if UI.WidgetExists(Id(:fstab_options))
+            UI.ChangeWidget(Id(:fstab_options), :Enabled, 
!Builtins.isempty(mp))
           end
-          new = HandleSubvol(new)
-        end
-        if UI.WidgetExists(Id(:fstab_options))
-          UI.ChangeWidget(Id(:fstab_options), :Enabled, !Builtins.isempty(mp))
         end
       end
 
@@ -879,10 +960,11 @@
           FileSystemOptions(Ops.get_map(new, "fs_options", {}), selected_fs)
         )
       end
+      apply_snapshots_checkbox_value(new) if ret == :next
 
       Builtins.y2milestone("HandlePartWidgetChanges old:%1", old)
       Builtins.y2milestone("HandlePartWidgetChanges new:%1", new)
-      deep_copy(new)
+      new
     end
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-storage-3.2.5/src/include/partitioning/ep-dialogs.rb 
new/yast2-storage-3.2.7/src/include/partitioning/ep-dialogs.rb
--- old/yast2-storage-3.2.5/src/include/partitioning/ep-dialogs.rb      
2017-01-27 10:37:24.774924265 +0100
+++ new/yast2-storage-3.2.7/src/include/partitioning/ep-dialogs.rb      
2017-02-02 22:01:49.985603628 +0100
@@ -356,7 +356,7 @@
                 tmp1
               ),
               VSpacing(0.45),
-              CryptButton(data)
+              CryptCheckBox(data)
             )
           )
         )


Reply via email to