libzypp  13.10.6
ZYppCommitResult.cc
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
13 #include <iostream>
14 #include "zypp/base/LogTools.h"
15 
16 #include "zypp/ZYppCommitResult.h"
17 
19 namespace zypp
20 {
21 
23  //
24  // CLASS NAME : ZYppCommitResult::Impl
25  //
27 
29  {
30  public:
31  Impl()
32  {}
33 
34  public:
35  Pathname _root;
39 
40  private:
41  friend Impl * rwcowClone<Impl>( const Impl * rhs );
43  Impl * clone() const { return new Impl( *this ); }
44  };
45 
47  //
48  // CLASS NAME : ZYppCommitResult
49  //
51 
53  : _pimpl( new Impl )
54  {}
55 
57  : _pimpl( lhs_r._pimpl )
58  {}
59 
60  ZYppCommitResult::ZYppCommitResult( const Pathname & root_r )
61  : _pimpl( new Impl )
62  { _pimpl->_root = root_r; }
63 
65  {}
66 
67  const Pathname & ZYppCommitResult::root() const
68  { return _pimpl->_root; }
69 
71  { return _pimpl->_transaction; }
72 
74  { return _pimpl->_transaction; }
75 
77  { return _pimpl->_transactionStepList; }
78 
80  { return _pimpl->_transactionStepList; }
81 
83  { return _pimpl->_updateMessages; }
84 
86  { return _pimpl->_updateMessages; }
87 
89 
90  std::ostream & operator<<( std::ostream & str, const ZYppCommitResult & obj )
91  {
93  for_( it, obj.transaction().actionBegin(), obj.transaction().actionEnd() )
94  {
95  ++result[0];
96  switch ( it->stepStage() )
97  {
98  case sat::Transaction::STEP_DONE : ++result[1]; break;
99  case sat::Transaction::STEP_ERROR : ++result[2]; break;
100  case sat::Transaction::STEP_TODO : ++result[3]; break;
101  }
102  }
103  str << "CommitResult "
104  << " (total " << result[0]
105  << ", done " << result[1]
106  << ", error " << result[2]
107  << ", skipped " << result[3]
108  << ", updateMessages " << obj.updateMessages().size()
109  << ")";
110  return str;
111  }
112 
114 } // namespace zypp
std::vector< sat::Transaction::Step > TransactionStepList
Result returned from ZYpp::commit.
TransactionStepList & rTransactionStepList()
Manipulate transactionStepList.
TransactionStepList _transactionStepList
Libsolv transaction wrapper.
Definition: Transaction.h:54
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition: Easy.h:27
const UpdateNotifications & updateMessages() const
List of update messages installed during this commit.
const Pathname & root() const
Remembered root directory of the target.
const TransactionStepList & transactionStepList() const
List of sat::Transaction::Step to be executed by commit.
std::ostream & operator<<(std::ostream &str, const Exception &obj)
Definition: Exception.cc:120
RWCOW_pointer< Impl > _pimpl
Pointer to data.
UpdateNotifications _updateMessages
UpdateNotifications & rUpdateMessages()
Manipulate updateMessages Pathnames are relative to the targets root directory.
action_iterator actionEnd() const
Pointer behind the last action step in transaction.
Definition: Transaction.h:372
Impl * clone() const
clone for RWCOW_pointer
std::list< UpdateNotificationFile > UpdateNotifications
action_iterator actionBegin(StepStages filter_r=StepStages()) const
Pointer to the 1st action step in [filtered] transaction.
Definition: Transaction.h:369
const sat::Transaction & transaction() const
The full transaction list.
sat::Transaction & rTransaction()
Manipulate transaction.