Hello community, here is the log from the commit of package yast2-snapper for openSUSE:Factory checked in at 2019-03-10 09:29:26 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-snapper (Old) and /work/SRC/openSUSE:Factory/.yast2-snapper.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-snapper" Sun Mar 10 09:29:26 2019 rev:60 rq:682366 version:4.1.2 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-snapper/yast2-snapper.changes 2018-12-31 09:42:44.830395562 +0100 +++ /work/SRC/openSUSE:Factory/.yast2-snapper.new.28833/yast2-snapper.changes 2019-03-10 09:29:35.264262140 +0100 @@ -1,0 +2,13 @@ +Wed Mar 06 22:06:46 CET 2019 - aschn...@suse.com + +- added button to refresh list of snapshots (bsc#1128279, or just + as good gh#yast/yast-yast2#713 ) +- 4.1.2 + +------------------------------------------------------------------- +Tue Mar 05 17:58:48 CET 2019 - aschn...@suse.com + +- enable rubocop +- 4.1.1 + +------------------------------------------------------------------- Old: ---- yast2-snapper-4.1.0.tar.bz2 New: ---- yast2-snapper-4.1.2.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-snapper.spec ++++++ --- /var/tmp/diff_new_pack.J5JXXX/_old 2019-03-10 09:29:35.752262017 +0100 +++ /var/tmp/diff_new_pack.J5JXXX/_new 2019-03-10 09:29:35.752262017 +0100 @@ -1,7 +1,7 @@ # # spec file for package yast2-snapper # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: yast2-snapper -Version: 4.1.0 +Version: 4.1.2 Release: 0 # change to noarch causes problems according to behlert @@ -28,12 +28,12 @@ BuildRequires: doxygen BuildRequires: update-desktop-files -BuildRequires: yast2 +BuildRequires: yast2 >= 4.1.60 BuildRequires: yast2-devtools >= 3.1.10 BuildRequires: rubygem(%{rb_default_ruby_abi}:rspec) BuildRequires: rubygem(%{rb_default_ruby_abi}:ruby-dbus) Requires: snapper -Requires: yast2 >= 2.21.22 +Requires: yast2 >= 4.1.60 Requires: yast2-ruby-bindings >= 1.0.0 Requires: rubygem(%{rb_default_ruby_abi}:ruby-dbus) Supplements: packageand(snapper:yast2) ++++++ yast2-snapper-4.1.0.tar.bz2 -> yast2-snapper-4.1.2.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-snapper-4.1.0/.rubocop.yml new/yast2-snapper-4.1.2/.rubocop.yml --- old/yast2-snapper-4.1.0/.rubocop.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-snapper-4.1.2/.rubocop.yml 2019-03-07 10:11:02.000000000 +0100 @@ -0,0 +1,244 @@ + +# use the shared Yast defaults + +inherit_from: + /usr/share/YaST2/data/devtools/data/rubocop_yast_style.yml + +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2019-03-05 16:42:32 +0100 using RuboCop version 0.41.2. +# The point is for the user to remove these configuration records +# one by one as the offenses are removed from the code base. +# Note that changes in the inspected code, or installation of new +# versions of RuboCop, may require this file to be generated again. + +# Offense count: 2 +Lint/ConditionPosition: + Exclude: + - 'src/modules/SnapperDbus.rb' + +# Offense count: 4 +Lint/LiteralInCondition: + Exclude: + - 'src/include/snapper/dialogs.rb' + +# Offense count: 7 +Lint/RescueException: + Exclude: + - 'src/modules/Snapper.rb' + +# Offense count: 2 +Lint/UselessAccessModifier: + Exclude: + - 'src/modules/Snapper.rb' + +# Offense count: 4 +Lint/UselessAssignment: + Exclude: + - 'src/include/snapper/dialogs.rb' + - 'test/snapper_tree_test.rb' + +# Offense count: 6 +Metrics/AbcSize: + Max: 403 + +# Offense count: 2 +Metrics/BlockNesting: + Max: 4 + +# Offense count: 1 +# Configuration parameters: CountComments. +Metrics/ClassLength: + Max: 364 + +# Offense count: 4 +Metrics/CyclomaticComplexity: + Max: 54 + +# Offense count: 9 +# Configuration parameters: AllowHeredoc, AllowURI, URISchemes. +# URISchemes: http, https +Metrics/LineLength: + Max: 264 + +# Offense count: 8 +# Configuration parameters: CountComments. +Metrics/MethodLength: + Max: 508 + +# Offense count: 1 +# Configuration parameters: CountComments. +Metrics/ModuleLength: + Max: 1023 + +# Offense count: 5 +Metrics/PerceivedComplexity: + Max: 63 + +# Offense count: 1 +Style/AccessorMethodName: + Exclude: + - 'src/modules/Snapper.rb' + +# Offense count: 10 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles. +# SupportedStyles: braces, no_braces, context_dependent +Style/BracesAroundHashParameters: + Exclude: + - 'src/modules/Snapper.rb' + - 'test/snapper_dbus_test.rb' + - 'test/snapper_test.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles, SingleLineConditionsOnly. +# SupportedStyles: assign_to_condition, assign_inside_condition +Style/ConditionalAssignment: + Exclude: + - 'src/include/snapper/dialogs.rb' + - 'src/modules/Snapper.rb' + +# Offense count: 9 +Style/Documentation: + Exclude: + - 'spec/**/*' + - 'test/**/*' + - 'src/clients/snapper.rb' + - 'src/include/snapper/dialogs.rb' + - 'src/include/snapper/helps.rb' + - 'src/include/snapper/wizards.rb' + - 'src/modules/Snapper.rb' + - 'src/modules/SnapperDbus.rb' + +# Offense count: 2 +# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts. +Style/FileName: + Exclude: + - 'src/modules/Snapper.rb' + - 'src/modules/SnapperDbus.rb' + +# Offense count: 3 +# Configuration parameters: EnforcedStyle, SupportedStyles. +# SupportedStyles: format, sprintf, percent +Style/FormatString: + Exclude: + - 'src/include/snapper/dialogs.rb' + +# Offense count: 4 +# Configuration parameters: MinBodyLength. +Style/GuardClause: + Exclude: + - 'src/include/snapper/dialogs.rb' + - 'src/modules/Snapper.rb' + +# Offense count: 53 +# Cop supports --auto-correct. +# Configuration parameters: SupportedStyles, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. +# SupportedStyles: ruby19, ruby19_no_mixed_keys, hash_rockets +Style/HashSyntax: + EnforcedStyle: hash_rockets + +# Offense count: 1 +Style/IfInsideElse: + Exclude: + - 'src/include/snapper/dialogs.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: MaxLineLength. +Style/IfUnlessModifier: + Exclude: + - 'src/include/snapper/dialogs.rb' + - 'src/modules/Snapper.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +Style/InfiniteLoop: + Exclude: + - 'src/include/snapper/dialogs.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles. +# SupportedStyles: line_count_dependent, lambda, literal +Style/Lambda: + Exclude: + - 'src/include/snapper/wizards.rb' + +# Offense count: 34 +# Cop supports --auto-correct. +Style/LineEndConcatenation: + Exclude: + - 'src/include/snapper/dialogs.rb' + - 'src/include/snapper/helps.rb' + +# Offense count: 21 +# Configuration parameters: EnforcedStyle, SupportedStyles. +# SupportedStyles: snake_case, camelCase +Style/MethodName: + Exclude: + - 'src/include/snapper/dialogs.rb' + - 'src/include/snapper/wizards.rb' + - 'src/modules/Snapper.rb' + +# Offense count: 4 +Style/MultilineTernaryOperator: + Exclude: + - 'src/include/snapper/dialogs.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/MutableConstant: + Exclude: + - 'src/modules/SnapperDbus.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +Style/NilComparison: + Exclude: + - 'src/include/snapper/dialogs.rb' + - 'src/modules/Snapper.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: IncludeSemanticChanges. +Style/NonNilCheck: + Exclude: + - 'src/modules/Snapper.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +Style/RedundantException: + Exclude: + - 'src/modules/SnapperDbus.rb' + +# Offense count: 14 +# Cop supports --auto-correct. +# Configuration parameters: AllowMultipleReturnValues. +Style/RedundantReturn: + Exclude: + - 'src/include/snapper/dialogs.rb' + - 'src/modules/Snapper.rb' + - 'src/modules/SnapperDbus.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/SelfAssignment: + Exclude: + - 'src/include/snapper/dialogs.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: IgnoredMethods. +# IgnoredMethods: respond_to, define_method +Style/SymbolProc: + Exclude: + - 'src/modules/Snapper.rb' + +# Offense count: 1 +# Configuration parameters: EnforcedStyle, SupportedStyles. +# SupportedStyles: snake_case, camelCase +Style/VariableName: + Exclude: + - 'src/include/snapper/helps.rb' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-snapper-4.1.0/Rakefile new/yast2-snapper-4.1.2/Rakefile --- old/yast2-snapper-4.1.0/Rakefile 2018-12-07 09:52:10.000000000 +0100 +++ new/yast2-snapper-4.1.2/Rakefile 2019-03-07 10:11:02.000000000 +0100 @@ -1,6 +1,6 @@ require "yast/rake" Yast::Tasks.configuration do |conf| - #lets ignore license check for now + # lets ignore license check for now conf.skip_license_check << /.*/ end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-snapper-4.1.0/package/yast2-snapper.changes new/yast2-snapper-4.1.2/package/yast2-snapper.changes --- old/yast2-snapper-4.1.0/package/yast2-snapper.changes 2018-12-07 09:52:10.000000000 +0100 +++ new/yast2-snapper-4.1.2/package/yast2-snapper.changes 2019-03-07 10:11:02.000000000 +0100 @@ -1,4 +1,17 @@ ------------------------------------------------------------------- +Wed Mar 06 22:06:46 CET 2019 - aschn...@suse.com + +- added button to refresh list of snapshots (bsc#1128279, or just + as good gh#yast/yast-yast2#713 ) +- 4.1.2 + +------------------------------------------------------------------- +Tue Mar 05 17:58:48 CET 2019 - aschn...@suse.com + +- enable rubocop +- 4.1.1 + +------------------------------------------------------------------- Fri Dec 7 08:01:11 UTC 2018 - jreidin...@suse.com - always use absolute path to binaries (bsc#1118291) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-snapper-4.1.0/package/yast2-snapper.spec new/yast2-snapper-4.1.2/package/yast2-snapper.spec --- old/yast2-snapper-4.1.0/package/yast2-snapper.spec 2018-12-07 09:52:10.000000000 +0100 +++ new/yast2-snapper-4.1.2/package/yast2-snapper.spec 2019-03-07 10:11:02.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2-snapper -Version: 4.1.0 +Version: 4.1.2 Release: 0 Group: System/YaST @@ -31,12 +31,12 @@ BuildRequires: doxygen BuildRequires: update-desktop-files -BuildRequires: yast2 +BuildRequires: yast2 >= 4.1.60 BuildRequires: yast2-devtools >= 3.1.10 BuildRequires: rubygem(%{rb_default_ruby_abi}:rspec) BuildRequires: rubygem(%{rb_default_ruby_abi}:ruby-dbus) Requires: snapper -Requires: yast2 >= 2.21.22 +Requires: yast2 >= 4.1.60 Requires: yast2-ruby-bindings >= 1.0.0 Requires: rubygem(%{rb_default_ruby_abi}:ruby-dbus) Supplements: packageand(snapper:yast2) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-snapper-4.1.0/src/clients/snapper.rb new/yast2-snapper-4.1.2/src/clients/snapper.rb --- old/yast2-snapper-4.1.0/src/clients/snapper.rb 2018-12-07 09:52:10.000000000 +0100 +++ new/yast2-snapper-4.1.2/src/clients/snapper.rb 2019-03-07 10:11:02.000000000 +0100 @@ -27,13 +27,10 @@ # Main file for snapper configuration. Uses all other files. module Yast - class SnapperClient < Client - include Yast::Logger def main - Yast.import "UI" textdomain "snapper" @@ -57,11 +54,8 @@ log.info("----------------------------------------") deep_copy(ret) - end - end - end Yast::SnapperClient.new.main diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-snapper-4.1.0/src/include/snapper/dialogs.rb new/yast2-snapper-4.1.2/src/include/snapper/dialogs.rb --- old/yast2-snapper-4.1.0/src/include/snapper/dialogs.rb 2018-12-07 09:52:10.000000000 +0100 +++ new/yast2-snapper-4.1.2/src/include/snapper/dialogs.rb 2019-03-07 10:11:02.000000000 +0100 @@ -25,12 +25,9 @@ # Authors: Jiri Suchomel <jsuch...@suse.cz> module Yast - module SnapperDialogsInclude - include Yast::Logger - def initialize_snapper_dialogs(include_target) Yast.import "UI" @@ -47,17 +44,14 @@ Yast.include include_target, "snapper/helps.rb" end - def timestring(t) return t.strftime("%F %T") end - def ReallyAbort Popup.ReallyAbort(true) end - # Read settings dialog # @return `abort if aborted and `next otherwise def ReadDialog @@ -68,13 +62,11 @@ ret ? :next : :abort end - # transform userdata from widget to map def get_userdata(id) return Snapper.string_to_userdata(UI.QueryWidget(Id(id), :Value)) end - # generate list of items for Cleanup combo box def cleanup_items(current) Builtins.maplist(["timeline", "number", ""]) do |cleanup| @@ -82,7 +74,6 @@ end end - # compare editable parts of snapshot maps def snapshot_modified(orig, new) orig = deep_copy(orig) @@ -94,15 +85,13 @@ ret end - # grouped enable condition based on snapshot presence for modification widgets def enable_snapshot_buttons(condition) - UI.ChangeWidget(Id(:show), :Enabled, condition) + UI.ChangeWidget(Id(:show), :Enabled, condition) UI.ChangeWidget(Id(:modify), :Enabled, condition) UI.ChangeWidget(Id(:delete), :Enabled, condition) end - # Popup for modification of existing snapshot # @return true if new snapshot was created def ModifySnapshotPopup(snapshot) @@ -229,7 +218,6 @@ modified end - # Popup for creating new snapshot # @return true if new snapshot was created def CreateSnapshotPopup(pre_snapshots) @@ -317,12 +305,12 @@ UI.ChangeWidget( Id("post"), :Enabled, - !pre_items.empty? + !pre_items.empty? ) UI.ChangeWidget( Id(:pre_list), :Enabled, - !pre_items.empty? + !pre_items.empty? ) ret = nil @@ -343,7 +331,6 @@ created end - # Popup for deleting existing snapshot # @return true if snapshot was deleted def DeleteSnapshotPopup(snapshot) @@ -356,7 +343,7 @@ # yes/no popup question if Popup.YesNo(_("Really delete snapshot %{num}?") % { :num => num }) - return Snapper.DeleteSnapshot([ num ]) + return Snapper.DeleteSnapshot([num]) end else @@ -364,7 +351,7 @@ # yes/no popup question if Popup.YesNo(_("Really delete snapshots %{pre} and %{post}?") % { :pre => pre_num, :post => num }) - return Snapper.DeleteSnapshot([ pre_num, num ]) + return Snapper.DeleteSnapshot([pre_num, num]) end end @@ -372,7 +359,6 @@ false end - # Summary dialog # @return dialog result def SummaryDialog @@ -473,12 +459,11 @@ Popup.ClearFeedback UI.ChangeWidget(Id(:snapshots_table), :Items, get_snapshot_items.call) - enable_snapshot_buttons(!snapshot_items.empty?) + enable_snapshot_buttons(!snapshot_items.empty?) nil end - contents = VBox( HBox( # combo box label @@ -506,9 +491,9 @@ # button label PushButton(Id(:show), Opt(:default), _("Show Changes")), PushButton(Id(:create), Label.CreateButton), - # button label - PushButton(Id(:modify), _("Modify")), + PushButton(Id(:modify), Label.ModifyButton), PushButton(Id(:delete), Label.DeleteButton), + PushButton(Id(:refresh), Label.RefreshButton), HStretch() ) ) @@ -528,7 +513,7 @@ UI.ChangeWidget( Id(:configs), :Enabled, - configs.size > 1 + configs.size > 1 ) ret = nil @@ -586,6 +571,11 @@ next end + elsif ret == :refresh + + update_snapshots.call + next + elsif ret == :next break @@ -599,15 +589,13 @@ deep_copy(ret) end - def generate_ui_file_tree(subtree) return subtree.children.map do |file| Item(Id(file.fullname), term(:icon, file.icon), file.name, false, - generate_ui_file_tree(file)) + generate_ui_file_tree(file)) end end - def format_diff(diff, textmode) lines = Builtins.splitstring(String.EscapeTags(diff), "\n") if !textmode @@ -630,10 +618,8 @@ return ret end - # @return dialog result def ShowDialog - # dialog caption caption = _("Selected Snapshot Overview") @@ -829,7 +815,6 @@ nil end - # create the term for selected file set_entry_term = lambda do if current_file && current_file.status != 0 @@ -870,7 +855,7 @@ ), HBox( HSpacing(2), - # FIXME without label, there's no shortcut! + # FIXME: without label, there's no shortcut! Left( ComboBox( Id(:selection_snapshots), @@ -1124,17 +1109,17 @@ current_file.created? # yes/no question, %1 is file name, %2 is number if Popup.YesNo( - Builtins.sformat( - _( - "Do you want to delete the file\n" + - "\n" + - "%1\n" + - "\n" + - "from current system?" - ), - Snapper.GetFileFullPath(current_filename) - ) + Builtins.sformat( + _( + "Do you want to delete the file\n" + + "\n" + + "%1\n" + + "\n" + + "from current system?" + ), + Snapper.GetFileFullPath(current_filename) ) + ) Snapper.RestoreFiles( ret == :restore_pre ? pre_num : snapshot_num, [current_filename] @@ -1145,18 +1130,18 @@ elsif ret == :restore_pre # yes/no question, %1 is file name, %2 is number if Popup.YesNo( - Builtins.sformat( - _( - "Do you want to copy the file\n" + - "\n" + - "%1\n" + - "\n" + - "from snapshot '%2' to current system?" - ), - Snapper.GetFileFullPath(current_filename), - pre_num - ) + Builtins.sformat( + _( + "Do you want to copy the file\n" + + "\n" + + "%1\n" + + "\n" + + "from snapshot '%2' to current system?" + ), + Snapper.GetFileFullPath(current_filename), + pre_num ) + ) Snapper.RestoreFiles(pre_num, [current_filename]) end next @@ -1164,18 +1149,18 @@ elsif ret == :restore # yes/no question, %1 is file name, %2 is number if Popup.YesNo( - Builtins.sformat( - _( - "Do you want to copy the file\n" + - "\n" + - "%1\n" + - "\n" + - "from snapshot '%2' to current system?" - ), - Snapper.GetFileFullPath(current_filename), - from - ) + Builtins.sformat( + _( + "Do you want to copy the file\n" + + "\n" + + "%1\n" + + "\n" + + "from snapshot '%2' to current system?" + ), + Snapper.GetFileFullPath(current_filename), + from ) + ) Snapper.RestoreFiles(from, [current_filename]) end next @@ -1183,7 +1168,7 @@ elsif ret == :next filenames = UI.QueryWidget(Id(:tree), :SelectedItems) - filenames.map!{ |filename| filename.force_encoding(Encoding::ASCII_8BIT) } + filenames.map! { |filename| filename.force_encoding(Encoding::ASCII_8BIT) } # remove filenames not changed between the snapshots, e.g. /foo if # only /foo/bar changed @@ -1200,27 +1185,27 @@ end if Popup.AnyQuestionRichText( - # popup headline - _("Restoring files"), - # popup message, %1 is snapshot number, %2 list of files - Builtins.sformat( - _( - "<p>These files will be restored from snapshot '%1':</p>\n" + - "<p>\n" + - "%2\n" + - "</p>\n" + - "<p>Files existing in original snapshot will be copied to current system.</p>\n" + - "<p>Files that did not exist in the snapshot will be deleted.</p>Are you sure?" - ), - from, - to_restore.join("<br>") + # popup headline + _("Restoring files"), + # popup message, %1 is snapshot number, %2 list of files + Builtins.sformat( + _( + "<p>These files will be restored from snapshot '%1':</p>\n" + + "<p>\n" + + "%2\n" + + "</p>\n" + + "<p>Files existing in original snapshot will be copied to current system.</p>\n" + + "<p>Files that did not exist in the snapshot will be deleted.</p>Are you sure?" ), - 60, - 20, - Label.YesButton, - Label.NoButton, - :focus_no - ) + from, + to_restore.join("<br>") + ), + 60, + 20, + Label.YesButton, + Label.NoButton, + :focus_no + ) Snapper.RestoreFiles(from, filenames) break end @@ -1235,7 +1220,5 @@ deep_copy(ret) end - end - end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-snapper-4.1.0/src/include/snapper/helps.rb new/yast2-snapper-4.1.2/src/include/snapper/helps.rb --- old/yast2-snapper-4.1.0/src/include/snapper/helps.rb 2018-12-07 09:52:10.000000000 +0100 +++ new/yast2-snapper-4.1.2/src/include/snapper/helps.rb 2019-03-07 10:11:02.000000000 +0100 @@ -26,7 +26,7 @@ module Yast module SnapperHelpsInclude - def initialize_snapper_helps(include_target) + def initialize_snapper_helps(_include_target) textdomain "snapper" # All helps are here @@ -43,9 +43,12 @@ "used for storing the file system state in a certain time, while Pre and Post are used to define the changes done by special operation performed between taking those two snapshots. Pre and Post snapshots are paired together in the table.</p>\n" + "<p>Select a snapshot or snapshot pair and click <b>Show Changes</b> to see the\n" + "new file system changes in the specified snapshot.</p>\n" - ), + ) + + # Summary dialog help: + _("<p>Click <b>Refresh</b> to update the list of snapshots. This is only required\n" + + "if some other program is changing the list of snapshots.</p>"), # Show snapshot dialog help - "show_pair" => _( + "show_pair" => _( "<p><b><big>Snapshot Overview</big></b><p>\n" + "<p>\n" + "The tree shows all the files that were modified between creating the first ('pre') and second ('post') snapshot. On the right side, you see the description generated when the first snapshot was created and the time of creation for both snapshots.\n" + @@ -64,7 +67,7 @@ "When a file is selected in the tree, you can see the its difference between snapshot version and current system.\n" + "</p>\n" ) - } + } # EOF end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-snapper-4.1.0/src/include/snapper/wizards.rb new/yast2-snapper-4.1.2/src/include/snapper/wizards.rb --- old/yast2-snapper-4.1.0/src/include/snapper/wizards.rb 2018-12-07 09:52:10.000000000 +0100 +++ new/yast2-snapper-4.1.2/src/include/snapper/wizards.rb 2019-03-07 10:11:02.000000000 +0100 @@ -25,9 +25,7 @@ # Authors: Jiri Suchomel <jsuch...@suse.cz> module Yast - module SnapperWizardsInclude - def initialize_snapper_wizards(include_target) Yast.import "UI" @@ -77,7 +75,5 @@ UI.CloseDialog deep_copy(ret) end - end - end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-snapper-4.1.0/src/modules/Snapper.rb new/yast2-snapper-4.1.2/src/modules/Snapper.rb --- old/yast2-snapper-4.1.0/src/modules/Snapper.rb 2018-12-07 09:52:10.000000000 +0100 +++ new/yast2-snapper-4.1.2/src/modules/Snapper.rb 2019-03-07 10:11:02.000000000 +0100 @@ -29,15 +29,12 @@ require "yast" module Yast - class SnapperClass < Module - include Yast::Logger attr_reader :current_config attr_reader :current_subvolume - def main Yast.import "UI" textdomain "snapper" @@ -62,29 +59,23 @@ @current_config = "" @current_subvolume = "" - end - def current_config=(current_config) - @current_config = current_config if !@current_config.empty? - @current_subvolume = get_config()[1] + @current_subvolume = get_config[1] else @current_subvolume = "" end log.info("current_config:#{@current_config} current_subvolume:#{@current_subvolume}") - end - # Return Tree of files modified between given snapshots # Map is recursively describing the filesystem structure; helps to build Tree widget contents def ReadModifiedFilesTree(from, to) - SnapperDbus.create_comparison(@current_config, from, to) files = SnapperDbus.get_files(@current_config, from, to) SnapperDbus.delete_comparison(@current_config, from, to) @@ -96,21 +87,16 @@ end return root - end - - def get_config() - + def get_config return SnapperDbus.get_config(@current_config) rescue Exception => e Report.Error(_("Failed to get config:" + "\n" + e.message)) return {} - end - def prepend_subvolume(filename) if @current_subvolume == "/" return filename @@ -119,19 +105,15 @@ end end - # Return the path to given snapshot def GetSnapshotPath(snapshot_num) - return SnapperDbus.get_mount_point(@current_config, snapshot_num) rescue Exception => e Report.Error(_("Failed to get snapshot mount point:" + "\n" + e.message)) return "" - end - # Return the full path to the given file from currently selected configuration (subvolume) # @param [String] file path, relatively to current config # GetFileFullPath ("/testfile.txt") -> /abc/testfile.txt for /abc subvolume @@ -139,7 +121,6 @@ return prepend_subvolume(file) end - # Describe what was done with given file between given snapshots # - when new is 0, meaning is 'current system' def GetFileModification(file, old, new) @@ -210,10 +191,8 @@ deep_copy(ret) end - # Read the list of snapshots def ReadSnapshots - snapshot_maps = SnapperDbus.list_snapshots(@current_config) @snapshots = [] @@ -238,10 +217,8 @@ true end - def ReadConfigs - - @configs = SnapperDbus.list_configs() + @configs = SnapperDbus.list_configs if @configs.include?("root") self.current_config = "root" @@ -250,24 +227,21 @@ else self.current_config = "" end - end - # Create new snapshot # Return true on success def CreateSnapshot(args) - case args["type"] when "single" SnapperDbus.create_single_snapshot(@current_config, args["description"], args["cleanup"], - args["userdata"]) + args["userdata"]) when "pre" SnapperDbus.create_pre_snapshot(@current_config, args["description"], args["cleanup"], - args["userdata"]) + args["userdata"]) when "post" SnapperDbus.create_post_snapshot(@current_config, args["pre"], args["description"], - args["cleanup"], args["userdata"]) + args["cleanup"], args["userdata"]) end return true @@ -277,27 +251,22 @@ return false end - # Modify existing snapshot # Return true on success def ModifySnapshot(args) - SnapperDbus.set_snapshot(@current_config, args["num"], args["description"], args["cleanup"], - args["userdata"]) + args["userdata"]) return true rescue Exception => e Report.Error(_("Failed to modify snapshot:" + "\n" + e.message)) return false - end - # Delete existing snapshot # Return true on success def DeleteSnapshot(nums) - SnapperDbus.delete_snapshots(@current_config, nums) return true @@ -305,17 +274,14 @@ rescue Exception => e Report.Error(_("Failed to delete snapshot:" + "\n" + e.message)) return false - end - # Init snapper (get configs and snapshots) # Return true on success def Init - # We do not set help text here, because it was set outside Progress.New( - # Snapper read dialog caption + # Snapper read dialog caption _("Initializing Snapper"), " ", 2, @@ -323,7 +289,7 @@ # Progress stage 1/2 _("Read list of configurations"), # Progress stage 2/2 - _("Read list of snapshots"), + _("Read list of snapshots") ], [ # Progress step 1/2 @@ -363,10 +329,8 @@ Progress.NextStage return true - end - # Return the given file mode as octal number def GetFileMode(file) out = Convert.to_map( @@ -494,14 +458,12 @@ ret end - # convert hash with userdata to a string # { "a" => "1", "b" => "2" } -> "a=1, b=2" def userdata_to_string(userdata) return userdata.map { |k, v| "#{k}=#{v}" }.join(", ") end - # convert string with userdata to a hash # "a=1, b=2" -> { "a" => "1", "b" => "2" } def string_to_userdata(string) @@ -509,16 +471,14 @@ if s.include?("=") s.split("=", 2).map { |t| t.strip } else - [ s.strip, "" ] + [s.strip, ""] end end.to_h end - - private + private class Tree - attr_accessor :name, :status attr_reader :children @@ -529,7 +489,7 @@ @children = [] end - def each() + def each if @parent != nil yield self end @@ -540,20 +500,19 @@ end end - def fullname() - return @parent ? @parent.fullname() + "/" + @name : @name + def fullname + return @parent ? @parent.fullname + "/" + @name : @name end - def created?() + def created? return @status & 0x01 != 0 end - def deleted?() + def deleted? return @status & 0x02 != 0 end - - def icon() + def icon if @status == 0 return "yast-gray-dot.png" elsif created? @@ -565,13 +524,11 @@ end end - def add(fullname, status) - a, b = fullname.split("/", 2) - return add(b, status) if fullname.start_with? "/" #leading / + return add(b, status) if fullname.start_with? "/" # leading / - i = @children.index{ |x| x.name == a } + i = @children.index { |x| x.name == a } if i if b @@ -588,16 +545,13 @@ end @children << subtree end - end - def find(fullname) - a, b = fullname.split("/", 2) - return find(b) if fullname.start_with? "/" #leading / + return find(b) if fullname.start_with? "/" # leading / - i = @children.index{ |x| x.name == a } + i = @children.index { |x| x.name == a } if !i return nil @@ -608,13 +562,10 @@ else return @children[i].find(b) end - end - end - - public + public publish :variable => :snapshots, :type => "list <map>" publish :variable => :selected_snapshot, :type => "map" @@ -630,10 +581,8 @@ publish :function => :CreateSnapshot, :type => "boolean (map)" publish :function => :Init, :type => "boolean ()" publish :function => :RestoreFiles, :type => "boolean (integer, list <string>)" - end Snapper = SnapperClass.new Snapper.main - end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-snapper-4.1.0/src/modules/SnapperDbus.rb new/yast2-snapper-4.1.2/src/modules/SnapperDbus.rb --- old/yast2-snapper-4.1.0/src/modules/SnapperDbus.rb 2018-12-07 09:52:10.000000000 +0100 +++ new/yast2-snapper-4.1.2/src/modules/SnapperDbus.rb 2019-03-07 10:11:02.000000000 +0100 @@ -22,15 +22,12 @@ require "dbus" module Yast - class SnapperDbusClass < Module - include Yast::Logger def main end - def list_configs result = dbus_object.ListConfigs().first log.debug("list_configs result:#{result}") @@ -38,7 +35,6 @@ result.map(&:first) end - def get_config(config_name) result = dbus_object.GetConfig(config_name).first log.debug("get_config for name '#{config_name}' result:#{result}") @@ -46,7 +42,6 @@ result end - TYPE_INT_TO_SYMBOL = { 0 => :SINGLE, 1 => :PRE, @@ -59,47 +54,43 @@ ret = result.map do |snapshot| { - "num" => snapshot[0], - "type" => TYPE_INT_TO_SYMBOL[snapshot[1]], - "pre_num" => snapshot[2], - "date" => Time.at(snapshot[3]), - "uid" => snapshot[4], + "num" => snapshot[0], + "type" => TYPE_INT_TO_SYMBOL[snapshot[1]], + "pre_num" => snapshot[2], + "date" => Time.at(snapshot[3]), + "uid" => snapshot[4], "description" => unescape(snapshot[5]), - "cleanup" => unescape(snapshot[6]), - "userdata" => unescape(snapshot[7]) + "cleanup" => unescape(snapshot[6]), + "userdata" => unescape(snapshot[7]) } end log.debug("list_snapshots ret:#{ret}") return ret - end - def create_single_snapshot(config_name, description, cleanup, userdata) result = dbus_object.CreateSingleSnapshot(config_name, escape(description), escape(cleanup), - escape(userdata)).first + escape(userdata)).first log.debug("create_single_snapshot config_name:#{config_name} description:#{description} "\ "cleanup:#{cleanup} userdata:#{userdata} result:#{result}") result end - def create_pre_snapshot(config_name, description, cleanup, userdata) result = dbus_object.CreatePreSnapshot(config_name, escape(description), escape(cleanup), - escape(userdata)).first + escape(userdata)).first log.debug("create_pre_snapshot config_name:#{config_name} description:#{description} "\ "cleanup:#{cleanup} userdata:#{userdata} result: #{result}") result end - def create_post_snapshot(config_name, prenum, description, cleanup, userdata) result = dbus_object.CreatePostSnapshot(config_name, prenum, escape(description), - escape(cleanup), escape(userdata)).first + escape(cleanup), escape(userdata)).first log.debug("create_post_snapshot config_name:#{config_name} prenum:#{prenum} "\ "description:#{description} cleanup:#{cleanup} userdata:#{userdata}"\ "result #{result}") @@ -107,7 +98,6 @@ result end - def delete_snapshots(config_name, nums) result = dbus_object.DeleteSnapshots(config_name, nums).first log.debug("delete_snapshots config_name:#{config_name} nums:#{nums} result:#{result}") @@ -115,10 +105,9 @@ result end - def set_snapshot(config_name, num, description, cleanup, userdata) result = dbus_object.SetSnapshot(config_name, num, escape(description), escape(cleanup), - escape(userdata)).first + escape(userdata)).first log.debug("set_snapshot config_name:#{config_name} num:#{num} "\ "description:#{description} cleanup:#{cleanup} userdata:#{userdata} "\ "result #{result}") @@ -126,7 +115,6 @@ result end - def get_mount_point(config_name, num) result = dbus_object.GetMountPoint(config_name, num).first log.debug("get_mount_point config_name:#{config_name} num:#{num} result#{result}") @@ -134,7 +122,6 @@ result end - def create_comparison(config_name, num1, num2) result = dbus_object.CreateComparison(config_name, num1, num2).first log.debug("create_comparison config_name:#{config_name} num1:#{num1} num2:#{num2} "\ @@ -143,7 +130,6 @@ result end - def delete_comparison(config_name, num1, num2) result = dbus_object.DeleteComparison(config_name, num1, num2).first log.debug("delete_comparison config_name:#{config_name} num1:#{num1} num2:#{num2} "\ @@ -152,7 +138,6 @@ result end - def get_files(config_name, num1, num2) result = dbus_object.GetFiles(config_name, num1, num2).first log.debug("get_files config_name:#{config_name} num1:#{num1} num2:#{num2} result:#{result}") @@ -162,25 +147,23 @@ end end - - private + private def dbus_object return @dbus_object if @dbus_object log.info("connecting to snapperd") - @system_bus = DBus::SystemBus.instance() + @system_bus = DBus::SystemBus.instance @service = @system_bus.service("org.opensuse.Snapper") @dbus_object = @service.object("/org/opensuse/Snapper") @dbus_object.default_iface = "org.opensuse.Snapper" - @dbus_object.introspect() + @dbus_object.introspect @dbus_object end # Escape a String or Hash for snapperd. See snapper dbus documentation for details. def escape(str) - ret = str.dup if ret.is_a?(::String) @@ -196,7 +179,7 @@ elsif ret.is_a?(Hash) - ret = ret.map { |k, v| [ escape(k), escape(v) ] }.to_h + ret = ret.map { |k, v| [escape(k), escape(v)] }.to_h elsif @@ -205,13 +188,10 @@ end return ret - end - # Unescape a String or Hash from snapperd. See snapper dbus documentation for details. def unescape(str) - ret = str.dup if ret.is_a?(::String) @@ -221,13 +201,13 @@ if tmp == "\\\\" "\\" else - tmp[2,2].hex.chr + tmp[2, 2].hex.chr end end elsif ret.is_a?(Hash) - ret = ret.map { |k, v| [ unescape(k), unescape(v) ] }.to_h + ret = ret.map { |k, v| [unescape(k), unescape(v)] }.to_h elsif @@ -236,12 +216,9 @@ end return ret - end - end SnapperDbus = SnapperDbusClass.new SnapperDbus.main - end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-snapper-4.1.0/test/snapper_dbus_test.rb new/yast2-snapper-4.1.2/test/snapper_dbus_test.rb --- old/yast2-snapper-4.1.0/test/snapper_dbus_test.rb 2018-12-07 09:52:10.000000000 +0100 +++ new/yast2-snapper-4.1.2/test/snapper_dbus_test.rb 2019-03-07 10:11:02.000000000 +0100 @@ -10,17 +10,14 @@ expect(Yast::SnapperDbus.send(:escape, "hello")).to eq("hello") end - it "call with UTF-8" do expect(Yast::SnapperDbus.send(:escape, "schön")).to eq("sch\\xc3\\xb6n".force_encoding(Encoding::ASCII_8BIT)) end - it "call with slash" do expect(Yast::SnapperDbus.send(:escape, "\\")).to eq("\\\\") end - it "call with a hash" do expect(Yast::SnapperDbus.send(:escape, { "schön" => "hier" })) .to eq({ "sch\\xc3\\xb6n".force_encoding(Encoding::ASCII_8BIT) => "hier" }) @@ -33,7 +30,6 @@ expect(Yast::SnapperDbus.send(:unescape, "world").encoding).to eq(Encoding::ASCII_8BIT) end - it "call with escaped UTF-8" do expect(Yast::SnapperDbus.send(:unescape, "sch\\xc3\\xb6n")).to eq("schön".force_encoding(Encoding::ASCII_8BIT)) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-snapper-4.1.0/test/snapper_test.rb new/yast2-snapper-4.1.2/test/snapper_test.rb --- old/yast2-snapper-4.1.0/test/snapper_test.rb 2018-12-07 09:52:10.000000000 +0100 +++ new/yast2-snapper-4.1.2/test/snapper_test.rb 2019-03-07 10:11:02.000000000 +0100 @@ -7,7 +7,7 @@ describe Yast::Snapper do describe "#userdata_to_string" do it "call with empty userdata" do - expect(Yast::Snapper.userdata_to_string({ })).to eq("") + expect(Yast::Snapper.userdata_to_string({})).to eq("") end it "call with simple userdata" do @@ -21,7 +21,7 @@ describe "#string_to_userdata" do it "call with empty string" do - expect(Yast::Snapper.string_to_userdata("")).to eq({ }) + expect(Yast::Snapper.string_to_userdata("")).to eq({}) end it "call with simple string" do