Class: Yast::SoftwareSimpleProposalClient

Inherits:
Client
  • Object
show all
Defined in:
src/clients/software_simple_proposal.rb

Overview

Proposal function dispatcher - software.

Instance Method Summary collapse

Instance Method Details

#mainObject


5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'src/clients/software_simple_proposal.rb', line 5

def main
  textdomain "packager"

  Yast.import "Packages"

  @func = Convert.to_string(WFM.Args(0))
  @param = Convert.to_map(WFM.Args(1))
  @ret = {}

  if @func == "MakeProposal"
    @force_reset = Ops.get_boolean(@param, "force_reset", false)
    @language_changed = Ops.get_boolean(@param, "language_changed", false)

    Builtins.y2milestone(
      "package proposal: force reset: %1, reinit: %2, language changed: %3",
      @force_reset,
      false,
      @language_changed
    )

    @ret = Packages.Proposal(
      false, # user decision: reset to default
      false, # reinitialize due to language or partition change
      true
    )

    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
    deep_copy(@ret)
  else
    WFM.CallFunction("software_proposal", [@func, @param])
  end
end