Class: Packages::CommitResult

Inherits:
Object
  • Object
show all
Defined in:
library/packages/src/lib/packages/commit_result.rb

Overview

Commit results coming from libzypp

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(successful, failed, remaining, srcremaining, update_messages) ⇒ CommitResult

Constructor



52
53
54
55
56
57
58
# File 'library/packages/src/lib/packages/commit_result.rb', line 52

def initialize(successful, failed, remaining, srcremaining, update_messages)
  @successful = successful
  @failed = failed || []
  @remaining = remaining || []
  @srcremaining = srcremaining || []
  @update_messages = update_messages || []
end

Instance Attribute Details

#committedObject (readonly)

Returns the value of attribute committed



6
7
8
# File 'library/packages/src/lib/packages/commit_result.rb', line 6

def committed
  @committed
end

#failedObject (readonly)

Returns the value of attribute failed



6
7
8
# File 'library/packages/src/lib/packages/commit_result.rb', line 6

def failed
  @failed
end

#remainingObject (readonly)

Returns the value of attribute remaining



6
7
8
# File 'library/packages/src/lib/packages/commit_result.rb', line 6

def remaining
  @remaining
end

#srcremainingObject (readonly)

Returns the value of attribute srcremaining



6
7
8
# File 'library/packages/src/lib/packages/commit_result.rb', line 6

def srcremaining
  @srcremaining
end

#successfulObject (readonly)

Returns the value of attribute successful



6
7
8
# File 'library/packages/src/lib/packages/commit_result.rb', line 6

def successful
  @successful
end

#update_messagesObject (readonly)

Returns the value of attribute update_messages



6
7
8
# File 'library/packages/src/lib/packages/commit_result.rb', line 6

def update_messages
  @update_messages
end

Class Method Details

.build_update_messages(messages) ⇒ Array<Packager::UpdateMessage>

Convert an array of hash into an array of UpdateMessage objects

Each hash contains the following keys/values:

  • solvable: solvable name (usually package names).

  • text: message text.

  • installationPath: path to the libzypp's file containing the message

    after installation.
    
  • currentPath: path to the libzypp's file containing the message

    currently. It will differ from installationPath
    when running inst-sys.
    


34
35
36
37
38
39
# File 'library/packages/src/lib/packages/commit_result.rb', line 34

def build_update_messages(messages)
  messages.map do |msg|
    Packages::UpdateMessage.new(msg["solvable"], msg["text"],
      msg["installationPath"], msg["currentPath"])
  end
end

.from_result(result) ⇒ Object

Construct an instance taking as input the Pkg.Commit or Pkg.PkgCommit output

Pkg.Commit and Pkg.PkcCommit return an array with the following elements: [successful, failed, remaining, srcremaining, update_messages].



15
16
17
18
# File 'library/packages/src/lib/packages/commit_result.rb', line 15

def from_result(result)
  messages = build_update_messages(result[4] || [])
  new(result[0], result[1], result[2], result[3], messages)
end