#
SET(LIBZYPP_MAJOR "17")
SET(LIBZYPP_COMPATMINOR "9")
-SET(LIBZYPP_MINOR "10")
-SET(LIBZYPP_PATCH "3")
+SET(LIBZYPP_MINOR "11")
+SET(LIBZYPP_PATCH "0")
#
-# LAST RELEASED: 17.10.3 (9)
+# LAST RELEASED: 17.11.0 (9)
# (The number in parenthesis is LIBZYPP_COMPATMINOR)
#=======
-------------------------------------------------------------------
+Fri Jan 11 10:24:33 CET 2019 - ma@suse.de
+
+- PoolItemBest: Optionally prefer not locked packages (for bsc#1113296)
+- ui::Selectable: add `hasLocks` to indicate a partially locked
+ item (for bsc#1113296)
+- version 17.11.0 (9)
+
+-------------------------------------------------------------------
Tue Dec 18 14:01:19 CET 2018 - ma@suse.de
- Simplify complex locks so zypper can display them (bsc#1112911)
/** PoolItemBest implementation. */
struct PoolItemBest::Impl
{
+ Impl( bool preferNotLocked_r )
+ : _preferNotLocked { preferNotLocked_r }
+ {}
+
Container _container;
+ bool _preferNotLocked;
private:
friend Impl * rwcowClone<Impl>( const Impl * rhs );
//
///////////////////////////////////////////////////////////////////
+ void PoolItemBest::_ctor_init( bool preferNotLocked_r )
+ { _dont_use_this_use_pimpl.reset( new RWCOW_pointer<Impl>(new Impl( preferNotLocked_r )) ); }
+
void PoolItemBest::_ctor_init()
- { _dont_use_this_use_pimpl.reset( new RWCOW_pointer<Impl>(new Impl) ); }
+ { _ctor_init( /*preferNotLocked*/false ); }
const PoolItemBest::Container & PoolItemBest::container() const
{ return pimpl()->_container; }
void PoolItemBest::add( const PoolItem & pi_r )
{
Container & container( pimpl()->_container );
+
PoolItem & ccand( container[pi_r.satSolvable().ident()] );
- if ( ! ccand || ui::SelectableTraits::AVOrder()( pi_r, ccand ) )
+ if ( ! ccand )
+ ccand = pi_r;
+ else if ( pimpl()->_preferNotLocked )
+ {
+ if ( ! pi_r.status().isLocked() )
+ {
+ if ( ccand.status().isLocked() || ui::SelectableTraits::AVOrder()( pi_r, ccand ) )
+ ccand = pi_r;
+ }
+ else if ( ccand.status().isLocked() )
+ {
+ if ( ui::SelectableTraits::AVOrder()( pi_r, ccand ) )
+ ccand = pi_r;
+ }
+ }
+ else if ( ui::SelectableTraits::AVOrder()( pi_r, ccand ) )
ccand = pi_r;
}
* sorts the \ref ui::Selectable list of available objects, thus follows the
* same rules the \ref resolver will apply.
*
+ * Ctor argument \ref preferNotLocked causes locked packages to be considered
+ * less than not locked packages.
+ *
* \code
* PoolQuery q;
* q.addAttribute(sat::SolvAttr::name, "lib*");
typedef MapKVIteratorTraits<Container>::Key_const_iterator ident_iterator;
public:
+ /** Indicator argument for ctor: consider locked packages less than not locked packages. */
+ static constexpr bool preferNotLocked = true;
+
+ public:
/** Default ctor. */
- PoolItemBest()
- { _ctor_init(); }
+ PoolItemBest( bool preferNotLocked_r = false )
+ { _ctor_init( preferNotLocked_r ); }
/** Ctor feeding a \ref sat::Solvable. */
- PoolItemBest( sat::Solvable slv_r )
- { _ctor_init(); add( slv_r ); }
+ PoolItemBest( sat::Solvable slv_r, bool preferNotLocked_r = false )
+ { _ctor_init( preferNotLocked_r ); add( slv_r ); }
/** Ctor feeding a \ref PoolItem. */
- PoolItemBest( const PoolItem & pi_r )
- { _ctor_init(); add( pi_r ); }
+ PoolItemBest( const PoolItem & pi_r, bool preferNotLocked_r = false )
+ { _ctor_init( preferNotLocked_r ); add( pi_r ); }
/** Ctor feeding a range of \ref sat::Solvable or \ref PoolItem. */
template<class TIterator>
- PoolItemBest( TIterator begin_r, TIterator end_r )
- { _ctor_init(); add( begin_r, end_r ); }
+ PoolItemBest( TIterator begin_r, TIterator end_r, bool preferNotLocked_r = false )
+ { _ctor_init( preferNotLocked_r ); add( begin_r, end_r ); }
public:
/** Feed one \ref sat::Solvable. */
//@}
private:
- void _ctor_init();
+ void _ctor_init( bool preferNotLocked_r );
+ void _ctor_init(/*preferNotLocked = false*/); ///< bin.compat legacy
const Container & container() const;
private:
/** Implementation */
static void logSat( CPool *, void *data, int type, const char *logString )
{
// "1234567890123456789012345678901234567890
+ if ( 0 == strncmp( logString, "job: user installed", 19 ) )
+ return;
+ if ( 0 == strncmp( logString, "job: multiversion", 17 ) )
+ return;
if ( 0 == strncmp( logString, " - no rule created", 19 ) )
return;
if ( 0 == strncmp( logString, " next rules: 0 0", 19 ) )
void SATResolver::setLocks()
{
+ unsigned icnt = 0;
+ unsigned acnt = 0;
+
for (PoolItemList::const_iterator iter = _items_to_lock.begin(); iter != _items_to_lock.end(); ++iter) {
sat::detail::SolvableIdType ident( (*iter)->satSolvable().id() );
if (iter->status().isInstalled()) {
- MIL << "Lock installed item " << *iter << endl;
+ ++icnt;
queue_push( &(_jobQueue), SOLVER_INSTALL | SOLVER_SOLVABLE );
queue_push( &(_jobQueue), ident );
} else {
- MIL << "Lock NOT installed item " << *iter << endl;
+ ++acnt;
queue_push( &(_jobQueue), SOLVER_ERASE | SOLVER_SOLVABLE | MAYBE_CLEANDEPS );
queue_push( &(_jobQueue), ident );
}
}
+ MIL << "Locked " << icnt << " installed items and " << acnt << " NOT installed items." << endl;
///////////////////////////////////////////////////////////////////
// Weak locks: Ignore if an item with this name is already installed.
void Selectable::setLicenceConfirmed( bool val_r )
{ _pimpl->setLicenceConfirmed( val_r ); }
+ bool Selectable::hasLocks() const
+ { return _pimpl->hasLocks(); }
Selectable::Fate Selectable::fate() const
{
bool unmodified() const
{ return fate() == UNMODIFIED; }
- /** True if locked (subclass of unmodified). */
+ /** True if locked (subclass of unmodified).
+ * The \ref locked status indicates that \b all installed and/or \b all available
+ * items are locked. So you can't remove and/or can't install any item. This
+ * is the common case.
+ * \see \ref hasLocks
+ */
bool locked() const
{ Status st( status() ); return( st == S_Protected || st == S_Taboo ); }
+ /** True if it includes locked items (don't mix this with the \ref locked status).
+ * This is also \c true for partially locked items, where only specific versions
+ * are locked.
+ * \see \ref locked
+ */
+ bool hasLocks() const;
+
/** True if either to delete or to install */
bool toModify() const
{ return fate() != UNMODIFIED; }
void setLicenceConfirmed( bool val_r )
{ if ( candidateObj() ) candidateObj().status().setLicenceConfirmed( val_r ); }
+ /** \copydoc Selectable::hasLocks()const */
+ bool hasLocks() const
+ {
+ for ( const PoolItem & pi : available() )
+ {
+ if ( pi.status().isLocked() )
+ return true;
+ }
+ for ( const PoolItem & pi : installed() )
+ {
+ if ( pi.status().isLocked() )
+ return true;
+ }
+ return false;
+ }
+
private:
PoolItem transactingInstalled() const
{