Author: kkaempf
Date: Wed Feb 20 17:39:26 2008
New Revision: 8841
URL: http://svn.opensuse.org/viewcvs/zypp?rev=8841&view=rev
Log:
(hack) move solvable from one repo to another
Modified:
trunk/sat-solver/applayer/xsolvable.c
trunk/sat-solver/applayer/xsolvable.h
trunk/sat-solver/bindings/satsolver.i
Modified: trunk/sat-solver/applayer/xsolvable.c
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/applayer/xsolvable.c?rev=8841&r1=8840&r2=8841&view=diff
==============================================================================
--- trunk/sat-solver/applayer/xsolvable.c (original)
+++ trunk/sat-solver/applayer/xsolvable.c Wed Feb 20 17:39:26 2008
@@ -18,6 +18,7 @@
*/
#include
+#include
#include
#include "xsolvable.h"
@@ -89,6 +90,25 @@
return 1;
}
+
+/*
+ * crude hack of adding an existing Solvable to another Repp
+ */
+
+XSolvable *
+xsolvable_add( Repo *repo, XSolvable *xs )
+{
+ if (repo->pool != xs->pool)
+ return NULL; /* must be of same repo */
+ Id sid = repo_add_solvable( repo );
+ Solvable *old_s = pool_id2solvable( xs->pool, xs->id );
+ Solvable *new_s = pool_id2solvable( repo->pool, sid );
+ memcpy( new_s, old_s, sizeof( Solvable ) );
+ new_s->repo = repo;
+
+ return xsolvable_new( repo->pool, sid );
+}
+
/************************************************
* Pool/Repo
*
Modified: trunk/sat-solver/applayer/xsolvable.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/applayer/xsolvable.h?rev=8841&r1=8840&r2=8841&view=diff
==============================================================================
--- trunk/sat-solver/applayer/xsolvable.h (original)
+++ trunk/sat-solver/applayer/xsolvable.h Wed Feb 20 17:39:26 2008
@@ -60,6 +60,11 @@
Solvable *xsolvable_solvable( const XSolvable *xs );
/*
+ * Add an existing solvable to Repo
+ */
+XSolvable *xsolvable_add( Repo *repo, XSolvable *xs );
+
+/*
* Find XSolvable by name in pool (and repo)
* If repo == NULL, search the complete pool
* If repo != NULL, limit search to the given repo
Modified: trunk/sat-solver/bindings/satsolver.i
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/bindings/satsolver.i?rev=8841&r1=8840&r2=8841&view=diff
==============================================================================
--- trunk/sat-solver/bindings/satsolver.i (original)
+++ trunk/sat-solver/bindings/satsolver.i Wed Feb 20 17:39:26 2008
@@ -591,6 +591,12 @@
XSolvable *create_solvable( const char *name, const char *evr, const char *arch = NULL )
{ return xsolvable_create( $self, name, evr, arch ); }
+#if defined(SWIGRUBY)
+ %alias add "<<";
+#endif
+ XSolvable *add( XSolvable *xs )
+ { return xsolvable_add( $self, xs); }
+
void each()
{ repo_xsolvables_iterate( $self, generic_xsolvables_iterate_callback ); }
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org