Class: Yast::SoftwareProposalClient

Inherits:
Installation::ProposalClient
  • Object
show all
Defined in:
src/lib/packager/clients/software_proposal.rb

Overview

Software installation proposal

Instance Method Summary collapse

Constructor Details

#initializeSoftwareProposalClient


27
28
29
30
31
32
33
34
# File 'src/lib/packager/clients/software_proposal.rb', line 27

def initialize
  Yast.import "Pkg"
  textdomain "packager"

  Yast.import "Packages"
  Yast.import "Language"
  Yast.import "Installation"
end

Instance Method Details

#ask_user(params) ⇒ Object


99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'src/lib/packager/clients/software_proposal.rb', line 99

def ask_user(params)
  chosen_id = params["chosen_id"]
  if chosen_id == "mediacheck"
    @result = Convert.to_symbol(WFM.CallFunction("checkmedia", WFM.Args))
  else
    @result = :again
    @client_to_call = "inst_sw_select"

    while @result == :again
      @result = Convert.to_symbol(
        WFM.CallFunction(@client_to_call, [true, true])
      )
    end
  end
  @ret = { "workflow_sequence" => @result }
end

#descriptionObject


116
117
118
119
120
121
122
123
124
125
126
127
# File 'src/lib/packager/clients/software_proposal.rb', line 116

def description
  # disable proposal if doing image-only installation
  return nil if Installation.image_only

  {
    # this is a heading
    "rich_text_title" => _("Software"),
    # this is a menu entry
    "menu_title"      => _("&Software"),
    "id"              => "software_stuff"
  }
end

#make_proposal(flags) ⇒ Object


36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'src/lib/packager/clients/software_proposal.rb', line 36

def make_proposal(flags)
  @force_reset = flags.fetch("force_reset", false)

  @language_changed = adjust_locales
  @language_changed ||= flags.fetch("language_changed", false)

  # if only partitioning has been changed just return the current state,
  # don't reset to default (bnc#450786, bnc#371875)
  if partitioning_changed? && !@language_changed && !@force_reset &&
      !Packages.PackagesProposalChanged
    @ret = Packages.Summary([:product, :pattern, :selection, :size, :desktop], false)
  else
    @reinit = @language_changed
    Builtins.y2milestone(
      "package proposal: force reset: %1, reinit: %2, language changed: %3",
      @force_reset,
      @reinit,
      @language_changed
    )
    @ret = Packages.Proposal(
      @force_reset, # user decision: reset to default
      @reinit, # reinitialize due to language or partition change
      false
    ) # simple version
  end

  if @language_changed && !@force_reset
    # if the  language has changed the software proposal is reset to the default settings
    if !Builtins.haskey(@ret, "warning")
      # the language_changed flag has NOT been set by the NLD frame
      @ret = Builtins.add(
        @ret,
        "warning",
        _("The software proposal is reset to the default values.")
      )
    end
  end
  if Ops.greater_than(Packages.solve_errors, 0)
    # the proposal for the packages requires manual intervention
    @ret = Builtins.union(
      @ret,
      # warning text
      "warning"       => _(
        "Cannot solve dependencies automatically. Manual intervention is required."
      ),
      "warning_level" => :blocker
    )
  end
  remote_installation_error = Packages.check_remote_installation_packages
  unless remote_installation_error.empty?
    # The Default warning_level is "error". So the user can continue
    # installation.
    if @ret["warning"]
      @ret["warning"] << "\n"
      @ret["warning"] << remote_installation_error
    else
      @ret["warning"] = remote_installation_error
    end
  end

  @ret
end