bool Selectable::multiversionInstall() const
{ return _pimpl->multiversionInstall(); }
+ bool Selectable::pickInstall( const PoolItem & pi_r, ResStatus::TransactByValue causer_r, bool yesno_r )
+ { return _pimpl->pickInstall( pi_r, causer_r, yesno_r ); }
+
+ bool Selectable::pickDelete( const PoolItem & pi_r, ResStatus::TransactByValue causer_r, bool yesno_r )
+ { return _pimpl->pickDelete( pi_r, causer_r, yesno_r ); }
+
+ ////////////////////////////////////////////////////////////////////////
+
bool Selectable::isUndetermined() const
{ return _pimpl->isUndetermined(); }
*/
bool isUnmaintained() const;
+ /** \name Multiversion install.
+ *
+ * Using \ref pickInstall or \ref pickDelete with non-multiversionInstall items
+ * is possible, but additional constraints will apply. E.g. selecting one item for
+ * install will deselect any other.
+ */
+ //@{
/** Whether different versions of this package can be installed at the same time.
* Per default \c false. \see also \ref ZConfig::multiversion.
*/
bool multiversionInstall() const;
+ /** Select a specific available item for installation.
+ */
+ bool pickInstall( const PoolItem & pi_r, ResStatus::TransactByValue causer_r = ResStatus::USER, bool yesno_r = true );
+
+ /** Deselect a specific available item from installation.
+ */
+ bool pickNoInstall( const PoolItem & pi_r, ResStatus::TransactByValue causer_r = ResStatus::USER )
+ { return pickInstall( pi_r, causer_r, false ); }
+
+ /** Select a specific installed item for deletion.
+ */
+ bool pickDelete( const PoolItem & pi_r, ResStatus::TransactByValue causer_r = ResStatus::USER, bool yesno_r = true );
+
+ /** Deselect a specific installed item from deletion.
+ */
+ bool pickNoDelete( const PoolItem & pi_r, ResStatus::TransactByValue causer_r = ResStatus::USER )
+ { return pickDelete( pi_r, causer_r, false ); }
+ //@}
+
/** \name Classification of available patches (pseudo installed items).
* A patch is either \c not \c relevant, \c satisfied or \c broken.
* The same applies to other pseudo installed kinds.
return _candidate = newCandidate;
}
+ bool Selectable::Impl::pickInstall( const PoolItem & pi_r, ResStatus::TransactByValue causer_r, bool yesno_r )
+ {
+ if ( pi_r.satSolvable().ident() != ident() || pi_r.satSolvable().isSystem() )
+ return false; // not my PoolItem or an installed one
+
+ return pi_r.status().setTransact( yesno_r, causer_r );
+ }
+
+ bool Selectable::Impl::pickDelete( const PoolItem & pi_r, ResStatus::TransactByValue causer_r, bool yesno_r )
+ {
+ if ( pi_r.satSolvable().ident() != ident() || ! pi_r.satSolvable().isSystem() )
+ return false; // not my PoolItem or not installed
+
+ return pi_r.status().setTransact( yesno_r, causer_r );
+ }
+
ResStatus::TransactByValue Selectable::Impl::modifiedBy() const
{
PoolItem cand( candidateObj() );
/** */
bool setStatus( const Status state_r, ResStatus::TransactByValue causer_r );
- /** Installed object. */
+ /** Installed object (transacting ot highest version). */
PoolItem installedObj() const
{
- if (!installedEmpty())
- return *_installedItems.begin();
+ if ( installedEmpty() )
return PoolItem();
+ PoolItem ret( transactingInstalled() );
+ return ret ? ret : *_installedItems.begin();
}
/** Best among available objects.
*/
PoolItem updateCandidateObj() const
{
- if ( installedEmpty() || ! _defaultCandidate )
+ if ( multiversionInstall() || installedEmpty() || ! _defaultCandidate )
return _defaultCandidate;
- // Here: installed and _defaultCandidate are non NULL.
+ // Here: installed and _defaultCandidate are non NULL and it's not a
+ // multiversion install.
// update candidate must come from the highest priority repo
if ( _defaultCandidate->repoInfo().priority() != (*availableBegin())->repoInfo().priority() )
PoolItem theObj() const
{
PoolItem ret( candidateObj() );
- if (ret)
- return ret;
-
- if ( ! _installedItems.empty() )
- return (*_installedItems.begin());
-
- return PoolItem();
+ if ( ret )
+ return ret;
+ return installedObj();
}
////////////////////////////////////////////////////////////////////////
bool multiversionInstall() const
{ return theObj().satSolvable().multiversionInstall(); }
+ bool pickInstall( const PoolItem & pi_r, ResStatus::TransactByValue causer_r, bool yesno_r );
+
+ bool pickDelete( const PoolItem & pi_r, ResStatus::TransactByValue causer_r, bool yesno_r );
+
+ ////////////////////////////////////////////////////////////////////////
+
bool isUndetermined() const
{
PoolItem cand( candidateObj() );
{ if ( candidateObj() ) candidateObj().status().setLicenceConfirmed( val_r ); }
private:
+ PoolItem transactingInstalled() const
+ {
+ for_( it, installedBegin(), installedEnd() )
+ {
+ if ( (*it).status().transacts() )
+ return (*it);
+ }
+ return PoolItem();
+ }
+
PoolItem transactingCandidate() const
{
- for ( available_const_iterator it = availableBegin();
- it != availableEnd(); ++it )
+ for_( it, availableBegin(), availableEnd() )
{
if ( (*it).status().transacts() )
return (*it);
PoolItem defaultCandidate() const
{
- if ( !installedEmpty() )
+ if ( ! ( multiversionInstall() || installedEmpty() ) )
{
// prefer the installed objects arch and vendor
bool solver_allowVendorChange( ZConfig::instance().solver_allowVendorChange() );
str << " (I 0) {}" << endl << " ";
else
{
+ PoolItem icand( obj.installedObj() );
str << " (I " << obj.installedSize() << ") {" << endl;
for_( it, obj.installedBegin(), obj.installedEnd() )
{
- str << " " << *it << endl;
+ char t = ' ';
+ if ( *it == icand )
+ {
+ t = 'i';
+ }
+ str << " " << t << " " << *it << endl;
}
str << "} ";
}