libzypp: zypp::ZYppCommitResult Class Reference

libzypp 17.38.14

zypp::ZYppCommitResult Class Reference

Result returned from ZYpp::commit. More...

`#include <zypp/ZYppCommitResult.h>`

## Classes
class | Impl

## Public Types
using | TransactionStepList = std::vector<sat::Transaction::Step>

## Public Member Functions
| ZYppCommitResult ()
| ZYppCommitResult (const ZYppCommitResult &lhs_r)
| ZYppCommitResult (const Pathname &root_r)
| ~ZYppCommitResult ()
const Pathname & | root () const
| Remembered root directory of the target.
bool | attemptToModify () const
| `True` if at least one attempt to actually install/remove packages was made.
void | attemptToModify (bool yesno_r)
| Set attemptToModify.
bool | singleTransactionMode () const
| `True` if the commit was executed in one big rpm transaction.
void | setSingleTransactionMode (bool yesno_r)
const sat::Transaction & | transaction () const
| The full transaction list.
sat::Transaction & | rTransaction ()
| Manipulate transaction.
const TransactionStepList & | transactionStepList () const
| List of sat::Transaction::Step to be executed by commit.
TransactionStepList & | rTransactionStepList ()
| Manipulate transactionStepList.
const UpdateNotifications & | updateMessages () const
| List of update messages installed during this commit.
UpdateNotifications & | rUpdateMessages ()
| Manipulate updateMessages \Note Pathnames are relative to the targets root directory.

## Some statistics based on \ref Transaction
Class Transaction allows to count and iterate the action steps to get more detailed information about the transaction result. Here are just a few convenience methods for easy evaluation. ZYppCommitResult result; const sat::Transaction & trans( result.transaction() ); for_( it, trans.actionBegin(~sat::Transaction::STEP_DONE), trans.actionEnd() ) { // process all steps not DONE (ERROR and TODO) if ( it->satSolvable() ) std::cout << it->satSolvable() << endl; else // deleted @System solvable: print post mortem data available std::cout << it->ident() << endl; } for_ #define for_(IT, BEG, END) Convenient for-loops using iterator. Definition Easy.h:27 zypp::ZYppCommitResult::ZYppCommitResult ZYppCommitResult() Definition ZYppCommitResult.cc:54 zypp::ZYppCommitResult::transaction const sat::Transaction & transaction() const The full transaction list. Definition ZYppCommitResult.cc:84 zypp::sat::Transaction Libsolv transaction wrapper. Definition Transaction.h:52 zypp::sat::Transaction::STEP_DONE @ STEP_DONE [OK] success Definition Transaction.h:74 See also Transaction, transaction()
RWCOW_pointer< Impl > | _pimpl
| Pointer to data.
bool | allDone () const
| Whether all steps were performed successfully (none skipped or error).
bool | noError () const
| Whether an error ocurred (skipped streps are ok).

## Detailed Description

Result returned from ZYpp::commit.

Note
  Transaction data are provided and maintained during commit. Though the interface does not inhibit manipulation of transaction data outside commit (those methods could have been made `private:`), this is not recommended as you may easily mess up things.

See also
  ZYpp::commit

Definition at line 63 of file ZYppCommitResult.h.

## Member Typedef Documentation

## ◆ TransactionStepList

using zypp::ZYppCommitResult::TransactionStepList = std::vector<sat::Transaction::Step>

Definition at line 66 of file ZYppCommitResult.h.

## Constructor & Destructor Documentation

## ◆ ZYppCommitResult() [1/3]

zypp::ZYppCommitResult::ZYppCommitResult | ( |  | ) |

Definition at line 54 of file ZYppCommitResult.cc.

## ◆ ZYppCommitResult() [2/3]

zypp::ZYppCommitResult::ZYppCommitResult | ( | const ZYppCommitResult & | lhs_r | ) |

Definition at line 58 of file ZYppCommitResult.cc.

## ◆ ZYppCommitResult() [3/3]

zypp::ZYppCommitResult::ZYppCommitResult | ( | const Pathname & | root_r | ) |

Definition at line 62 of file ZYppCommitResult.cc.

## ◆ ~ZYppCommitResult()

zypp::ZYppCommitResult::~ZYppCommitResult | ( |  | ) |

Definition at line 66 of file ZYppCommitResult.cc.

## Member Function Documentation

## ◆ root()

const Pathname & zypp::ZYppCommitResult::root | ( |  | ) | const

Remembered root directory of the target.

\Note Pathnames within this class are relative to the targets root directory.

Definition at line 69 of file ZYppCommitResult.cc.

## ◆ attemptToModify() [1/2]

bool zypp::ZYppCommitResult::attemptToModify | ( |  | ) | const

`True` if at least one attempt to actually install/remove packages was made.

While this is false there should have been no serious modifications to the system. Mainly used to detect whether commit failed while preloading the caches or within the real action.

Definition at line 72 of file ZYppCommitResult.cc.

## ◆ attemptToModify() [2/2]

void zypp::ZYppCommitResult::attemptToModify | ( | bool | yesno_r | ) |

Set attemptToModify.

Definition at line 75 of file ZYppCommitResult.cc.

## ◆ singleTransactionMode()

bool zypp::ZYppCommitResult::singleTransactionMode | ( |  | ) | const

`True` if the commit was executed in one big rpm transaction.

This can be used to figure out when it is required to show more information about which packages failed during the transaction, because otherwise, that information might get lost in the backlog.

Definition at line 78 of file ZYppCommitResult.cc.

## ◆ setSingleTransactionMode()

void zypp::ZYppCommitResult::setSingleTransactionMode | ( | bool | yesno_r | ) |

Definition at line 81 of file ZYppCommitResult.cc.

## ◆ transaction()

const sat::Transaction & zypp::ZYppCommitResult::transaction | ( |  | ) | const

The full transaction list.

The complete list including transaction steps that do not require any action (like obsoletes or non-package actions). Depending on ZYppCommitPolicy::restrictToMedia only a subset of this transaction might have been executed.

See also
  transactionStepList.

Definition at line 84 of file ZYppCommitResult.cc.

## ◆ rTransaction()

sat::Transaction & zypp::ZYppCommitResult::rTransaction | ( |  | ) |

Manipulate transaction.

Definition at line 87 of file ZYppCommitResult.cc.

## ◆ transactionStepList()

const ZYppCommitResult::TransactionStepList & zypp::ZYppCommitResult::transactionStepList | ( |  | ) | const

List of sat::Transaction::Step to be executed by commit.

The list of transaction step commit actually tried to execute.

Definition at line 90 of file ZYppCommitResult.cc.

## ◆ rTransactionStepList()

ZYppCommitResult::TransactionStepList & zypp::ZYppCommitResult::rTransactionStepList | ( |  | ) |

Manipulate transactionStepList.

Definition at line 93 of file ZYppCommitResult.cc.

## ◆ updateMessages()

const UpdateNotifications & zypp::ZYppCommitResult::updateMessages | ( |  | ) | const

List of update messages installed during this commit.

\Note Pathnames are relative to the targets root directory.

ZYppCommitResult result;
...
if ( ! result.updateMessages().empty() )
{
MIL << "Received " << result.updateMessages().size() << " update notification(s):" << endl;
for_( it, result.updateMessages().begin(), result.updateMessages().end() )
{
MIL << "- From " << it->solvable().asString() << " in file " << Pathname::showRootIf( result.root(), it->file() ) << ":" << endl;
{
// store message files content in a string:
InputStream istr( Pathname::assertprefix( result.root(), it->file() ) );
std::ostringstream strstr;
iostr::copy( istr, strstr );
std::string message( strstr.str() ); // contains the message
}
{
// or write out the message file indented:
InputStream istr( Pathname::assertprefix( result.root(), it->file() ) );
iostr::copyIndent( istr, MIL, "> " ) << endl;
}
}
}
MIL
#define MIL
Definition Logger.h:103
zypp::InputStream
Helper to create and pass std::istream.
Definition inputstream.h:57
zypp::Pathname::assertprefix
static Pathname assertprefix(const Pathname &root_r, const Pathname &path_r)
Unless path_r does not already denote a path below root_r, combine them.
Definition Pathname.cc:272
zypp::Pathname::showRootIf
static std::string showRootIf(const Pathname &root_r, const Pathname &path_r)
String representation as "(root)/path", unless root is "/" or empty.
Definition Pathname.cc:195
zypp::ZYppCommitResult::root
const Pathname & root() const
Remembered root directory of the target.
Definition ZYppCommitResult.cc:69
zypp::ZYppCommitResult::updateMessages
const UpdateNotifications & updateMessages() const
List of update messages installed during this commit.
Definition ZYppCommitResult.cc:96
zypp::iostr::copyIndent
std::ostream & copyIndent(std::istream &from_r, std::ostream &to_r, const std::string &indent_r="> ")
Copy istream to ostream, prefixing each line with indent_r (default "> " ).
Definition IOStream.h:65
zypp::iostr::copy
std::ostream & copy(std::istream &from_r, std::ostream &to_r)
Copy istream to ostream.
Definition IOStream.h:51

Definition at line 96 of file ZYppCommitResult.cc.

## ◆ rUpdateMessages()

UpdateNotifications & zypp::ZYppCommitResult::rUpdateMessages | ( |  | ) |

Manipulate updateMessages \Note Pathnames are relative to the targets root directory.

Definition at line 99 of file ZYppCommitResult.cc.

## ◆ allDone()

bool zypp::ZYppCommitResult::allDone | ( |  | ) | const
| inline

Whether all steps were performed successfully (none skipped or error).

Definition at line 177 of file ZYppCommitResult.h.

## ◆ noError()

bool zypp::ZYppCommitResult::noError | ( |  | ) | const
| inline

Whether an error ocurred (skipped streps are ok).

Definition at line 181 of file ZYppCommitResult.h.

## Member Data Documentation

## ◆ _pimpl

RWCOW_pointer<Impl> zypp::ZYppCommitResult::_pimpl
| private

Pointer to data.

Definition at line 190 of file ZYppCommitResult.h.

The documentation for this class was generated from the following files:

- zypp/ZYppCommitResult.h
- zypp/ZYppCommitResult.cc