libzypp: zypp/ZYppCommitResult.cc Source File

libzypp 17.38.9

ZYppCommitResult.cc
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12
13#include <iostream>
14#include <zypp-core/base/LogTools.h>
15
16#include <zypp/ZYppCommitResult.h>
17
19namespace zypp
20{
21
23 //
24 // CLASS NAME : ZYppCommitResult::Impl
25 //
27
28 class ZYppCommitResult::Impl
29 {
30 public:
31 Impl()
32 {}
33
34 public:
35 Pathname _root;
36 FalseBool _attemptToModify;
37 FalseBool _singleTransactionMode;
38 sat::Transaction _transaction;
39 TransactionStepList _transactionStepList;
40 UpdateNotifications _updateMessages;
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
54 ZYppCommitResult::ZYppCommitResult()
55 : _pimpl( new Impl )
56 {}
57
58 ZYppCommitResult::ZYppCommitResult( const ZYppCommitResult & lhs_r )
59 : _pimpl( lhs_r._pimpl )
60 {}
61
62 ZYppCommitResult::ZYppCommitResult( const Pathname & root_r )
63 : _pimpl( new Impl )
64 { _pimpl->_root = root_r; }
65
66 ZYppCommitResult::~ZYppCommitResult()
67 {}
68
69 const Pathname & ZYppCommitResult::root() const
70 { return _pimpl->_root; }
71
72 bool ZYppCommitResult::attemptToModify() const
73 { return _pimpl->_attemptToModify; }
74
75 void ZYppCommitResult::attemptToModify( bool yesno_r )
76 { _pimpl->_attemptToModify = yesno_r; }
77
78 bool ZYppCommitResult::singleTransactionMode() const
79 { return _pimpl->_singleTransactionMode; }
80
81 void ZYppCommitResult::setSingleTransactionMode( bool yesno_r )
82 { _pimpl->_singleTransactionMode = yesno_r; }
83
84 const sat::Transaction & ZYppCommitResult::transaction() const
85 { return _pimpl->_transaction; }
86
87 sat::Transaction & ZYppCommitResult::rTransaction()
88 { return _pimpl->_transaction; }
89
90 const ZYppCommitResult::TransactionStepList & ZYppCommitResult::transactionStepList() const
91 { return _pimpl->_transactionStepList; }
92
93 ZYppCommitResult::TransactionStepList & ZYppCommitResult::rTransactionStepList()
94 { return _pimpl->_transactionStepList; }
95
96 const UpdateNotifications & ZYppCommitResult::updateMessages() const
97 { return _pimpl->_updateMessages; }
98
99 UpdateNotifications & ZYppCommitResult::rUpdateMessages()
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
for_
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition Easy.h:27
LogTools.h
ZYppCommitResult.h
zypp::DefaultIntegral
Integral type with defined initial value when default constructed.
Definition defaultintegral.h:42
zypp::ZYppCommitResult::Impl
Definition ZYppCommitResult.cc:29
zypp::ZYppCommitResult::Impl::_transaction
sat::Transaction _transaction
Definition ZYppCommitResult.cc:38
zypp::ZYppCommitResult::Impl::_updateMessages
UpdateNotifications _updateMessages
Definition ZYppCommitResult.cc:40
zypp::ZYppCommitResult::Impl::_root
Pathname _root
Definition ZYppCommitResult.cc:35
zypp::ZYppCommitResult::Impl::_transactionStepList
TransactionStepList _transactionStepList
Definition ZYppCommitResult.cc:39
zypp::ZYppCommitResult::Impl::_attemptToModify
FalseBool _attemptToModify
Definition ZYppCommitResult.cc:36
zypp::ZYppCommitResult::Impl::rwcowClone
friend Impl * rwcowClone(const Impl *rhs)
zypp::ZYppCommitResult::Impl::clone
Impl * clone() const
clone for RWCOW_pointer
Definition ZYppCommitResult.cc:45
zypp::ZYppCommitResult::Impl::Impl
Impl()
Definition ZYppCommitResult.cc:31
zypp::ZYppCommitResult::Impl::_singleTransactionMode
FalseBool _singleTransactionMode
Definition ZYppCommitResult.cc:37
zypp::ZYppCommitResult
Result returned from ZYpp::commit.
Definition ZYppCommitResult.h:64
zypp::ZYppCommitResult::singleTransactionMode
bool singleTransactionMode() const
True if the commit was executed in one big rpm transaction.
Definition ZYppCommitResult.cc:78
zypp::ZYppCommitResult::~ZYppCommitResult
~ZYppCommitResult()
Definition ZYppCommitResult.cc:66
zypp::ZYppCommitResult::_pimpl
RWCOW_pointer< Impl > _pimpl
Pointer to data.
Definition ZYppCommitResult.h:190
zypp::ZYppCommitResult::attemptToModify
bool attemptToModify() const
True if at least one attempt to actually install/remove packages was made.
Definition ZYppCommitResult.cc:72
zypp::ZYppCommitResult::ZYppCommitResult
ZYppCommitResult()
Definition ZYppCommitResult.cc:54
zypp::ZYppCommitResult::root
const Pathname & root() const
Remembered root directory of the target.
Definition ZYppCommitResult.cc:69
zypp::ZYppCommitResult::rTransactionStepList
TransactionStepList & rTransactionStepList()
Manipulate transactionStepList.
Definition ZYppCommitResult.cc:93
zypp::ZYppCommitResult::updateMessages
const UpdateNotifications & updateMessages() const
List of update messages installed during this commit.
Definition ZYppCommitResult.cc:96
zypp::ZYppCommitResult::setSingleTransactionMode
void setSingleTransactionMode(bool yesno_r)
Definition ZYppCommitResult.cc:81
zypp::ZYppCommitResult::transactionStepList
const TransactionStepList & transactionStepList() const
List of sat::Transaction::Step to be executed by commit.
Definition ZYppCommitResult.cc:90
zypp::ZYppCommitResult::rUpdateMessages
UpdateNotifications & rUpdateMessages()
Manipulate updateMessages \Note Pathnames are relative to the targets root directory.
Definition ZYppCommitResult.cc:99
zypp::ZYppCommitResult::TransactionStepList
std::vector< sat::Transaction::Step > TransactionStepList
Definition ZYppCommitResult.h:66
zypp::ZYppCommitResult::transaction
const sat::Transaction & transaction() const
The full transaction list.
Definition ZYppCommitResult.cc:84
zypp::ZYppCommitResult::rTransaction
sat::Transaction & rTransaction()
Manipulate transaction.
Definition ZYppCommitResult.cc:87
zypp::filesystem::Pathname
Pathname.
Definition Pathname.h:48
zypp::sat::Transaction
Libsolv transaction wrapper.
Definition Transaction.h:52
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::sat::Transaction::actionEnd
action_iterator actionEnd() const
Pointer behind the last action step in transaction.
Definition Transaction.h:383
zypp::sat::Transaction::STEP_DONE
@ STEP_DONE
[OK] success
Definition Transaction.h:74
zypp::sat::Transaction::STEP_TODO
@ STEP_TODO
[__] unprocessed
Definition Transaction.h:73
zypp::sat::Transaction::STEP_ERROR
@ STEP_ERROR
[**] error
Definition Transaction.h:75
str
String related utilities and Regular expression matching.
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition CodePitfalls.doc:2
zypp::UpdateNotifications
std::list< UpdateNotificationFile > UpdateNotifications
Definition ZYppCommitResult.h:48
zypp::FalseBool
DefaultIntegral< bool, false > FalseBool
relates: DefaultIntegral false initialized bool
Definition defaultintegral.h:91
zypp::operator<<
std::ostream & operator<<(std::ostream &str, const Capabilities &obj)
relates: Capabilities Stream output
Definition Capabilities.cc:65