Author: schubi2
Date: Thu Oct 25 12:02:30 2007
New Revision: 7630
URL: http://svn.opensuse.org/viewcvs/zypp?rev=7630&view=rev
Log:
generate queue
Modified:
trunk/libzypp/zypp/CMakeLists.txt
trunk/libzypp/zypp/sat/SATResolver.cc
Modified: trunk/libzypp/zypp/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/CMakeLists.txt?rev=7630&r1=7629&r2=7630&view=diff
==============================================================================
--- trunk/libzypp/zypp/CMakeLists.txt (original)
+++ trunk/libzypp/zypp/CMakeLists.txt Thu Oct 25 12:02:30 2007
@@ -1174,6 +1174,7 @@
TARGET_LINK_LIBRARIES(zypp ${LIBXML_LIBRARY} )
TARGET_LINK_LIBRARIES(zypp ${SQLITE_LIBRARY} )
TARGET_LINK_LIBRARIES(zypp ${ZLIB_LIBRARY} )
+TARGET_LINK_LIBRARIES(zypp satsolver )
INSTALL(TARGETS zypp LIBRARY DESTINATION ${LIB_INSTALL_DIR} )
Modified: trunk/libzypp/zypp/sat/SATResolver.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/SATResolver.cc?rev=7630&r1=7629&r2=7630&view=diff
==============================================================================
--- trunk/libzypp/zypp/sat/SATResolver.cc (original)
+++ trunk/libzypp/zypp/sat/SATResolver.cc Thu Oct 25 12:02:30 2007
@@ -31,6 +31,10 @@
#include "zypp/CapFilters.h"
#include "zypp/sat/SATResolver.h"
+extern "C" {
+#include "satsolver/source_solv.h"
+#include "satsolver/poolarch.h"
+}
/////////////////////////////////////////////////////////////////////////
namespace zypp
@@ -281,6 +285,64 @@
+//------------------------------------------------------------------------------------------------------------
+// Helper functions for the SAT-Pool
+//------------------------------------------------------------------------------------------------------------
+
+// find solvable id by name and source
+// If source != NULL, find there
+// else find in pool (available packages)
+//
+
+static Id
+select_solvable( Pool *pool,
+ const PoolItem_Ref item)
+{
+ Id id, archid;
+ int end;
+
+ string packageName = str::form (_("%s:%s"),
+ item->kind().asString().c_str(),
+ item->name().c_str()
+ );
+
+ string repoName = item->repository().info().alias();
+
+ // Searching concerning source
+ Source *source = NULL;
+ for (int i = 0; i < pool->nsources; i++)
+ {
+ string compName(source_name(pool->sources[i]));
+ if (repoName == compName) {
+ source = pool->sources[i];
+ break;
+ }
+ }
+
+ id = str2id( pool, packageName.c_str(), 0 );
+ if (id == ID_NULL) {
+ return id;
+ }
+ archid = ID_NULL;
+ archid = str2id( pool, item->arch().asString().c_str(), 0 );
+ if (archid == ID_NULL) {
+ return ID_NULL;
+ }
+
+ end = source ? source->start + source->nsolvables : pool->nsolvables;
+ for (int i = source ? source->start : 1 ; i < end; i++)
+ {
+ if (archid && pool->solvables[i].arch != archid)
+ continue;
+ if (pool->solvables[i].name == id)
+ return i;
+ }
+
+ return ID_NULL;
+}
+
+
+
// This function loops over the pool and grabs
// all item.status().transacts() and item.status().byUser()
// It clears all previous bySolver() states also
@@ -309,16 +371,55 @@
invokeOnEach ( _pool.begin(), _pool.end(),
resfilter::ByKeep( ), // collect keeps from Pool to resolver queue
functor::functorRef