Showing with 339 additions and 42 deletions.
  1. +2 −0 CMakeLists.txt
  2. +10 −0 NEWS
  3. +4 −0 TODO_1.0
  4. +1 −1 VERSION.cmake
  5. +78 −6 bindings/solv.i
  6. +58 −2 doc/gen/libsolv-bindings.3
  7. +44 −1 doc/libsolv-bindings.txt
  8. +0 −1 ext/CMakeLists.txt
  9. +13 −9 ext/pool_parserpmrichdep.c
  10. +21 −0 package/libsolv.changes
  11. +1 −4 package/libsolv.spec.in
  12. +0 −1 src/CMakeLists.txt
  13. +23 −2 src/pool.c
  14. +4 −2 src/repodata.c
  15. +27 −1 src/solver.c
  16. +53 −12 tools/repo2solv.c
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ SET (ENABLE_HAIKU ON)
SET (have_system ${have_system}x)
ENDIF (HAIKU)

SET (CMAKE_MACOSX_RPATH ON)

IF (${have_system} STREQUAL x)
MESSAGE (STATUS "Building for no system")
ENDIF (${have_system} STREQUAL x)
Expand Down
10 changes: 10 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
This file contains the major changes between
libsolv versions:

Version 0.7.6
- selected bug fixes:
* fix repository priority handling for multiversion packages
* better support of inverval deps in pool_match_dep()
* support src rpms that have non-empty provides
- new features
* bindings: add get_disabled_list() and set_disabled_list()
* bindings: add whatcontainsdep()
* bindings: make the selection filters return the self object

Version 0.7.5
- selected bug fixes:
* fix favorq leaking between solver runs if the solver is reused
Expand Down
4 changes: 4 additions & 0 deletions TODO_1.0
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@

- write more manpages

- forcebest pruning is not optimal: it should keep multiple packages
with the same version instead of reducing to just one package for
each name

IDEAS:

drop SEARCH_FILES and add SEARCH_BASENAME instead?
2 changes: 1 addition & 1 deletion VERSION.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ SET(LIBSOLVEXT_SOVERSION "1")

SET(LIBSOLV_MAJOR "0")
SET(LIBSOLV_MINOR "7")
SET(LIBSOLV_PATCH "5")
SET(LIBSOLV_PATCH "6")

84 changes: 78 additions & 6 deletions bindings/solv.i
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -649,6 +647,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
**/
Expand Down Expand Up @@ -1362,42 +1387,50 @@ 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)
{
selection_add($self->pool, &$self->q, &lsel->q);
$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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down
60 changes: 58 additions & 2 deletions doc/gen/libsolv-bindings.3
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
.\" Title: Libsolv-Bindings
.\" Author: [see the "Author" section]
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
.\" Date: 03/16/2019
.\" Date: 07/01/2019
.\" Manual: LIBSOLV
.\" Source: libsolv
.\" Language: English
.\"
.TH "LIBSOLV\-BINDINGS" "3" "03/16/2019" "libsolv" "LIBSOLV"
.TH "LIBSOLV\-BINDINGS" "3" "07/01/2019" "libsolv" "LIBSOLV"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
Expand Down Expand Up @@ -1129,6 +1129,62 @@ Set the callback function called when repository metadata needs to be loaded on
.\}
.sp
Decrement the reference count of the appdata object\&. This can be used to break circular references (e\&.g\&. if the pool\(cqs appdata value points to some meta data structure that contains a pool handle)\&. If used incorrectly, this method can lead to application crashes, so beware\&. (This method is a no\-op for ruby and tcl\&.)
.sp
.if n \{\
.RS 4
.\}
.nf
\fBId *get_considered_list()\fR
my \fI@ids\fR \fB=\fR \fI$pool\fR\fB\->get_considered_list()\fR;
\fIids\fR \fB=\fR \fIpool\fR\fB\&.get_considered_list()\fR
\fIids\fR \fB=\fR \fIpool\fR\fB\&.get_considered_list()\fR
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
\fBvoid set_considered_list(Id *\fR\fIids\fR\fB)\fR
\fI$pool\fR\fB\->set_considered_list(\e\fR\fI@ids\fR\fB)\fR;
\fIpool\fR\fB\&.set_considered_list(\fR\fIids\fR\fB)\fR
\fIpool\fR\fB\&.set_considered_list(\fR\fIids\fR\fB)\fR
.fi
.if n \{\
.RE
.\}
.sp
Get/set the list of solvables that are eligible for installation\&. Note that you need to recreate the whatprovides hash after changing the list\&.
.sp
.if n \{\
.RS 4
.\}
.nf
\fBId *get_disabled_list()\fR
my \fI@ids\fR \fB=\fR \fI$pool\fR\fB\->get_disabled_list()\fR;
\fIids\fR \fB=\fR \fIpool\fR\fB\&.get_disabled_list()\fR
\fIids\fR \fB=\fR \fIpool\fR\fB\&.get_disabled_list()\fR
.fi
.if n \{\
.RE
.\}
.sp
.if n \{\
.RS 4
.\}
.nf
\fBvoid set_disabled_list(Id *\fR\fIids\fR\fB)\fR
\fI$pool\fR\fB\->set_disabled_list(\e\fR\fI@ids\fR\fB)\fR;
\fIpool\fR\fB\&.set_disabled_list(\fR\fIids\fR\fB)\fR
\fIpool\fR\fB\&.set_disabled_list(\fR\fIids\fR\fB)\fR
.fi
.if n \{\
.RE
.\}
.sp
Get/set the list of solvables that are not eligible for installation\&. This is basically the inverse of the \(lqconsidered\(rq methods above, i\&.e\&. calling \(lqset_disabled_list()\(rq with an empty list will make all solvables eligible for installation\&. Note you need to recreate the whatprovides hash after changing the list\&.
.SS "DATA RETRIEVAL METHODS"
.sp
In the following functions, the \fIkeyname\fR argument describes what to retrieve\&. For the standard cases you can use the available Id constants\&. For example,
Expand Down
45 changes: 44 additions & 1 deletion doc/libsolv-bindings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,20 @@ a Dep object or a simple Id as argument.
Filter list of solvables by repo priority, architecture and version.
Solvable *whatcontainsdep(Id keyname, DepId dep, Id marker = -1)
my @solvables = $pool->whatcontainsdep($keyname, $dep)
solvables = pool.whatcontainsdep(keyname, dep)
solvables = pool.whatcontainsdep(keyname, dep)
Return all solvables for which keyname contains the dependency.
Solvable *whatmatchesdep(Id keyname, DepId dep, Id marker = -1)
my @solvables = $pool->whatmatchesdep($keyname, $sdep)
solvables = pool.whatmatchesdep(keyname, dep)
solvables = pool.whatmatchesdep(keyname, dep)
Return all solvables that have dependencies in keyname that match the dependency.
Solvable *whatmatchessolvable(Id keyname, Solvable solvable, Id marker = -1)
my @solvables = $pool->whatmatchessolvable($keyname, $solvable)
solvables = pool.whatmatchessolvable(keyname, solvable)
Expand Down Expand Up @@ -645,6 +659,35 @@ circular references (e.g. if the pool's appdata value points to some meta data
structure that contains a pool handle). If used incorrectly, this method can
lead to application crashes, so beware. (This method is a no-op for ruby and tcl.)
Id *get_considered_list()
my @ids = $pool->get_considered_list();
ids = pool.get_considered_list()
ids = pool.get_considered_list()
void set_considered_list(Id *ids)
$pool->set_considered_list(\@ids);
pool.set_considered_list(ids)
pool.set_considered_list(ids)
Get/set the list of solvables that are eligible for installation. Note that
you need to recreate the whatprovides hash after changing the list.
Id *get_disabled_list()
my @ids = $pool->get_disabled_list();
ids = pool.get_disabled_list()
ids = pool.get_disabled_list()
void set_disabled_list(Id *ids)
$pool->set_disabled_list(\@ids);
pool.set_disabled_list(ids)
pool.set_disabled_list(ids)
Get/set the list of solvables that are not eligible for installation. This is
basically the inverse of the ``considered'' methods above, i.e. calling
``set_disabled_list()'' with an empty list will make all solvables eligible for
installation. Note you need to recreate the whatprovides hash after changing the
list.
=== DATA RETRIEVAL METHODS ===
In the following functions, the _keyname_ argument describes what to retrieve.
Expand Down Expand Up @@ -807,7 +850,7 @@ Back reference to the pool this dependency belongs to.

The id of this dependency.

== Methods ==
=== METHODS ===

Dep Rel(int flags, DepId evrid, bool create = 1)
my $reldep = $dep->Rel($flags, $evrdep);
Expand Down
1 change: 0 additions & 1 deletion ext/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ ENDIF ()

SET_TARGET_PROPERTIES(libsolvext PROPERTIES OUTPUT_NAME "solvext")
SET_TARGET_PROPERTIES(libsolvext PROPERTIES SOVERSION ${LIBSOLVEXT_SOVERSION})
SET_TARGET_PROPERTIES(libsolvext PROPERTIES INSTALL_NAME_DIR ${CMAKE_INSTALL_LIBDIR})

INSTALL (FILES ${libsolvext_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/solv")
INSTALL (TARGETS libsolvext LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
Expand Down
Loading