Hello community, here is the log from the commit of package yast2-packager for openSUSE:Factory checked in at 2017-02-18 03:16:39 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 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 2017-02-08 11:02:13.553163702 +0100 +++ /work/SRC/openSUSE:Factory/.yast2-packager.new/yast2-packager.changes 2017-02-18 03:16:40.424904743 +0100 @@ -1,0 +2,15 @@ +Wed Feb 8 14:40:29 UTC 2017 - [email protected] + +- drop inst_desktop client as it is replaced by new desktop + selection based on roles (poo#14936, bsc#1025415) +- Allow Desktop module to specify that no desktop is selected +- 3.2.16 + +------------------------------------------------------------------- +Mon Feb 6 14:00:13 UTC 2017 - [email protected] + +- Do not allow changing services of type "plugin" and its + repositories, they cannot be changed (related to bsc#1021117) +- 3.2.15 + +------------------------------------------------------------------- Old: ---- yast2-packager-3.2.14.tar.bz2 New: ---- yast2-packager-3.2.16.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-packager.spec ++++++ --- /var/tmp/diff_new_pack.NR3ESv/_old 2017-02-18 03:16:40.804851080 +0100 +++ /var/tmp/diff_new_pack.NR3ESv/_new 2017-02-18 03:16:40.808850516 +0100 @@ -17,7 +17,7 @@ Name: yast2-packager -Version: 3.2.14 +Version: 3.2.16 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ yast2-packager-3.2.14.tar.bz2 -> yast2-packager-3.2.16.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-3.2.14/package/yast2-packager.changes new/yast2-packager-3.2.16/package/yast2-packager.changes --- old/yast2-packager-3.2.14/package/yast2-packager.changes 2017-02-06 10:52:35.561337791 +0100 +++ new/yast2-packager-3.2.16/package/yast2-packager.changes 2017-02-16 17:14:05.354221488 +0100 @@ -1,4 +1,19 @@ ------------------------------------------------------------------- +Wed Feb 8 14:40:29 UTC 2017 - [email protected] + +- drop inst_desktop client as it is replaced by new desktop + selection based on roles (poo#14936, bsc#1025415) +- Allow Desktop module to specify that no desktop is selected +- 3.2.16 + +------------------------------------------------------------------- +Mon Feb 6 14:00:13 UTC 2017 - [email protected] + +- Do not allow changing services of type "plugin" and its + repositories, they cannot be changed (related to bsc#1021117) +- 3.2.15 + +------------------------------------------------------------------- Wed Feb 1 16:03:24 UTC 2017 - [email protected] - Fix escaping spaces ( yast uses web form escaping to "+" but diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-3.2.14/package/yast2-packager.spec new/yast2-packager-3.2.16/package/yast2-packager.spec --- old/yast2-packager-3.2.14/package/yast2-packager.spec 2017-02-06 10:52:35.561337791 +0100 +++ new/yast2-packager-3.2.16/package/yast2-packager.spec 2017-02-16 17:14:05.354221488 +0100 @@ -17,7 +17,7 @@ Name: yast2-packager -Version: 3.2.14 +Version: 3.2.16 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-3.2.14/src/clients/inst_desktop.rb new/yast2-packager-3.2.16/src/clients/inst_desktop.rb --- old/yast2-packager-3.2.14/src/clients/inst_desktop.rb 2017-02-06 10:52:35.561337791 +0100 +++ new/yast2-packager-3.2.16/src/clients/inst_desktop.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,300 +0,0 @@ -# encoding: utf-8 - -# File: clients/inst_desktop.ycp -# Package: Installation -# Summary: Desktop Selection -# Authors: Jiri Srain <[email protected]> -# -# $Id$ -# -module Yast - class InstDesktopClient < Client - def main - Yast.import "UI" - - textdomain "packager" - - Yast.import "Directory" - Yast.import "GetInstArgs" - Yast.import "Label" - Yast.import "Packages" - Yast.import "Popup" - Yast.import "ProductFeatures" - Yast.import "Stage" - Yast.import "Wizard" - Yast.import "DefaultDesktop" - - # do not offer the dialog if base selection is fixed - if ProductFeatures.GetFeature("software", "selection_type") == :fixed - return :auto - end - - @alt_desktop = DefaultDesktop.Desktop - @other_desktop = nil - - if @alt_desktop == nil - DefaultDesktop.Init - @alt_desktop = DefaultDesktop.Desktop - end - if @alt_desktop != nil - if @alt_desktop != "kde" && @alt_desktop != "gnome" - @alt_desktop = "other" - end - end - - @display = UI.GetDisplayInfo - @space = Ops.get_boolean(@display, "TextMode", true) ? 1 : 3 - - # all the arguments - @argmap = GetInstArgs.argmap - - - - @gnome_blurb = - # explanation text for GNOME - _( - "GNOME is a powerful and intuitive desktop\n" + - "environment that uses Evolution as mailer,\n" + - "Firefox as browser, and Nautilus as file manager.\n" - ) - - @kde_blurb = - # explanation text for KDE - _( - "KDE is a powerful and intuitive desktop\n" + - "environment that uses Kontact as mailer,\n" + - "Dolphin as file manager, and offers\n" + - "both Firefox and Konqueror as Web browsers.\n" - ) - - # help text 1/3 - @help = _( - "<p>Both <b>KDE</b> and <b>GNOME</b> are powerful and intuitive\n" + - "desktop environments. They combine ease of use\n" + - "and attractive graphical interfaces with their\n" + - "own sets of perfectly integrated applications.</p>" - ) + - # help text 2/3 - _( - "<p>Choosing the default <b>GNOME</b> or <b>KDE</b> desktop\n" + - "environment installs a broad set of the\n" + - "most important desktop applications on your\n" + - "system.</p>" - ) + - # help text 3/3 - _( - "<p>Choose <b>Other</b> then select from\n" + - "an alternative, such as a text-only system or a minimal graphical\n" + - "system with a basic window manager.</p>" - ) - - @kde = VBox( - Left( - RadioButton( - Id("kde"), - Opt(:notify, :boldFont), - # radio button - _("&KDE"), - @alt_desktop == "kde" - ) - ), - Left( - HBox( - HSpacing(3), - Top(Label(@kde_blurb)), - HSpacing(1), - Right( - Top( - Image( - Ops.add(Directory.icondir, "/48x48/apps/yast-kde.png"), - "" - ) - ) - ) - ) - ) - ) - - @gnome = VBox( - Left( - RadioButton( - Id("gnome"), - Opt(:notify, :boldFont), - # radio button - _("&GNOME"), - @alt_desktop == "gnome" - ) - ), - HBox( - HSpacing(3), - Top(Label(@gnome_blurb)), - HSpacing(1), - Right( - Top( - Image( - Ops.add(Directory.icondir, "/48x48/apps/yast-gnome.png"), - "" - ) - ) - ) - ) - ) - - @contents = RadioButtonGroup( - Id(:desktop), - HBox( - HWeight(1, Empty()), # Distribute excess space 1:2 (left:right) - VBox( - VStretch(), - # label (in bold font) - VWeight(10, @gnome), - VSpacing(0.4), - VWeight(10, @kde), - VSpacing(0.4), - VWeight( - 10, - HBox( - Left( - RadioButton( - Id("other"), - Opt(:notify, :boldFont), - # radio button - _("&Other"), - @alt_desktop != "gnome" && @alt_desktop != "kde" && - @alt_desktop != nil - ) - ), - HBox( - HSpacing(2), - # push button - RadioButtonGroup( - Id(:other_rb), - ReplacePoint(Id(:other_options), VBox(VSpacing(4))) - ) - ) - ) - ), - VStretch() - ), - HWeight(2, Empty()) - ) - ) - - # dialog caption - Wizard.SetContents( - _("Desktop Selection"), - @contents, - @help, - GetInstArgs.enable_back, - GetInstArgs.enable_next - ) - Wizard.SetTitleIcon("yast-desktop-select") - Wizard.SetFocusToNextButton - - # initialize other desktop when going back - if @alt_desktop == "other" - @other_desktop = DefaultDesktop.Desktop - EnableOtherOptions() - end - - @ret = nil - begin - @event = UI.WaitForEvent - @ret = Ops.get(@event, "ID") - - # by default, nothing is selected, enabling next - # handling [Next] button - if @ret == "gnome" || @ret == "kde" || @ret == "min_x11" || - @ret == "text" - Wizard.EnableNextButton - elsif @ret == "other" && - (@other_desktop == "min_x11" || @other_desktop == "text") - Wizard.EnableNextButton - else - Wizard.DisableNextButton - end - - if @ret == :next - if @alt_desktop == nil || @alt_desktop == "" - Popup.Message( - _("No desktop was selected. Select the\ndesktop to install.") - ) - @ret = nil - # alt_desktop is also neither 'nil' nor "" - elsif @alt_desktop == "other" - @alt_desktop = @other_desktop - end - elsif @ret == :abort - if Popup.ConfirmAbort(Stage.initial ? :painless : :incomplete) - return :abort - end - next - elsif @ret == "other" - EnableOtherOptions() - elsif @ret == "gnome" || @ret == "kde" - @alt_desktop = Builtins.tostring(@ret) - DisableOtherOptions() - elsif @ret == "min_x11" || @ret == "text" - @alt_desktop = "other" - @other_desktop = Builtins.tostring(@ret) - end - end until @ret == :back || @ret == :next - - Wizard.EnableNextButton - - @ret = :next if @ret == :accept - - if @ret == :next - if DefaultDesktop.Desktop != @alt_desktop - Builtins.y2milestone("Setting default desktop to %1", @alt_desktop) - DefaultDesktop.SetDesktop(@alt_desktop) - Packages.ForceFullRepropose - Packages.Reset([:product]) - end - end - - Convert.to_symbol(@ret) - - - - # EOF - end - - def EnableOtherOptions - UI.ReplaceWidget( - Id(:other_options), - VBox( - VSpacing(2), - Left( - RadioButton( - Id("min_x11"), - Opt(:notify), - # radio button - _("&Minimal Graphical System"), - @other_desktop == "min_x11" - ) - ), - Left( - RadioButton( - Id("text"), - Opt(:notify), - # radio button - _("&Text Mode"), - @other_desktop == "text" - ) - ) - ) - ) - - nil - end - - def DisableOtherOptions - UI.ReplaceWidget(Id(:other_options), VBox(VSpacing(4))) - - nil - end - end -end - -Yast::InstDesktopClient.new.main diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-3.2.14/src/clients/inst_packages.rb new/yast2-packager-3.2.16/src/clients/inst_packages.rb --- old/yast2-packager-3.2.14/src/clients/inst_packages.rb 2017-02-06 10:52:35.561337791 +0100 +++ new/yast2-packager-3.2.16/src/clients/inst_packages.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,102 +0,0 @@ -# encoding: utf-8 - -# Module: inst_packages.ycp -# Authors: Stefan Hundhammer <[email protected]> -# Purpose: Show the package installation dialog -# -# $Id$ -# -module Yast - class InstPackagesClient < Client - def main - textdomain "packager" - - Yast.import "PackagesUI" - Yast.import "Stage" - Yast.import "Mode" - - #///////////////////////////////////////////////////////////////////////// - # MAIN - #///////////////////////////////////////////////////////////////////////// - - @result = :cancel - - Builtins.y2warning( - "Warning: inst_packages.ycp client is obsoleted, use module PackagesUI.ycp instead" - ) - Builtins.y2milestone( - "Stage: %1, Mode: %2, Args: %3", - Stage.stage, - Mode.mode, - WFM.Args - ) - - # installation or update from a running system (there is a "Pattern Selection" button) (#229951) - if Builtins.size(WFM.Args) == 0 && - (Stage.initial || Stage.normal && Mode.update) - @result = patternSelection - else - if Ops.greater_than(Builtins.size(WFM.Args), 0) && - Ops.is_map?(WFM.Args(0)) - Builtins.y2milestone( - "inst_packages called with options: %1", - WFM.Args - ) - - @mode = nil - @repo_mgr = nil - - # the options may be passed in a map or in a list - if Ops.is_map?(WFM.Args(0)) - @opts = Convert.to_map(WFM.Args(0)) - @mode = Ops.get_symbol(@opts, "dialog_type", :searchMode) - @repo_mgr = Ops.get_boolean(@opts, "repo_mgmt", false) - elsif Ops.is_symbol?(WFM.Args(0)) - @mode = Convert.to_symbol(WFM.Args(0)) - - @repo_mgr = WFM.Args(1) == :repoMgr if Ops.is_symbol?(WFM.Args(1)) - end - - @mode = :searchMode if @mode == nil - - @repo_mgr = Mode.normal if @repo_mgr == nil - - if @mode == :patternSelector || @mode == :pattern - @result = patternSelection - else - @result = detailedSelection(@mode, @repo_mgr, nil) - end - else - @result = detailedSelection(:searchMode, false, nil) - end - end - - @result - end - - # Start the detailed package selection. If 'mode' is non-nil, it will be - # passed as an option to the PackageSelector widget. - # - # Returns `accept or `cancel . - # - def detailedSelection(mode, enable_repo_mgr, display_support_status) - options = { - "mode" => mode, - "enable_repo_mgr" => enable_repo_mgr, - "display_support_status" => display_support_status - } - - PackagesUI.RunPackageSelector(options) - end - - # Start the pattern selection dialog. If the UI does not support the - # PatternSelector, start the detailed selection with "selections" as the - # initial view. - # - def patternSelection - PackagesUI.RunPatternSelector - end - end -end - -Yast::InstPackagesClient.new.main diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-3.2.14/src/clients/inst_productsources.rb new/yast2-packager-3.2.16/src/clients/inst_productsources.rb --- old/yast2-packager-3.2.14/src/clients/inst_productsources.rb 2017-02-06 10:52:35.561337791 +0100 +++ new/yast2-packager-3.2.16/src/clients/inst_productsources.rb 2017-02-16 17:14:05.398221488 +0100 @@ -136,6 +136,11 @@ @script_called_from_another = true end + # useful when do not want to skip already used repos, but need to call it from another client + if @script_noncmdline_args["script_called_from_another"] + @script_called_from_another = true + end + @main_link = "" @list_of_repos = {} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-3.2.14/src/clients/repositories.rb new/yast2-packager-3.2.16/src/clients/repositories.rb --- old/yast2-packager-3.2.14/src/clients/repositories.rb 2017-02-06 10:52:35.565337791 +0100 +++ new/yast2-packager-3.2.16/src/clients/repositories.rb 2017-02-16 17:14:05.414221488 +0100 @@ -12,6 +12,8 @@ # module Yast class RepositoriesClient < Client + include Yast::Logger + NO_SERVICE = :no_service NO_SERVICE_ITEM = :no_service_item @@ -567,7 +569,7 @@ Builtins.foreach(deleted_services) do |_alias| Builtins.y2milestone("Removing service %1", _alias) success = success && Pkg.ServiceDelete(_alias) - end + end Builtins.y2milestone("New service config: %1", @serviceStatesOut) @@ -589,7 +591,7 @@ Builtins.y2milestone("Modifying service %1", _alias) success = success && Pkg.ServiceSet(_alias, s) end - end + end # if started from the package manager we need to call these extra # pkg-bindings to sync the pool state @@ -635,7 +637,7 @@ success = success && Pkg.SourceRefreshNow(srcid) end - end + end success = success && KeyManager.Write @@ -1150,7 +1152,7 @@ global_current = Ops.add(global_current, 1) Ops.get(s, "SrcId") == Ops.get_integer(sourceState, "SrcId", -1) - end + end Builtins.y2milestone("global_current: %1", global_current) @@ -1170,244 +1172,9 @@ if input == :replace if @repository_view - generalData = Pkg.SourceGeneralData(id) - # use the full URL (incl. the password) when editing it - url2 = Pkg.SourceRawURL(id) - old_url = url2 - plaindir = Ops.get_string(generalData, "type", "YaST") == @plaindir_type - - SourceDialogs.SetRepoName(Ops.get_string(sourceState, "name", "")) - begin - url2 = SourceDialogs.EditPopupType(url2, plaindir) - - break if Builtins.size(url2) == 0 - - same_url = url2 == old_url - - Builtins.y2debug( - "same_url: %1 (old: %2, new: %3)", - same_url, - old_url, - url2 - ) - - # special check for cd:// and dvd:// repositories - if !same_url - new_url_parsed = URL.Parse(url2) - old_url_parsed = URL.Parse(old_url) - - new_url_scheme = Builtins.tolower( - Ops.get_string(new_url_parsed, "scheme", "") - ) - old_url_scheme = Builtins.tolower( - Ops.get_string(old_url_parsed, "scheme", "") - ) - - # ignore cd:// <-> dvd:// changes if the path is not changed - if (new_url_scheme == "cd" || new_url_scheme == "dvd") && - (old_url_scheme == "cd" || old_url_scheme == "dvd") - # compare only directories, ignore e.g. ?device=/dev/sr0 options - if Ops.get_string(new_url_parsed, "path", "") == - Ops.get_string(old_url_parsed, "path", "") - Pkg.SourceChangeUrl( - Ops.get_integer(sourceState, "SrcId", -1), - url2 - ) - same_url = true - end - end - end - - if !same_url || plaindir != SourceDialogs.IsPlainDir - Builtins.y2milestone( - "URL or plaindir flag changed, recreating the source" - ) - # copy the refresh flag - - # get current alias - _alias = Ops.get_string(generalData, "alias", "alias") - Builtins.y2milestone("Reusing alias: %1", _alias) - - createResult = createSourceWithAlias( - url2, - SourceDialogs.IsPlainDir, - Ops.get_boolean(sourceState, "do_refresh", false), - SourceDialogs.GetRepoName, - _alias - ) - if createResult == :ok - # restore the origonal properties (enabled, autorefresh, keeppackages) - # the added repository is at the end of the list - idx = Ops.subtract(Builtins.size(@sourceStatesOut), 1) - addedSource = Ops.get(@sourceStatesOut, idx, {}) - - Builtins.y2milestone("Orig repo: %1", sourceState) - Builtins.y2milestone("Added repo: %1", addedSource) - - if addedSource != {} - auto_refresh = Ops.get_boolean( - sourceState, - "autorefresh", - true - ) - keeppackages = Ops.get_boolean( - sourceState, - "keeppackages", - false - ) - enabled = Ops.get_boolean(sourceState, "enabled", true) - priority = Ops.get_integer( - sourceState, - "priority", - @default_priority - ) - Builtins.y2milestone( - "Restoring the original properties: enabled: %1, autorefresh: %2, keeppackages: %3, priority: %4", - enabled, - auto_refresh, - keeppackages, - priority - ) - - # set the original properties - Ops.set(addedSource, "autorefresh", auto_refresh) - Ops.set(addedSource, "keeppackages", keeppackages) - Ops.set(addedSource, "enabled", enabled) - Ops.set(addedSource, "priority", priority) - - # get the ID of the old repo and mark it for removal - srcid = Ops.get_integer( - @sourceStatesOut, - [global_current, "SrcId"], - -1 - ) - if srcid != -1 - @sourcesToDelete = Builtins.add(@sourcesToDelete, srcid) - SourceManager.just_removed_sources = Builtins.add( - SourceManager.just_removed_sources, - srcid - ) - end - - # replace the data - Ops.set(@sourceStatesOut, global_current, addedSource) - # remove the duplicate at the end - @sourceStatesOut = Builtins.remove(@sourceStatesOut, idx) - - # refresh only the name and URL in the table - UI.ChangeWidget( - Id(:table), - Cell(global_current, 3), - Ops.get_string(addedSource, "name", "") - ) - UI.ChangeWidget(Id(:table), Cell(global_current, 5), url2) - - fillCurrentRepoInfo - end - end - else - Builtins.y2milestone( - "URL is the same, not recreating the source" - ) - - new_name = SourceDialogs.GetRepoName - if new_name != Ops.get_string(sourceState, "name", "") - Ops.set(sourceState, "name", new_name) - Ops.set(@sourceStatesOut, global_current, sourceState) - - # update only the name cell in the table - UI.ChangeWidget( - Id(:table), - Cell(global_current, 3), - new_name - ) - - fillCurrentRepoInfo - else - Builtins.y2milestone( - "The repository name has not been changed" - ) - end - - createResult = :ok - end - end while createResult == :again # service view + repo_replace_handler(sourceState, global_current) else - service_info = Ops.get(@serviceStatesOut, current, {}) - Builtins.y2milestone("Editing service %1...", current) - url2 = Ops.get_string(service_info, "raw_url", "") - old_url = url2 - - SourceDialogs.SetRepoName( - Ops.get_string(service_info, "name", "") - ) - begin - url2 = SourceDialogs.EditPopupService(url2) - - break if Builtins.size(url2) == 0 - if url2 != old_url - Builtins.y2milestone( - "URL of the service has been changed, recreating the service" - ) - # createSource() can potentially create a repository instead of a service - # Probe for a service first must be done before creating a new service - service_type = Pkg.ServiceProbe(url2) - Builtins.y2milestone("Probed service type: %1", service_type) - - if service_type != nil && service_type != "NONE" - createResult = createSource( - url2, - false, - false, - SourceDialogs.GetRepoName - ) - if createResult == :ok - deleteService(current) - fillTable(@repository_view, @displayed_service) - fillCurrentRepoInfo - - # refresh also the combobox widget - UpdateCombobox() - end - else - Report.Error( - Builtins.sformat( - _("There is no service at URL:\n%1"), - url2 - ) - ) - end - else - Builtins.y2milestone( - "URL is the same, not recreating the service" - ) - entered_service_name = SourceDialogs.GetRepoName - old_service_name = Ops.get_string(service_info, "name", "") - - if old_service_name != entered_service_name - Builtins.y2milestone( - "Updating name of the service to '%1'", - entered_service_name - ) - Ops.set(service_info, "name", entered_service_name) - Ops.set(@serviceStatesOut, current, service_info) - fillTable(@repository_view, @displayed_service) - fillCurrentRepoInfo - createResult = :ok - - # update the reference - @sourceStatesOut = Builtins.maplist(@sourceStatesOut) do |src_state| - if Ops.get_string(src_state, "service", "") == old_service_name - Ops.set(src_state, "service", entered_service_name) - end - deep_copy(src_state) - end - - # refresh also the combobox widget - UpdateCombobox() - end - end - end while createResult == :again + service_replace_handler(current) end elsif input == :refresh if @repository_view @@ -1469,7 +1236,7 @@ to_refresh = Ops.add(to_refresh, 1) end end - end + end Builtins.y2milestone( @@ -1558,7 +1325,7 @@ Pkg.ServiceRefresh(service_alias) end end - end + end Progress.Finish @@ -1566,129 +1333,25 @@ end elsif input == :delete if @repository_view - # yes-no popup - if Popup.YesNo(_("Delete the selected repository from the list?")) - deleteSource(global_current) - fillTable(@repository_view, @displayed_service) - fillCurrentRepoInfo - end + repo_delete_handler(global_current) else - selected_service = Ops.get_string( - Ops.get(@serviceStatesOut, current, {}), - "name", - "" - ) - # yes-no popup - if Popup.YesNo( - Builtins.sformat( - _("Delete service %1\nand its repositories?"), - selected_service - ) - ) - service_alias = Ops.get_string( - Ops.get(@serviceStatesOut, current, {}), - "alias", - "" - ) - RemoveReposFromService(service_alias) - - deleteService(current) - fillTable(@repository_view, @displayed_service) - fillCurrentRepoInfo - - # refresh also the combobox widget - UpdateCombobox() - end + service_delete_handler(current) end elsif input == :enable if @repository_view - state = Ops.get_boolean(sourceState, "enabled", true) - state = !state - # corresponds to the "Enable/Disable" button - newstate = state ? UI.Glyph(:CheckMark) : "" - UI.ChangeWidget(Id(:table), term(:Item, current, 1), newstate) - Ops.set(sourceState, "enabled", state) - Ops.set(@sourceStatesOut, global_current, sourceState) + repo_enable_handler(sourceState, global_current, current) else - srv = Ops.get(@serviceStatesOut, current, {}) - Builtins.y2milestone("Selected service: %1", srv) - - state = Ops.get_boolean(srv, "enabled", false) - state = !state - - # disable/enable the repositories belonging to the service - service_alias = Ops.get_string( - Ops.get(@serviceStatesOut, current, {}), - "alias", - "" - ) - SetReposStatusFromService(service_alias, state) - - # update the table - newstate = state ? UI.Glyph(:CheckMark) : "" - UI.ChangeWidget(Id(:table), term(:Item, current, 0), newstate) - - # store the change - Ops.set(srv, "enabled", state) - Ops.set(@serviceStatesOut, current, srv) + service_enable_handler(current) end elsif input == :autorefresh if @repository_view - source_id = Ops.get_integer(sourceState, "SrcId", 0) - src_data = Pkg.SourceGeneralData(source_id) - type = Ops.get_string(src_data, "type", "") - state = Ops.get_boolean(sourceState, "autorefresh", true) - - if type == "PlainDir" && !state - # popup message - Popup.Message( - _("For the selected repository, refresh\ncannot be set.") - ) - else - state = !state - - newstate = state ? UI.Glyph(:CheckMark) : "" - UI.ChangeWidget(Id(:table), term(:Item, current, 2), newstate) - end - - Ops.set(sourceState, "autorefresh", state) - Ops.set(@sourceStatesOut, global_current, sourceState) + repo_autorefresh_handler(sourceState, global_current, current) else - srv = Ops.get(@serviceStatesOut, current, {}) - Builtins.y2milestone("Selected service: %1", srv) - - state = Ops.get_boolean(srv, "autorefresh", false) - state = !state - - # update the table - newstate = state ? UI.Glyph(:CheckMark) : "" - UI.ChangeWidget(Id(:table), term(:Item, current, 1), newstate) - - # store the change - Ops.set(srv, "autorefresh", state) - Ops.set(@serviceStatesOut, current, srv) + service_autorefresh_handler(current) end - - # do not refresh the item in the table - current = -1 elsif input == :priority if @repository_view - # refresh the value in the table - new_priority = Convert.to_integer( - UI.QueryWidget(Id(:priority), :Value) - ) - Builtins.y2debug("New priority: %1", new_priority) - - UI.ChangeWidget( - Id(:table), - term(:Item, current, 0), - PriorityToString(new_priority) - ) - Ops.set(sourceState, "priority", new_priority) - Ops.set(@sourceStatesOut, global_current, sourceState) - - # do not refresh the item in the table - current = -1 + repo_priority_handler(sourceState, global_current, current) else Builtins.y2error( "Ignoring event `priority: the widget should NOT be displayed in service mode!" @@ -1696,17 +1359,7 @@ end elsif input == :keeppackages if @repository_view - # refresh the value in the table - new_keep = Convert.to_boolean( - UI.QueryWidget(Id(:keeppackages), :Value) - ) - Builtins.y2milestone("New keep packages option: %1", new_keep) - - Ops.set(sourceState, "keeppackages", new_keep) - Ops.set(@sourceStatesOut, global_current, sourceState) - - # do not refresh the item in the table - current = -1 + repo_keeppackages_handler(sourceState, global_current) else Builtins.y2error( "Ignoring event `keeppackages: the widget should NOT be displayed in service mode!" @@ -1907,7 +1560,7 @@ @serviceStatesIn, Pkg.ServiceGet(srv_alias) ) - end + end Builtins.y2milestone("Loaded services: %1", @serviceStatesIn) @@ -1943,6 +1596,452 @@ UI.CloseDialog ret end + + # Handle the "Delete" button in the service view + # @param [Integer] current index of the selected item in the table + def service_delete_handler(current) + selected_service = @serviceStatesOut[current] || {} + + service_alias = selected_service["alias"] + msg = _("The services of type 'plugin' cannot be removed.") + return if !plugin_service_check(service_alias, msg) + + # yes-no popup + return if !Popup.YesNo( + Builtins.sformat( + _("Delete service %1\nand its repositories?"), + selected_service["name"] + ) + ) + + RemoveReposFromService(service_alias) + + deleteService(current) + fillTable(@repository_view, @displayed_service) + fillCurrentRepoInfo + + # refresh also the combobox widget + UpdateCombobox() + end + + # Handle the "Delete" button in the repository view + # @param [Integer] global_current index of the repository in the @sourceStatesOut + def repo_delete_handler(global_current) + repo = @sourceStatesOut[global_current] || {} + + msg = _("The repositories belonging to a service of type 'plugin' cannot be removed.") + return if !repo["service"].to_s.empty? && !plugin_service_check(repo["service"], msg) + + # yes-no popup + return if !Popup.YesNo(_("Delete the selected repository from the list?")) + + deleteSource(global_current) + fillTable(@repository_view, @displayed_service) + fillCurrentRepoInfo + end + + # Handle the "Enable" checkbox in the repository view + # @param [Hash] sourceState the current state of the repository or service + # @param [Integer] global_current index of the repository in the @sourceStatesOut + # @param [Integer] current index of the selected item in the table + def repo_enable_handler(sourceState, global_current, current) + repo = @sourceStatesOut[global_current] || {} + return if !repo["service"].to_s.empty? && !plugin_service_check(repo["service"], repo_change_msg) + + state = !sourceState["enabled"] + # corresponds to the "Enable/Disable" button + state_symbol = state ? UI.Glyph(:CheckMark) : "" + UI.ChangeWidget(Id(:table), term(:Item, current, 1), state_symbol) + sourceState["enabled"] = state + @sourceStatesOut[global_current] = sourceState + end + + # Handle the "Enable" checkbox in the service view + # @param [Integer] current index of the selected item in the table + def service_enable_handler(current) + srv = @serviceStatesOut[current] + return if !srv + + log.info("Selected service: #{srv}") + state = !srv["enabled"] + + # disable/enable the repositories belonging to the service + service_alias = srv["alias"] + return if !plugin_service_check(service_alias, plugin_change_msg) + + SetReposStatusFromService(service_alias, state) + + # update the table + state_symbol = state ? UI.Glyph(:CheckMark) : "" + UI.ChangeWidget(Id(:table), term(:Item, current, 0), state_symbol) + + # store the change + srv["enabled"] = state + @serviceStatesOut[current] = srv + end + + # Handle the "Autorefresh" checkbox in the repository view + # @param [Hash] sourceState the current state of the repository or service + # @param [Integer] global_current index of the repository in the @sourceStatesOut + # @param [Integer] current index of the selected item in the table + def repo_autorefresh_handler(sourceState, global_current, current) + source_id = sourceState["SrcId"] + src_data = Pkg.SourceGeneralData(source_id) + return if !plugin_service_check(sourceState["service"], repo_change_msg) + + type = src_data["type"] + state = !sourceState["autorefresh"] + + if type == "PlainDir" && state + # popup message + Popup.Message(_("For the selected repository, refresh\ncannot be set.")) + return + end + + new_symbol = state ? UI.Glyph(:CheckMark) : "" + UI.ChangeWidget(Id(:table), term(:Item, current, 2), new_symbol) + + sourceState["autorefresh"] = state + @sourceStatesOut[global_current] = sourceState + end + + # Handle the "Autorefresh" checkbox in the service view + # @param [Integer] current index of the selected item in the table + def service_autorefresh_handler(current) + srv = @serviceStatesOut[current] + log.info("Selected service: #{srv}") + + service_alias = srv["alias"] + return if !plugin_service_check(service_alias, plugin_change_msg) + + state = !srv["autorefresh"] + # update the table + new_symbol = state ? UI.Glyph(:CheckMark) : "" + UI.ChangeWidget(Id(:table), term(:Item, current, 1), new_symbol) + + # store the change + srv["autorefresh"] = state + @serviceStatesOut[current] = srv + end + + # Handle the "Priority" field in the repository view + # @param [Hash] sourceState the current state of the repository or service + # @param [Integer] global_current index of the repository in the @sourceStatesOut + # @param [Integer] current index of the selected item in the table + def repo_priority_handler(sourceState, global_current, current) + return if !plugin_service_check(sourceState["service"], repo_change_msg) + + # refresh the value in the table + new_priority = UI.QueryWidget(Id(:priority), :Value) + log.debug("New priority: #{new_priority}") + + UI.ChangeWidget( + Id(:table), + term(:Item, current, 0), + PriorityToString(new_priority) + ) + sourceState["priority"] = new_priority + @sourceStatesOut[global_current] = sourceState + end + + # Handle the "Keep packages" check box in the repository view + # @param [Hash] sourceState the current state of the repository or service + # @param [Integer] global_current index of the repository in the @sourceStatesOut + def repo_keeppackages_handler(sourceState, global_current) + return if !plugin_service_check(sourceState["service"], repo_change_msg) + + # refresh the value in the table + new_keep = UI.QueryWidget(Id(:keeppackages), :Value) + log.info("New keep packages option: #{new_keep}") + + sourceState["keeppackages"] = new_keep + @sourceStatesOut[global_current] = sourceState + end + + # Handle the "Edit" button in the repository view + # @param [Hash] sourceState the current state of the repository or service + # @param [Integer] global_current index of the repository in the @sourceStatesOut + def repo_replace_handler(sourceState, global_current) + id = sourceState["SrcId"] + generalData = Pkg.SourceGeneralData(id) + + return if !plugin_service_check(generalData["service"], repo_change_msg) + + # use the full URL (incl. the password) when editing it + url2 = Pkg.SourceRawURL(id) + old_url = url2 + plaindir = Ops.get_string(generalData, "type", "YaST") == @plaindir_type + + SourceDialogs.SetRepoName(Ops.get_string(sourceState, "name", "")) + begin + url2 = SourceDialogs.EditPopupType(url2, plaindir) + + break if Builtins.size(url2) == 0 + + same_url = url2 == old_url + + Builtins.y2debug( + "same_url: %1 (old: %2, new: %3)", + same_url, + old_url, + url2 + ) + + # special check for cd:// and dvd:// repositories + if !same_url + new_url_parsed = URL.Parse(url2) + old_url_parsed = URL.Parse(old_url) + + new_url_scheme = Builtins.tolower( + Ops.get_string(new_url_parsed, "scheme", "") + ) + old_url_scheme = Builtins.tolower( + Ops.get_string(old_url_parsed, "scheme", "") + ) + + # ignore cd:// <-> dvd:// changes if the path is not changed + if (new_url_scheme == "cd" || new_url_scheme == "dvd") && + (old_url_scheme == "cd" || old_url_scheme == "dvd") + # compare only directories, ignore e.g. ?device=/dev/sr0 options + if Ops.get_string(new_url_parsed, "path", "") == + Ops.get_string(old_url_parsed, "path", "") + Pkg.SourceChangeUrl( + Ops.get_integer(sourceState, "SrcId", -1), + url2 + ) + same_url = true + end + end + end + + if !same_url || plaindir != SourceDialogs.IsPlainDir + Builtins.y2milestone( + "URL or plaindir flag changed, recreating the source" + ) + # copy the refresh flag + + # get current alias + _alias = Ops.get_string(generalData, "alias", "alias") + Builtins.y2milestone("Reusing alias: %1", _alias) + + createResult = createSourceWithAlias( + url2, + SourceDialogs.IsPlainDir, + Ops.get_boolean(sourceState, "do_refresh", false), + SourceDialogs.GetRepoName, + _alias + ) + if createResult == :ok + # restore the origonal properties (enabled, autorefresh, keeppackages) + # the added repository is at the end of the list + idx = Ops.subtract(Builtins.size(@sourceStatesOut), 1) + addedSource = Ops.get(@sourceStatesOut, idx, {}) + + Builtins.y2milestone("Orig repo: %1", sourceState) + Builtins.y2milestone("Added repo: %1", addedSource) + + if addedSource != {} + auto_refresh = Ops.get_boolean( + sourceState, + "autorefresh", + true + ) + keeppackages = Ops.get_boolean( + sourceState, + "keeppackages", + false + ) + enabled = Ops.get_boolean(sourceState, "enabled", true) + priority = Ops.get_integer( + sourceState, + "priority", + @default_priority + ) + Builtins.y2milestone( + "Restoring the original properties: enabled: %1, autorefresh: %2, keeppackages: %3, priority: %4", + enabled, + auto_refresh, + keeppackages, + priority + ) + + # set the original properties + Ops.set(addedSource, "autorefresh", auto_refresh) + Ops.set(addedSource, "keeppackages", keeppackages) + Ops.set(addedSource, "enabled", enabled) + Ops.set(addedSource, "priority", priority) + + # get the ID of the old repo and mark it for removal + srcid = Ops.get_integer( + @sourceStatesOut, + [global_current, "SrcId"], + -1 + ) + if srcid != -1 + @sourcesToDelete = Builtins.add(@sourcesToDelete, srcid) + SourceManager.just_removed_sources = Builtins.add( + SourceManager.just_removed_sources, + srcid + ) + end + + # replace the data + Ops.set(@sourceStatesOut, global_current, addedSource) + # remove the duplicate at the end + @sourceStatesOut = Builtins.remove(@sourceStatesOut, idx) + + # refresh only the name and URL in the table + UI.ChangeWidget( + Id(:table), + Cell(global_current, 3), + Ops.get_string(addedSource, "name", "") + ) + UI.ChangeWidget(Id(:table), Cell(global_current, 5), url2) + + fillCurrentRepoInfo + end + end + else + Builtins.y2milestone( + "URL is the same, not recreating the source" + ) + + new_name = SourceDialogs.GetRepoName + if new_name != Ops.get_string(sourceState, "name", "") + Ops.set(sourceState, "name", new_name) + Ops.set(@sourceStatesOut, global_current, sourceState) + + # update only the name cell in the table + UI.ChangeWidget( + Id(:table), + Cell(global_current, 3), + new_name + ) + + fillCurrentRepoInfo + else + Builtins.y2milestone( + "The repository name has not been changed" + ) + end + + createResult = :ok + end + end while createResult == :again # service view + end + + # Handle the "Edit" button in the service view + # @param [Integer] current index of the selected item in the table + def service_replace_handler(current) + service_info = Ops.get(@serviceStatesOut, current, {}) + + service_alias = service_info["alias"] + return if !plugin_service_check(service_alias, plugin_change_msg) + + Builtins.y2milestone("Editing service %1...", current) + url2 = Ops.get_string(service_info, "raw_url", "") + old_url = url2 + + SourceDialogs.SetRepoName( + Ops.get_string(service_info, "name", "") + ) + begin + url2 = SourceDialogs.EditPopupService(url2) + + break if Builtins.size(url2) == 0 + if url2 != old_url + Builtins.y2milestone( + "URL of the service has been changed, recreating the service" + ) + # createSource() can potentially create a repository instead of a service + # Probe for a service first must be done before creating a new service + service_type = Pkg.ServiceProbe(url2) + Builtins.y2milestone("Probed service type: %1", service_type) + + if service_type != nil && service_type != "NONE" + createResult = createSource( + url2, + false, + false, + SourceDialogs.GetRepoName + ) + if createResult == :ok + deleteService(current) + fillTable(@repository_view, @displayed_service) + fillCurrentRepoInfo + + # refresh also the combobox widget + UpdateCombobox() + end + else + Report.Error( + Builtins.sformat( + _("There is no service at URL:\n%1"), + url2 + ) + ) + end + else + Builtins.y2milestone( + "URL is the same, not recreating the service" + ) + entered_service_name = SourceDialogs.GetRepoName + old_service_name = Ops.get_string(service_info, "name", "") + + if old_service_name != entered_service_name + Builtins.y2milestone( + "Updating name of the service to '%1'", + entered_service_name + ) + Ops.set(service_info, "name", entered_service_name) + Ops.set(@serviceStatesOut, current, service_info) + fillTable(@repository_view, @displayed_service) + fillCurrentRepoInfo + createResult = :ok + + # update the reference + @sourceStatesOut = Builtins.maplist(@sourceStatesOut) do |src_state| + if Ops.get_string(src_state, "service", "") == old_service_name + Ops.set(src_state, "service", entered_service_name) + end + deep_copy(src_state) + end + + # refresh also the combobox widget + UpdateCombobox() + end + end + end while createResult == :again + end + + # The message displayed when trying to change a plugin service + def plugin_change_msg + # TRANSLATORS: An error message + _("The services of type 'plugin' cannot be changed.") + end + + # The message displayed when trying to change a repository belonging + # to a plugin service + def repo_change_msg + # TRANSLATORS: An error message + _("The repositories belonging to a service of type 'plugin' cannot be changed.") + end + + # Check whether the service is of type "plugin", if yes display the message + # @see https://doc.opensuse.org/projects/libzypp/SLE12SP2/zypp-plugins.html#plugin-services + # @see https://doc.opensuse.org/projects/libzypp/SLE12SP2/zypp-services.html + # @param [String] service_alias Alias of the service + # @param [String] msg Error message displayed + # @return [Boolean] true if type of service is not "plugin", false otherwise + def plugin_service_check(service_alias, msg) + # check whether this is a repo from a plugin based service + serv_info = Pkg.ServiceGet(service_alias) + + return true if (serv_info["type"] != "plugin") + + Popup.Message(msg) + false + end end unless defined? (Yast::RepositoriesClient) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-3.2.14/src/modules/DefaultDesktop.rb new/yast2-packager-3.2.16/src/modules/DefaultDesktop.rb --- old/yast2-packager-3.2.14/src/modules/DefaultDesktop.rb 2017-02-06 10:52:35.569337791 +0100 +++ new/yast2-packager-3.2.16/src/modules/DefaultDesktop.rb 2017-02-16 17:14:05.474221488 +0100 @@ -281,13 +281,14 @@ end # Set the default desktop - # @param [String,nil] new_desktop one of those desktops defined in control file or nil + # @param [String,nil] new_desktop one of those desktops defined in control file or nil for no desktop selected def SetDesktop(new_desktop) Init() if new_desktop == nil # Reset the selected patterns Builtins.y2milestone("Reseting DefaultDesktop") + @desktop = nil # Do not overwrite the autoyast pattern selection by # the default desktop pattern selection (bnc#888981) @@ -400,6 +401,8 @@ def Description Init() + return "" unless @desktop + ProductControl.GetTranslatedText( Ops.get_string(@all_desktops, [@desktop, "label_id"], "") )
