13 #include <solv/transaction.h>
14 #include <solv/solver.h>
50 friend std::ostream &
operator<<( std::ostream & str,
const Impl & obj );
53 typedef std::tr1::unordered_set<detail::IdType>
set_type;
54 typedef std::tr1::unordered_map<detail::IdType,detail::IdType>
map_type;
63 ,
_arch( solv_r.arch() )
70 typedef std::tr1::unordered_map<detail::IdType,PostMortem>
pmmap_type;
84 if ( ! (*it).status().transacts() )
87 decisionq.
push( solv.isSystem() ? -solv.id() : solv.id() );
92 noobsq.
push( SOLVER_NOOBSOLETES | SOLVER_SOLVABLE_NAME );
93 noobsq.
push( it->id() );
96 ::solver_calculate_noobsmap(
myPool().getPool(), noobsq, noobsmap );
97 _trans = ::transaction_create_decisionq(
myPool().getPool(), decisionq, noobsmap );
129 { ::transaction_free(
_trans ); }
145 ::transaction_order(
_trans, SOLVER_TRANSACTION_KEEP_ORDERDATA );
151 int ret = transaction_order_add_choices(
_trans, chosen, choices );
152 MIL << ret <<
": " << chosen <<
": " << choices << endl;
161 ::transaction_order(
_trans, 0 );
168 {
return(
_trans->steps.count == 0 ); }
171 {
return _trans->steps.count; }
197 switch( ::transaction_type(
_trans, solv_r.
id(), SOLVER_TRANSACTION_RPM_ONLY ) )
215 pmmap_type::const_iterator it(
_pmMap.find( solv_r.
id() ) );
216 return( it ==
_pmMap.end() ? _none : it->second );
222 map_type::const_iterator res(
_linkMap.find( solv_r.
id() ) );
223 return( res ==
_linkMap.end() ? solv_r.
id() : res->second );
227 {
return( set_r.find( sid_r ) != set_r.end() ); }
241 if ( stage != newval_r )
258 if ( solv_r &&
_trans->steps.elements )
284 static shared_ptr<Impl> _nullimpl(
new Impl );
292 return str <<
"Transaction: " << obj.
size() <<
" (" << (obj.
valid()?
"valid":
"INVALID") <<
")";
302 : _pimpl(
Impl::nullimpl() )
306 : _pimpl( new
Impl( loadFromPool ) )
313 {
return _pimpl->valid(); }
316 {
return _pimpl->order(); }
319 {
return _pimpl->empty(); }
322 {
return _pimpl->size(); }
343 {
return str << *obj.
_pimpl; }
367 {
return _pimpl->stepType( _solv ); }
370 {
return _pimpl->stepStage( _solv ); }
373 {
_pimpl->stepStage( _solv, val_r ); }
376 {
return _solv ? _solv.ident() :
_pimpl->pmdata(_solv )._ident; }
379 {
return _solv ? _solv.edition() :
_pimpl->pmdata(_solv )._edition; }
382 {
return _solv ? _solv.arch() :
_pimpl->pmdata(_solv )._arch; }
390 str <<
'[' << obj.
ident() <<
'-' << obj.
edition() <<
'.' << obj.
arch() <<
']';
398 #define OUTS(E,S) case Transaction::E: return str << #S; break
412 #define OUTS(E,S) case Transaction::E: return str << #S; break
418 return str <<
"[??]";
429 Transaction_const_iterator::Transaction_const_iterator()
435 , _pimpl( iter_r._pimpl )
Simple serial number watcher.
int IdType
Generic Id type.
A Solvable object within the sat Pool.
Transaction const_iterator.
[M] Install(multiversion) item (
bool isIn(const set_type &set_r, detail::IdType sid_r) const
std::ostream & operator<<(std::ostream &str, const LocaleSupport &obj)
iterator find(const RW_pointer< Transaction::Impl > &self_r, const sat::Solvable &solv_r)
bool operator==(const Map &lhs, const Map &rhs)
StepStage stepStage(Solvable solv_r) const
detail::IdType resolve(const Solvable &solv_r) const
const_iterator find(const sat::Solvable &solv_r) const
Return iterator pointing to solv_r or end.
bool isSystem() const
Return whether this Solvable belongs to the system repo.
StepStage
Step action result.
Transaction()
Default ctor: empty transaction.
Access to the sat-pools string space.
Libsolv transaction wrapper.
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Edition represents [epoch:]version[-release]
std::ostream & operator<<(std::ostream &str, const Transaction::Impl &obj)
iterator begin(const RW_pointer< Transaction::Impl > &self_r)
StepType stepType(Solvable solv_r) const
std::tr1::unordered_map< detail::IdType, detail::IdType > map_type
const_iterator begin() const
Iterator to the first TransactionStep.
StepStage stepStage() const
Step action result.
[ ] Nothing (includes implicit deletes due to obsoletes and non-package actions)
void push(value_type val_r)
Push a value to the end off the Queue.
void stepStage(detail::IdType sid_r, StepStage newval_r)
StepType stepType() const
Type of action to perform in this step.
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
PostMortem(const sat::Solvable &solv_r)
static Pool instance()
Singleton ctor.
value_type pop_front()
Pop and return the 1st Id from the queue or 0 if empty.
Backlink to the associated PoolImpl.
RW_pointer< Impl > _pimpl
Pointer to implementation.
mutable::Transaction * _trans
const_iterator end(const RW_pointer< Transaction::Impl > &self_r) const
friend std::ostream & operator<<(std::ostream &str, const Transaction &obj)
A single step within a Transaction.
SerialNumberWatcher _watcher
const PostMortem & pmdata(Solvable solv_r) const
detail::Transaction_const_iterator const_iterator
Transaction implementation.
Transaction_const_iterator()
bool order()
Order transaction steps for commit.
bool isClean(unsigned serial_r) const
Return whether serial_r is still unchanged.
bool valid() const
Whether transaction actually contains data and also fits the current pools content.
static PoolImpl & myPool()
const_iterator begin(const RW_pointer< Transaction::Impl > &self_r) const
std::ostream & dumpOn(std::ostream &str, const LocaleSupport &obj)
Solvable satSolvable() const
Return the corresponding Solvable.
Libsolv Id queue wrapper.
StepType
Type of (rpm) action to perform in a Step.
DefaultIntegral< bool, false > _ordered
size_t size() const
Number of steps in transaction steps.
sat::Solvable buddy() const
Return the buddy we share our status object with.
detail::IdType * _find(const sat::Solvable &solv_r) const
const_iterator find(const RW_pointer< Transaction::Impl > &self_r, const sat::Solvable &solv_r) const
bool empty() const
Whether the transaction contains any steps.
const_iterator end() const
Iterator behind the last TransactionStep.
static shared_ptr< Impl > nullimpl()
Offer default Impl.
std::tr1::unordered_set< detail::IdType > set_type
int erase(const Pathname &path)
Erase whatever happens to be located at path (file or directory).
Wrapper for const correct access via Smart pointer types.
friend std::ostream & operator<<(std::ostream &str, const Impl &obj)
Reference to a PoolItem connecting ResObject and ResStatus.
IdType id() const
Expert backdoor.
StepStage stepStage(detail::IdType sid_r) const
std::tr1::unordered_map< detail::IdType, PostMortem > pmmap_type
bool isKind(const ResKind &kind_r) const
Test whether a Solvable is of a certain ResKind.
iterator end(const RW_pointer< Transaction::Impl > &self_r)
Libsolv (bit)Map wrapper.
void stepStage(Solvable solv_r, StepStage newval_r)
detail::Transaction_iterator iterator
static ResPool instance()
Singleton ctor.