Mailinglist Archive: zypp-commit (606 mails)

< Previous Next >
[zypp-commit] r9654 - in /trunk/libzypp/zypp: ./ solver/detail/
  • From: schubi2@xxxxxxxxxxxxxxxx
  • Date: Tue, 15 Apr 2008 15:54:06 -0000
  • Message-id: <20080415155406.CA43029E14@xxxxxxxxxxxxxxxx>
Author: schubi2
Date: Tue Apr 15 17:54:06 2008
New Revision: 9654

URL: http://svn.opensuse.org/viewcvs/zypp?rev=9654&view=rev
Log:
added lock request; bugfix in wead dependency

Added:
trunk/libzypp/zypp/solver/detail/SolverQueueItemLock.cc
trunk/libzypp/zypp/solver/detail/SolverQueueItemLock.h
Modified:
trunk/libzypp/zypp/CMakeLists.txt
trunk/libzypp/zypp/solver/detail/SolverQueueItem.cc
trunk/libzypp/zypp/solver/detail/SolverQueueItem.h
trunk/libzypp/zypp/solver/detail/SolverQueueItemDelete.cc
trunk/libzypp/zypp/solver/detail/SolverQueueItemInstall.cc
trunk/libzypp/zypp/solver/detail/Types.h

Modified: trunk/libzypp/zypp/CMakeLists.txt
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/CMakeLists.txt?rev=9654&r1=9653&r2=9654&view=diff
==============================================================================
--- trunk/libzypp/zypp/CMakeLists.txt (original)
+++ trunk/libzypp/zypp/CMakeLists.txt Tue Apr 15 17:54:06 2008
@@ -494,6 +494,7 @@
solver/detail/SolverQueueItemDelete.cc
solver/detail/SolverQueueItemUpdate.cc
solver/detail/SolverQueueItemInstallOneOf.cc
+ solver/detail/SolverQueueItemLock.cc
solver/detail/SATResolver.cc
)

@@ -515,6 +516,7 @@
solver/detail/SolverQueueItemDelete.h
solver/detail/SolverQueueItemUpdate.h
solver/detail/SolverQueueItemInstallOneOf.h
+ solver/detail/SolverQueueItemLock.h
solver/detail/SATResolver.h
)


Modified: trunk/libzypp/zypp/solver/detail/SolverQueueItem.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/solver/detail/SolverQueueItem.cc?rev=9654&r1=9653&r2=9654&view=diff
==============================================================================
--- trunk/libzypp/zypp/solver/detail/SolverQueueItem.cc (original)
+++ trunk/libzypp/zypp/solver/detail/SolverQueueItem.cc Tue Apr 15 17:54:06 2008
@@ -43,9 +43,10 @@
{
switch (_type) {
case QUEUE_ITEM_TYPE_UNKNOWN : os << "unknown"; break;
- case QUEUE_ITEM_TYPE_UPDATE : os << "update"; break;
+ case QUEUE_ITEM_TYPE_UPDATE : os << "update"; break;
+ case QUEUE_ITEM_TYPE_LOCK : os << "lock"; break;
case QUEUE_ITEM_TYPE_INSTALL : os << "install"; break;
- case QUEUE_ITEM_TYPE_DELETE : os << "delete"; break;
+ case QUEUE_ITEM_TYPE_DELETE : os << "delete"; break;
case QUEUE_ITEM_TYPE_INSTALL_ONE_OF: os << "install one of"; break;

default: os << "?solverqueueitem?"; break;
}

Modified: trunk/libzypp/zypp/solver/detail/SolverQueueItem.h
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/solver/detail/SolverQueueItem.h?rev=9654&r1=9653&r2=9654&view=diff
==============================================================================
--- trunk/libzypp/zypp/solver/detail/SolverQueueItem.h (original)
+++ trunk/libzypp/zypp/solver/detail/SolverQueueItem.h Tue Apr 15 17:54:06 2008
@@ -52,7 +52,8 @@
QUEUE_ITEM_TYPE_UPDATE,
QUEUE_ITEM_TYPE_INSTALL,
QUEUE_ITEM_TYPE_DELETE,
- QUEUE_ITEM_TYPE_INSTALL_ONE_OF,
+ QUEUE_ITEM_TYPE_INSTALL_ONE_OF,
+ QUEUE_ITEM_TYPE_LOCK
} SolverQueueItemType;


@@ -98,6 +99,7 @@
bool isDelete (void) const { return _type == QUEUE_ITEM_TYPE_DELETE; }
bool isInstall (void) const { return _type == QUEUE_ITEM_TYPE_INSTALL; }
bool isUpdate (void) const { return _type == QUEUE_ITEM_TYPE_UPDATE; }
+ bool isLock (void) const { return _type == QUEUE_ITEM_TYPE_LOCK; }
bool isInstallOneOf (void) const { return _type ==
QUEUE_ITEM_TYPE_INSTALL_ONE_OF; }



Modified: trunk/libzypp/zypp/solver/detail/SolverQueueItemDelete.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/solver/detail/SolverQueueItemDelete.cc?rev=9654&r1=9653&r2=9654&view=diff
==============================================================================
--- trunk/libzypp/zypp/solver/detail/SolverQueueItemDelete.cc (original)
+++ trunk/libzypp/zypp/solver/detail/SolverQueueItemDelete.cc Tue Apr 15
17:54:06 2008
@@ -65,12 +65,13 @@
bool SolverQueueItemDelete::addRule (Queue & q, Pool *SATPool)
{
Id id = str2id( SATPool, _name.c_str(), 0 );
- queue_push( &(q), SOLVER_ERASE_SOLVABLE_NAME );
+ if (_soft) {
+ queue_push( &(q), SOLVER_ERASE_SOLVABLE_NAME | SOLVER_WEAK);
+ } else {
+ queue_push( &(q), SOLVER_ERASE_SOLVABLE_NAME );
+ }
queue_push( &(q), id);
- if (_soft) {
- queue_push( &(q), SOLVER_WEAK );
- queue_push( &(q), id);
- }
+
MIL << "Delete " << _name << (_soft ? "(soft)" : "")
<< " with SAT-Pool: " << id << endl;
return true;

Modified: trunk/libzypp/zypp/solver/detail/SolverQueueItemInstall.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/solver/detail/SolverQueueItemInstall.cc?rev=9654&r1=9653&r2=9654&view=diff
==============================================================================
--- trunk/libzypp/zypp/solver/detail/SolverQueueItemInstall.cc (original)
+++ trunk/libzypp/zypp/solver/detail/SolverQueueItemInstall.cc Tue Apr 15
17:54:06 2008
@@ -66,12 +66,13 @@
bool SolverQueueItemInstall::addRule (Queue & q, Pool *SATPool)
{
Id id = str2id( SATPool, _name.c_str(), 0 );
- queue_push( &(q), SOLVER_INSTALL_SOLVABLE_NAME );
- queue_push( &(q), id);
- if (_soft) {
- queue_push( &(q), SOLVER_WEAK );
- queue_push( &(q), id);
+ if (_soft) {
+ queue_push( &(q), SOLVER_INSTALL_SOLVABLE_NAME | SOLVER_WEAK );
+ } else {
+ queue_push( &(q), SOLVER_INSTALL_SOLVABLE_NAME );
}
+ queue_push( &(q), id);
+
MIL << "Install " << _name << (_soft ? "(soft)" : "")
<< " with SAT-Pooly: " << id << endl;
return true;

Added: trunk/libzypp/zypp/solver/detail/SolverQueueItemLock.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/solver/detail/SolverQueueItemLock.cc?rev=9654&view=auto
==============================================================================
--- trunk/libzypp/zypp/solver/detail/SolverQueueItemLock.cc (added)
+++ trunk/libzypp/zypp/solver/detail/SolverQueueItemLock.cc Tue Apr 15 17:54:06
2008
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* SolverQueueItem.cc
+ *
+ * Copyright (C) 2008 SUSE Linux Products GmbH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#include "zypp/base/Logger.h"
+#include "zypp/solver/detail/SolverQueueItemLock.h"
+
+/////////////////////////////////////////////////////////////////////////
+namespace zypp
+{ ///////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////
+ namespace solver
+ { /////////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////////
+ namespace detail
+ { ///////////////////////////////////////////////////////////////////
+
+using namespace std;
+
+IMPL_PTR_TYPE(SolverQueueItemLock);
+
+//---------------------------------------------------------------------------
+
+std::ostream &
+SolverQueueItemLock::dumpOn( std::ostream & os ) const
+{
+ os << "[" << (_soft?"Soft":"") << "Lock: " <<
+ _item << "]";
+
+ return os;
+}
+
+//---------------------------------------------------------------------------
+
+SolverQueueItemLock::SolverQueueItemLock (const ResPool & pool,
+ const PoolItem & item, bool soft)
+ : SolverQueueItem (QUEUE_ITEM_TYPE_LOCK, pool)
+ , _item (item)
+ , _soft (soft)
+{
+}
+
+
+SolverQueueItemLock::~SolverQueueItemLock()
+{
+}
+
+//---------------------------------------------------------------------------
+
+bool SolverQueueItemLock::addRule (Queue & q, Pool *SATPool)
+{
+ Id id = _item.satSolvable().id();
+ if (id == ID_NULL) {
+ ERR << "Lock : " << _item << " not found" << endl;
+ return false;
+ }
+ MIL << "Lock " << _item << " with the SAT-Pool ID: " << id << endl;
+ if (_item.status().isInstalled()) {
+ if (_soft) {
+ queue_push( &(q), SOLVER_INSTALL_SOLVABLE | SOLVER_WEAK );
+ } else {
+ queue_push( &(q), SOLVER_INSTALL_SOLVABLE );
+ }
+ } else {
+ if (_soft) {
+ queue_push( &(q), SOLVER_ERASE_SOLVABLE | SOLVER_WEAK );
+ } else {
+ queue_push( &(q), SOLVER_ERASE_SOLVABLE );
+ }
+ }
+ queue_push( &(q), id );
+ return true;
+}
+
+SolverQueueItem_Ptr
+SolverQueueItemLock::copy (void) const
+{
+ SolverQueueItemLock_Ptr new_lock = new SolverQueueItemLock (pool(), _item);
+ new_lock->SolverQueueItem::copy(this);
+
+ new_lock->_soft = _soft;
+ return new_lock;
+}
+
+int
+SolverQueueItemLock::cmp (SolverQueueItem_constPtr item) const
+{
+ int cmp = this->compare (item);
+ if (cmp != 0)
+ return cmp;
+ SolverQueueItemLock_constPtr lock = dynamic_pointer_cast<const
SolverQueueItemLock>(item);
+ return compareByNVRA (_item.resolvable(), lock->_item.resolvable());
+}
+
+
+//---------------------------------------------------------------------------
+
+
+///////////////////////////////////////////////////////////////////
+ };// namespace detail
+ /////////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////////
+ };// namespace solver
+ ///////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////
+};// namespace zypp
+/////////////////////////////////////////////////////////////////////////

Added: trunk/libzypp/zypp/solver/detail/SolverQueueItemLock.h
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/solver/detail/SolverQueueItemLock.h?rev=9654&view=auto
==============================================================================
--- trunk/libzypp/zypp/solver/detail/SolverQueueItemLock.h (added)
+++ trunk/libzypp/zypp/solver/detail/SolverQueueItemLock.h Tue Apr 15 17:54:06
2008
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* QueueItem.h
+ *
+ * Copyright (C) 2008 SUSE Linux Products GmbH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifndef ZYPP_SOLVER_DETAIL_QUEUEITEMLOCK_H
+#define ZYPP_SOLVER_DETAIL_QUEUEITEMLOCK_H
+
+#include <iosfwd>
+#include <string>
+
+#include "zypp/solver/detail/SolverQueueItem.h"
+#include "zypp/PoolItem.h"
+
+/////////////////////////////////////////////////////////////////////////
+namespace zypp
+{ ///////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////
+ namespace solver
+ { /////////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////////
+ namespace detail
+ { ///////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////
+//
+// CLASS NAME : SolverQueueItemLock
+
+class SolverQueueItemLock : public SolverQueueItem {
+
+ private:
+
+ PoolItem _item; // the item to-be-locked
+ bool _soft; // if triggered by a soft requirement (a recommends)
+
+ public:
+
+ SolverQueueItemLock (const ResPool & pool, const PoolItem & item, bool
soft = false);
+ virtual ~SolverQueueItemLock();
+
+ // ---------------------------------- I/O
+
+ virtual std::ostream & dumpOn( std::ostream & str ) const;
+
+ friend std::ostream& operator<<(std::ostream & str, const
SolverQueueItemLock & obj)
+ { return obj.dumpOn (str); }
+
+ // ---------------------------------- accessors
+
+ bool isSoft (void) const { return _soft; }
+
+ // ---------------------------------- methods
+
+ virtual bool addRule (Queue & q, Pool *SATPool);
+ virtual SolverQueueItem_Ptr copy (void) const;
+ virtual int cmp (SolverQueueItem_constPtr item) const;
+};
+
+///////////////////////////////////////////////////////////////////
+ };// namespace detail
+ /////////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////////
+ };// namespace solver
+ ///////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////
+};// namespace zypp
+/////////////////////////////////////////////////////////////////////////
+
+#endif // ZYPP_SOLVER_DETAIL_QUEUEITEMLOCK_H

Modified: trunk/libzypp/zypp/solver/detail/Types.h
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/solver/detail/Types.h?rev=9654&r1=9653&r2=9654&view=diff
==============================================================================
--- trunk/libzypp/zypp/solver/detail/Types.h (original)
+++ trunk/libzypp/zypp/solver/detail/Types.h Tue Apr 15 17:54:06 2008
@@ -62,7 +62,8 @@
DEFINE_PTR_TYPE(SolverQueueItemUpdate);
DEFINE_PTR_TYPE(SolverQueueItemDelete);
DEFINE_PTR_TYPE(SolverQueueItemInstall);
-DEFINE_PTR_TYPE(SolverQueueItemInstallOneOf);
+DEFINE_PTR_TYPE(SolverQueueItemInstallOneOf);
+DEFINE_PTR_TYPE(SolverQueueItemLock);

///////////////////////////////////////////////////////////////////
};// namespace detail

--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages