summaryrefslogtreecommitdiff
path: root/bindings/solv.i
diff options
context:
space:
mode:
Diffstat (limited to 'bindings/solv.i')
-rw-r--r--bindings/solv.i84
1 files changed, 78 insertions, 6 deletions
diff --git a/bindings/solv.i b/bindings/solv.i
index 107192f..48d3f1f 100644
--- a/bindings/solv.i
+++ b/bindings/solv.i
@@ -629,10 +629,8 @@ SWIG_AsValDepId(void *obj, int *val) {
%typemap(out) disown_helper {
#if defined(SWIGRUBY)
SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Pool, SWIG_POINTER_DISOWN | 0 );
-#elif defined(SWIGPYTHON) && SWIG_VERSION < 0x040000
- SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Pool, SWIG_POINTER_DISOWN | 0 );
#elif defined(SWIGPYTHON)
- SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Pool, SWIG_POINTER_DISOWN | 0 );
+ SWIG_ConvertPtr($self, &argp1,SWIGTYPE_p_Pool, SWIG_POINTER_DISOWN | 0 );
#elif defined(SWIGPERL)
SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Pool, SWIG_POINTER_DISOWN | 0 );
#elif defined(SWIGTCL)
@@ -650,6 +648,33 @@ SWIG_AsValDepId(void *obj, int *val) {
/**
+ ** return $self
+ **/
+
+%define returnself(func)
+#if defined(SWIGPYTHON)
+%typemap(out) void func {
+ $result = $self;
+ Py_INCREF($result);
+}
+#elif defined(SWIGPERL)
+%typemap(out) void func {
+ $result = sv_2mortal(SvREFCNT_inc(ST(0)));argvi++;
+}
+#elif defined(SWIGRUBY)
+%typemap(ret) void func {
+ return self;
+}
+#elif defined(SWIGTCL)
+%typemap(out) void func {
+ Tcl_IncrRefCount(objv[1]);
+ Tcl_SetObjResult(interp, objv[1]);
+}
+#endif
+%enddef
+
+
+/**
** misc stuff
**/
@@ -1362,12 +1387,14 @@ typedef struct {
s->flags = $self->flags;
return s;
}
+returnself(filter)
void filter(Selection *lsel) {
if ($self->pool != lsel->pool)
queue_empty(&$self->q);
else
selection_filter($self->pool, &$self->q, &lsel->q);
}
+returnself(add)
void add(Selection *lsel) {
if ($self->pool == lsel->pool)
{
@@ -1375,29 +1402,35 @@ typedef struct {
$self->flags |= lsel->flags;
}
}
+returnself(add_raw)
void add_raw(Id how, Id what) {
queue_push2(&$self->q, how, what);
}
+returnself(subtract)
void subtract(Selection *lsel) {
if ($self->pool == lsel->pool)
selection_subtract($self->pool, &$self->q, &lsel->q);
}
+returnself(select)
void select(const char *name, int flags) {
if ((flags & SELECTION_MODEBITS) == 0)
flags |= SELECTION_FILTER | SELECTION_WITH_ALL;
$self->flags = selection_make($self->pool, &$self->q, name, flags);
}
+returnself(matchdeps)
void matchdeps(const char *name, int flags, Id keyname, Id marker = -1) {
if ((flags & SELECTION_MODEBITS) == 0)
flags |= SELECTION_FILTER | SELECTION_WITH_ALL;
$self->flags = selection_make_matchdeps($self->pool, &$self->q, name, flags, keyname, marker);
}
+returnself(matchdepid)
void matchdepid(DepId dep, int flags, Id keyname, Id marker = -1) {
if ((flags & SELECTION_MODEBITS) == 0)
flags |= SELECTION_FILTER | SELECTION_WITH_ALL;
$self->flags = selection_make_matchdepid($self->pool, &$self->q, dep, flags, keyname, marker);
}
+returnself(matchsolvable)
void matchsolvable(XSolvable *solvable, int flags, Id keyname, Id marker = -1) {
if ((flags & SELECTION_MODEBITS) == 0)
flags |= SELECTION_FILTER | SELECTION_WITH_ALL;
@@ -1976,6 +2009,14 @@ typedef struct {
pool_flush_namespaceproviders($self, ns, evr);
}
+ %typemap(out) Queue whatcontainsdep Queue2Array(XSolvable *, 1, new_XSolvable(arg1, id));
+ %newobject whatcontainsdep;
+ Queue whatcontainsdep(Id keyname, DepId dep, Id marker = -1) {
+ Queue q;
+ queue_init(&q);
+ pool_whatcontainsdep($self, keyname, dep, &q, marker);
+ return q;
+ }
%typemap(out) Queue whatmatchesdep Queue2Array(XSolvable *, 1, new_XSolvable(arg1, id));
%newobject whatmatchesdep;
@@ -2057,9 +2098,18 @@ typedef struct {
queue_init(&q);
int i;
for (i = 2; i < $self->nsolvables; i++) {
- if (!$self->solvables[i].repo)
- continue;
- if (!$self->considered || MAPTST($self->considered, i))
+ if ($self->solvables[i].repo && (!$self->considered || MAPTST($self->considered, i)))
+ queue_push(&q, i);
+ }
+ return q;
+ }
+
+ Queue get_disabled_list() {
+ Queue q;
+ queue_init(&q);
+ int i;
+ for (i = 2; i < $self->nsolvables; i++) {
+ if ($self->solvables[i].repo && ($self->considered && !MAPTST($self->considered, i)))
queue_push(&q, i);
}
return q;
@@ -2081,6 +2131,28 @@ typedef struct {
}
}
+ void set_disabled_list(Queue q) {
+ int i;
+ Id p;
+ if (!q.count) {
+ if ($self->considered) {
+ map_free($self->considered);
+ $self->considered = solv_free($self->considered);
+ }
+ return;
+ }
+ if (!$self->considered) {
+ $self->considered = solv_calloc(1, sizeof(Map));
+ map_init($self->considered, $self->nsolvables);
+ }
+ map_setall($self->considered);
+ for (i = 0; i < q.count; i++) {
+ p = q.elements[i];
+ if (p > 0 && p < $self->nsolvables)
+ MAPCLR($self->considered, p);
+ }
+ }
+
void setpooljobs(Queue solvejobs) {
queue_free(&$self->pooljobs);
queue_init_clone(&$self->pooljobs, &solvejobs);