libzypp  17.23.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;
40 
41  private:
42  friend Impl * rwcowClone<Impl>( const Impl * rhs );
44  Impl * clone() const { return new Impl( *this ); }
45  };
46 
48  //
49  // CLASS NAME : ZYppCommitResult
50  //
52 
54  : _pimpl( new Impl )
55  {}
56 
58  : _pimpl( lhs_r._pimpl )
59  {}
60 
62  : _pimpl( new Impl )
63  { _pimpl->_root = root_r; }
64 
66  {}
67 
69  { return _pimpl->_root; }
70 
72  { return _pimpl->_attemptToModify; }
73 
74  void ZYppCommitResult::attemptToModify( bool yesno_r )
75  { _pimpl->_attemptToModify = yesno_r; }
76 
78  { return _pimpl->_transaction; }
79 
81  { return _pimpl->_transaction; }
82 
84  { return _pimpl->_transactionStepList; }
85 
87  { return _pimpl->_transactionStepList; }
88 
90  { return _pimpl->_updateMessages; }
91 
93  { return _pimpl->_updateMessages; }
94 
96 
97  std::ostream & operator<<( std::ostream & str, const ZYppCommitResult & obj )
98  {
100  for_( it, obj.transaction().actionBegin(), obj.transaction().actionEnd() )
101  {
102  ++result[0];
103  switch ( it->stepStage() )
104  {
105  case sat::Transaction::STEP_DONE : ++result[1]; break;
106  case sat::Transaction::STEP_ERROR : ++result[2]; break;
107  case sat::Transaction::STEP_TODO : ++result[3]; break;
108  }
109  }
110  str << "CommitResult "
111  << " (total " << result[0]
112  << ", done " << result[1]
113  << ", error " << result[2]
114  << ", skipped " << result[3]
115  << ", updateMessages " << obj.updateMessages().size()
116  << ")";
117  return str;
118  }
119 
121 } // namespace zypp
zypp::ZYppCommitResult::Impl::Impl
Impl()
Definition: ZYppCommitResult.cc:31
zypp::sat::Transaction::STEP_DONE
[OK] success
Definition: Transaction.h:74
zypp::ZYppCommitResult::ZYppCommitResult
ZYppCommitResult()
Definition: ZYppCommitResult.cc:53
zypp::ZYppCommitResult::Impl::_transaction
sat::Transaction _transaction
Definition: ZYppCommitResult.cc:37
zypp::ZYppCommitResult::rTransactionStepList
TransactionStepList & rTransactionStepList()
Manipulate transactionStepList.
Definition: ZYppCommitResult.cc:86
zypp::ZYppCommitResult::rTransaction
sat::Transaction & rTransaction()
Manipulate transaction.
Definition: ZYppCommitResult.cc:80
zypp::sat::Transaction
Libsolv transaction wrapper.
Definition: Transaction.h:51
zypp::sat::Transaction::actionBegin
action_iterator actionBegin(StepStages filter_r=StepStages()) const
Pointer to the 1st action step in [filtered] transaction.
Definition: Transaction.h:380
zypp::ZYppCommitResult::~ZYppCommitResult
~ZYppCommitResult()
Definition: ZYppCommitResult.cc:65
zypp::ZYppCommitResult::transactionStepList
const TransactionStepList & transactionStepList() const
List of sat::Transaction::Step to be executed by commit.
Definition: ZYppCommitResult.cc:83
zypp::ZYppCommitResult::Impl
Definition: ZYppCommitResult.cc:28
LogTools.h
zypp::sat::Transaction::STEP_ERROR
[**] error
Definition: Transaction.h:75
zypp::ZYppCommitResult::_pimpl
RWCOW_pointer< Impl > _pimpl
Pointer to data.
Definition: ZYppCommitResult.h:178
zypp::ZYppCommitResult::root
const Pathname & root() const
Remembered root directory of the target.
Definition: ZYppCommitResult.cc:68
zypp::ZYppCommitResult::Impl::_attemptToModify
FalseBool _attemptToModify
Definition: ZYppCommitResult.cc:36
ZYppCommitResult.h
zypp::ZYppCommitResult::rUpdateMessages
UpdateNotifications & rUpdateMessages()
Manipulate updateMessages \Note Pathnames are relative to the targets root directory.
Definition: ZYppCommitResult.cc:92
zypp::ZYppCommitResult::Impl::clone
Impl * clone() const
clone for RWCOW_pointer
Definition: ZYppCommitResult.cc:44
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
zypp::ZYppCommitResult
Result returned from ZYpp::commit.
Definition: ZYppCommitResult.h:62
zypp::ZYppCommitResult::TransactionStepList
std::vector< sat::Transaction::Step > TransactionStepList
Definition: ZYppCommitResult.h:65
zypp::ZYppCommitResult::attemptToModify
bool attemptToModify() const
True if at least one attempt to actually install/remove packages was made.
Definition: ZYppCommitResult.cc:71
zypp::ZYppCommitResult::Impl::_transactionStepList
TransactionStepList _transactionStepList
Definition: ZYppCommitResult.cc:38
zypp::DefaultIntegral< unsigned, 0 >
zypp::sat::Transaction::STEP_TODO
[__] unprocessed
Definition: Transaction.h:73
zypp::ZYppCommitResult::Impl::_root
Pathname _root
Definition: ZYppCommitResult.cc:35
zypp::sat::Transaction::actionEnd
action_iterator actionEnd() const
Pointer behind the last action step in transaction.
Definition: Transaction.h:383
zypp::operator<<
std::ostream & operator<<(std::ostream &str, const Exception &obj)
Definition: Exception.cc:147
for_
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition: Easy.h:28
zypp::ZYppCommitResult::transaction
const sat::Transaction & transaction() const
The full transaction list.
Definition: ZYppCommitResult.cc:77
zypp::filesystem::Pathname
Pathname.
Definition: Pathname.h:44
zypp::ZYppCommitResult::updateMessages
const UpdateNotifications & updateMessages() const
List of update messages installed during this commit.
Definition: ZYppCommitResult.cc:89
zypp::UpdateNotifications
std::list< UpdateNotificationFile > UpdateNotifications
Definition: ZYppCommitResult.h:47
str
String related utilities and Regular expression matching.
zypp::ZYppCommitResult::Impl::_updateMessages
UpdateNotifications _updateMessages
Definition: ZYppCommitResult.cc:39