Skip to content

Commit 8bb3b58

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

3 files changed

Lines changed: 40 additions & 0 deletions

File tree

bindings/solv.i

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,12 @@ SWIG_AsValDepId(void *obj, int *val) {
663663
%typemaps_asval(%checkcode(POINTER), SWIG_AsValSolvFpPtr, "SWIG_AsValSolvFpPtr", FILE*);
664664
%typemaps_asval(%checkcode(INT32), SWIG_AsValDepId, "SWIG_AsValDepId", DepId);
665665

666+
%define SamePool(pool1,pool2) %{ {
667+
if (pool1 != pool2)
668+
SWIG_exception_fail(SWIG_ArgError(EINVAL), "pool of argument $argnum must be same as pool in method's object");
669+
}
670+
%}
671+
%enddef
666672

667673
/**
668674
** the C declarations
@@ -1067,10 +1073,12 @@ typedef struct {
10671073
Id what;
10681074
} Job;
10691075

1076+
%typemap(check) XSolvable *pool_solvable SamePool($1->pool, arg1)
10701077
%nodefaultctor Pool;
10711078
%nodefaultdtor Pool;
10721079
typedef struct {
10731080
} Pool;
1081+
%typemap(check) XSolvable *pool_solvable;
10741082

10751083
%nodefaultctor Repo;
10761084
%nodefaultdtor Repo;
@@ -1978,6 +1986,15 @@ typedef struct {
19781986
return q;
19791987
}
19801988

1989+
%typemap(out) Queue whatmatchessolvable Queue2Array(XSolvable *, 1, new_XSolvable(arg1, id));
1990+
%newobject whatmatchessolvable;
1991+
Queue whatmatchessolvable(Id keyname, XSolvable *pool_solvable, Id marker = -1) {
1992+
Queue q;
1993+
queue_init(&q);
1994+
pool_whatmatchessolvable($self, keyname, pool_solvable->id, &q, marker);
1995+
return q;
1996+
}
1997+
19811998
#ifdef SWIGRUBY
19821999
%rename("isknownarch?") isknownarch;
19832000
#endif

doc/gen/libsolv-bindings.3

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,21 @@ Filter list of solvables by repo priority, architecture and version\&.
866866
.RS 4
867867
.\}
868868
.nf
869+
\fBSolvable *whatmatchessolvable(Id\fR \fIkeyname\fR\fB, Solvable\fR \fIsolvable\fR\fB, Id\fR \fImarker\fR \fB= \-1)\fR
870+
my \fI@solvables\fR \fB=\fR \fI$pool\fR\fB\->whatmatchessolvable(\fR\fI$keyname\fR\fB,\fR \fI$solvable\fR\fB)\fR
871+
\fIsolvables\fR \fB=\fR \fIpool\fR\fB\&.whatmatchessolvable(\fR\fIkeyname\fR\fB,\fR \fIsolvable\fR\fB)\fR
872+
\fIsolvables\fR \fB=\fR \fIpool\fR\fB\&.whatmatchessolvable(\fR\fIkeyname\fR\fB,\fR \fIsolvable\fR\fB)\fR
873+
.fi
874+
.if n \{\
875+
.RE
876+
.\}
877+
.sp
878+
Return all solvables that match package dependencies in against solvable\(cqs provides\&.
879+
.sp
880+
.if n \{\
881+
.RS 4
882+
.\}
883+
.nf
869884
\fBId *matchprovidingids(const char *\fR\fImatch\fR\fB, int\fR \fIflags\fR\fB)\fR
870885
my \fI@ids\fR \fB=\fR \fI$pool\fR\fB\->matchprovidingids(\fR\fI$match\fR\fB,\fR \fI$flags\fR\fB)\fR;
871886
\fIids\fR \fB=\fR \fIpool\fR\fB\&.matchprovidingids(\fR\fImatch\fR\fB,\fR \fIflags\fR\fB)\fR

doc/libsolv-bindings.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,14 @@ a Dep object or a simple Id as argument.
495495
496496
Filter list of solvables by repo priority, architecture and version.
497497
498+
Solvable *whatmatchessolvable(Id keyname, Solvable solvable, Id marker = -1)
499+
my @solvables = $pool->whatmatchessolvable($keyname, $solvable)
500+
solvables = pool.whatmatchessolvable(keyname, solvable)
501+
solvables = pool.whatmatchessolvable(keyname, solvable)
502+
503+
Return all solvables that match package dependencies in against solvable's
504+
provides.
505+
498506
Id *matchprovidingids(const char *match, int flags)
499507
my @ids = $pool->matchprovidingids($match, $flags);
500508
ids = pool.matchprovidingids(match, flags)

0 commit comments

Comments
 (0)