summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--NEWS4
-rw-r--r--VERSION.cmake2
-rw-r--r--bindings/python/CMakeLists.txt1
-rw-r--r--bindings/python3/CMakeLists.txt5
-rw-r--r--bindings/solv.i13
-rw-r--r--doc/libsolv-bindings.328
-rw-r--r--doc/libsolv-bindings.txt12
-rwxr-xr-xexamples/p5solv1
-rwxr-xr-xexamples/pysolv1
-rwxr-xr-xexamples/rbsolv1
-rw-r--r--examples/solv/repoinfo_type_mdk.c21
-rw-r--r--examples/solv/repoinfo_type_rpmmd.c1
-rw-r--r--examples/solv/repoinfo_type_susetags.c3
-rwxr-xr-xexamples/tclsolv2
-rw-r--r--ext/CMakeLists.txt2
-rw-r--r--ext/repo_rpmdb.c4
-rw-r--r--ext/testcase.c19
-rw-r--r--ext/testcase.h3
-rw-r--r--package/libsolv.changes29
-rw-r--r--package/libsolv.spec.in50
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/libsolv.ver4
-rw-r--r--src/policy.c16
-rw-r--r--src/policy.h2
-rw-r--r--src/poolarch.c10
-rw-r--r--src/poolvendor.c7
-rw-r--r--src/solver.c65
-rw-r--r--src/util.c2
-rw-r--r--test/testcases/sat/reuse.t20
-rw-r--r--test/testcases/strongrecommends/break.t28
-rw-r--r--test/testcases/strongrecommends/strongr.t27
-rw-r--r--tools/testsolv.c20
33 files changed, 352 insertions, 55 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bcdeee6..7902065 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -284,7 +284,7 @@ ENDFOREACH (VAR)
FOREACH (VAR
ENABLE_RPMDB ENABLE_RPMPKG ENABLE_PUBKEY ENABLE_RPMMD ENABLE_RPMDB_BYRPMHEADER
- ENABLE_SUSEREPO ENABLE_COMPS
+ ENABLE_SUSEREPO ENABLE_COMPS ENABLE_TESTCASE_HELIXREPO
ENABLE_HELIXREPO ENABLE_MDKREPO ENABLE_ARCHREPO ENABLE_DEBIAN ENABLE_HAIKU
ENABLE_ZLIB_COMPRESSION ENABLE_LZMA_COMPRESSION ENABLE_BZIP2_COMPRESSION
ENABLE_PGPVRFY ENABLE_APPDATA)
diff --git a/NEWS b/NEWS
index ed1a963..b3fd37b 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,10 @@
This file contains the major changes between
libsolv versions:
+Version 0.6.28
+- new features:
+ * new pool_best_solvables() function
+
Version 0.6.27
- new features:
* allow building with libxml2 instead of libexpat
diff --git a/VERSION.cmake b/VERSION.cmake
index 55b1018..f4958cb 100644
--- a/VERSION.cmake
+++ b/VERSION.cmake
@@ -49,5 +49,5 @@ SET(LIBSOLVEXT_SOVERSION "0")
SET(LIBSOLV_MAJOR "0")
SET(LIBSOLV_MINOR "6")
-SET(LIBSOLV_PATCH "27")
+SET(LIBSOLV_PATCH "28")
diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt
index dc6648d..a83695f 100644
--- a/bindings/python/CMakeLists.txt
+++ b/bindings/python/CMakeLists.txt
@@ -16,6 +16,7 @@ ENDIF (NOT DEFINED PYTHON_VERSION_MAJOR)
IF (${PYTHON_VERSION_MAJOR} GREATER 2)
SET (SWIG_PY_FLAGS -DPYTHON3=1)
ENDIF (${PYTHON_VERSION_MAJOR} GREATER 2)
+SET (SWIG_PY_FLAGS ${SWIG_PY_FLAGS} -DSWIG_PYTHON_LEGACY_BOOL=1)
MESSAGE (STATUS "Python executable: ${PYTHON_EXECUTABLE}")
MESSAGE (STATUS "Python installation dir: ${PYTHON_INSTALL_DIR}")
diff --git a/bindings/python3/CMakeLists.txt b/bindings/python3/CMakeLists.txt
index 09c8e29..28e8e00 100644
--- a/bindings/python3/CMakeLists.txt
+++ b/bindings/python3/CMakeLists.txt
@@ -13,13 +13,16 @@ ENDIF (NOT DEFINED PYTHON3_EXECUTABLE)
EXECUTE_PROCESS(COMMAND ${PYTHON3_EXECUTABLE} -c "from sys import stdout; from distutils import sysconfig; stdout.write(sysconfig.get_python_lib(True))" OUTPUT_VARIABLE PYTHON3_INSTALL_DIR)
EXECUTE_PROCESS(COMMAND ${PYTHON3_EXECUTABLE} -c "from sys import stdout; from distutils import sysconfig; stdout.write(sysconfig.get_python_inc())" OUTPUT_VARIABLE PYTHON3_INCLUDE_DIR)
+SET (SWIG_PY3_FLAGS -DPYTHON3=1)
+SET (SWIG_PY3_FLAGS ${SWIG_PY3_FLAGS} -DSWIG_PYTHON_LEGACY_BOOL=1)
+
MESSAGE (STATUS "Python3 executable: ${PYTHON3_EXECUTABLE}")
MESSAGE (STATUS "Python3 installation dir: ${PYTHON3_INSTALL_DIR}")
MESSAGE (STATUS "Python3 include path: ${PYTHON3_INCLUDE_DIR}")
ADD_CUSTOM_COMMAND (
OUTPUT solv_python.c
- COMMAND ${SWIG_EXECUTABLE} ${SWIG_FLAGS} -python -DPYTHON3=1 -I${CMAKE_SOURCE_DIR}/src -o solv_python.c ${CMAKE_SOURCE_DIR}/bindings/solv.i
+ COMMAND ${SWIG_EXECUTABLE} ${SWIG_FLAGS} -python ${SWIG_PY3_FLAGS} -I${CMAKE_SOURCE_DIR}/src -o solv_python.c ${CMAKE_SOURCE_DIR}/bindings/solv.i
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${CMAKE_SOURCE_DIR}/bindings/solv.i
)
diff --git a/bindings/solv.i b/bindings/solv.i
index 7302d3a..354cde7 100644
--- a/bindings/solv.i
+++ b/bindings/solv.i
@@ -330,7 +330,8 @@ typedef struct {
#if defined(SWIGPERL)
-/* work around a swig bug */
+/* work around a swig bug for swig versions < 2.0.5 */
+#if SWIG_VERSION < 0x020005
%{
#undef SWIG_CALLXS
#ifdef PERL_OBJECT
@@ -343,6 +344,7 @@ typedef struct {
# endif
#endif
%}
+#endif
%define perliter(class)
@@ -2609,7 +2611,6 @@ rb_eval_string(
#ifdef SWIGPERL
perliter(solv::Pool_repo_iterator)
#endif
- %newobject __next__;
Repo *__next__() {
Pool *pool = $self->pool;
if ($self->id >= pool->nrepos)
@@ -2625,7 +2626,7 @@ rb_eval_string(
void each() {
Repo *n;
while ((n = Pool_repo_iterator___next__($self)) != 0) {
- rb_yield(SWIG_NewPointerObj(SWIG_as_voidptr(n), SWIGTYPE_p_Repo, SWIG_POINTER_OWN | 0));
+ rb_yield(SWIG_NewPointerObj(SWIG_as_voidptr(n), SWIGTYPE_p_Repo, 0 | 0));
}
}
#endif
@@ -2830,6 +2831,9 @@ rb_eval_string(
const char *lookup_location(unsigned int *OUTPUT) {
return solvable_lookup_location($self->pool->solvables + $self->id, OUTPUT);
}
+ const char *lookup_sourcepkg() {
+ return solvable_lookup_sourcepkg($self->pool->solvables + $self->id);
+ }
%newobject Dataiterator;
Dataiterator *Dataiterator(Id key, const char *match = 0, int flags = 0) {
return new_Dataiterator($self->pool, 0, $self->id, key, match, flags);
@@ -3792,6 +3796,9 @@ rb_eval_string(
if (buf)
repodata_set_bin_checksum(repo_id2repodata($self->repo, $self->id), solvid, keyname, solv_chksum_get_type(chksum), buf);
}
+ void set_sourcepkg(Id solvid, const char *sourcepkg) {
+ repodata_set_sourcepkg(repo_id2repodata($self->repo, $self->id), solvid, sourcepkg);
+ }
const char *lookup_str(Id solvid, Id keyname) {
return repodata_lookup_str(repo_id2repodata($self->repo, $self->id), solvid, keyname);
}
diff --git a/doc/libsolv-bindings.3 b/doc/libsolv-bindings.3
index 477a6e4..f2d8e8d 100644
--- a/doc/libsolv-bindings.3
+++ b/doc/libsolv-bindings.3
@@ -2425,6 +2425,21 @@ Return a tuple containing the on\-media location and an optional media number fo
.RS 4
.\}
.nf
+\fBconst char *lookup_sourcepkg()\fR;
+my \fR\fI$sourcepkg\fR\fB =\fR \fI$solvable\fR\fB\->lookup_sourcepkg()\fR;
+\fIsourcepkg\fR\fB \fB=\fR \fIsolvable\fR\fB\&.lookup_sourcepkg()\fR
+\fIsourcepkg\fR\fB \fB=\fR \fIsolvable\fR\fB\&.lookup_sourcepkg()\fR
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+Return a sourcepkg name associated with solvable\&.
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
\fBDataiterator Dataiterator(Id\fR \fIkeyname\fR\fB, const char *\fR\fImatch\fR \fB= 0, int\fR \fIflags\fR \fB= 0)\fR
my \fI$di\fR \fB=\fR \fI$solvable\fR\fB\->Dataiterator(\fR\fI$keyname\fR\fB,\fR \fI$match\fR\fB,\fR \fI$flags\fR\fB)\fR;
\fIdi\fR \fB=\fR \fIsolvable\fR\fB\&.Dataiterator(\fR\fIkeyname\fR\fB,\fR \fImatch\fR\fB,\fR \fIflags\fR\fB)\fR
@@ -5557,6 +5572,19 @@ Lookup functions\&. Return the data element stored in the specified solvable\&.
.RS 4
.\}
.nf
+\fBvoid set_sourcepkg(Id\fR \fIsolvid\fR\fB, const char *\fR\fIsourcepkg\fR\fB)\fR;
+\fI$data\fR\fB\->set_sourcepkg(\fR\fI$solvid\fR\fB, \fI$sourcepkg\fR\fB)\fR;
+\fIdata\fR\fB\&.set_sourcepkg(\fR\fIsolvid\fR\fB,\fR \fIsourcepkg\fR\fB)\fR
+\fIdata\fR\fB\&.set_sourcepkg(\fR\fIsolvid\fR\fB,\fR \fIsourcepkg\fR\fB)\fR
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
\fBvoid add_idarray(Id\fR \fIsolvid\fR\fB, Id\fR \fIkeyname\fR\fB, DepId\fR \fIid\fR\fB)\fR;
\fI$data\fR\fB\->add_idarray(\fR\fI$solvid\fR\fB,\fR \fI$keyname\fR\fB,\fR \fI$id\fR\fB)\fR;
\fIdata\fR\fB\&.add_idarray(\fR\fIsolvid\fR\fB,\fR \fIkeyname\fR\fB,\fR \fIid\fR\fB)\fR
diff --git a/doc/libsolv-bindings.txt b/doc/libsolv-bindings.txt
index e44d53a..4de090f 100644
--- a/doc/libsolv-bindings.txt
+++ b/doc/libsolv-bindings.txt
@@ -1357,6 +1357,13 @@ Return a tuple containing the on-media location and an optional
media number for multi-part repositories (e.g. repositories
spawning multiple DVDs).
+ const char *lookup_sourcepkg();
+ my $sourcepkg = $solvable->lookup_sourcepkg();
+ sourcepkg = solvable.lookup_sourcepkg()
+ sourcepkg = solvable.lookup_sourcepkg()
+
+Return a sourcepkg name associated with solvable.
+
Dataiterator Dataiterator(Id keyname, const char *match = 0, int flags = 0)
my $di = $solvable->Dataiterator($keyname, $match, $flags);
di = solvable.Dataiterator(keyname, match, flags)
@@ -3412,6 +3419,11 @@ SOLVID_META solvid that stores repodata meta information.
data.set_checksum(solvid, keyname, chksum)
data.set_checksum(solvid, keyname, chksum)
+ void set_sourcepkg(Id solvid, const char *sourcepkg);
+ $data.set_sourcepkg($solvid, $sourcepkg);
+ data.set_sourcepkg(solvid, sourcepkg)
+ data.set_sourcepkg(solvid, sourcepkg)
+
void add_idarray(Id solvid, Id keyname, DepId id);
$data->add_idarray($solvid, $keyname, $id);
data.add_idarray(solvid, keyname, id)
diff --git a/examples/p5solv b/examples/p5solv
index 0a1dbb0..45debb1 100755
--- a/examples/p5solv
+++ b/examples/p5solv
@@ -256,6 +256,7 @@ sub add_ext {
sub add_exts {
my ($self) = @_;
my $repodata = $self->{handle}->add_repodata(0);
+ $repodata->extend_to_repo();
$self->add_ext($repodata, 'deltainfo', 'DL');
$self->add_ext($repodata, 'filelists', 'FL');
$repodata->internalize();
diff --git a/examples/pysolv b/examples/pysolv
index 3d6ca07..891c237 100755
--- a/examples/pysolv
+++ b/examples/pysolv
@@ -391,6 +391,7 @@ class repo_repomd(repo_generic):
def add_exts(self):
repodata = self.handle.add_repodata(0)
+ repodata.extend_to_repo()
self.add_ext(repodata, 'deltainfo', 'DL')
self.add_ext(repodata, 'filelists', 'FL')
repodata.internalize()
diff --git a/examples/rbsolv b/examples/rbsolv
index be633f3..87f0d16 100755
--- a/examples/rbsolv
+++ b/examples/rbsolv
@@ -317,6 +317,7 @@ class Repo_rpmmd < Repo_generic
def add_exts
repodata = @handle.add_repodata(0)
+ repodata.extend_to_repo()
add_ext(repodata, 'deltainfo', 'DL')
add_ext(repodata, 'filelists', 'FL')
repodata.internalize()
diff --git a/examples/solv/repoinfo_type_mdk.c b/examples/solv/repoinfo_type_mdk.c
index 96b005f..69287b3 100644
--- a/examples/solv/repoinfo_type_mdk.c
+++ b/examples/solv/repoinfo_type_mdk.c
@@ -103,6 +103,18 @@ mdk_load_ext(Repo *repo, Repodata *data)
return 1;
}
+static void
+mdk_add_ext(Repo *repo, Repodata *data, const char *what, const char *ext, const char *filename, Id chksumtype, const unsigned char *chksum)
+{
+ Id handle = repodata_new_handle(data);
+ /* we mis-use the repomd ids here... need something generic in the future */
+ repodata_set_poolstr(data, handle, REPOSITORY_REPOMD_TYPE, what);
+ repodata_set_str(data, handle, REPOSITORY_REPOMD_LOCATION, filename);
+ repodata_set_bin_checksum(data, handle, REPOSITORY_REPOMD_CHECKSUM, chksumtype, chksum);
+ add_ext_keys(data, handle, ext);
+ repodata_add_flexarray(data, SOLVID_META, REPOSITORY_EXTERNAL, handle);
+}
+
int
mdk_load(struct repoinfo *cinfo, Pool **sigpoolp)
{
@@ -195,13 +207,8 @@ mdk_load(struct repoinfo *cinfo, Pool **sigpoolp)
/* setup on-demand loading of filelist data */
if (mdk_find(md5sums, "files.xml.lzma", md5))
{
- Id handle = repodata_new_handle(data);
- /* we mis-use the repomd ids here... need something generic in the future */
- repodata_set_poolstr(data, handle, REPOSITORY_REPOMD_TYPE, "filelists");
- repodata_set_str(data, handle, REPOSITORY_REPOMD_LOCATION, "media_info/files.xml.lzma");
- repodata_set_bin_checksum(data, handle, REPOSITORY_REPOMD_CHECKSUM, REPOKEY_TYPE_MD5, md5);
- add_ext_keys(data, handle, "FL");
- repodata_add_flexarray(data, SOLVID_META, REPOSITORY_EXTERNAL, handle);
+ repodata_extend_block(data, repo->start, repo->end - repo->start);
+ mdk_add_ext(repo, data, "filelists", "FL", "media_info/files.xml.lzma", REPOKEY_TYPE_MD5, md5);
}
solv_free(md5sums);
repodata_internalize(data);
diff --git a/examples/solv/repoinfo_type_rpmmd.c b/examples/solv/repoinfo_type_rpmmd.c
index 98c5d36..2a5cd7f 100644
--- a/examples/solv/repoinfo_type_rpmmd.c
+++ b/examples/solv/repoinfo_type_rpmmd.c
@@ -196,6 +196,7 @@ repomd_load(struct repoinfo *cinfo, Pool **sigpoolp)
}
#endif
data = repo_add_repodata(repo, 0);
+ repodata_extend_block(data, repo->start, repo->end - repo->start);
repomd_add_ext(repo, data, "deltainfo", "DL");
repomd_add_ext(repo, data, "filelists", "FL");
repodata_internalize(data);
diff --git a/examples/solv/repoinfo_type_susetags.c b/examples/solv/repoinfo_type_susetags.c
index 596171c..c22c736 100644
--- a/examples/solv/repoinfo_type_susetags.c
+++ b/examples/solv/repoinfo_type_susetags.c
@@ -47,7 +47,7 @@ susetags_find(Repo *repo, const char *what, const unsigned char **chksump, Id *c
return filename;
}
-void
+static void
susetags_add_ext(Repo *repo, Repodata *data)
{
Pool *pool = repo->pool;
@@ -264,6 +264,7 @@ susetags_load(struct repoinfo *cinfo, Pool **sigpoolp)
#endif
repo_internalize(repo);
data = repo_add_repodata(repo, 0);
+ repodata_extend_block(data, repo->start, repo->end - repo->start);
susetags_add_ext(repo, data);
repodata_internalize(data);
writecachedrepo(cinfo, 0, 0);
diff --git a/examples/tclsolv b/examples/tclsolv
index 0fc4e2a..8d855be 100755
--- a/examples/tclsolv
+++ b/examples/tclsolv
@@ -260,6 +260,7 @@ proc repo_repomd_add_ext {selfName repodata what ext} {
proc repo_repomd_add_exts {selfName} {
upvar $selfName self
set repodata [$self(handle) add_repodata 0]
+ $repodata extend_to_repo
repo_repomd_add_ext self $repodata "filelists" "FL"
$repodata internalize
}
@@ -383,6 +384,7 @@ proc repo_susetags_add_ext {selfName repodata what ext} {
proc repo_susetags_add_exts {selfName} {
upvar $selfName self
set repodata [$self(handle) add_repodata 0]
+ $repodata extend_to_repo
repo_susetags_add_ext self $repodata "packages.FL" "FL"
repo_susetags_add_ext self $repodata "packages.FL.gz" "FL"
$repodata internalize
diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt
index bdc6ee9..b8917a2 100644
--- a/ext/CMakeLists.txt
+++ b/ext/CMakeLists.txt
@@ -143,7 +143,7 @@ SET_TARGET_PROPERTIES(libsolvext PROPERTIES SOVERSION ${LIBSOLVEXT_SOVERSION})
SET_TARGET_PROPERTIES(libsolvext PROPERTIES INSTALL_NAME_DIR ${LIB_INSTALL_DIR})
INSTALL (FILES ${libsolvext_HEADERS} DESTINATION "${INCLUDE_INSTALL_DIR}/solv")
-INSTALL (TARGETS libsolvext LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
+INSTALL (TARGETS libsolvext LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR} RUNTIME DESTINATION bin)
IF (ENABLE_STATIC AND NOT DISABLE_SHARED)
ADD_LIBRARY (libsolvext_static STATIC ${libsolvext_SRCS})
diff --git a/ext/repo_rpmdb.c b/ext/repo_rpmdb.c
index 40a1e3e..b98720a 100644
--- a/ext/repo_rpmdb.c
+++ b/ext/repo_rpmdb.c
@@ -262,7 +262,7 @@ headint64array(RpmHead *h, int tag, int *cnt)
for (o = 0; o < i; o++, d += 8)
{
unsigned int x = d[0] << 24 | d[1] << 16 | d[2] << 8 | d[3];
- r[o] = (unsigned long long)x << 32 | (d[4] << 24 | d[5] << 16 | d[6] << 8 | d[7]);
+ r[o] = (unsigned long long)x << 32 | (unsigned int)(d[4] << 24 | d[5] << 16 | d[6] << 8 | d[7]);
}
return r;
}
@@ -281,7 +281,7 @@ headint64(RpmHead *h, int tag)
return 0;
d = h->dp + o;
i = d[0] << 24 | d[1] << 16 | d[2] << 8 | d[3];
- return (unsigned long long)i << 32 | (d[4] << 24 | d[5] << 16 | d[6] << 8 | d[7]);
+ return (unsigned long long)i << 32 | (unsigned int)(d[4] << 24 | d[5] << 16 | d[6] << 8 | d[7]);
}
static unsigned int *
diff --git a/ext/testcase.c b/ext/testcase.c
index f515057..26acefa 100644
--- a/ext/testcase.c
+++ b/ext/testcase.c
@@ -23,6 +23,9 @@
#include "testcase.h"
#include "selection.h"
#include "solv_xfopen.h"
+#if ENABLE_TESTCASE_HELIXREPO
+#include "ext/repo_helix.h"
+#endif
#define DISABLE_JOIN2
#include "tools_util.h"
@@ -175,6 +178,9 @@ static const char *features[] = {
#ifdef ENABLE_COMPLEX_DEPS
"complex_deps",
#endif
+#if ENABLE_TESTCASE_HELIXREPO
+ "testcase_helixrepo",
+#endif
0
};
@@ -2266,7 +2272,7 @@ testcase_write_mangled(Solver *solv, const char *dir, int resultflags, const cha
strqueue_push(&sq, cmd);
}
- if (resultflags)
+ if ((resultflags & ~TESTCASE_RESULT_REUSE_SOLVER) != 0)
{
char *result;
cmd = 0;
@@ -2513,6 +2519,10 @@ testcase_read(Pool *pool, FILE *fp, const char *testcase, Queue *job, char **res
int ngenid = 0;
Queue autoinstq;
+ if (resultp)
+ *resultp = 0;
+ if (resultflagsp)
+ *resultflagsp = 0;
if (!fp && !(fp = fopen(testcase, "r")))
{
pool_debug(pool, SOLV_ERROR, "testcase_read: could not open '%s'\n", testcase);
@@ -2617,10 +2627,9 @@ testcase_read(Pool *pool, FILE *fp, const char *testcase, Queue *job, char **res
repo_add_solv(repo, rfp, 0);
fclose(rfp);
}
-#if 0
+#if ENABLE_TESTCASE_HELIXREPO
else if (!strcmp(repotype, "helix"))
{
- extern int repo_add_helix(Repo *repo, FILE *fp, int flags);
repo_add_helix(repo, rfp, 0);
fclose(rfp);
}
@@ -2794,8 +2803,10 @@ testcase_read(Pool *pool, FILE *fp, const char *testcase, Queue *job, char **res
if (resultflagsp)
*resultflagsp = resultflags;
}
- else if (!strcmp(pieces[0], "nextjob") && npieces == 1)
+ else if (!strcmp(pieces[0], "nextjob"))
{
+ if (npieces == 2 && resultflagsp && !strcmp(pieces[1], "reusesolver"))
+ *resultflagsp |= TESTCASE_RESULT_REUSE_SOLVER;
break;
}
else if (!strcmp(pieces[0], "disable") && npieces == 3)
diff --git a/ext/testcase.h b/ext/testcase.h
index d3ad505..341b9c2 100644
--- a/ext/testcase.h
+++ b/ext/testcase.h
@@ -19,6 +19,9 @@
#define TESTCASE_RESULT_GENID (1 << 7)
#define TESTCASE_RESULT_REASON (1 << 8)
+/* reuse solver hack, testsolv use only */
+#define TESTCASE_RESULT_REUSE_SOLVER (1 << 31)
+
extern Id testcase_str2dep(Pool *pool, const char *s);
extern const char *testcase_dep2str(Pool *pool, Id id);
extern const char *testcase_repoid2str(Pool *pool, Id repoid);
diff --git a/package/libsolv.changes b/package/libsolv.changes
index 94bb400..5418084 100644
--- a/package/libsolv.changes
+++ b/package/libsolv.changes
@@ -1,4 +1,33 @@
-------------------------------------------------------------------
+Fri Jun 30 16:37:31 CEST 2017 - mls@suse.de
+
+- make peace with newer perl versions
+- fix memory leak in bindings
+- add pool_best_solvables() function
+- fix 64bit integer parsing from RPM headers
+- bump version to 0.6.28
+
+-------------------------------------------------------------------
+Sun May 28 13:32:15 UTC 2017 - ngompa13@gmail.com
+
+- Enable complex/rich dependencies for CentOS/RHEL 7, matching how
+ libsolv is configured there.
+
+-------------------------------------------------------------------
+Thu May 11 12:41:07 UTC 2017 - ngompa13@gmail.com
+
+- Disable bzip2 and xz/lzma compression support for SLE <= 12
+
+-------------------------------------------------------------------
+Mon May 8 13:15:09 UTC 2017 - ngompa13@gmail.com
+
+- Enable bzip2 and xz/lzma compression support
+- Enable complex/rich dependencies on distributions with RPM 4.13+
+- Simplified CentOS/RHEL conditionals
+- Added Mageia conditionals
+- Fixed a few spec portability issues
+
+-------------------------------------------------------------------
Tue Apr 25 14:11:05 CEST 2017 - mls@suse.de
- change queue resize code to use adaptive chunk sizes
diff --git a/package/libsolv.spec.in b/package/libsolv.spec.in
index d21562c..6f153f0 100644
--- a/package/libsolv.spec.in
+++ b/package/libsolv.spec.in
@@ -30,18 +30,32 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build
%bcond_without ruby_binding
%bcond_with zypp
+%if 0%{?leap_version} >= 420300 || 0%{?sle_version} >= 120300 || 0%{?suse_version} >= 1330 || !0%{?suse_version}
+%bcond_without bz2
+%bcond_without xz
+%else
+%bcond_with bz2
+%bcond_with xz
+%endif
+
+%if 0%{?fedora} || 0%{?rhel} >= 7 || 0%{?mageia} >= 6 || 0%{?suse_version} >= 1330
+%bcond_without richdeps
+%else
+%bcond_with richdeps
+%endif
+
%if 0%{?mandriva_version}
# force this version on mandriva
BuildRequires: libneon0.26-devel
%endif
-%if 0%{?fedora_version} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
+%if 0%{?fedora} || 0%{?rhel} >= 6 || 0%{?mageia}
BuildRequires: db-devel
%endif
BuildRequires: libxml2-devel
%if 0%{?suse_version} && 0%{?suse_version} < 1100
BuildRequires: graphviz
%endif
-%if 0%{?suse_version} > 1020
+%if 0%{?suse_version} > 1020 || 0%{?fedora} || 0%{?mageia}
BuildRequires: fdupes
%endif
BuildRequires: cmake
@@ -51,27 +65,43 @@ BuildRequires: zlib-devel
%if %{with perl_binding}
BuildRequires: perl
-%if 0%{?fedora_version} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
+%if 0%{?fedora} || 0%{?rhel} >= 6 || 0%{?mageia}
BuildRequires: perl-devel
%endif
BuildRequires: swig
%endif
+
%if %{with ruby_binding}
%global ruby_vendorarch %(ruby -r rbconfig -e "puts RbConfig::CONFIG['vendorarchdir'].nil? ? RbConfig::CONFIG['sitearchdir'] : RbConfig::CONFIG['vendorarchdir']")
BuildRequires: ruby
BuildRequires: ruby-devel
BuildRequires: swig
%endif
+
%if %{with python_binding}
%global python_sitearch %(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(True))")
BuildRequires: python-devel
BuildRequires: swig
%endif
+
%if %{with python3_binding}
%global python3_sitearch %(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(True))")
BuildRequires: python3-devel
%endif
+%if %{with bz2}
+%if 0%{?suse_version}
+BuildRequires: libbz2-devel
+%else
+BuildRequires: bzip2-devel
+%endif
+%endif
+
+%if %{with xz}
+BuildRequires: xz-devel
+%endif
+
+
Summary: A new approach to package dependency solving
License: BSD-3-Clause
Group: Development/Libraries/C and C++
@@ -115,7 +145,7 @@ A new approach to package dependency solving.
Summary: Applications demoing the libsolv library
Group: System/Management
Requires: curl
-%if 0%{?fedora_version} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
+%if 0%{?fedora} || 0%{?rhel} >= 6 || 0%{?mageia}
Requires: gnupg2
%endif
%if 0%{?suse_version}
@@ -166,8 +196,11 @@ export CFLAGS="$RPM_OPT_FLAGS"
export CXXFLAGS="$CFLAGS"
CMAKE_FLAGS=
-%if 0%{?fedora_version} || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600
-CMAKE_FLAGS="-DFEDORA=1"
+%if 0%{?fedora} || 0%{?rhel} >= 6
+CMAKE_FLAGS="-DFEDORA=1 -DENABLE_APPDATA=1 -DENABLE_COMPS=1"
+%endif
+%if 0%{?mageia}
+CMAKE_FLAGS="-DMAGEIA=1 -DENABLE_APPDATA=1 -DENABLE_COMPS=1"
%endif
%if 0%{?suse_version}
CMAKE_FLAGS="-DSUSE=1 -DENABLE_APPDATA=1 -DENABLE_COMPS=1"
@@ -185,10 +218,13 @@ cmake $CMAKE_FLAGS \
%{?with_python_binding:-DENABLE_PYTHON=1} \
%{?with_python3_binding:-DENABLE_PYTHON3=1} \
%{?with_ruby_binding:-DENABLE_RUBY=1} \
+ %{?with_bz2:-DENABLE_BZIP2_COMPRESSION=1} \
+ %{?with_xz:-DENABLE_LZMA_COMPRESSION=1} \
+ %{?with_richdeps:-DENABLE_COMPLEX_DEPS=1} \
%{?with_zypp:-DENABLE_SUSEREPO=1 -DENABLE_HELIXREPO=1} \
-DUSE_VENDORDIRS=1 \
-DCMAKE_SKIP_RPATH=1
-make %{?jobs:-j %jobs}
+make %{?_smp_mflags}
%install
make DESTDIR=$RPM_BUILD_ROOT install
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0109755..76ea9f1 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -44,7 +44,7 @@ SET_TARGET_PROPERTIES(libsolv PROPERTIES SOVERSION ${LIBSOLV_SOVERSION})
SET_TARGET_PROPERTIES(libsolv PROPERTIES INSTALL_NAME_DIR ${LIB_INSTALL_DIR})
INSTALL (FILES ${libsolv_HEADERS} DESTINATION "${INCLUDE_INSTALL_DIR}/solv")
-INSTALL (TARGETS libsolv LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
+INSTALL (TARGETS libsolv LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR} RUNTIME DESTINATION bin)
IF (ENABLE_STATIC AND NOT DISABLE_SHARED)
ADD_LIBRARY (libsolv_static STATIC ${libsolv_SRCS})
diff --git a/src/libsolv.ver b/src/libsolv.ver
index 19f98bb..d65c0d6 100644
--- a/src/libsolv.ver
+++ b/src/libsolv.ver
@@ -422,3 +422,7 @@ SOLV_1.0 {
local:
*;
};
+
+SOLV_1.1 {
+ pool_best_solvables;
+} SOLV_1.0;
diff --git a/src/policy.c b/src/policy.c
index 8b4c2e4..a6d3441 100644
--- a/src/policy.c
+++ b/src/policy.c
@@ -1353,6 +1353,22 @@ policy_filter_unwanted(Solver *solv, Queue *plist, int mode)
}
}
+void
+pool_best_solvables(Pool *pool, Queue *plist, int flags)
+{
+ if (plist->count > 1)
+ prune_to_highest_prio(pool, plist);
+ if (plist->count > 1)
+ prune_to_best_arch(pool, plist);
+ if (plist->count > 1)
+ prune_to_best_version(pool, plist);
+ if (plist->count > 1)
+ {
+ dislike_old_versions(pool, plist);
+ sort_by_common_dep(pool, plist);
+ }
+}
+
/* check if there is an illegal architecture change if
* installed solvable s1 is replaced by s2 */
diff --git a/src/policy.h b/src/policy.h
index 0c3c7cb..68f4db9 100644
--- a/src/policy.h
+++ b/src/policy.h
@@ -38,6 +38,8 @@ extern void policy_update_recommendsmap(Solver *solv);
extern void policy_create_obsolete_index(Solver *solv);
+extern void pool_best_solvables(Pool *pool, Queue *plist, int flags);
+
/* internal, do not use */
extern void prune_to_best_version(Pool *pool, Queue *plist);
extern void policy_prefer_favored(Solver *solv, Queue *plist);
diff --git a/src/poolarch.c b/src/poolarch.c
index 83cbd62..8da16c1 100644
--- a/src/poolarch.c
+++ b/src/poolarch.c
@@ -35,11 +35,11 @@ static const char *archpolicies[] = {
"ia64", "ia64:i686:i586:i486:i386",
"armv7hnl", "armv7hnl:armv7hl:armv6hl",
"armv7hl", "armv7hl:armv6hl",
- "armv7l", "armv7l:armv6l:armv5tejl:armv5tel:armv5l:armv4tl:armv4l:armv3l",
- "armv6l", "armv6l:armv5tejl:armv5tel:armv5l:armv4tl:armv4l:armv3l",
- "armv5tejl", "armv5tejl:armv5tel:armv5l:armv4tl:armv4l:armv3l",
- "armv5tel", "armv5tel:armv5l:armv4tl:armv4l:armv3l",
- "armv5tl", "armv5l:armv4tl:armv4l:armv3l",
+ "armv7l", "armv7l:armv6l:armv5tejl:armv5tel:armv5tl:armv5l:armv4tl:armv4l:armv3l",
+ "armv6l", "armv6l:armv5tejl:armv5tel:armv5tl:armv5l:armv4tl:armv4l:armv3l",
+ "armv5tejl", "armv5tejl:armv5tel:armv5tl:armv5l:armv4tl:armv4l:armv3l",
+ "armv5tel", "armv5tel:armv5tl:armv5l:armv4tl:armv4l:armv3l",
+ "armv5tl", "armv5tl:armv5l:armv4tl:armv4l:armv3l",
"armv5l", "armv5l:armv4tl:armv4l:armv3l",
"armv4tl", "armv4tl:armv4l:armv3l",
"armv4l", "armv4l:armv3l",
diff --git a/src/poolvendor.c b/src/poolvendor.c
index ec25f9d..adb84d8 100644
--- a/src/poolvendor.c
+++ b/src/poolvendor.c
@@ -5,15 +5,14 @@
* for further information
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
/* we need FNM_CASEFOLD */
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include <fnmatch.h>
#include "pool.h"
diff --git a/src/solver.c b/src/solver.c
index fb1554a..bec1d9f 100644
--- a/src/solver.c
+++ b/src/solver.c
@@ -1110,6 +1110,35 @@ solver_reset(Solver *solv)
enabledisablelearntrules(solv);
}
+static inline int
+queue_contains(Queue *q, Id id)
+{
+ int i;
+ for (i = 0; i < q->count; i++)
+ if (q->elements[i] == id)
+ return 1;
+ return 0;
+}
+
+static void
+disable_recommendsrules(Solver *solv, Queue *weakq)
+{
+ Pool *pool = solv->pool;
+ int i;
+ for (i = 0; i < weakq->count; i++)
+ {
+ Rule *r;
+ if (!queue_contains(solv->recommendsruleq, weakq->elements[i]))
+ continue;
+ r = solv->rules + weakq->elements[i];
+ if (r->d >= 0)
+ {
+ POOL_DEBUG(SOLV_DEBUG_UNSOLVABLE, "disabling ");
+ solver_printruleclass(solv, SOLV_DEBUG_UNSOLVABLE, r);
+ solver_disablerule(solv, r);
+ }
+ }
+}
/*-------------------------------------------------------------------
*
@@ -1119,7 +1148,7 @@ solver_reset(Solver *solv)
*/
static void
-analyze_unsolvable_rule(Solver *solv, Rule *r, Id *lastweakp, Map *rseen)
+analyze_unsolvable_rule(Solver *solv, Rule *r, Queue *weakq, Map *rseen)
{
Pool *pool = solv->pool;
int i;
@@ -1134,12 +1163,11 @@ analyze_unsolvable_rule(Solver *solv, Rule *r, Id *lastweakp, Map *rseen)
MAPSET(rseen, why - solv->learntrules);
for (i = solv->learnt_why.elements[why - solv->learntrules]; solv->learnt_pool.elements[i]; i++)
if (solv->learnt_pool.elements[i] > 0)
- analyze_unsolvable_rule(solv, solv->rules + solv->learnt_pool.elements[i], lastweakp, rseen);
+ analyze_unsolvable_rule(solv, solv->rules + solv->learnt_pool.elements[i], weakq, rseen);
return;
}
- if (solv->weakrulemap.size && MAPTST(&solv->weakrulemap, why))
- if (!*lastweakp || why > *lastweakp)
- *lastweakp = why;
+ if (solv->weakrulemap.size && MAPTST(&solv->weakrulemap, why) && weakq)
+ queue_push(weakq, why);
/* do not add pkg rules to problem */
if (why < solv->pkgrules_end)
return;
@@ -1200,12 +1228,12 @@ analyze_unsolvable(Solver *solv, Rule *cr, int disablerules)
Rule *r;
Map involved; /* global to speed things up? */
Map rseen;
+ Queue weakq;
Id pp, v, vv, why;
int i, idx;
Id *decisionmap = solv->decisionmap;
int oldproblemcount;
int oldlearntpoolcount;
- Id lastweak;
int record_proof = 1;
POOL_DEBUG(SOLV_DEBUG_UNSOLVABLE, "ANALYZE UNSOLVABLE ----------------------\n");
@@ -1221,10 +1249,10 @@ analyze_unsolvable(Solver *solv, Rule *cr, int disablerules)
r = cr;
map_init(&involved, pool->nsolvables);
map_init(&rseen, solv->learntrules ? solv->nrules - solv->learntrules : 0);
+ queue_init(&weakq);
if (record_proof)
queue_push(&solv->learnt_pool, r - solv->rules);
- lastweak = 0;
- analyze_unsolvable_rule(solv, r, &lastweak, &rseen);
+ analyze_unsolvable_rule(solv, r, &weakq, &rseen);
FOR_RULELITERALS(v, pp, r)
{
if (DECISIONMAP_TRUE(v)) /* the one true literal */
@@ -1244,7 +1272,7 @@ analyze_unsolvable(Solver *solv, Rule *cr, int disablerules)
if (record_proof)
queue_push(&solv->learnt_pool, why);
r = solv->rules + why;
- analyze_unsolvable_rule(solv, r, &lastweak, &rseen);
+ analyze_unsolvable_rule(solv, r, &weakq, &rseen);
FOR_RULELITERALS(v, pp, r)
{
if (DECISIONMAP_TRUE(v)) /* the one true literal */
@@ -1257,11 +1285,25 @@ analyze_unsolvable(Solver *solv, Rule *cr, int disablerules)
map_free(&rseen);
queue_push(&solv->problems, 0); /* mark end of this problem */
- if (lastweak)
+ if (weakq.count)
{
- /* disable last weak rule */
+ Id lastweak;
+ /* revert problems */
solv->problems.count = oldproblemcount;
solv->learnt_pool.count = oldlearntpoolcount;
+ /* find last weak */
+ lastweak = 0;
+ for (i = 0; i < weakq.count; i++)
+ if (weakq.elements[i] > lastweak)
+ lastweak = weakq.elements[i];
+ if (lastweak < solv->pkgrules_end && solv->strongrecommends && solv->recommendsruleq && queue_contains(solv->recommendsruleq, lastweak))
+ {
+ disable_recommendsrules(solv, &weakq);
+ queue_free(&weakq);
+ solver_reset(solv);
+ return 0;
+ }
+ queue_free(&weakq);
if (lastweak >= solv->jobrules && lastweak < solv->jobrules_end)
v = -(solv->ruletojob.elements[lastweak - solv->jobrules] + 1);
else
@@ -1276,6 +1318,7 @@ analyze_unsolvable(Solver *solv, Rule *cr, int disablerules)
solver_reset(solv);
return 0;
}
+ queue_free(&weakq);
if (solv->allowuninstall || solv->allowuninstall_all || solv->allowuninstallmap.size)
if (autouninstall(solv, solv->problems.elements + oldproblemcount + 1) != 0)
diff --git a/src/util.c b/src/util.c
index b2e9179..65c8629 100644
--- a/src/util.c
+++ b/src/util.c
@@ -139,7 +139,7 @@ solv_timems(unsigned int subtract)
see also: http://sources.redhat.com/ml/libc-alpha/2008-12/msg00003.html
*/
-#if defined(__GLIBC__) && (defined(HAVE_QSORT_R) || defined(HAVE___QSORT_R))
+#if (defined(__GLIBC__) || defined(__NEWLIB__)) && (defined(HAVE_QSORT_R) || defined(HAVE___QSORT_R))
void
solv_sort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *, void *), void *compard)
diff --git a/test/testcases/sat/reuse.t b/test/testcases/sat/reuse.t
new file mode 100644
index 0000000..7abb266
--- /dev/null
+++ b/test/testcases/sat/reuse.t
@@ -0,0 +1,20 @@
+repo system 0 testtags <inline>
+#>=Pkg: X 1 1 x86_64
+repo available 0 testtags <inline>
+#>=Pkg: A 1 1 x86_64
+#>=Req: X
+#>=Pkg: B 1 1 x86_64
+job install name A
+result transaction,problems,rules <inline>
+#>install A-1-1.x86_64@available
+#>install X-1-1.x86_64@system
+#>rule job 300db6ce502dde94261e267a8c535441 A-1-1.x86_64@available
+#>rule pkg 11c27e407a56aad27bd6b3eadc17374b X-1-1.x86_64@system
+#>rule pkg 11c27e407a56aad27bd6b3eadc17374b -A-1-1.x86_64@available
+nextjob reusesolver
+job install name B
+result transaction,problems,rules <inline>
+#>install B-1-1.x86_64@available
+#>rule job ad168c1819736b8aa6f507ab075b3494 B-1-1.x86_64@available
+#>rule pkg 11c27e407a56aad27bd6b3eadc17374b X-1-1.x86_64@system
+#>rule pkg 11c27e407a56aad27bd6b3eadc17374b -A-1-1.x86_64@available
diff --git a/test/testcases/strongrecommends/break.t b/test/testcases/strongrecommends/break.t
new file mode 100644
index 0000000..54031c0
--- /dev/null
+++ b/test/testcases/strongrecommends/break.t
@@ -0,0 +1,28 @@
+#
+# A recommends B and B recommends C
+#
+# With strongrecommends, we get the following
+# rules:
+# A -> B
+# B -> C
+# after pkg rules sorting, this will be (-B is less than -A)
+# B -> C (weak)
+# A -> B (weak)
+# If just the last weak rule is broken, only A will be
+# installed but but B. So the code now breaks all weak
+# recommends rules.
+repo system 0 testtags <inline>
+#>=Pkg: X 1 1 noarch
+#>=Con: C
+repo available 0 testtags <inline>
+#>=Pkg: A 1 2 noarch
+#>=Rec: B
+#>=Pkg: B 1 1 noarch
+#>=Rec: C
+#>=Pkg: C 1 1 noarch
+system i686 rpm system
+solverflags strongrecommends
+job install name A
+result transaction,problems <inline>
+#>install A-1-2.noarch@available
+#>install B-1-1.noarch@available
diff --git a/test/testcases/strongrecommends/strongr.t b/test/testcases/strongrecommends/strongr.t
new file mode 100644
index 0000000..e6f5295
--- /dev/null
+++ b/test/testcases/strongrecommends/strongr.t
@@ -0,0 +1,27 @@
+# test strong recommends
+#
+# with normal recommends, the solver will
+# not backtrack to fulfill them.
+#
+repo system 0 testtags <inline>
+#>=Pkg: A 1 1 noarch
+#>=Con: C
+#>=Pkg: A2 1 1 noarch
+#>=Con: C2
+repo available 0 testtags <inline>
+#>=Pkg: A 1 2 noarch
+#>=Pkg: B 1 1 noarch
+#>=Rec: C
+#>=Pkg: C 1 1 noarch
+#>=Pkg: B2 1 1 noarch
+#>=Rec: C2
+#>=Pkg: C2 1 1 noarch
+system i686 rpm system
+solverflags strongrecommends
+job install name B
+job install name B2
+result transaction,problems <inline>
+#>install B-1-1.noarch@available
+#>install B2-1-1.noarch@available
+#>install C-1-1.noarch@available
+#>upgrade A-1-1.noarch@system A-1-2.noarch@available
diff --git a/tools/testsolv.c b/tools/testsolv.c
index d0328ae..d751246 100644
--- a/tools/testsolv.c
+++ b/tools/testsolv.c
@@ -68,7 +68,7 @@ main(int argc, char **argv)
Pool *pool;
Queue job;
Queue solq;
- Solver *solv;
+ Solver *solv, *reusesolv = 0;
char *result = 0;
int resultflags = 0;
int debuglevel = 0;
@@ -140,7 +140,12 @@ main(int argc, char **argv)
pool_free(pool);
exit(resultflags == 77 ? 77 : 1);
}
-
+ if (reusesolv)
+ {
+ solver_free(solv);
+ solv = reusesolv;
+ reusesolv = 0;
+ }
if (!multijob && !feof(fp))
multijob = 1;
@@ -179,8 +184,8 @@ main(int argc, char **argv)
solver_solve(solv, &job);
solv->solution_callback = 0;
solv->solution_callback_data = 0;
- if (!resultflags)
- resultflags = TESTCASE_RESULT_TRANSACTION | TESTCASE_RESULT_PROBLEMS;
+ if ((resultflags & ~TESTCASE_RESULT_REUSE_SOLVER) == 0)
+ resultflags |= TESTCASE_RESULT_TRANSACTION | TESTCASE_RESULT_PROBLEMS;
myresult = testcase_solverresult(solv, resultflags);
if (rescallback && reportsolutiondata.result)
{
@@ -292,8 +297,13 @@ main(int argc, char **argv)
}
}
queue_free(&job);
- solver_free(solv);
+ if ((resultflags & TESTCASE_RESULT_REUSE_SOLVER) != 0 && !feof(fp))
+ reusesolv = solv;
+ else
+ solver_free(solv);
}
+ if (reusesolv)
+ solver_free(reusesolv);
pool_free(pool);
fclose(fp);
}