]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
bindings: Add pool.whatmatchessolvable() 298/head
authorIgor Gnatenko <i.gnatenko.brain@gmail.com>
Sat, 9 Feb 2019 20:51:32 +0000 (21:51 +0100)
committerIgor Gnatenko <i.gnatenko.brain@gmail.com>
Wed, 13 Feb 2019 09:08:29 +0000 (10:08 +0100)
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
bindings/solv.i
doc/gen/libsolv-bindings.3
doc/libsolv-bindings.txt

index cbfddb730e5e92eec0cad5e9a125f7fa32f264ef..b507449745900dab48d657162240712bd00e55c1 100644 (file)
@@ -663,6 +663,12 @@ SWIG_AsValDepId(void *obj, int *val) {
 %typemaps_asval(%checkcode(POINTER), SWIG_AsValSolvFpPtr, "SWIG_AsValSolvFpPtr", FILE*);
 %typemaps_asval(%checkcode(INT32), SWIG_AsValDepId, "SWIG_AsValDepId", DepId);
 
+%define SamePool(pool1,pool2) %{ {
+  if (pool1 != pool2)
+    SWIG_exception_fail(SWIG_ArgError(EINVAL), "pool of argument $argnum must be same as pool in method's object");
+}
+%}
+%enddef
 
 /**
  ** the C declarations
@@ -1067,10 +1073,12 @@ typedef struct {
   Id what;
 } Job;
 
+%typemap(check) XSolvable *pool_solvable SamePool($1->pool, arg1)
 %nodefaultctor Pool;
 %nodefaultdtor Pool;
 typedef struct {
 } Pool;
+%typemap(check) XSolvable *pool_solvable;
 
 %nodefaultctor Repo;
 %nodefaultdtor Repo;
@@ -1978,6 +1986,15 @@ typedef struct {
     return q;
   }
 
+  %typemap(out) Queue whatmatchessolvable Queue2Array(XSolvable *, 1, new_XSolvable(arg1, id));
+  %newobject whatmatchessolvable;
+  Queue whatmatchessolvable(Id keyname, XSolvable *pool_solvable, Id marker = -1) {
+    Queue q;
+    queue_init(&q);
+    pool_whatmatchessolvable($self, keyname, pool_solvable->id, &q, marker);
+    return q;
+  }
+
 #ifdef SWIGRUBY
   %rename("isknownarch?") isknownarch;
 #endif
index a6cf3588f7a0cb759b4ccd64b5a9455e9e44e33f..47bf7dd75fa07a3841952636e42b5795dea47d27 100644 (file)
@@ -866,6 +866,21 @@ Filter list of solvables by repo priority, architecture and version\&.
 .RS 4
 .\}
 .nf
+\fBSolvable *whatmatchessolvable(Id\fR \fIkeyname\fR\fB, Solvable\fR \fIsolvable\fR\fB, Id\fR \fImarker\fR \fB= \-1)\fR
+my \fI@solvables\fR \fB=\fR \fI$pool\fR\fB\->whatmatchessolvable(\fR\fI$keyname\fR\fB,\fR \fI$solvable\fR\fB)\fR
+\fIsolvables\fR \fB=\fR \fIpool\fR\fB\&.whatmatchessolvable(\fR\fIkeyname\fR\fB,\fR \fIsolvable\fR\fB)\fR
+\fIsolvables\fR \fB=\fR \fIpool\fR\fB\&.whatmatchessolvable(\fR\fIkeyname\fR\fB,\fR \fIsolvable\fR\fB)\fR
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+Return all solvables that match package dependencies in against solvable\(cqs provides\&.
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
 \fBId *matchprovidingids(const char *\fR\fImatch\fR\fB, int\fR \fIflags\fR\fB)\fR
 my \fI@ids\fR \fB=\fR \fI$pool\fR\fB\->matchprovidingids(\fR\fI$match\fR\fB,\fR \fI$flags\fR\fB)\fR;
 \fIids\fR \fB=\fR \fIpool\fR\fB\&.matchprovidingids(\fR\fImatch\fR\fB,\fR \fIflags\fR\fB)\fR
index 450ed41c36ecbff49e7b43ed763f8a9d9daeef15..f3020c54118d204af7f1fe2604536296a3ab1bfd 100644 (file)
@@ -495,6 +495,14 @@ a Dep object or a simple Id as argument.
 
 Filter list of solvables by repo priority, architecture and version.
 
+       Solvable *whatmatchessolvable(Id keyname, Solvable solvable, Id marker = -1)
+       my @solvables = $pool->whatmatchessolvable($keyname, $solvable)
+       solvables = pool.whatmatchessolvable(keyname, solvable)
+       solvables = pool.whatmatchessolvable(keyname, solvable)
+
+Return all solvables that match package dependencies in against solvable's
+provides.
+
        Id *matchprovidingids(const char *match, int flags)
        my @ids = $pool->matchprovidingids($match, $flags);
        ids = pool.matchprovidingids(match, flags)