-------------------------------------------------------------------
+Tue May 23 17:26:41 CEST 2006 - ma@suse.de
+
+- Added PoolItem_Ref::statusReset. Resets the PoolItem status without
+ loosing autoprotection (eg. for foreign vendor). (assists #177469)
+
+-------------------------------------------------------------------
Tue May 23 17:04:04 CEST 2006 - jsrain@suse.cz
- added mediaNr() to PatchRpm and DeltaRpm classes
Tue May 23 15:58:04 CEST 2006 - dmacvicar@suse.de
- enable YUM license to confirm.
- needed for #174476
+ needed for #174476
- adapt store to serialize and read all new resobject fields
- use install-time to now() when serializing (#174653)
- rev 3427
*
*/
#include <iostream>
-//#include "zypp/base/Logger.h"
+#include "zypp/base/Logger.h"
#include "zypp/PoolItem.h"
+#include "zypp/Package.h"
+#include "zypp/VendorAttr.h"
using std::endl;
const ResStatus & status_r = ResStatus() )
: _status( status_r )
, _resolvable( res_r )
- {}
+ {
+ autoprotect();
+ }
ResStatus & status() const
{ return _status; }
+ ResStatus & statusReset() const
+ {
+ if ( ! autoprotect() )
+ {
+ _status.setLock( false, zypp::ResStatus::USER );
+ _status.resetTransact( zypp::ResStatus::USER );
+ }
+ return _status;
+ }
+
ResObject::constPtr resolvable() const
{ return _resolvable; }
+ bool autoprotect() const;
+
private:
mutable ResStatus _status;
ResObject::constPtr _resolvable;
return str;
}
+ inline bool PoolItem_Ref::Impl::autoprotect() const
+ {
+ if ( _status.isInstalled()
+ && isKind<Package>( _resolvable )
+ && VendorAttr::instance().autoProtect( _resolvable->vendor() ) )
+ {
+ _status.setLock( true, zypp::ResStatus::USER );
+ MIL << "Protect vendor '" << _resolvable->vendor() << "' " << *this << endl;
+ return true;
+ }
+ return false;
+ }
+
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : PoolItem_Ref
ResStatus & PoolItem_Ref::status() const
{ return _pimpl->status(); }
+ ResStatus & PoolItem_Ref::statusReset() const
+ { return _pimpl->statusReset(); }
+
ResObject::constPtr PoolItem_Ref::resolvable() const
{ return _pimpl->resolvable(); }
~PoolItem_Ref();
public:
- /** Returns */
+ /** Returns the current status. */
ResStatus & status() const;
+ /** Reset status (applies autoprotection). */
+ ResStatus & statusReset() const;
+
/** Returns the ResObject::constPtr.
* \see \ref operator->
*/
* ------------------------------------------------------------------------------- */
PoolImpl::Item item( ptr_r, ResStatus (_installed) );
-
/* -------------------------------------------------------------------------------
* 3.) Status adjustments
* ------------------------------------------------------------------------------- */
- if ( _installed )
- {
- Package::constPtr pkgptr( asKind<Package>( ptr_r ) );
- if ( pkgptr && VendorAttr::instance().autoProtect( pkgptr->vendor() ) )
- {
- item.status().setTransactValue( ResStatus::LOCKED, ResStatus::USER );
- MIL << "Protect vendor '" << pkgptr->vendor() << "' " << *pkgptr << endl;
- }
- }
+ // Foreign vendor protection handled in PoolItem ctor.
/* -------------------------------------------------------------------------------
* 3.) Feed