]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
bindings: Add matchsolvable() for Pool and Selection 305/head
authorIgor Gnatenko <i.gnatenko.brain@gmail.com>
Sat, 16 Mar 2019 11:10:21 +0000 (12:10 +0100)
committerIgor Gnatenko <i.gnatenko.brain@gmail.com>
Sat, 16 Mar 2019 11:25:27 +0000 (12:25 +0100)
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
bindings/solv.i
doc/gen/libsolv-bindings.3
doc/libsolv-bindings.txt

index d1143c3beb9f26474318e69eb9045e7396adb48a..8ab1c8b9d97f2ab1ce61129f207e93f8f48137a9 100644 (file)
@@ -1379,7 +1379,7 @@ typedef struct {
     if ($self->pool == lsel->pool)
       selection_subtract($self->pool, &$self->q, &lsel->q);
   }
-  
+
   void select(const char *name, int flags) {
     if ((flags & SELECTION_MODEBITS) == 0)
       flags |= SELECTION_FILTER | SELECTION_WITH_ALL;
@@ -1395,6 +1395,11 @@ typedef struct {
       flags |= SELECTION_FILTER | SELECTION_WITH_ALL;
     $self->flags = selection_make_matchdepid($self->pool, &$self->q, dep, flags, keyname, marker);
   }
+  void matchsolvable(XSolvable *solvable, int flags, Id keyname, Id marker = -1) {
+    if ((flags & SELECTION_MODEBITS) == 0)
+      flags |= SELECTION_FILTER | SELECTION_WITH_ALL;
+    $self->flags = selection_make_matchsolvable($self->pool, &$self->q, solvable->id, flags, keyname, marker);
+  }
 
   %typemap(out) Queue jobs Queue2Array(Job *, 2, new_Job(arg1->pool, id, idp[1]));
   %newobject jobs;
@@ -1708,7 +1713,7 @@ typedef struct {
     int result, ecode = 0, vresult = 0;
     Tcl_Obj *objvx[2];
     objvx[0] = callback_var->obj;
-    objvx[1] = SWIG_NewInstanceObj(SWIG_as_voidptr(xd), SWIGTYPE_p_XRepodata, 0); 
+    objvx[1] = SWIG_NewInstanceObj(SWIG_as_voidptr(xd), SWIGTYPE_p_XRepodata, 0);
     Tcl_IncrRefCount(objvx[1]);
     result = Tcl_EvalObjv(interp, sizeof(objvx)/sizeof(*objvx), objvx, TCL_EVAL_GLOBAL);
     Tcl_DecrRefCount(objvx[1]);
@@ -2037,6 +2042,13 @@ typedef struct {
     return sel;
   }
 
+  %newobject matchsolvable;
+  Selection *matchsolvable(XSolvable *solvable, int flags, Id keyname, Id marker = -1) {
+    Selection *sel = new_Selection($self);
+    sel->flags = selection_make_matchsolvable($self, &sel->q, solvable->id, flags, keyname, marker);
+    return sel;
+  }
+
   Queue get_considered_list() {
     Queue q;
     queue_init(&q);
index 47bf7dd75fa07a3841952636e42b5795dea47d27..88ab97d38c5ed14afd9b051ec8c6dde2d2f716b0 100644 (file)
@@ -2,12 +2,12 @@
 .\"     Title: Libsolv-Bindings
 .\"    Author: [see the "Author" section]
 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
-.\"      Date: 02/13/2019
+.\"      Date: 03/16/2019
 .\"    Manual: LIBSOLV
 .\"    Source: libsolv
 .\"  Language: English
 .\"
-.TH "LIBSOLV\-BINDINGS" "3" "02/13/2019" "libsolv" "LIBSOLV"
+.TH "LIBSOLV\-BINDINGS" "3" "03/16/2019" "libsolv" "LIBSOLV"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -875,7 +875,7 @@ my \fI@solvables\fR \fB=\fR \fI$pool\fR\fB\->whatmatchessolvable(\fR\fI$keyname\
 .RE
 .\}
 .sp
-Return all solvables that match package dependencies in against solvable\(cqs provides\&.
+Return all solvables that match package dependencies against solvable\(cqs provides\&.
 .sp
 .if n \{\
 .RS 4
@@ -1047,7 +1047,7 @@ Create a selection by matching package dependencies against the specified string
 .\}
 .nf
 \fBSelection matchdepid(DepId\fR \fIdep\fR\fB, int\fR \fIflags\fR\fB, Id\fR \fIkeyname\fR\fB, Id\fR \fImarker\fR \fB= \-1)\fR
-my \fI$sel\fR \fB=\fR \fI$pool\fR\fB\->matchdepid(\fR\fIdep\fR\fB,\fR \fI$flags\fR\fB,\fR \fI$keyname\fR\fB)\fR;
+my \fI$sel\fR \fB=\fR \fI$pool\fR\fB\->matchdepid(\fR\fI$dep\fR\fB,\fR \fI$flags\fR\fB,\fR \fI$keyname\fR\fB)\fR;
 \fIsel\fR \fB=\fR \fIpool\fR\fB\&.matchdepid(\fR\fIdep\fR\fB,\fR \fIflags\fR\fB,\fR \fIkeyname\fR\fB)\fR
 \fIsel\fR \fB=\fR \fIpool\fR\fB\&.matchdepid(\fR\fIdep\fR\fB,\fR \fIflags\fR\fB,\fR \fIkeyname\fR\fB)\fR
 .fi
@@ -1061,6 +1061,21 @@ Create a selection by matching package dependencies against the specified depend
 .RS 4
 .\}
 .nf
+\fBSelection matchsolvable(Solvable\fR \fIsolvable\fR\fB, int\fR \fIflags\fR\fB, Id\fR \fIkeyname\fR\fB, Id\fR \fImarker\fR \fB= \-1)\fR
+my \fI$sel\fR \fB=\fR \fI$pool\fR\fB\->matchsolvable(\fR\fI$solvable\fR\fB,\fR \fI$flags\fR\fB,\fR \fI$keyname\fR\fB)\fR;
+\fIsel\fR \fB=\fR \fIpool\fR\fB\&.matchsolvable(\fR\fIsolvable\fR\fB,\fR \fIflags\fR\fB,\fR \fIkeyname\fR\fB)\fR
+\fIsel\fR \fB=\fR \fIpool\fR\fB\&.matchsolvable(\fR\fIsolvable\fR\fB,\fR \fIflags\fR\fB,\fR \fIkeyname\fR\fB)\fR
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+Create a selection by matching package dependencies against the specified solvable\(cqs provides\&.
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
 \fBvoid setpooljobs(Jobs *\fR\fIjobs\fR\fB)\fR
 \fI$pool\fR\fB\->setpooljobs(\e\fR\fI@jobs\fR\fB)\fR;
 \fIpool\fR\fB\&.setpooljobs(\fR\fIjobs\fR\fB)\fR
@@ -3377,6 +3392,21 @@ Do a matchdepid operation and combine the result with the current selection\&.
 .RS 4
 .\}
 .nf
+\fBvoid matchsolvable(Solvable\fR \fIsolvable\fR\fB, int\fR \fIflags\fR\fB, Id\fR \fIkeyname\fR\fB, Id\fR \fImarker\fR \fB= \-1)\fR
+\fI$sel\fR\fB\->matchsolvable(\fR\fI$solvable\fR\fB,\fR \fI$flags\fR\fB,\fR \fI$keyname\fR\fB)\fR;
+\fIsel\fR\fB\&.matchsolvable(\fR\fIsolvable\fR\fB,\fR \fIflags\fR\fB,\fR \fIkeyname\fR\fB)\fR
+\fIsel\fR\fB\&.matchsolvable(\fR\fIsolvable\fR\fB,\fR \fIflags\fR\fB,\fR \fIkeyname\fR\fB)\fR
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+Do a matchsolvable operation and combine the result with the current selection\&.
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
 \fB<stringification>\fR
 my \fI$str\fR \fB=\fR \fI$sel\fR\fB\->str\fR;
 \fIstr\fR \fB= str(\fR\fIsel\fR\fB)\fR
index f3020c54118d204af7f1fe2604536296a3ab1bfd..7b4f5053e15aadf6aed6d2a6e31e93b855528945 100644 (file)
@@ -500,7 +500,7 @@ Filter list of solvables by repo priority, architecture and version.
        solvables = pool.whatmatchessolvable(keyname, solvable)
        solvables = pool.whatmatchessolvable(keyname, solvable)
 
-Return all solvables that match package dependencies in against solvable's
+Return all solvables that match package dependencies against solvable's
 provides.
 
        Id *matchprovidingids(const char *match, int flags)
@@ -591,7 +591,7 @@ Create a selection by matching package dependencies against the specified string
 This can be used if you want to match other dependency types than ``provides''.
 
        Selection matchdepid(DepId dep, int flags, Id keyname, Id marker = -1)
-       my $sel = $pool->matchdepid(dep, $flags, $keyname);
+       my $sel = $pool->matchdepid($dep, $flags, $keyname);
        sel = pool.matchdepid(dep, flags, keyname)
        sel = pool.matchdepid(dep, flags, keyname)
 
@@ -600,6 +600,14 @@ dependency. This may be faster than matchdeps and also works with complex
 dependencies. The downside is that you cannot use globs or case insensitive
 matching.
 
+       Selection matchsolvable(Solvable solvable, int flags, Id keyname, Id marker = -1)
+       my $sel = $pool->matchsolvable($solvable, $flags, $keyname);
+       sel = pool.matchsolvable(solvable, flags, keyname)
+       sel = pool.matchsolvable(solvable, flags, keyname)
+
+Create a selection by matching package dependencies against the specified
+solvable's provides.
+
        void setpooljobs(Jobs *jobs)
        $pool->setpooljobs(\@jobs);
        pool.setpooljobs(jobs)
@@ -1901,6 +1909,13 @@ Do a matchdeps operation and combine the result with the current selection.
 
 Do a matchdepid operation and combine the result with the current selection.
 
+       void matchsolvable(Solvable solvable, int flags, Id keyname, Id marker = -1)
+       $sel->matchsolvable($solvable, $flags, $keyname);
+       sel.matchsolvable(solvable, flags, keyname)
+       sel.matchsolvable(solvable, flags, keyname)
+
+Do a matchsolvable operation and combine the result with the current selection.
+
        <stringification>
        my $str = $sel->str;
        str = str(sel)