Class: Yast::PackageClass

Inherits:
Module
  • Object
show all
Defined in:
library/packages/src/modules/Package.rb

Instance Method Summary collapse

Instance Method Details

#Available(package) ⇒ Object



172
173
174
175
176
177
178
179
# File 'library/packages/src/modules/Package.rb', line 172

def Available(package)
  function = Convert.convert(
    Ops.get(functions, "Available"),
    from: "any",
    to:   "boolean (string)"
  )
  function.call(package)
end

#DoInstall(packages) ⇒ Object

Install list of packages

Parameters:

  • packages (Array<String>)

    list of packages to be installed

Returns:

  • True on success



134
135
136
137
138
139
140
141
142
# File 'library/packages/src/modules/Package.rb', line 134

def DoInstall(packages)
  packages = deep_copy(packages)
  function = Convert.convert(
    Ops.get(functions, "DoInstall"),
    from: "any",
    to:   "boolean (list <string>)"
  )
  function.call(packages)
end

#DoInstallAndRemove(toinstall, toremove) ⇒ Object

Install and Remove list of packages in one go

Parameters:

  • toinstall (Array<String>)

    list of packages to be installed

  • toremove (Array<String>)

    list of packages to be removed

Returns:

  • True on success



161
162
163
164
165
166
167
168
169
170
# File 'library/packages/src/modules/Package.rb', line 161

def DoInstallAndRemove(toinstall, toremove)
  toinstall = deep_copy(toinstall)
  toremove = deep_copy(toremove)
  function = Convert.convert(
    Ops.get(functions, "DoInstallAndRemove"),
    from: "any",
    to:   "boolean (list <string>, list <string>)"
  )
  function.call(toinstall, toremove)
end

#DoRemove(packages) ⇒ Object

Remove list of packages

Parameters:

  • packages (Array<String>)

    list of packages to be removed

Returns:

  • True on success



147
148
149
150
151
152
153
154
155
# File 'library/packages/src/modules/Package.rb', line 147

def DoRemove(packages)
  packages = deep_copy(packages)
  function = Convert.convert(
    Ops.get(functions, "DoRemove"),
    from: "any",
    to:   "boolean (list <string>)"
  )
  function.call(packages)
end

#functionsObject

If Yast is running in the autoyast configuration mode no changes will be done on the target system by using the PackageAI class.



127
128
129
# File 'library/packages/src/modules/Package.rb', line 127

def functions
  Mode.config ? @FunctionsAI : @FunctionsSystem
end

#Installed(package) ⇒ Object



181
182
183
184
185
186
187
188
# File 'library/packages/src/modules/Package.rb', line 181

def Installed(package)
  function = Convert.convert(
    Ops.get(functions, "Installed"),
    from: "any",
    to:   "boolean (string)"
  )
  function.call(package)
end

#InstallKernel(kernel_modules) ⇒ Object



208
209
210
211
212
213
214
215
216
# File 'library/packages/src/modules/Package.rb', line 208

def InstallKernel(kernel_modules)
  kernel_modules = deep_copy(kernel_modules)
  function = Convert.convert(
    Ops.get(functions, "InstallKernel"),
    from: "any",
    to:   "boolean (list <string>)"
  )
  function.call(kernel_modules)
end

#mainObject



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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'library/packages/src/modules/Package.rb', line 39

def main
  textdomain "base"

  Yast.import "Mode"
  Yast.import "PackageAI"
  Yast.import "PackageSystem"

  # **
  # Packages Manipulation

  @FunctionsSystem = {
    "DoInstall"          => fun_ref(
      PackageSystem.method(:DoInstall),
      "boolean (list <string>)"
    ),
    "DoRemove"           => fun_ref(
      PackageSystem.method(:DoRemove),
      "boolean (list <string>)"
    ),
    "DoInstallAndRemove" => fun_ref(
      PackageSystem.method(:DoInstallAndRemove),
      "boolean (list <string>, list <string>)"
    ),
    "Available"          => fun_ref(
      PackageSystem.method(:Available),
      "boolean (string)"
    ),
    "Installed"          => fun_ref(
      PackageSystem.method(:Installed),
      "boolean (string)"
    ),
    "InstallKernel"      => fun_ref(
      PackageSystem.method(:InstallKernel),
      "boolean (list <string>)"
    ),
    "PackageInstalled"   => fun_ref(
      PackageSystem.method(:PackageInstalled),
      "boolean (string)"
    ),
    "PackageAvailable"   => fun_ref(
      PackageSystem.method(:PackageAvailable),
      "boolean (string)"
    )
  }

  @FunctionsAI = {
    "DoInstall"          => fun_ref(
      PackageAI.method(:DoInstall),
      "boolean (list <string>)"
    ),
    "DoRemove"           => fun_ref(
      PackageAI.method(:DoRemove),
      "boolean (list <string>)"
    ),
    "DoInstallAndRemove" => fun_ref(
      PackageAI.method(:DoInstallAndRemove),
      "boolean (list <string>, list <string>)"
    ),
    "Available"          => fun_ref(
      PackageAI.method(:Available),
      "boolean (string)"
    ),
    "Installed"          => fun_ref(
      PackageAI.method(:Installed),
      "boolean (string)"
    ),
    "InstallKernel"      => fun_ref(
      PackageAI.method(:InstallKernel),
      "boolean (list <string>)"
    ),
    "PackageInstalled"   => fun_ref(
      PackageAI.method(:PackageInstalled),
      "boolean (string)"
    ),
    "PackageAvailable"   => fun_ref(
      PackageAI.method(:PackageAvailable),
      "boolean (string)"
    )
  }

  @last_op_canceled = false

  Yast.include self, "packages/common.rb"
end

#PackageAvailable(package) ⇒ Object



190
191
192
193
194
195
196
197
# File 'library/packages/src/modules/Package.rb', line 190

def PackageAvailable(package)
  function = Convert.convert(
    Ops.get(functions, "PackageAvailable"),
    from: "any",
    to:   "boolean (string)"
  )
  function.call(package)
end

#PackageInstalled(package) ⇒ Object



199
200
201
202
203
204
205
206
# File 'library/packages/src/modules/Package.rb', line 199

def PackageInstalled(package)
  function = Convert.convert(
    Ops.get(functions, "PackageInstalled"),
    from: "any",
    to:   "boolean (string)"
  )
  function.call(package)
end