summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2018-11-30 12:40:43 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2018-11-30 12:40:43 +0900
commite1659dc4ce74d3c47f465103951dafff8fc0cf9f (patch)
treee135d41257133e53a1a09571fbdf3cb284b49bba /src
parent97330b5a608c2213fdf3f49bfbaa268bf9627920 (diff)
downloadlibsolv-e1659dc4ce74d3c47f465103951dafff8fc0cf9f.tar.gz
libsolv-e1659dc4ce74d3c47f465103951dafff8fc0cf9f.tar.bz2
libsolv-e1659dc4ce74d3c47f465103951dafff8fc0cf9f.zip
Imported Upstream version 0.6.28upstream/0.6.28
Change-Id: I7eea26ff3eb092805c915018606cc185fa47e21f Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'src')
-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
8 files changed, 86 insertions, 22 deletions
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)