Skip to content

Commit

Permalink
Merge pull request #16 from kobliha/popup_for_switching_from_patterns
Browse files Browse the repository at this point in the history
Warning user that changing update mode from "patterns" to "update only installed rpms" might lead into broken system.
  • Loading branch information
kobliha committed Apr 15, 2014
2 parents 95aed00 + 56fefff commit d9ea1c3
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 17 deletions.
8 changes: 8 additions & 0 deletions package/yast2-update.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Tue Apr 15 15:57:20 CEST 2014 - locilka@suse.com

- Warning user that changing update mode from "patterns" to
"update only installed rpms" might lead into broken system.
Only if "patterns" were the default selection (bnc#873122).
- 3.1.5

-------------------------------------------------------------------
Fri Mar 28 15:02:22 CET 2014 - locilka@suse.com

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-update.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-update
Version: 3.1.4
Version: 3.1.5
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
39 changes: 23 additions & 16 deletions src/clients/inst_update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -218,19 +218,29 @@ def main
end

if (@ret == :next || @ret == :ok) && Pkg.RestoreState(true)
@something_changed = false

if UI.QueryWidget(Id(:notupgrade), :Value) !=
Update.onlyUpdateInstalled
@something_changed = true
end

if @something_changed && Packages.base_selection_modified
# yes/no question
if !Popup.YesNo(
_("Do you really want\nto reset your detailed selection?")
new_onlyUpdateInstalled = UI.QueryWidget(Id(:notupgrade), :Value)
# Selection has changed
if Update.onlyUpdateInstalled != new_onlyUpdateInstalled
# BNC#873122
# The default is 'do not onlyUpdateInstalled'
# New status is 'do onlyUpdateInstalled'
if !Update.default_onlyUpdateInstalled && new_onlyUpdateInstalled
next unless Popup::AnyQuestion(
Label.WarningMsg,
# warning / question
_(
"Changing the update method to 'Update packages only' might\n" +
"lead into non-bootable or non-working system if you do not\n" +
"adjust the list of packages yourself.\n\n" +
"Really continue?"
),
Label.YesButton,
Label.NoButton,
:focus_no
)
next
elsif Packages.base_selection_modified
# yes/no question
next unless Popup.YesNo(_("Do you really want\nto reset your detailed selection?"))
end
end
end
Expand All @@ -242,10 +252,7 @@ def main
Update.did_init1 = false

@b1 = Update.onlyUpdateInstalled
Update.onlyUpdateInstalled = Convert.to_boolean(
UI.QueryWidget(Id(:notupgrade), :Value)
)
# Update::deleteOldPackages = (boolean) UI::QueryWidget (`id(`delete), `Value);
Update.onlyUpdateInstalled = UI.QueryWidget(Id(:notupgrade), :Value)

if @b1 != Update.onlyUpdateInstalled || @details_pressed
Update.manual_interaction = true
Expand Down
2 changes: 2 additions & 0 deletions src/modules/Update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ def Reset
# y2milestone ("deleteOldPackages %1", deleteOldPackages);

@onlyUpdateInstalled = OnlyUpdateInstalled()
@default_onlyUpdateInstalled = deep_copy(@onlyUpdateInstalled)
Builtins.y2milestone("onlyUpdateInstalled %1", @onlyUpdateInstalled)

@disallow_upgrade = false
Expand Down Expand Up @@ -857,6 +858,7 @@ def installed_product
publish :variable => :did_init2, :type => "boolean"
publish :variable => :last_runlevel, :type => "integer"
publish :variable => :onlyUpdateInstalled, :type => "boolean"
publish :variable => :default_onlyUpdateInstalled, :type => "boolean"
publish :variable => :selected_selection, :type => "string"
publish :variable => :products_incompatible, :type => "boolean"
publish :variable => :updateBasePackages, :type => "boolean"
Expand Down

0 comments on commit d9ea1c3

Please sign in to comment.