1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
4 * Copyright (C) 2008 SUSE Linux Products GmbH
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
22 #include <solv/solver.h>
25 #define ZYPP_USE_RESOLVER_INTERNALS
27 #include <zypp/base/Logger.h>
28 #include <zypp/solver/detail/SolverQueueItemLock.h>
32 /////////////////////////////////////////////////////////////////////////
34 { ///////////////////////////////////////////////////////////////////////
35 ///////////////////////////////////////////////////////////////////////
37 { /////////////////////////////////////////////////////////////////////
38 /////////////////////////////////////////////////////////////////////
40 { ///////////////////////////////////////////////////////////////////
43 IMPL_PTR_TYPE(SolverQueueItemLock);
45 //---------------------------------------------------------------------------
48 SolverQueueItemLock::dumpOn( std::ostream & os ) const
50 os << "[" << (_soft?"Soft":"") << "Lock: " <<
56 //---------------------------------------------------------------------------
58 SolverQueueItemLock::SolverQueueItemLock (const ResPool & pool,
59 const PoolItem & item, bool soft)
60 : SolverQueueItem (QUEUE_ITEM_TYPE_LOCK, pool)
67 SolverQueueItemLock::~SolverQueueItemLock()
71 //---------------------------------------------------------------------------
73 bool SolverQueueItemLock::addRule (sat::detail::CQueue & q)
75 ::Id id = _item.satSolvable().id();
77 ERR << "Lock : " << _item << " not found" << endl;
80 MIL << "Lock " << _item << " with the SAT-Pool ID: " << id << endl;
81 if (_item.status().isInstalled()) {
83 queue_push( &(q), SOLVER_INSTALL | SOLVER_SOLVABLE | SOLVER_WEAK );
85 queue_push( &(q), SOLVER_INSTALL | SOLVER_SOLVABLE );
89 queue_push( &(q), SOLVER_ERASE | SOLVER_SOLVABLE | SOLVER_WEAK );
91 queue_push( &(q), SOLVER_ERASE | SOLVER_SOLVABLE );
94 queue_push( &(q), id );
99 SolverQueueItemLock::copy (void) const
101 SolverQueueItemLock_Ptr new_lock = new SolverQueueItemLock (pool(), _item);
102 new_lock->SolverQueueItem::copy(this);
104 new_lock->_soft = _soft;
109 SolverQueueItemLock::cmp (SolverQueueItem_constPtr item) const
111 int cmp = this->compare (item);
114 SolverQueueItemLock_constPtr lock = dynamic_pointer_cast<const SolverQueueItemLock>(item);
115 return compareByNVRA (_item, lock->_item);
119 //---------------------------------------------------------------------------
122 ///////////////////////////////////////////////////////////////////
123 };// namespace detail
124 /////////////////////////////////////////////////////////////////////
125 /////////////////////////////////////////////////////////////////////
126 };// namespace solver
127 ///////////////////////////////////////////////////////////////////////
128 ///////////////////////////////////////////////////////////////////////
130 /////////////////////////////////////////////////////////////////////////