Skip to content

Commit 5ddb0ce

Browse files
committed
bindings: Add pool.best_solvables()
Signed-off-by: Igor Gnatenko <[email protected]>
1 parent 3578cb3 commit 5ddb0ce

3 files changed

Lines changed: 33 additions & 2 deletions

File tree

bindings/solv.i

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ typedef struct {
381381

382382
%typemap(in) Queue Array2Queue(SWIG_AsVal_int, "integers")
383383
%typemap(in) Queue solvejobs ObjArray2Queue(Job *, queue_push2(&$1, obj->how, obj->what))
384+
%typemap(in) Queue solvables ObjArray2Queue(XSolvable *, queue_push(&$1, obj->id))
384385

385386

386387

@@ -1945,6 +1946,14 @@ typedef struct {
19451946
queue_push(&q, p);
19461947
return q;
19471948
}
1949+
%typemap(out) Queue best_solvables Queue2Array(XSolvable *, 1, new_XSolvable(arg1, id));
1950+
%newobject best_solvables;
1951+
Queue best_solvables(Queue solvables, int flags=0) {
1952+
Queue q;
1953+
queue_init_clone(&q, &solvables);
1954+
pool_best_solvables($self, &q, flags);
1955+
return q;
1956+
}
19481957

19491958
Id towhatprovides(Queue q) {
19501959
return pool_queuetowhatprovides($self, &q);

doc/gen/libsolv-bindings.3

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
.\" Title: Libsolv-Bindings
33
.\" Author: [see the "Author" section]
44
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
5-
.\" Date: 12/06/2018
5+
.\" Date: 02/13/2019
66
.\" Manual: LIBSOLV
77
.\" Source: libsolv
88
.\" Language: English
99
.\"
10-
.TH "LIBSOLV\-BINDINGS" "3" "12/06/2018" "libsolv" "LIBSOLV"
10+
.TH "LIBSOLV\-BINDINGS" "3" "02/13/2019" "libsolv" "LIBSOLV"
1111
.\" -----------------------------------------------------------------
1212
.\" * Define some portability stuff
1313
.\" -----------------------------------------------------------------
@@ -851,6 +851,21 @@ Return all solvables that provide the specified dependency\&. You can use either
851851
.RS 4
852852
.\}
853853
.nf
854+
\fBSolvable *best_solvables(Solvable *\fR\fIsolvables\fR\fB, int\fR \fIflags\fR \fB= 0)\fR
855+
my \fI@solvables\fR \fB=\fR \fI$pool\fR\fB\->best_solvables(\fR\fI$solvables\fR\fB)\fR;
856+
\fIsolvables\fR \fB=\fR \fIpool\fR\fB\&.best_solvables(\fR\fIsolvables\fR\fB)\fR
857+
\fIsolvables\fR \fB=\fR \fIpool\fR\fB\&.best_solvables(\fR\fIsolvables\fR\fB)\fR
858+
.fi
859+
.if n \{\
860+
.RE
861+
.\}
862+
.sp
863+
Filter list of solvables by repo priority, architecture and version\&.
864+
.sp
865+
.if n \{\
866+
.RS 4
867+
.\}
868+
.nf
854869
\fBId *matchprovidingids(const char *\fR\fImatch\fR\fB, int\fR \fIflags\fR\fB)\fR
855870
my \fI@ids\fR \fB=\fR \fI$pool\fR\fB\->matchprovidingids(\fR\fI$match\fR\fB,\fR \fI$flags\fR\fB)\fR;
856871
\fIids\fR \fB=\fR \fIpool\fR\fB\&.matchprovidingids(\fR\fImatch\fR\fB,\fR \fIflags\fR\fB)\fR

doc/libsolv-bindings.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,13 @@ the call to addfileprovides().
488488
Return all solvables that provide the specified dependency. You can use either
489489
a Dep object or a simple Id as argument.
490490
491+
Solvable *best_solvables(Solvable *solvables, int flags = 0)
492+
my @solvables = $pool->best_solvables($solvables);
493+
solvables = pool.best_solvables(solvables)
494+
solvables = pool.best_solvables(solvables)
495+
496+
Filter list of solvables by repo priority, architecture and version.
497+
491498
Id *matchprovidingids(const char *match, int flags)
492499
my @ids = $pool->matchprovidingids($match, $flags);
493500
ids = pool.matchprovidingids(match, flags)

0 commit comments

Comments
 (0)