libzypp  17.28.5
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:
36  FalseBool _attemptToModify;
41 
42  private:
43  friend Impl * rwcowClone<Impl>( const Impl * rhs );
45  Impl * clone() const { return new Impl( *this ); }
46  };
47 
49  //
50  // CLASS NAME : ZYppCommitResult
51  //
53 
55  : _pimpl( new Impl )
56  {}
57 
59  : _pimpl( lhs_r._pimpl )
60  {}
61 
63  : _pimpl( new Impl )
64  { _pimpl->_root = root_r; }
65 
67  {}
68 
70  { return _pimpl->_root; }
71 
73  { return _pimpl->_attemptToModify; }
74 
75  void ZYppCommitResult::attemptToModify( bool yesno_r )
76  { _pimpl->_attemptToModify = yesno_r; }
77 
79  { return _pimpl->_singleTransactionMode; }
80 
82  { _pimpl->_singleTransactionMode = yesno_r; }
83 
85  { return _pimpl->_transaction; }
86 
88  { return _pimpl->_transaction; }
89 
91  { return _pimpl->_transactionStepList; }
92 
94  { return _pimpl->_transactionStepList; }
95 
97  { return _pimpl->_updateMessages; }
98 
100  { return _pimpl->_updateMessages; }
101 
103 
104  std::ostream & operator<<( std::ostream & str, const ZYppCommitResult & obj )
105  {
106  DefaultIntegral<unsigned,0> result[4];
107  for_( it, obj.transaction().actionBegin(), obj.transaction().actionEnd() )
108  {
109  ++result[0];
110  switch ( it->stepStage() )
111  {
112  case sat::Transaction::STEP_DONE : ++result[1]; break;
113  case sat::Transaction::STEP_ERROR : ++result[2]; break;
114  case sat::Transaction::STEP_TODO : ++result[3]; break;
115  }
116  }
117  str << "CommitResult "
118  << " (total " << result[0]
119  << ", done " << result[1]
120  << ", error " << result[2]
121  << ", skipped " << result[3]
122  << ", updateMessages " << obj.updateMessages().size()
123  << ")";
124  return str;
125  }
126 
128 } // namespace zypp
const Pathname & root() const
Remembered root directory of the target.
std::vector< sat::Transaction::Step > TransactionStepList
Result returned from ZYpp::commit.
std::ostream & operator<<(std::ostream &str, const InputStream &obj)
Definition: InputStream.cc:166
TransactionStepList & rTransactionStepList()
Manipulate transactionStepList.
const sat::Transaction & transaction() const
The full transaction list.
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition: Easy.h:28
String related utilities and Regular expression matching.
TransactionStepList _transactionStepList
Libsolv transaction wrapper.
Definition: Transaction.h:51
bool singleTransactionMode() const
True if the commit was executed in one big rpm transaction, this can be used to figure out when its r...
RWCOW_pointer< Impl > _pimpl
Pointer to data.
UpdateNotifications _updateMessages
UpdateNotifications & rUpdateMessages()
Manipulate updateMessages Pathnames are relative to the targets root directory.
bool attemptToModify() const
True if at least one attempt to actually install/remove packages was made.
void setSingleTransactionMode(bool yesno_r)
std::list< UpdateNotificationFile > UpdateNotifications
const TransactionStepList & transactionStepList() const
List of sat::Transaction::Step to be executed by commit.
action_iterator actionEnd() const
Pointer behind the last action step in transaction.
Definition: Transaction.h:383
Impl * clone() const
clone for RWCOW_pointer
sat::Transaction & rTransaction()
Manipulate transaction.
const UpdateNotifications & updateMessages() const
List of update messages installed during this commit.
action_iterator actionBegin(StepStages filter_r=StepStages()) const
Pointer to the 1st action step in [filtered] transaction.
Definition: Transaction.h:380
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1