Zypp Commits
Threads by month
- ----- 2024 -----
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
November 2007
- 10 participants
- 268 discussions
[zypp-commit] r7971 - in /trunk/sat-solver/src: policy.c solver.c solver.h
by mlschroe@svn.opensuse.org 29 Nov '07
by mlschroe@svn.opensuse.org 29 Nov '07
29 Nov '07
Author: mlschroe
Date: Thu Nov 29 10:32:47 2007
New Revision: 7971
URL: http://svn.opensuse.org/viewcvs/zypp?rev=7971&view=rev
Log:
- make schubi's job much easier by providing nice helper functions
that find and analyze a problem rule
Modified:
trunk/sat-solver/src/policy.c
trunk/sat-solver/src/solver.c
trunk/sat-solver/src/solver.h
Modified: trunk/sat-solver/src/policy.c
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/policy.c?rev=7971…
==============================================================================
--- trunk/sat-solver/src/policy.c (original)
+++ trunk/sat-solver/src/policy.c Thu Nov 29 10:32:47 2007
@@ -297,6 +297,7 @@
plist->count = j;
}
+/* legacy, do not use anymore! */
void
prune_best_version_arch(Pool *pool, Queue *plist)
{
Modified: trunk/sat-solver/src/solver.c
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/solver.c?rev=7971…
==============================================================================
--- trunk/sat-solver/src/solver.c (original)
+++ trunk/sat-solver/src/solver.c Thu Nov 29 10:32:47 2007
@@ -2742,198 +2742,321 @@
}
}
-int
-printconflicts(Solver *solv, Solvable *s, Id pc)
+/* this is basically the reverse of addrpmrulesforsolvable */
+SolverProbleminfo
+solver_problemruleinfo(Solver *solv, Queue *job, Id rid, Id *depp, Id *sourcep, Id *targetp)
{
Pool *pool = solv->pool;
- Solvable *sc = pool->solvables + pc;
- Id p, *pp, con, *conp, obs, *obsp;
- int numc = 0;
-
- if (s->conflicts)
+ Repo *installed = solv->installed;
+ Rule *r;
+ Solvable *s;
+ int dontfix = 0;
+ Id p, *pp, req, *reqp, con, *conp, obs, *obsp, *dp;
+
+ if (rid >= solv->weakrules)
+ abort();
+ if (rid >= solv->systemrules)
{
- conp = s->repo->idarraydata + s->conflicts;
- while ((con = *conp++) != 0)
+ *depp = 0;
+ *sourcep = solv->installed->start + (rid - solv->systemrules);
+ *targetp = 0;
+ return SOLVER_PROBLEM_UPDATE_RULE;
+ }
+ if (rid >= solv->jobrules)
+ {
+
+ r = solv->rules + rid;
+ p = solv->ruletojob.elements[rid - solv->jobrules];
+ *depp = job->elements[p + 1];
+ *sourcep = p;
+ *targetp = job->elements[p];
+ if (r->d == 0 && r->w2 == 0 && r->p == -SYSTEMSOLVABLE)
+ return SOLVER_PROBLEM_JOB_NOTHING_PROVIDES_DEP;
+ return SOLVER_PROBLEM_JOB_RULE;
+ }
+ if (rid < 0)
+ {
+ /* a rpm rule assertion */
+ if (rid == -SYSTEMSOLVABLE)
+ abort(); /* can happen only for job rules */
+ s = pool->solvables - rid;
+ if (installed && !solv->fixsystem && s->repo == installed)
+ dontfix = 1;
+ if (dontfix) /* dontfix packages never have a neg assertion */
+ abort();
+ /* see why the package is not installable */
+ if (s->arch != ARCH_SRC && s->arch != ARCH_NOSRC && !pool_installable(pool, s))
+ return SOLVER_PROBLEM_NOT_INSTALLABLE;
+ /* check requires */
+ if (!s->requires)
+ abort();
+ reqp = s->repo->idarraydata + s->requires;
+ while ((req = *reqp++) != 0)
{
- FOR_PROVIDES(p, pp, con)
+ if (req == SOLVABLE_PREREQMARKER)
+ continue;
+ dp = pool_whatprovides(pool, req);
+ if (*dp == 0)
{
- if (p != pc)
- continue;
- POOL_DEBUG(SAT_DEBUG_RESULT, "packags %s conflicts with %s, which is provided by %s\n", solvable2str(pool, s), dep2str(pool, con), solvable2str(pool, sc));
- numc++;
+ *depp = req;
+ *sourcep = -rid;
+ *targetp = 0;
+ return SOLVER_PROBLEM_NOTHING_PROVIDES_DEP;
}
}
+ abort();
}
- if (s->obsoletes && (!solv->installed || s->repo != solv->installed))
+ r = solv->rules + rid;
+ if (r->p >= 0)
+ abort(); /* not a rpm rule */
+ if (r->d == 0 && r->w2 == 0)
{
- obsp = s->repo->idarraydata + s->obsoletes;
- while ((obs = *obsp++) != 0)
- {
- FOR_PROVIDES(p, pp, obs)
- {
- if (p != pc)
- continue;
- POOL_DEBUG(SAT_DEBUG_RESULT, "packags %s obsolets %s, which is provided by %s\n", solvable2str(pool, s), dep2str(pool, obs), solvable2str(pool, sc));
- numc++;
- }
- }
+ /* an assertion. we don't store them as rpm rules, so
+ * can't happen */
+ abort();
}
- return numc;
-}
-
-void
-printprobleminfo(Solver *solv, Queue *job, Id problem)
-{
- Pool *pool = solv->pool;
- Rule *r;
- Solvable *s;
- Id p, d, rn;
- Id idx = solv->problems.elements[problem - 1];
-
- rn = solv->learnt_pool.elements[idx];
- if (rn < 0)
+ s = pool->solvables - r->p;
+ if (installed && !solv->fixsystem && s->repo == installed)
+ dontfix = 1;
+ if (r->d == 0 && r->w2 < 0)
{
- p = rn; /* fake a negative assertion rule */
- r = 0;
- }
- else
- {
- r = solv->rules + rn;
- p = r->p;
- }
+ /* a package conflict */
+ Solvable *s2 = pool->solvables - r->w2;
+ int dontfix2 = 0;
- if (!r || r->w2 == 0)
- {
- Id req, *reqp, *dp;
- int count = 0;
+ if (installed && !solv->fixsystem && s2->repo == installed)
+ dontfix2 = 1;
- /* assertions */
- if (p == -SYSTEMSOLVABLE)
+ /* if both packages have the same name and at least one of them
+ * is not installed, they conflict */
+ if (s->name == s2->name && (!installed || (s->repo != installed || s2->repo != installed)))
{
- Id ji, what;
+ *depp = 0;
+ *sourcep = -r->p;
+ *targetp = -r->w2;
+ return SOLVER_PROBLEM_SAME_NAME;
+ }
- /* we tried to deinstall the system solvable. must be a job. */
- if (rn < solv->jobrules || rn >= solv->systemrules)
- abort();
- ji = solv->ruletojob.elements[rn - solv->jobrules];
- what = job->elements[ji + 1];
- switch (job->elements[ji])
- {
- case SOLVER_INSTALL_SOLVABLE_NAME:
- POOL_DEBUG(SAT_DEBUG_RESULT, "no solvable exists with name %s\n", dep2str(pool, what));
- break;
- case SOLVER_INSTALL_SOLVABLE_PROVIDES:
- POOL_DEBUG(SAT_DEBUG_RESULT, "no solvable provides %s\n", dep2str(pool, what));
- break;
- default:
- pool_debug(pool, SAT_FATAL, "unknown job\n");
- abort();
+ /* check conflicts in both directions */
+ if (s->conflicts)
+ {
+ conp = s->repo->idarraydata + s->conflicts;
+ while ((con = *conp++) != 0)
+ {
+ FOR_PROVIDES(p, pp, con)
+ {
+ if (dontfix && pool->solvables[p].repo == installed)
+ continue;
+ if (p != -r->w2)
+ continue;
+ *depp = con;
+ *sourcep = -r->p;
+ *targetp = p;
+ return SOLVER_PROBLEM_PACKAGE_CONFLICT;
+ }
}
- return;
}
- if (p > 0 && solv->learnt_pool.elements[idx + 1] == -p)
+ if (s2->conflicts)
{
- /* we conflicted with a direct rpm assertion */
- /* print other rule */
- p = -p;
- rn = 0;
+ conp = s2->repo->idarraydata + s2->conflicts;
+ while ((con = *conp++) != 0)
+ {
+ FOR_PROVIDES(p, pp, con)
+ {
+ if (dontfix2 && pool->solvables[p].repo == installed)
+ continue;
+ if (p != -r->p)
+ continue;
+ *depp = con;
+ *sourcep = -r->w2;
+ *targetp = p;
+ return SOLVER_PROBLEM_PACKAGE_CONFLICT;
+ }
+ }
}
- if (rn >= solv->jobrules)
+ /* check obsoletes in both directions */
+ if ((!installed || s->repo != installed) && s->obsoletes)
{
- POOL_DEBUG(SAT_DEBUG_RESULT, "some job/system/learnt rule\n");
- printrule(solv, SAT_DEBUG_RESULT, r);
- return;
+ obsp = s->repo->idarraydata + s->obsoletes;
+ while ((obs = *obsp++) != 0)
+ {
+ FOR_PROVIDES(p, pp, obs)
+ {
+ if (p != -r->w2)
+ continue;
+ *depp = obs;
+ *sourcep = -r->p;
+ *targetp = p;
+ return SOLVER_PROBLEM_PACKAGE_OBSOLETES;
+ }
+ }
}
- if (p >= 0)
- abort();
- /* negative assertion, i.e. package is not installable */
- s = pool->solvables + (-p);
- if (s->requires)
+ if ((!installed || s2->repo != installed) && s2->obsoletes)
{
- reqp = s->repo->idarraydata + s->requires;
- while ((req = *reqp++) != 0)
+ obsp = s2->repo->idarraydata + s2->obsoletes;
+ while ((obs = *obsp++) != 0)
{
- if (req == SOLVABLE_PREREQMARKER)
- continue;
- dp = pool_whatprovides(pool, req);
- if (*dp)
- continue;
- POOL_DEBUG(SAT_DEBUG_RESULT, "package %s requires %s, but no package provides it\n", solvable2str(pool, s), dep2str(pool, req));
- count++;
+ FOR_PROVIDES(p, pp, obs)
+ {
+ if (p != -r->p)
+ continue;
+ *depp = obs;
+ *sourcep = -r->w2;
+ *targetp = p;
+ return SOLVER_PROBLEM_PACKAGE_OBSOLETES;
+ }
}
}
- if (!count)
- POOL_DEBUG(SAT_DEBUG_RESULT, "package %s is not installable\n", solvable2str(pool, s));
- return;
+ /* all cases checked, can't happen */
+ abort();
}
-
- if (rn >= solv->learntrules)
- {
- /* learnt rule, ignore for now */
- POOL_DEBUG(SAT_DEBUG_RESULT, "some learnt rule...\n");
- printrule(solv, SAT_DEBUG_RESULT, r);
- return;
- }
- if (rn >= solv->systemrules)
- {
- /* system rule, ignore for now */
- POOL_DEBUG(SAT_DEBUG_RESULT, "some system rule...\n");
- printrule(solv, SAT_DEBUG_RESULT, r);
- return;
- }
- if (rn >= solv->jobrules)
+ /* simple requires */
+ if (!s->requires)
+ abort();
+ reqp = s->repo->idarraydata + s->requires;
+ while ((req = *reqp++) != 0)
{
- /* job rule, ignore for now */
- POOL_DEBUG(SAT_DEBUG_RESULT, "some job rule...\n");
- printrule(solv, SAT_DEBUG_RESULT, r);
- return;
+ if (req == SOLVABLE_PREREQMARKER)
+ continue;
+ dp = pool_whatprovides(pool, req);
+ if (r->d == 0)
+ {
+ if (*dp == r->w2 && dp[1] == 0)
+ break;
+ }
+ else if (dp - pool->whatprovidesdata == r->d)
+ break;
}
- /* only rpm rules left... */
- p = r->p;
- d = r->d;
- if (p >= 0)
+ if (!req)
abort();
- if (d == 0 && r->w2 < 0)
+ *depp = req;
+ *sourcep = -r->p;
+ *targetp = 0;
+ return SOLVER_PROBLEM_DEP_PROVIDERS_NOT_INSTALLABLE;
+}
+
+static void
+findproblemrule_internal(Solver *solv, Id idx, Id *reqrp, Id *conrp, Id *sysrp, Id *jobrp)
+{
+ Id rid;
+ Id lreqr, lconr, lsysr, ljobr;
+ Rule *r;
+
+ lreqr = lconr = lsysr = ljobr = 0;
+ while ((rid = solv->learnt_pool.elements[idx++]) != 0)
{
- Solvable *sp, *sd;
- d = r->w2;
- sp = pool->solvables + (-p);
- sd = pool->solvables + (-d);
- if (sp->name == sd->name)
+ if (rid >= solv->learntrules)
+ findproblemrule_internal(solv, solv->learnt_why.elements[rid - solv->learntrules], &lreqr, &lconr, &lsysr, &ljobr);
+ else if (rid >= solv->systemrules)
{
- POOL_DEBUG(SAT_DEBUG_RESULT, "cannot install both %s and %s\n", solvable2str(pool, sp), solvable2str(pool, sd));
+ if (!*sysrp)
+ *sysrp = rid;
}
- else
+ else if (rid >= solv->jobrules)
{
- printconflicts(solv, pool->solvables + (-p), -d);
- printconflicts(solv, pool->solvables + (-d), -p);
+ if (!*jobrp)
+ *jobrp = rid;
}
- }
- else
- {
- /* find requires of p that corresponds with our rule */
- Id req, *reqp, *dp;
- s = pool->solvables + (-p);
- reqp = s->repo->idarraydata + s->requires;
- while ((req = *reqp++) != 0)
+ else if (rid >= 0)
{
- if (req == SOLVABLE_PREREQMARKER)
- continue;
- dp = pool_whatprovides(pool, req);
- if (d == 0)
+ r = solv->rules + rid;
+ if (!r->d && r->w2 < 0)
{
- if (*dp == r->w2 && dp[1] == 0)
- break;
+ if (!*conrp)
+ *conrp = rid;
+ }
+ else
+ {
+ if (!*reqrp)
+ *reqrp = rid;
}
- else if (dp - pool->whatprovidesdata == d)
- break;
}
- if (!req)
+ else
{
- pool_debug(pool, SAT_FATAL, "req not found\n");
- abort();
+ /* assertion, counts as require rule */
+ /* system solvable doesn't count, as this is useful information */
+ if (rid == -SYSTEMSOLVABLE)
+ continue;
+ if (!*reqrp)
+ *reqrp = rid;
}
- POOL_DEBUG(SAT_DEBUG_RESULT, "package %s requires %s, but none of its providers can be installed\n", solvable2str(pool, s), dep2str(pool, req));
+ }
+ if (!*reqrp && lreqr)
+ *reqrp = lreqr;
+ if (!*conrp && lconr)
+ *conrp = lconr;
+ if (!*jobrp && ljobr)
+ *jobrp = ljobr;
+ if (!*sysrp && lsysr)
+ *sysrp = lsysr;
+}
+
+Id
+findproblemrule(Solver *solv, Id problem)
+{
+ Id reqr, conr, sysr, jobr;
+ Id idx = solv->problems.elements[problem - 1];
+ reqr = conr = sysr = jobr = 0;
+ findproblemrule_internal(solv, idx, &reqr, &conr, &sysr, &jobr);
+ if (reqr)
+ return reqr;
+ if (conr)
+ return conr;
+ if (sysr)
+ return sysr;
+ if (jobr)
+ return jobr;
+ abort();
+}
+
+void
+printprobleminfo(Solver *solv, Queue *job, Id problem)
+{
+ Pool *pool = solv->pool;
+ Id probr;
+ Id dep, source, target;
+ Solvable *s, *s2;
+
+ probr = findproblemrule(solv, problem);
+ switch (solver_problemruleinfo(solv, job, probr, &dep, &source, &target))
+ {
+ case SOLVER_PROBLEM_UPDATE_RULE:
+ s = pool_id2solvable(pool, source);
+ POOL_DEBUG(SAT_DEBUG_RESULT, "problem with installed package %s\n", solvable2str(pool, s));
+ return;
+ case SOLVER_PROBLEM_JOB_RULE:
+ POOL_DEBUG(SAT_DEBUG_RESULT, "conflicting requests\n");
+ return;
+ case SOLVER_PROBLEM_JOB_NOTHING_PROVIDES_DEP:
+ POOL_DEBUG(SAT_DEBUG_RESULT, "nothing provides requested %s\n", dep2str(pool, dep));
+ return;
+ case SOLVER_PROBLEM_NOT_INSTALLABLE:
+ s = pool_id2solvable(pool, source);
+ POOL_DEBUG(SAT_DEBUG_RESULT, "package %s is not installable\n", solvable2str(pool, s));
+ return;
+ case SOLVER_PROBLEM_NOTHING_PROVIDES_DEP:
+ s = pool_id2solvable(pool, source);
+ POOL_DEBUG(SAT_DEBUG_RESULT, "nothing provides %s needed by %s\n", dep2str(pool, dep), solvable2str(pool, s));
+ return;
+ case SOLVER_PROBLEM_SAME_NAME:
+ s = pool_id2solvable(pool, source);
+ s2 = pool_id2solvable(pool, target);
+ POOL_DEBUG(SAT_DEBUG_RESULT, "cannot install both %s and %s\n", solvable2str(pool, s), solvable2str(pool, s2));
+ return;
+ case SOLVER_PROBLEM_PACKAGE_CONFLICT:
+ s = pool_id2solvable(pool, source);
+ s2 = pool_id2solvable(pool, target);
+ POOL_DEBUG(SAT_DEBUG_RESULT, "package %s conflicts with %s provided by %s\n", solvable2str(pool, s), dep2str(pool, dep), solvable2str(pool, s2));
+ return;
+ case SOLVER_PROBLEM_PACKAGE_OBSOLETES:
+ s = pool_id2solvable(pool, source);
+ s2 = pool_id2solvable(pool, target);
+ POOL_DEBUG(SAT_DEBUG_RESULT, "package %s obsoletes %s provided by %s\n", solvable2str(pool, s), dep2str(pool, dep), solvable2str(pool, s2));
+ return;
+ case SOLVER_PROBLEM_DEP_PROVIDERS_NOT_INSTALLABLE:
+ s = pool_id2solvable(pool, source);
+ POOL_DEBUG(SAT_DEBUG_RESULT, "package %s requires %s, but none of the providers can be installed\n", solvable2str(pool, s), dep2str(pool, dep));
+ return;
}
}
Modified: trunk/sat-solver/src/solver.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/solver.h?rev=7971…
==============================================================================
--- trunk/sat-solver/src/solver.h (original)
+++ trunk/sat-solver/src/solver.h Thu Nov 29 10:32:47 2007
@@ -121,6 +121,19 @@
SOLVER_INSTALL_SOLVABLE_UPDATE
} SolverCmd;
+typedef enum {
+ SOLVER_PROBLEM_UPDATE_RULE,
+ SOLVER_PROBLEM_JOB_RULE,
+ SOLVER_PROBLEM_JOB_NOTHING_PROVIDES_DEP,
+ SOLVER_PROBLEM_NOT_INSTALLABLE,
+ SOLVER_PROBLEM_NOTHING_PROVIDES_DEP,
+ SOLVER_PROBLEM_SAME_NAME,
+ SOLVER_PROBLEM_PACKAGE_CONFLICT,
+ SOLVER_PROBLEM_PACKAGE_OBSOLETES,
+ SOLVER_PROBLEM_DEP_PROVIDERS_NOT_INSTALLABLE
+} SolverProbleminfo;
+
+
extern Solver *solver_create(Pool *pool, Repo *installed);
extern void solver_free(Solver *solv);
extern void solver_solve(Solver *solv, Queue *job);
@@ -129,6 +142,8 @@
extern Id solver_next_problem(Solver *solv, Id problem);
extern Id solver_next_solution(Solver *solv, Id problem, Id solution);
extern Id solver_next_solutionelement(Solver *solv, Id problem, Id solution, Id element, Id *p, Id *rp);
+extern SolverProbleminfo solver_problemruleinfo(Solver *solv, Queue *job, Id rid, Id *depp, Id *sourcep, Id *targetp);
+extern Id findproblemrule(Solver *solv, Id problem);
/* debug functions, do not use */
void printdecisions(Solver *solv);
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
[zypp-commit] r7970 - /trunk/libzypp/zypp/sat/detail/PoolImpl.cc
by schubi2@svn.opensuse.org 29 Nov '07
by schubi2@svn.opensuse.org 29 Nov '07
29 Nov '07
Author: schubi2
Date: Thu Nov 29 10:17:15 2007
New Revision: 7970
URL: http://svn.opensuse.org/viewcvs/zypp?rev=7970&view=rev
Log:
using defines; nice debug status :-)
Modified:
trunk/libzypp/zypp/sat/detail/PoolImpl.cc
Modified: trunk/libzypp/zypp/sat/detail/PoolImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/detail/PoolImpl…
==============================================================================
--- trunk/libzypp/zypp/sat/detail/PoolImpl.cc (original)
+++ trunk/libzypp/zypp/sat/detail/PoolImpl.cc Thu Nov 29 10:17:15 2007
@@ -69,7 +69,7 @@
}
// initialialize logging
bool verbose = ( getenv("ZYPP_FULLLOG") || getenv("ZYPP_LIBSAT_FULLLOG") );
- ::pool_setdebuglevel (_pool, verbose ? 5 : 0 );
+ ::pool_setdebuglevel (_pool, verbose ? SAT_DEBUG_SCHUBI : SAT_DEBUG_STATS);
::pool_setdebugcallback(_pool, logSat, NULL );
}
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
[zypp-commit] r7969 - /trunk/libzypp/zypp/sat/detail/PoolImpl.cc
by schubi2@svn.opensuse.org 29 Nov '07
by schubi2@svn.opensuse.org 29 Nov '07
29 Nov '07
Author: schubi2
Date: Thu Nov 29 09:57:31 2007
New Revision: 7969
URL: http://svn.opensuse.org/viewcvs/zypp?rev=7969&view=rev
Log:
addapted to new sat debug
Modified:
trunk/libzypp/zypp/sat/detail/PoolImpl.cc
Modified: trunk/libzypp/zypp/sat/detail/PoolImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/detail/PoolImpl…
==============================================================================
--- trunk/libzypp/zypp/sat/detail/PoolImpl.cc (original)
+++ trunk/libzypp/zypp/sat/detail/PoolImpl.cc Thu Nov 29 09:57:31 2007
@@ -14,7 +14,6 @@
#include <satsolver/solvable.h>
#include <satsolver/repo.h>
#include <satsolver/pool.h>
-#include <satsolver/sat_debug.h>
}
#include <iostream>
@@ -36,9 +35,13 @@
namespace detail
{ /////////////////////////////////////////////////////////////////
- void logSat( char *logString )
+ void logSat( struct _Pool *, void *data, int type, const char *logString )
{
- _MIL("satsolver") << logString;
+ if ((type & (SAT_FATAL|SAT_ERROR)) == 0) {
+ _MIL("satsolver") << logString;
+ } else {
+ _DBG("satsolver") << logString;
+ }
}
///////////////////////////////////////////////////////////////////
@@ -66,8 +69,8 @@
}
// initialialize logging
bool verbose = ( getenv("ZYPP_FULLLOG") || getenv("ZYPP_LIBSAT_FULLLOG") );
- ::sat_set_debug( verbose ? DEBUG_5 : ERROR, 1 ); // logging linenumer, function,....
- ::sat_set_debugCallback( logSat );
+ ::pool_setdebuglevel (_pool, verbose ? 5 : 0 );
+ ::pool_setdebugcallback(_pool, logSat, NULL );
}
///////////////////////////////////////////////////////////////////
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
29 Nov '07
Author: schubi2
Date: Thu Nov 29 09:37:54 2007
New Revision: 7968
URL: http://svn.opensuse.org/viewcvs/zypp?rev=7968&view=rev
Log:
removed verbose flag
Modified:
trunk/libzypp/zypp/sat/SATResolver.cc
Modified: trunk/libzypp/zypp/sat/SATResolver.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/SATResolver.cc?…
==============================================================================
--- trunk/libzypp/zypp/sat/SATResolver.cc (original)
+++ trunk/libzypp/zypp/sat/SATResolver.cc Thu Nov 29 09:37:54 2007
@@ -411,7 +411,6 @@
solv->allowdowngrade = false;
solv->allowuninstall = false;
solv->noupdateprovide = false;
- _SATPool->verbose = true;
// Solve !
MIL << "Starting solving...." << endl;
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
28 Nov '07
Author: mlschroe
Date: Wed Nov 28 17:56:00 2007
New Revision: 7967
URL: http://svn.opensuse.org/viewcvs/zypp?rev=7967&view=rev
Log:
- changed debug mechanism a bit, it is now part of the pool
Removed:
trunk/sat-solver/src/sat_debug.c
trunk/sat-solver/src/sat_debug.h
Modified:
trunk/sat-solver/src/CMakeLists.txt
trunk/sat-solver/src/evr.c
trunk/sat-solver/src/policy.c
trunk/sat-solver/src/pool.c
trunk/sat-solver/src/pool.h
trunk/sat-solver/src/repo_solv.c
trunk/sat-solver/src/solver.c
trunk/sat-solver/src/util.c
trunk/sat-solver/testsuite/deptestomatic.c
trunk/sat-solver/testsuite/yps.c
Modified: trunk/sat-solver/src/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/CMakeLists.txt?re…
==============================================================================
--- trunk/sat-solver/src/CMakeLists.txt (original)
+++ trunk/sat-solver/src/CMakeLists.txt Wed Nov 28 17:56:00 2007
@@ -1,10 +1,10 @@
SET(libsatsolver_SRCS bitmap.c poolarch.c poolvendor.c poolid.c strpool.c
-solver.c repo_solv.c evr.c pool.c queue.c repo.c util.c policy.c sat_debug.c)
+solver.c repo_solv.c evr.c pool.c queue.c repo.c util.c policy.c)
ADD_LIBRARY(satsolver STATIC ${libsatsolver_SRCS})
-SET(libsatsolver_HEADERS bitmap.h evr.h hash.h policy.h poolarch.h poolvendor.h pool.h poolid.h pooltypes.h queue.h solvable.h solver.h repo.h repo_solv.h util.h strpool.h sat_debug.h)
+SET(libsatsolver_HEADERS bitmap.h evr.h hash.h policy.h poolarch.h poolvendor.h pool.h poolid.h pooltypes.h queue.h solvable.h solver.h repo.h repo_solv.h util.h strpool.h)
SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O3 -Wall -fPIC" )
Modified: trunk/sat-solver/src/evr.c
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/evr.c?rev=7967&r1…
==============================================================================
--- trunk/sat-solver/src/evr.c (original)
+++ trunk/sat-solver/src/evr.c Wed Nov 28 17:56:00 2007
@@ -15,7 +15,6 @@
#include <string.h>
#include "evr.h"
#include "pool.h"
-#include "sat_debug.h"
int
vercmp(const char *s1, const char *q1, const char *s2, const char *q2)
@@ -90,7 +89,7 @@
evr2 = id2str(pool, evr2id);
#if 0
- sat_debug (DEBUG_5,"evrcmp %s %s\n", evr1, evr2);
+ POOL_DEBUG(DEBUG_EVRCMP, "evrcmp %s %s\n", evr1, evr2);
#endif
for (s1 = evr1; *s1 >= '0' && *s1 <= '9'; s1++)
;
Modified: trunk/sat-solver/src/policy.c
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/policy.c?rev=7967…
==============================================================================
--- trunk/sat-solver/src/policy.c (original)
+++ trunk/sat-solver/src/policy.c Wed Nov 28 17:56:00 2007
@@ -20,7 +20,6 @@
#include "policy.h"
#include "poolvendor.h"
#include "poolarch.h"
-#include "sat_debug.h"
static Pool *prune_best_version_arch_sortcmp_data;
@@ -223,7 +222,7 @@
if (plist->count < 2) /* no need to prune for a single entry */
return;
- sat_debug (DEBUG_2, "prune_to_best_version %d\n", plist->count);
+ POOL_DEBUG(SAT_DEBUG_POLICY, "prune_to_best_version %d\n", plist->count);
/* prune to best architecture */
if (pool->id2arch)
@@ -268,7 +267,7 @@
{
s = pool->solvables + plist->elements[i];
- sat_debug (DEBUG_2, "- %s\n", solvable2str(pool, s));
+ POOL_DEBUG(SAT_DEBUG_POLICY, "- %s\n", solvable2str(pool, s));
if (!best) /* if no best yet, the current is best */
{
Modified: trunk/sat-solver/src/pool.c
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/pool.c?rev=7967&r…
==============================================================================
--- trunk/sat-solver/src/pool.c (original)
+++ trunk/sat-solver/src/pool.c Wed Nov 28 17:56:00 2007
@@ -14,6 +14,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <stdarg.h>
#include <unistd.h>
#include <string.h>
@@ -24,7 +25,6 @@
#include "poolarch.h"
#include "util.h"
#include "evr.h"
-#include "sat_debug.h"
#define SOLVABLE_BLOCK 255
@@ -95,6 +95,8 @@
s->name = SYSTEM_SYSTEM;
s->arch = ARCH_NOARCH;
s->evr = ID_EMPTY;
+
+ pool->debugmask = SAT_DEBUG_RESULT; /* FIXME */
return pool;
}
@@ -270,7 +272,7 @@
;
}
o = dp - pool->whatprovidesdata;
- sat_debug (DEBUG_1, "shrunk whatprovidesdata from %d to %d\n", pool->whatprovidesdataoff, o);
+ POOL_DEBUG(SAT_DEBUG_STATS, "shrunk whatprovidesdata from %d to %d\n", pool->whatprovidesdataoff, o);
if (pool->whatprovidesdataoff == o)
return;
r = pool->whatprovidesdataoff - o;
@@ -300,8 +302,8 @@
Offset *whatprovides;
Id *whatprovidesdata, *d;
- sat_debug (DEBUG_1,"number of solvables: %d\n", pool->nsolvables);
- sat_debug (DEBUG_1,"number of ids: %d + %d\n", pool->ss.nstrings, pool->nrels);
+ POOL_DEBUG(SAT_DEBUG_STATS, "number of solvables: %d\n", pool->nsolvables);
+ POOL_DEBUG(SAT_DEBUG_STATS, "number of ids: %d + %d\n", pool->ss.nstrings, pool->nrels);
pool_freeidhashes(pool);
pool_freewhatprovides(pool);
@@ -342,13 +344,13 @@
np++; /* inc # of provider 'slots' */
}
- sat_debug (DEBUG_1, "provide ids: %d\n", np);
+ POOL_DEBUG(SAT_DEBUG_STATS, "provide ids: %d\n", np);
extra = 2 * pool->nrels;
if (extra < 256)
extra = 256;
- sat_debug (DEBUG_1, "provide space needed: %d + %d\n", off, extra);
+ POOL_DEBUG(SAT_DEBUG_STATS, "provide space needed: %d + %d\n", off, extra);
/* alloc space for all providers + extra */
whatprovidesdata = (Id *)xcalloc(off + extra, sizeof(Id));
@@ -379,12 +381,7 @@
while (*d) /* find free slot */
d++;
if (d[-1] == i)
- {
-#if 0
- sat_debug (DEBUG_4, "duplicate entry for %s in package %s.%s\n", id2str(pool, id), id2str(pool, s->name), id2str(pool, s->arch));
-#endif
- continue;
- }
+ continue;
}
*d = i; /* put solvable Id into data */
}
@@ -420,7 +417,7 @@
/* extend whatprovidesdata if needed, +1 for ID_NULL-termination */
if (pool->whatprovidesdataleft < count + 1)
{
- sat_debug (DEBUG_1, "growing provides hash data...\n");
+ POOL_DEBUG(SAT_DEBUG_STATS, "growing provides hash data...\n");
pool->whatprovidesdata = (Id *)xrealloc(pool->whatprovidesdata, (pool->whatprovidesdataoff + count + 4096) * sizeof(Id));
pool->whatprovidesdataleft = count + 4096;
}
@@ -438,7 +435,7 @@
}
-/******************************************************************************/
+/*************************************************************************/
/*
* addrelproviders
@@ -507,14 +504,14 @@
/* convert to whatprovides id */
#if 0
- sat_debug (DEBUG_1, "addrelproviders: what provides %s?\n", id2str(pool, name));
+ POOL_DEBUG(DEBUG_1, "addrelproviders: what provides %s?\n", id2str(pool, name));
#endif
if (flags && flags < 8)
{
FOR_PROVIDES(p, pp, name)
{
#if 0
- sat_debug (DEBUG_1, "addrelproviders: checking package %s\n", id2str(pool, pool->p[p].name));
+ POOL_DEBUG(DEBUG_1, "addrelproviders: checking package %s\n", id2str(pool, pool->p[p].name));
#endif
/* solvable p provides name in some rels */
pidp = pool->solvables[p].repo->idarraydata + pool->solvables[p].provides;
@@ -561,7 +558,7 @@
}
/* add providers to whatprovides */
#if 0
- sat_debug (DEBUG_1, "addrelproviders: adding %d packages to %d\n", plist.count, d);
+ POOL_DEBUG(DEBUG_1, "addrelproviders: adding %d packages to %d\n", plist.count, d);
#endif
pool->whatprovides[d] = pool_queuetowhatprovides(pool, &plist);
queue_free(&plist);
@@ -569,4 +566,48 @@
return pool->whatprovidesdata + pool->whatprovides[d];
}
+/*************************************************************************/
+
+void
+pool_debug(Pool *pool, int type, const char *format, ...)
+{
+ va_list args;
+ char buf[1024];
+
+ if ((type & SAT_FATAL) == 0)
+ {
+ if ((pool->debugmask & type) == 0)
+ return;
+ }
+ va_start(args, format);
+ if (!pool->debugcallback)
+ {
+ if ((type & (SAT_FATAL|SAT_ERROR)) == 0)
+ vprintf(format, args);
+ else
+ vfprintf(stderr, format, args);
+ return;
+ }
+ vsnprintf(buf, sizeof(buf), format, args);
+ pool->debugcallback(pool, pool->debugcallbackdata, type, buf);
+}
+
+void
+pool_setdebuglevel(Pool *pool, int level)
+{
+ int mask = SAT_DEBUG_RESULT;
+ if (level > 0)
+ mask |= SAT_DEBUG_STATS|SAT_DEBUG_ANALYZE|SAT_DEBUG_UNSOLVABLE;
+ if (level > 1)
+ mask |= SAT_DEBUG_JOB|SAT_DEBUG_SOLUTIONS|SAT_DEBUG_POLICY;
+ if (level > 2)
+ mask |= SAT_DEBUG_PROPAGATE;
+ if (level > 3)
+ mask |= SAT_DEBUG_RULE_CREATION;
+ if (level > 4)
+ mask |= SAT_DEBUG_SCHUBI;
+ pool->debugmask = mask;
+}
+
+
// EOF
Modified: trunk/sat-solver/src/pool.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/pool.h?rev=7967&r…
==============================================================================
--- trunk/sat-solver/src/pool.h (original)
+++ trunk/sat-solver/src/pool.h Wed Nov 28 17:56:00 2007
@@ -63,8 +63,6 @@
struct _Repo;
struct _Pool {
- int verbose; // pool is used everywhere, so put the verbose flag here
-
struct _Stringpool ss;
Reldep *rels; // table of rels: Id -> Reldep
@@ -100,8 +98,27 @@
char *dep2strbuf[DEP2STRBUF];
int dep2strlen[DEP2STRBUF];
int dep2strn;
+
+ /* debug mask and callback */
+ int debugmask;
+ void (*debugcallback)(struct _Pool *, void *data, int type, const char *str);
+ void *debugcallbackdata;
};
+#define SAT_FATAL (1<<0)
+#define SAT_ERROR (1<<1)
+#define SAT_WARN (1<<2)
+#define SAT_DEBUG_STATS (1<<3)
+#define SAT_DEBUG_RULE_CREATION (1<<4)
+#define SAT_DEBUG_PROPAGATE (1<<5)
+#define SAT_DEBUG_ANALYZE (1<<6)
+#define SAT_DEBUG_UNSOLVABLE (1<<7)
+#define SAT_DEBUG_SOLUTIONS (1<<8)
+#define SAT_DEBUG_POLICY (1<<9)
+#define SAT_DEBUG_RESULT (1<<10)
+#define SAT_DEBUG_JOB (1<<11)
+#define SAT_DEBUG_SCHUBI (1<<12)
+
#define TYPE_ID 1
#define TYPE_IDARRAY 2
#define TYPE_STR 3
@@ -137,6 +154,8 @@
*/
extern void pool_free(Pool *pool);
+extern void pool_debug(Pool *pool, int type, const char *format, ...) __attribute__((format(printf, 3, 4)));
+
/**
* Solvable management
*/
@@ -180,13 +199,29 @@
return pool_addrelproviders(pool, d);
}
+extern void pool_setdebuglevel(Pool *pool, int level);
+
+static inline void pool_setdebugcallback(Pool *pool, void (*debugcallback)(struct _Pool *, void *data, int type, const char *str), void *debugcallbackdata)
+{
+ pool->debugcallback = debugcallback;
+ pool->debugcallbackdata = debugcallbackdata;
+}
+
+static inline void pool_setdebugmask(Pool *pool, int mask)
+{
+ pool->debugmask = mask;
+}
+
/* loop over all providers of d */
#define FOR_PROVIDES(v, vp, d) \
for (vp = pool_whatprovides(pool, d) ; (v = *vp++) != 0; )
+#define POOL_DEBUG(type, ...) do {if ((pool->debugmask & (type)) != 0) pool_debug(pool, (type), __VA_ARGS__);} while (0)
+#define IF_POOLDEBUG(type) if ((pool->debugmask & (type)) != 0)
#ifdef __cplusplus
}
#endif
+
#endif /* SATSOLVER_POOL_H */
Modified: trunk/sat-solver/src/repo_solv.c
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/repo_solv.c?rev=7…
==============================================================================
--- trunk/sat-solver/src/repo_solv.c (original)
+++ trunk/sat-solver/src/repo_solv.c Wed Nov 28 17:56:00 2007
@@ -25,11 +25,12 @@
#include "repo_solv.h"
#include "util.h"
-#include "sat_debug.h"
#define INTERESTED_START SOLVABLE_NAME
#define INTERESTED_END SOLVABLE_FRESHENS
+Pool *mypool; /* for pool_debug... */
+
/*-----------------------------------------------------------------*/
/* .solv read functions */
@@ -48,7 +49,7 @@
c = getc(fp);
if (c == EOF)
{
- sat_debug (ERROR, "unexpected EOF\n");
+ pool_debug(mypool, SAT_FATAL, "unexpected EOF\n");
exit(1);
}
x = (x << 8) | c;
@@ -68,7 +69,7 @@
c = getc(fp);
if (c == EOF)
{
- sat_debug (ERROR, "unexpected EOF\n");
+ pool_debug(mypool, SAT_FATAL, "unexpected EOF\n");
exit(1);
}
return c;
@@ -90,7 +91,7 @@
c = getc(fp);
if (c == EOF)
{
- sat_debug (ERROR, "unexpected EOF\n");
+ pool_debug(mypool, SAT_FATAL, "unexpected EOF\n");
exit(1);
}
if (!(c & 128))
@@ -98,14 +99,14 @@
x = (x << 7) | c;
if (x >= max)
{
- sat_debug (ERROR, "read_id: id too large (%u/%u)\n", x, max);
+ pool_debug(mypool, SAT_FATAL, "read_id: id too large (%u/%u)\n", x, max);
exit(1);
}
return x;
}
x = (x << 7) ^ c ^ 128;
}
- sat_debug (ERROR, "read_id: id too long\n");
+ pool_debug(mypool, SAT_FATAL, "read_id: id too long\n");
exit(1);
}
@@ -124,7 +125,7 @@
c = getc(fp);
if (c == EOF)
{
- sat_debug (ERROR, "unexpected EOF\n");
+ pool_debug(mypool, SAT_FATAL, "unexpected EOF\n");
exit(1);
}
if ((c & 128) == 0)
@@ -132,12 +133,12 @@
x = (x << 6) | (c & 63);
if (x >= max)
{
- sat_debug (ERROR, "read_idarray: id too large (%u/%u)\n", x, max);
+ pool_debug(mypool, SAT_FATAL, "read_idarray: id too large (%u/%u)\n", x, max);
exit(1);
}
if (store == end)
{
- sat_debug (ERROR, "read_idarray: array overflow\n");
+ pool_debug(mypool, SAT_FATAL, "read_idarray: array overflow\n");
exit(1);
}
*store++ = map[x];
@@ -145,7 +146,7 @@
{
if (store == end)
{
- sat_debug (ERROR, "read_idarray: array overflow\n");
+ pool_debug(mypool, SAT_FATAL, "read_idarray: array overflow\n");
exit(1);
}
*store++ = 0;
@@ -201,14 +202,16 @@
unsigned int databits;
Solvable *s;
+ mypool = pool;
+
if (read_u32(fp) != ('S' << 24 | 'O' << 16 | 'L' << 8 | 'V'))
{
- sat_debug (ERROR, "not a SOLV file\n");
+ pool_debug(pool, SAT_FATAL, "not a SOLV file\n");
exit(1);
}
if (read_u32(fp) != SOLV_VERSION)
{
- sat_debug (ERROR, "unsupported SOLV version\n");
+ pool_debug(pool, SAT_FATAL, "unsupported SOLV version\n");
exit(1);
}
@@ -251,7 +254,7 @@
if (fread(strsp, sizeid, 1, fp) != 1)
{
- sat_debug (ERROR, "read error while reading strings\n");
+ pool_debug(pool, SAT_FATAL, "read error while reading strings\n");
exit(1);
}
strsp[sizeid] = 0; /* make string space \0 terminated */
@@ -265,8 +268,8 @@
hashmask = mkmask(pool->ss.nstrings + numid);
#if 0
- sat_debug (ALWAYS, "read %d strings\n", numid);
- sat_debug (ALWAYS, "string hash buckets: %d\n", hashmask + 1);
+ POOL_DEBUG(SAT_DEBUG_STATS, "read %d strings\n", numid);
+ POOL_DEBUG(SAT_DEBUG_STATS, "string hash buckets: %d\n", hashmask + 1);
#endif
/*
@@ -298,7 +301,7 @@
{
if (sp >= strsp + sizeid)
{
- sat_debug (ERROR, "not enough strings\n");
+ pool_debug(pool, SAT_FATAL, "not enough strings\n");
exit(1);
}
if (!*sp) /* empty string */
@@ -350,15 +353,15 @@
ran = (Reldep *)xrealloc(pool->rels, (pool->nrels + numrel) * sizeof(Reldep));
if (!ran)
{
- sat_debug (ERROR, "no mem for rel space\n");
+ pool_debug(pool, SAT_FATAL, "no mem for rel space\n");
exit(1);
}
pool->rels = ran; /* extended rel space */
hashmask = mkmask(pool->nrels + numrel);
#if 0
- sat_debug (ALWAYS, "read %d rels\n", numrel);
- sat_debug (ALWAYS, "rel hash buckets: %d\n", hashmask + 1);
+ POOL_DEBUG(SAT_DEBUG_STATS, "read %d rels\n", numrel);
+ POOL_DEBUG(SAT_DEBUG_STATS, "rel hash buckets: %d\n", hashmask + 1);
#endif
/*
* prep hash table with already existing RelDeps
@@ -415,7 +418,7 @@
*/
#if 0
- sat_debug (ALWAYS, "read repo data\n");
+ POOL_DEBUG(SAT_DEBUG_STATS, "read repo data\n");
#endif
numsrcdata = read_u32(fp);
for (i = 0; i < numsrcdata; i++)
@@ -435,7 +438,7 @@
;
break;
default:
- sat_debug (ERROR, "unknown type\n");
+ pool_debug(pool, SAT_FATAL, "unknown type %d\n", type);
exit(0);
}
}
@@ -446,7 +449,7 @@
*/
#if 0
- sat_debug (ALWAYS, "read solvable data info\n");
+ POOL_DEBUG(SAT_DEBUG_STATS, "read solvable data info\n");
#endif
numsolvdata = read_u32(fp);
numsolvdatabits = 0;
@@ -465,7 +468,7 @@
}
id = idmap[read_id(fp, numid)];
#if 0
- sat_debug (ALWAYS, "#%d: %s\n", i, id2str(pool, id));
+ POOL_DEBUG(SAT_DEBUG_STATS, "#%d: %s\n", i, id2str(pool, id));
#endif
solvdata[i].id = id;
size = read_u32(fp);
@@ -481,7 +484,7 @@
if (numsolvdatabits >= 32)
{
- sat_debug (ERROR, "too many data map bits\n");
+ pool_debug(pool, SAT_FATAL, "too many data map bits\n");
exit(1);
}
@@ -505,7 +508,7 @@
*/
#if 0
- sat_debug (ALWAYS, "read solvables\n");
+ POOL_DEBUG(SAT_DEBUG_STATS, "read solvables\n");
#endif
s = pool_id2solvable(pool, repo_add_solvable_block(repo, numsolv));
for (i = 0; i < numsolv; i++, s++)
@@ -543,13 +546,13 @@
else if (id == SOLVABLE_VENDOR)
s->vendor = did;
#if 0
- sat_debug (ALWAYS, "%s -> %s\n", id2str(pool, id), id2str(pool, did));
+ POOL_DEBUG(SAT_DEBUG_STATS, "%s -> %s\n", id2str(pool, id), id2str(pool, did));
#endif
break;
case TYPE_U32:
h = read_u32(fp);
#if 0
- sat_debug (ALWAYS, "%s -> %u\n", id2str(pool, id), h);
+ POOL_DEBUG(SAT_DEBUG_STATS, "%s -> %u\n", id2str(pool, id), h);
#endif
if (id == RPM_RPMDBID)
{
@@ -591,9 +594,9 @@
else if (id == SOLVABLE_FRESHENS)
s->freshens = ido;
#if 0
- sat_debug (ALWAYS, "%s ->\n", id2str(pool, id));
+ POOL_DEBUG(SAT_DEBUG_STATS, "%s ->\n", id2str(pool, id));
for (; repo->idarraydata[ido]; ido++)
- sat_debug (ALWAYS," %s\n", dep2str(pool, repo->idarraydata[ido]));
+ POOL_DEBUG(SAT_DEBUG_STATS," %s\n", dep2str(pool, repo->idarraydata[ido]));
#endif
break;
}
@@ -601,6 +604,7 @@
}
xfree(idmap);
xfree(solvdata);
+ mypool = 0;
}
// EOF
Modified: trunk/sat-solver/src/solver.c
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/solver.c?rev=7967…
==============================================================================
--- trunk/sat-solver/src/solver.c (original)
+++ trunk/sat-solver/src/solver.c Wed Nov 28 17:56:00 2007
@@ -22,7 +22,6 @@
#include "util.h"
#include "evr.h"
#include "policy.h"
-#include "sat_debug.h"
#define RULES_BLOCK 63
@@ -92,32 +91,32 @@
*/
static void
-printruleelement(Solver *solv, Rule *r, Id v)
+printruleelement(Solver *solv, int type, Rule *r, Id v)
{
Pool *pool = solv->pool;
Solvable *s;
if (v < 0)
{
s = pool->solvables + -v;
- sat_debug (ALWAYS, " !%s [%d]", solvable2str(pool, s), -v);
+ POOL_DEBUG(type, " !%s [%d]", solvable2str(pool, s), -v);
}
else
{
s = pool->solvables + v;
- sat_debug (ALWAYS, " %s [%d]", solvable2str(pool, s), v);
+ POOL_DEBUG(type, " %s [%d]", solvable2str(pool, s), v);
}
if (r)
{
if (r->w1 == v)
- sat_debug (ALWAYS, " (w1)");
+ POOL_DEBUG(type, " (w1)");
if (r->w2 == v)
- sat_debug (ALWAYS, " (w2)");
+ POOL_DEBUG(type, " (w2)");
}
if (solv->decisionmap[s - pool->solvables] > 0)
- sat_debug (ALWAYS, " Install.level%d", solv->decisionmap[s - pool->solvables]);
+ POOL_DEBUG(type, " Install.level%d", solv->decisionmap[s - pool->solvables]);
if (solv->decisionmap[s - pool->solvables] < 0)
- sat_debug (ALWAYS, " Conflict.level%d", -solv->decisionmap[s - pool->solvables]);
- sat_debug (ALWAYS, "\n");
+ POOL_DEBUG(type, " Conflict.level%d", -solv->decisionmap[s - pool->solvables]);
+ POOL_DEBUG(type, "\n");
}
@@ -126,18 +125,19 @@
*/
static void
-printrule(Solver *solv, Rule *r)
+printrule(Solver *solv, int type, Rule *r)
{
+ Pool *pool = solv->pool;
int i;
Id v;
if (r >= solv->rules && r < solv->rules + solv->nrules) /* r is a solver rule */
- sat_debug (ALWAYS, "Rule #%d:", (int)(r - solv->rules));
+ POOL_DEBUG(type, "Rule #%d:", (int)(r - solv->rules));
else
- sat_debug (ALWAYS, "Rule:"); /* r is any rule */
+ POOL_DEBUG(type, "Rule:"); /* r is any rule */
if (r && r->w1 == 0)
- sat_debug (ALWAYS, " (disabled)");
- sat_debug (ALWAYS, "\n");
+ POOL_DEBUG(type, " (disabled)");
+ POOL_DEBUG(type, "\n");
for (i = 0; ; i++)
{
if (i == 0)
@@ -152,23 +152,24 @@
v = solv->pool->whatprovidesdata[r->d + i - 1];
if (v == ID_NULL)
break;
- printruleelement(solv, r, v);
+ printruleelement(solv, type, r, v);
}
- sat_debug (ALWAYS, " next: %d %d\n", r->n1, r->n2);
+ POOL_DEBUG(type, " next: %d %d\n", r->n1, r->n2);
}
static void
-printruleclass(Solver *solv, Rule *r)
+printruleclass(Solver *solv, int type, Rule *r)
{
+ Pool *pool = solv->pool;
if (r - solv->rules >= solv->learntrules)
- sat_debug (ALWAYS, "LEARNT ");
+ POOL_DEBUG(type, "LEARNT ");
else if (r - solv->rules >= solv->weakrules)
- sat_debug (ALWAYS, "WEAK ");
+ POOL_DEBUG(type, "WEAK ");
else if (r - solv->rules >= solv->systemrules)
- sat_debug (ALWAYS, "SYSTEM ");
+ POOL_DEBUG(type, "SYSTEM ");
else if (r - solv->rules >= solv->jobrules)
- sat_debug (ALWAYS, "JOB ");
- printrule(solv, r);
+ POOL_DEBUG(type, "JOB ");
+ printrule(solv, type, r);
}
@@ -230,13 +231,14 @@
static void
unifyrules(Solver *solv)
{
+ Pool *pool = solv->pool;
int i, j;
Rule *ir, *jr;
if (solv->nrules <= 1) /* nothing to unify */
return;
- sat_debug (DEBUG_4, "----- unifyrules -----\n");
+ POOL_DEBUG(SAT_DEBUG_SCHUBI, "----- unifyrules -----\n");
/* sort rules first */
unifyrules_sortcmp_data = solv->pool;
@@ -257,13 +259,12 @@
}
/* reduced count from nrules to j rules */
- sat_debug (DEBUG_1, "pruned rules from %d to %d\n", solv->nrules, j);
+ POOL_DEBUG(SAT_DEBUG_STATS, "pruned rules from %d to %d\n", solv->nrules, j);
/* adapt rule buffer */
solv->nrules = j;
solv->rules = (Rule *)xrealloc(solv->rules, ((solv->nrules + RULES_BLOCK) & ~RULES_BLOCK) * sizeof(Rule));
-#if 1
- if (sat_debug_level() >= DEBUG_1)
+ IF_POOLDEBUG (SAT_DEBUG_STATS)
{
int binr = 0;
int lits = 0;
@@ -282,11 +283,10 @@
lits++;
}
}
- sat_debug (DEBUG_1, " binary: %d\n", binr);
- sat_debug (DEBUG_1," normal: %d, %d literals\n", solv->nrules - 1 - binr, lits);
+ POOL_DEBUG(SAT_DEBUG_STATS, " binary: %d\n", binr);
+ POOL_DEBUG(SAT_DEBUG_STATS, " normal: %d, %d literals\n", solv->nrules - 1 - binr, lits);
}
-#endif
- sat_debug (DEBUG_4, "----- unifyrules end -----\n");
+ POOL_DEBUG(SAT_DEBUG_SCHUBI, "----- unifyrules end -----\n");
}
#if 0
@@ -349,6 +349,7 @@
static Rule *
addrule(Solver *solv, Id p, Id d)
{
+ Pool *pool = solv->pool;
Rule *r = 0;
Id *dp = 0;
@@ -377,7 +378,7 @@
}
else if (d > 0)
{
- for (dp = solv->pool->whatprovidesdata + d; *dp; dp++, n++)
+ for (dp = pool->whatprovidesdata + d; *dp; dp++, n++)
if (*dp == -p)
return 0; /* rule is self-fulfilling */
if (n == 1)
@@ -418,8 +419,8 @@
Id *dp2;
if (d == r->d)
return r;
- dp2 = solv->pool->whatprovidesdata + r->d;
- for (dp = solv->pool->whatprovidesdata + d; *dp; dp++, dp2++)
+ dp2 = pool->whatprovidesdata + r->d;
+ for (dp = pool->whatprovidesdata + d; *dp; dp++, dp2++)
if (*dp != *dp2)
break;
if (*dp == *dp2)
@@ -457,15 +458,15 @@
{
r->d = d;
r->w1 = p;
- r->w2 = solv->pool->whatprovidesdata[d];
+ r->w2 = pool->whatprovidesdata[d];
}
r->n1 = 0;
r->n2 = 0;
- if (sat_debug_level() >= DEBUG_3)
+ IF_POOLDEBUG (SAT_DEBUG_RULE_CREATION)
{
- sat_debug (DEBUG_4, " Add rule: ");
- printrule (solv, r);
+ POOL_DEBUG(SAT_DEBUG_RULE_CREATION, " Add rule: ");
+ printrule(solv, SAT_DEBUG_RULE_CREATION, r);
}
return r;
@@ -535,24 +536,25 @@
static void
printproblem(Solver *solv, Id v)
{
+ Pool *pool = solv->pool;
int i;
Rule *r;
Id *jp;
if (v > 0)
- printrule(solv, solv->rules + v);
+ printrule(solv, SAT_DEBUG_SOLUTIONS, solv->rules + v);
else
{
v = -(v + 1);
- sat_debug (ALWAYS, "JOB %d\n", v);
+ POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "JOB %d\n", v);
jp = solv->ruletojob.elements;
for (i = solv->jobrules, r = solv->rules + i; i < solv->systemrules; i++, r++, jp++)
if (*jp == v)
{
- sat_debug (ALWAYS, " -");
- printrule(solv, r);
+ POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "- ");
+ printrule(solv, SAT_DEBUG_SOLUTIONS, r);
}
- sat_debug (ALWAYS, "ENDJOB\n");
+ POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "ENDJOB\n");
}
}
@@ -568,12 +570,13 @@
static void
makeruledecisions(Solver *solv)
{
+ Pool *pool = solv->pool;
int i, ri;
Rule *r, *rr;
Id v, vv;
int decisionstart;
- sat_debug (DEBUG_4, "----- makeruledecisions ; size decisionq: %d -----\n",solv->decisionq.count);
+ POOL_DEBUG(SAT_DEBUG_SCHUBI, "----- makeruledecisions ; size decisionq: %d -----\n",solv->decisionq.count);
decisionstart = solv->decisionq.count;
/* rpm rules don't have assertions, so we can start with the job
@@ -589,13 +592,13 @@
queue_push(&solv->decisionq, v);
queue_push(&solv->decisionq_why, r - solv->rules);
solv->decisionmap[vv] = v > 0 ? 1 : -1;
- if (sat_debug_level() >= DEBUG_4)
+ IF_POOLDEBUG (SAT_DEBUG_PROPAGATE)
{
Solvable *s = solv->pool->solvables + vv;
if (v < 0)
- sat_debug (ALWAYS, "removing %s\n", solvable2str(solv->pool, s));
+ POOL_DEBUG(SAT_DEBUG_PROPAGATE, "conflicting %s (assertion)\n", solvable2str(solv->pool, s));
else
- sat_debug (ALWAYS, "installing %s\n", solvable2str(solv->pool, s));
+ POOL_DEBUG(SAT_DEBUG_PROPAGATE, "installing %s (assertion)\n", solvable2str(solv->pool, s));
}
continue;
}
@@ -614,8 +617,8 @@
/* if we are weak, just disable ourself */
if (ri >= solv->weakrules)
{
- sat_debug (ALWAYS, "conflict, but I am weak, disabling ");
- printrule(solv, r);
+ POOL_DEBUG(SAT_DEBUG_UNSOLVABLE, "assertion conflict, but I am weak, disabling ");
+ printrule(solv, SAT_DEBUG_UNSOLVABLE, r);
disablerule(solv, r);
continue;
}
@@ -636,7 +639,7 @@
queue_push(&solv->learnt_pool, ri);
queue_push(&solv->learnt_pool, v != -SYSTEMSOLVABLE ? -v : v);
queue_push(&solv->learnt_pool, 0);
- sat_debug (ALWAYS, "conflict with rpm rule, disabling rule #%d\n", ri);
+ POOL_DEBUG(SAT_DEBUG_UNSOLVABLE, "conflict with rpm rule, disabling rule #%d\n", ri);
if (ri < solv->systemrules)
v = -(solv->ruletojob.elements[ri - solv->jobrules] + 1);
else
@@ -653,7 +656,7 @@
queue_push(&solv->learnt_pool, 0);
/* conflict with another job or system rule */
- sat_debug (ALWAYS, "conflicting system/job rules over literal %d\n", vv);
+ POOL_DEBUG(SAT_DEBUG_UNSOLVABLE, "conflicting system/job assertions over literal %d\n", vv);
/* push all of our rules asserting this literal on the problem stack */
for (i = solv->jobrules, rr = solv->rules + i; i < solv->nrules; i++, rr++)
{
@@ -661,7 +664,7 @@
continue;
if (rr->p != vv && rr->p != -vv)
continue;
- sat_debug (ALWAYS, " - disabling rule #%d\n", i);
+ POOL_DEBUG(SAT_DEBUG_UNSOLVABLE, " - disabling rule #%d\n", i);
v = i;
if (i < solv->systemrules)
v = -(solv->ruletojob.elements[i - solv->jobrules] + 1);
@@ -682,7 +685,7 @@
r = solv->rules + ri;
}
- sat_debug (DEBUG_4, "----- makeruledecisions end; size decisionq: %d -----\n",solv->decisionq.count);
+ POOL_DEBUG(SAT_DEBUG_SCHUBI, "----- makeruledecisions end; size decisionq: %d -----\n",solv->decisionq.count);
}
/*
@@ -693,11 +696,12 @@
static void
enabledisablelearntrules(Solver *solv)
{
+ Pool *pool = solv->pool;
Rule *r;
Id why, *whyp;
int i;
- sat_debug (DEBUG_1, "enabledisablelearntrules called\n");
+ POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "enabledisablelearntrules called\n");
for (i = solv->learntrules, r = solv->rules + i; i < solv->nrules; i++, r++)
{
whyp = solv->learnt_pool.elements + solv->learnt_why.elements[i - solv->learntrules];
@@ -711,19 +715,19 @@
/* why != 0: we found a disabled rule, disable the learnt rule */
if (why && r->w1)
{
- if (sat_debug_level() >= DEBUG_1)
+ IF_POOLDEBUG (SAT_DEBUG_SOLUTIONS)
{
- sat_debug (DEBUG_1, "disabling learnt ");
- printrule(solv, r);
+ POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "disabling learnt ");
+ printrule(solv, SAT_DEBUG_SOLUTIONS, r);
}
disablerule(solv, r);
}
else if (!why && !r->w1)
{
- if (sat_debug_level() >= DEBUG_1)
+ IF_POOLDEBUG (SAT_DEBUG_SOLUTIONS)
{
- sat_debug (DEBUG_1, "re-enabling learnt ");
- printrule(solv, r);
+ POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "re-enabling learnt ");
+ printrule(solv, SAT_DEBUG_SOLUTIONS, r);
}
enablerule(solv, r);
}
@@ -832,10 +836,10 @@
if (r->w1)
continue;
enablerule(solv, r);
- if (sat_debug_level() >= DEBUG_1)
+ IF_POOLDEBUG (SAT_DEBUG_SOLUTIONS)
{
- sat_debug (DEBUG_1, "@@@ re-enabling ");
- printrule(solv, r);
+ POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "@@@ re-enabling ");
+ printrule(solv, SAT_DEBUG_SOLUTIONS, r);
}
}
break;
@@ -849,10 +853,10 @@
if (r->w1)
break;
enablerule(solv, r);
- if (sat_debug_level() >= DEBUG_1)
+ IF_POOLDEBUG (SAT_DEBUG_SOLUTIONS)
{
- sat_debug (DEBUG_1, "@@@ re-enabling ");
- printrule(solv, r);
+ POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "@@@ re-enabling ");
+ printrule(solv, SAT_DEBUG_SOLUTIONS, r);
}
break;
case SOLVER_ERASE_SOLVABLE_NAME: /* remove by capability */
@@ -869,10 +873,10 @@
if (r->w1)
continue;
enablerule(solv, r);
- if (sat_debug_level() >= DEBUG_1)
+ IF_POOLDEBUG (SAT_DEBUG_SOLUTIONS)
{
- sat_debug (DEBUG_1, "@@@ re-enabling ");
- printrule(solv, r);
+ POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "@@@ re-enabling ");
+ printrule(solv, SAT_DEBUG_SOLUTIONS, r);
}
}
break;
@@ -915,7 +919,7 @@
Id *dp;
Id n;
- sat_debug (DEBUG_4, "----- addrpmrulesforsolvable -----\n");
+ POOL_DEBUG(SAT_DEBUG_SCHUBI, "----- addrpmrulesforsolvable -----\n");
queue_init_buffer(&q, qbuf, sizeof(qbuf)/sizeof(*qbuf));
queue_push(&q, s - pool->solvables); /* push solvable Id */
@@ -944,7 +948,7 @@
if (!dontfix && s->arch != ARCH_SRC && s->arch != ARCH_NOSRC && !pool_installable(pool, s))
{
- sat_debug (DEBUG_1, "package %s [%d] is not installable\n", solvable2str(pool, s), (Id)(s - pool->solvables));
+ POOL_DEBUG(SAT_DEBUG_RULE_CREATION, "package %s [%d] is not installable\n", solvable2str(pool, s), (Id)(s - pool->solvables));
addrule(solv, -n, 0); /* uninstallable */
}
@@ -978,7 +982,7 @@
}
if (!p) /* previously broken dependency */
{
- sat_debug (DEBUG_1, "ignoring broken requires %s of installed package %s\n", dep2str(pool, req), solvable2str(pool, s));
+ POOL_DEBUG(SAT_DEBUG_RULE_CREATION, "ignoring broken requires %s of installed package %s\n", dep2str(pool, req), solvable2str(pool, s));
continue;
}
}
@@ -986,16 +990,16 @@
if (!*dp)
{
/* nothing provides req! */
- sat_debug (DEBUG_1, "package %s [%d] is not installable (%s)\n", solvable2str(pool, s), (Id)(s - pool->solvables), dep2str(pool, req));
+ POOL_DEBUG(SAT_DEBUG_RULE_CREATION, "package %s [%d] is not installable (%s)\n", solvable2str(pool, s), (Id)(s - pool->solvables), dep2str(pool, req));
addrule(solv, -n, 0); /* mark requestor as uninstallable */
continue;
}
- if (sat_debug_level() >= DEBUG_2)
+ IF_POOLDEBUG (SAT_DEBUG_RULE_CREATION)
{
- sat_debug (DEBUG_2," %s requires %s\n", solvable2str(pool, s), dep2str(pool, req));
+ POOL_DEBUG(SAT_DEBUG_RULE_CREATION," %s requires %s\n", solvable2str(pool, s), dep2str(pool, req));
for (i = 0; dp[i]; i++)
- sat_debug (DEBUG_2, " provided by %s\n", solvable2str(pool, pool->solvables + dp[i]));
+ POOL_DEBUG(SAT_DEBUG_RULE_CREATION, " provided by %s\n", solvable2str(pool, pool->solvables + dp[i]));
}
/* add 'requires' dependency */
@@ -1083,8 +1087,7 @@
}
}
queue_free(&q);
- sat_debug (DEBUG_4, "----- addrpmrulesforsolvable end -----\n");
-
+ POOL_DEBUG(SAT_DEBUG_SCHUBI, "----- addrpmrulesforsolvable end -----\n");
}
static void
@@ -1095,7 +1098,7 @@
Id sup, *supp;
int i, n;
- sat_debug (DEBUG_4, "----- addrpmrulesforweak -----\n");
+ POOL_DEBUG(SAT_DEBUG_SCHUBI, "----- addrpmrulesforweak -----\n");
for (i = n = 1; n < pool->nsolvables; i++, n++)
{
if (i == pool->nsolvables)
@@ -1132,7 +1135,7 @@
addrpmrulesforsolvable(solv, s, m);
n = 0;
}
- sat_debug (DEBUG_4, "----- addrpmrulesforweak end -----\n");
+ POOL_DEBUG(SAT_DEBUG_SCHUBI, "----- addrpmrulesforweak end -----\n");
}
static void
@@ -1143,7 +1146,7 @@
Queue qs;
Id qsbuf[64];
- sat_debug (DEBUG_4, "----- addrpmrulesforupdaters -----\n");
+ POOL_DEBUG(SAT_DEBUG_SCHUBI, "----- addrpmrulesforupdaters -----\n");
queue_init_buffer(&qs, qsbuf, sizeof(qsbuf)/sizeof(*qsbuf));
policy_findupdatepackages(solv, s, &qs, allowall);
@@ -1154,8 +1157,7 @@
addrpmrulesforsolvable(solv, pool->solvables + qs.elements[i], m);
queue_free(&qs);
- sat_debug (DEBUG_1, "----- addrpmrulesforupdaters -----\n");
-
+ POOL_DEBUG(SAT_DEBUG_SCHUBI, "----- addrpmrulesforupdaters -----\n");
}
/*
@@ -1174,7 +1176,7 @@
Queue qs;
Id qsbuf[64];
- sat_debug (DEBUG_4, "----- addupdaterule -----\n");
+ POOL_DEBUG(SAT_DEBUG_SCHUBI, "----- addupdaterule -----\n");
queue_init_buffer(&qs, qsbuf, sizeof(qsbuf)/sizeof(*qsbuf));
policy_findupdatepackages(solv, s, &qs, allowall);
@@ -1184,7 +1186,7 @@
d = pool_queuetowhatprovides(pool, &qs); /* intern computed queue */
queue_free(&qs);
addrule(solv, s - pool->solvables, d); /* allow update of s */
- sat_debug (DEBUG_4, "----- addupdaterule end -----\n");
+ POOL_DEBUG(SAT_DEBUG_SCHUBI, "----- addupdaterule end -----\n");
}
@@ -1268,26 +1270,26 @@
Id *decisionmap = solv->decisionmap;
Id *watches = solv->watches + pool->nsolvables;
- sat_debug (DEBUG_4, "----- propagate -----\n");
+ POOL_DEBUG(SAT_DEBUG_PROPAGATE, "----- propagate -----\n");
while (solv->propagate_index < solv->decisionq.count)
{
/* negate because our watches trigger if literal goes FALSE */
pkg = -solv->decisionq.elements[solv->propagate_index++];
- if (sat_debug_level() >= DEBUG_4)
+ IF_POOLDEBUG (SAT_DEBUG_PROPAGATE)
{
- sat_debug (DEBUG_4, "popagate for decision %d level %d\n", -pkg, level);
- printruleelement(solv, 0, -pkg);
+ POOL_DEBUG(SAT_DEBUG_PROPAGATE, "popagate for decision %d level %d\n", -pkg, level);
+ printruleelement(solv, SAT_DEBUG_PROPAGATE, 0, -pkg);
}
for (rp = watches + pkg; *rp; rp = nrp)
{
r = solv->rules + *rp;
- if (sat_debug_level() >= DEBUG_4)
+ IF_POOLDEBUG (SAT_DEBUG_PROPAGATE)
{
- sat_debug (DEBUG_4," watch triggered ");
- printrule(solv, r);
+ POOL_DEBUG(SAT_DEBUG_PROPAGATE," watch triggered ");
+ printrule(solv, SAT_DEBUG_PROPAGATE, r);
}
if (pkg == r->w1)
@@ -1318,12 +1320,12 @@
if (p)
{
/* p is free to watch, move watch to p */
- if (sat_debug_level() >= DEBUG_4)
+ IF_POOLDEBUG (SAT_DEBUG_PROPAGATE)
{
if (p > 0)
- sat_debug (DEBUG_4, " -> move w%d to %s\n", (pkg == r->w1 ? 1 : 2), solvable2str(pool, pool->solvables + p));
+ POOL_DEBUG(SAT_DEBUG_PROPAGATE, " -> move w%d to %s\n", (pkg == r->w1 ? 1 : 2), solvable2str(pool, pool->solvables + p));
else
- sat_debug (DEBUG_4," -> move w%d to !%s\n", (pkg == r->w1 ? 1 : 2), solvable2str(pool, pool->solvables - p));
+ POOL_DEBUG(SAT_DEBUG_PROPAGATE," -> move w%d to !%s\n", (pkg == r->w1 ? 1 : 2), solvable2str(pool, pool->solvables - p));
}
*rp = *nrp;
nrp = rp;
@@ -1344,10 +1346,10 @@
/* unit clause found, set other watch to TRUE */
if (DECISIONMAP_TRUE(-ow))
return r; /* eek, a conflict! */
- if (sat_debug_level() >= DEBUG_2)
+ IF_POOLDEBUG (SAT_DEBUG_PROPAGATE)
{
- sat_debug (DEBUG_2, "unit ");
- printrule(solv, r);
+ POOL_DEBUG(SAT_DEBUG_PROPAGATE, "unit ");
+ printrule(solv, SAT_DEBUG_PROPAGATE, r);
}
if (ow > 0)
decisionmap[ow] = level;
@@ -1355,17 +1357,17 @@
decisionmap[-ow] = -level;
queue_push(&solv->decisionq, ow);
queue_push(&solv->decisionq_why, r - solv->rules);
- if (sat_debug_level() >= DEBUG_4)
+ IF_POOLDEBUG (SAT_DEBUG_PROPAGATE)
{
Solvable *s = pool->solvables + (ow > 0 ? ow : -ow);
if (ow > 0)
- sat_debug (DEBUG_4, " -> decided to install %s\n", solvable2str(pool, s));
+ POOL_DEBUG(SAT_DEBUG_PROPAGATE, " -> decided to install %s\n", solvable2str(pool, s));
else
- sat_debug (DEBUG_4, " -> decided to conflict %s\n", solvable2str(pool, s));
+ POOL_DEBUG(SAT_DEBUG_PROPAGATE, " -> decided to conflict %s\n", solvable2str(pool, s));
}
}
}
- sat_debug (DEBUG_4, "----- propagate end-----\n");
+ POOL_DEBUG(SAT_DEBUG_PROPAGATE, "----- propagate end-----\n");
return 0; /* all is well */
}
@@ -1394,13 +1396,13 @@
queue_init(&r);
- sat_debug (DEBUG_1, "ANALYZE at %d ----------------------\n", level);
+ POOL_DEBUG(SAT_DEBUG_ANALYZE, "ANALYZE at %d ----------------------\n", level);
map_init(&seen, pool->nsolvables);
idx = solv->decisionq.count;
for (;;)
{
- if (sat_debug_level() >= DEBUG_2)
- printruleclass(solv, c);
+ IF_POOLDEBUG (SAT_DEBUG_ANALYZE)
+ printruleclass(solv, SAT_DEBUG_ANALYZE, c);
queue_push(&solv->learnt_pool, c - solv->rules);
dp = c->d ? pool->whatprovidesdata + c->d : 0;
for (i = -1; ; i++)
@@ -1440,16 +1442,10 @@
else
{
queue_push(&r, v);
- if (sat_debug_level() >= DEBUG_4)
- {
- sat_debug (DEBUG_4, "PUSH %d ", v);
- printruleelement(solv, 0, v);
- }
if (l > rlevel)
rlevel = l;
}
}
- sat_debug (DEBUG_4, "num = %d\n", num);
if (num <= 0)
abort();
for (;;)
@@ -1471,24 +1467,22 @@
*dr = r.elements[0];
else
*dr = pool_queuetowhatprovides(pool, &r);
- if (sat_debug_level() >= DEBUG_1)
+ IF_POOLDEBUG (SAT_DEBUG_ANALYZE)
{
- sat_debug (DEBUG_1, "learned rule for level %d (am %d)\n", rlevel, level);
- printruleelement(solv, 0, -v);
+ POOL_DEBUG(SAT_DEBUG_ANALYZE, "learned rule for level %d (am %d)\n", rlevel, level);
+ printruleelement(solv, SAT_DEBUG_ANALYZE, 0, -v);
for (i = 0; i < r.count; i++)
- {
- v = r.elements[i];
- printruleelement(solv, 0, v);
- }
+ printruleelement(solv, SAT_DEBUG_ANALYZE, 0, r.elements[i]);
}
map_free(&seen);
+ /* push end marker on learnt reasons stack */
queue_push(&solv->learnt_pool, 0);
- if (sat_debug_level() >= DEBUG_4)
+ IF_POOLDEBUG (SAT_DEBUG_ANALYZE)
{
for (i = learnt_why; solv->learnt_pool.elements[i]; i++)
{
- sat_debug (DEBUG_4, "learnt_why ");
- printrule(solv, solv->rules + solv->learnt_pool.elements[i]);
+ POOL_DEBUG(SAT_DEBUG_ANALYZE, "learnt_why ");
+ printrule(solv, SAT_DEBUG_ANALYZE, solv->rules + solv->learnt_pool.elements[i]);
}
}
if (why)
@@ -1506,6 +1500,7 @@
static void
reset_solver(Solver *solv)
{
+ Pool *pool = solv->pool;
int i;
Id v;
@@ -1528,7 +1523,7 @@
solv->decisionmap[v > 0 ? v : -v] = v > 0 ? 1 : -1;
}
- sat_debug (DEBUG_2, "decisions done reduced from %d to %d\n", solv->decisionq.count, i);
+ POOL_DEBUG(SAT_DEBUG_UNSOLVABLE, "decisions done reduced from %d to %d\n", solv->decisionq.count, i);
solv->decisionq_why.count = i;
solv->decisionq.count = i;
@@ -1537,7 +1532,7 @@
/* redo all job/system decisions */
makeruledecisions(solv);
- sat_debug (DEBUG_2, "decisions so far: %d\n", solv->decisionq.count);
+ POOL_DEBUG(SAT_DEBUG_UNSOLVABLE, "decisions so far: %d\n", solv->decisionq.count);
/* recreate watch chains */
makewatches(solv);
}
@@ -1550,10 +1545,11 @@
static void
analyze_unsolvable_rule(Solver *solv, Rule *r)
{
+ Pool *pool = solv->pool;
int i;
Id why = r - solv->rules;
- if (sat_debug_level() >= DEBUG_2)
- printruleclass(solv, r);
+ IF_POOLDEBUG (SAT_DEBUG_UNSOLVABLE)
+ printruleclass(solv, SAT_DEBUG_UNSOLVABLE, r);
if (solv->learntrules && why >= solv->learntrules)
{
for (i = solv->learnt_why.elements[why - solv->learntrules]; solv->learnt_pool.elements[i]; i++)
@@ -1599,7 +1595,7 @@
int oldlearntpoolcount;
int lastweak;
- sat_debug (DEBUG_2, "ANALYZE UNSOLVABLE ----------------------\n");
+ POOL_DEBUG(SAT_DEBUG_UNSOLVABLE, "ANALYZE UNSOLVABLE ----------------------\n");
oldproblemcount = solv->problems.count;
oldlearntpoolcount = solv->learnt_pool.count;
@@ -1642,10 +1638,10 @@
if (!why)
{
/* level 1 and no why, must be an rpm assertion */
- if (sat_debug_level() >= DEBUG_4)
+ IF_POOLDEBUG (SAT_DEBUG_UNSOLVABLE)
{
- sat_debug (DEBUG_4, "RPM ");
- printruleelement(solv, 0, v);
+ POOL_DEBUG(SAT_DEBUG_UNSOLVABLE, "RPM ");
+ printruleelement(solv, SAT_DEBUG_UNSOLVABLE, 0, v);
}
/* this is the only positive rpm assertion */
if (v == SYSTEMSOLVABLE)
@@ -1699,8 +1695,8 @@
solv->problems.count = oldproblemcount;
solv->learnt_pool.count = oldlearntpoolcount;
r = solv->rules + lastweak;
- sat_debug (ALWAYS, "disabling weak ");
- printrule(solv, r);
+ POOL_DEBUG(SAT_DEBUG_UNSOLVABLE, "disabling weak ");
+ printrule(solv, SAT_DEBUG_UNSOLVABLE, r);
disablerule(solv, r);
reset_solver(solv);
return 1;
@@ -1717,7 +1713,7 @@
reset_solver(solv);
return 1;
}
- sat_debug (DEBUG_1, "UNSOLVABLE\n");
+ POOL_DEBUG(SAT_DEBUG_UNSOLVABLE, "UNSOLVABLE\n");
return 0;
}
@@ -1733,6 +1729,7 @@
static void
revert(Solver *solv, int level)
{
+ Pool *pool = solv->pool;
Id v, vv;
while (solv->decisionq.count)
{
@@ -1740,7 +1737,7 @@
vv = v > 0 ? v : -v;
if (solv->decisionmap[vv] <= level && solv->decisionmap[vv] >= -level)
break;
- sat_debug (DEBUG_4, "reverting decision %d at %d\n", v, solv->decisionmap[vv]);
+ POOL_DEBUG(SAT_DEBUG_PROPAGATE, "reverting decision %d at %d\n", v, solv->decisionmap[vv]);
solv->decisionmap[vv] = 0;
solv->decisionq.count--;
solv->decisionq_why.count--;
@@ -1796,6 +1793,7 @@
static int
setpropagatelearn(Solver *solv, int level, Id decision, int disablerules)
{
+ Pool *pool = solv->pool;
Rule *r;
Id p, d;
int l, why;
@@ -1817,21 +1815,18 @@
break;
if (level == 1)
return analyze_unsolvable(solv, r, disablerules);
- sat_debug (ALWAYS, "conflict with rule #%d\n", (int)(r - solv->rules));
+ POOL_DEBUG(SAT_DEBUG_ANALYZE, "conflict with rule #%d\n", (int)(r - solv->rules));
l = analyze(solv, level, r, &p, &d, &why); /* learnt rule in p and d */
if (l >= level || l <= 0)
abort();
- sat_debug (ALWAYS, "reverting decisions (level %d -> %d)\n", level, l);
+ POOL_DEBUG(SAT_DEBUG_ANALYZE, "reverting decisions (level %d -> %d)\n", level, l);
level = l;
revert(solv, level);
r = addrule(solv, p, d); /* p requires d */
if (!r)
abort();
if (solv->learnt_why.count != (r - solv->rules) - solv->learntrules)
- {
- sat_debug (ALWAYS, "%d %d\n", solv->learnt_why.count, (int)(r - solv->rules) - solv->learntrules);
- abort();
- }
+ abort();
queue_push(&solv->learnt_why, why);
if (d)
{
@@ -1842,12 +1837,12 @@
solv->decisionmap[p > 0 ? p : -p] = p > 0 ? level : -level;
queue_push(&solv->decisionq, p);
queue_push(&solv->decisionq_why, r - solv->rules);
- if (sat_debug_level() >= DEBUG_2)
+ IF_POOLDEBUG (SAT_DEBUG_ANALYZE)
{
- sat_debug (DEBUG_2, "decision: ");
- printruleelement(solv, 0, p);
- sat_debug (DEBUG_2, "new rule: ");
- printrule(solv, r);
+ POOL_DEBUG(SAT_DEBUG_ANALYZE, "decision: ");
+ printruleelement(solv, SAT_DEBUG_ANALYZE, 0, p);
+ POOL_DEBUG(SAT_DEBUG_ANALYZE, "new rule: ");
+ printrule(solv, SAT_DEBUG_ANALYZE, r);
}
}
return level;
@@ -1885,7 +1880,7 @@
}
p = dq->elements[i];
- sat_debug (DEBUG_4, "installing %s\n", solvable2str(pool, pool->solvables + p));
+ POOL_DEBUG(SAT_DEBUG_POLICY, "installing %s\n", solvable2str(pool, pool->solvables + p));
return setpropagatelearn(solv, level, p, disablerules);
}
@@ -1988,24 +1983,25 @@
Pool *pool = solv->pool;
Id p, *dp;
- if (sat_debug_level() >= DEBUG_4)
+ IF_POOLDEBUG (SAT_DEBUG_RULE_CREATION)
{
- sat_debug (DEBUG_4, "number of rules: %d\n", solv->nrules);
+ POOL_DEBUG (SAT_DEBUG_RULE_CREATION, "number of rules: %d\n", solv->nrules);
for (i = 0; i < solv->nrules; i++)
- printrule(solv, solv->rules + i);
+ printrule(solv, SAT_DEBUG_RULE_CREATION, solv->rules + i);
}
/* create watches chains */
makewatches(solv);
- sat_debug (DEBUG_1, "initial decisions: %d\n", solv->decisionq.count);
- if (sat_debug_level() >= DEBUG_4)
+ POOL_DEBUG(SAT_DEBUG_STATS, "initial decisions: %d\n", solv->decisionq.count);
+
+ IF_POOLDEBUG (SAT_DEBUG_SCHUBI)
printdecisions(solv);
/* start SAT algorithm */
level = 1;
systemlevel = level + 1;
- sat_debug (DEBUG_1, "solving...\n");
+ POOL_DEBUG(SAT_DEBUG_STATS, "solving...\n");
queue_init(&dq);
for (;;)
@@ -2016,7 +2012,7 @@
if (level == 1)
{
- sat_debug (DEBUG_1, "propagating (propagate_index: %d; size decisionq: %d)...\n", solv->propagate_index, solv->decisionq.count);
+ POOL_DEBUG(SAT_DEBUG_PROPAGATE, "propagating (propagate_index: %d; size decisionq: %d)...\n", solv->propagate_index, solv->decisionq.count);
if ((r = propagate(solv, level)) != 0)
{
if (analyze_unsolvable(solv, r, disablerules))
@@ -2035,7 +2031,7 @@
if (!solv->updatesystem)
{
/* try to keep as many packages as possible */
- sat_debug (DEBUG_1, "installing system packages\n");
+ POOL_DEBUG(SAT_DEBUG_STATS, "installing system packages\n");
for (i = solv->installed->start, n = 0; ; i++)
{
if (n == solv->installed->nsolvables)
@@ -2048,7 +2044,7 @@
n++;
if (solv->decisionmap[i] != 0)
continue;
- sat_debug (DEBUG_4, "keeping %s\n", solvable2str(pool, s));
+ POOL_DEBUG(SAT_DEBUG_PROPAGATE, "keeping %s\n", solvable2str(pool, s));
olevel = level;
level = setpropagatelearn(solv, level, i, disablerules);
if (level == 0)
@@ -2062,7 +2058,7 @@
}
if (solv->weaksystemrules)
{
- sat_debug (DEBUG_1, "installing weak system packages\n");
+ POOL_DEBUG(SAT_DEBUG_STATS, "installing weak system packages\n");
for (i = solv->installed->start; i < solv->installed->end; i++)
{
if (pool->solvables[i].repo != solv->installed)
@@ -2111,7 +2107,7 @@
* decide
*/
- sat_debug (DEBUG_1, "deciding unresolved rules\n");
+ POOL_DEBUG(SAT_DEBUG_STATS, "deciding unresolved rules\n");
for (i = 1, n = 1; ; i++, n++)
{
if (n == solv->nrules)
@@ -2176,11 +2172,14 @@
{
/* cannot happen as this means that
* the rule is unit */
- printrule(solv, r);
+ printrule(solv, SAT_FATAL, r);
abort();
}
- if (sat_debug_level() >= DEBUG_3)
- printrule(solv, r);
+ IF_POOLDEBUG (SAT_DEBUG_PROPAGATE)
+ {
+ POOL_DEBUG(SAT_DEBUG_PROPAGATE, "unfulfilled ");
+ printrule(solv, SAT_DEBUG_PROPAGATE, r);
+ }
olevel = level;
level = selectandinstall(solv, level, &dq, 0, disablerules);
@@ -2201,7 +2200,7 @@
{
int qcount;
- sat_debug (DEBUG_1, "installing recommended packages\n");
+ POOL_DEBUG(SAT_DEBUG_STATS, "installing recommended packages\n");
if (0)
{
for (i = 0; i < solv->decisionq.count; i++)
@@ -2268,7 +2267,7 @@
if (dq.count > 1)
policy_filter_unwanted(solv, &dq, 0, POLICY_MODE_RECOMMEND);
p = dq.elements[0];
- sat_debug (DEBUG_1, "installing recommended %s\n", solvable2str(pool, pool->solvables + p));
+ POOL_DEBUG(SAT_DEBUG_STATS, "installing recommended %s\n", solvable2str(pool, pool->solvables + p));
level = setpropagatelearn(solv, level, p, 0);
continue;
}
@@ -2285,7 +2284,7 @@
if (solv->branches.elements[i - 1] < 0)
break;
p = solv->branches.elements[i];
- sat_debug (DEBUG_1, "branching with %s\n", solvable2str(pool, pool->solvables + p));
+ POOL_DEBUG(SAT_DEBUG_STATS, "branching with %s\n", solvable2str(pool, pool->solvables + p));
queue_empty(&dq);
for (j = i + 1; j < solv->branches.count; j++)
queue_push(&dq, solv->branches.elements[j]);
@@ -2329,7 +2328,7 @@
/* kill old solvable so that we do not loop */
p = solv->branches.elements[lasti];
solv->branches.elements[lasti] = 0;
- sat_debug (DEBUG_1, "minimizing %d -> %d with %s\n", solv->decisionmap[p], l, solvable2str(pool, pool->solvables + p));
+ POOL_DEBUG(SAT_DEBUG_STATS, "minimizing %d -> %d with %s\n", solv->decisionmap[p], l, solvable2str(pool, pool->solvables + p));
level = lastl;
revert(solv, level);
@@ -2361,19 +2360,20 @@
static void
refine_suggestion(Solver *solv, Queue *job, Id *problem, Id sug, Queue *refined)
{
+ Pool *pool = solv->pool;
Rule *r;
int i, j;
Id v;
Queue disabled;
int disabledcnt;
- if (sat_debug_level() >= DEBUG_1)
+ IF_POOLDEBUG (SAT_DEBUG_SOLUTIONS)
{
- sat_debug (DEBUG_1, "refine_suggestion start\n");
+ POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "refine_suggestion start\n");
for (i = 0; problem[i]; i++)
{
if (problem[i] == sug)
- sat_debug (DEBUG_1, "=> ");
+ POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "=> ");
printproblem(solv, problem[i]);
}
}
@@ -2409,8 +2409,8 @@
run_solver(solv, 0, 0);
if (!solv->problems.count)
{
- sat_debug (DEBUG_1, "no more problems!\n");
- if (sat_debug_level() >= DEBUG_4)
+ POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "no more problems!\n");
+ IF_POOLDEBUG (SAT_DEBUG_SCHUBI)
printdecisions(solv);
break; /* great, no more problems */
}
@@ -2432,7 +2432,7 @@
if (disabled.count == disabledcnt)
{
/* no solution found, this was an invalid suggestion! */
- sat_debug (DEBUG_1, "no solution found!\n");
+ POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "no solution found!\n");
refined->count = 0;
break;
}
@@ -2449,9 +2449,9 @@
{
/* more than one solution, disable all */
/* do not push anything on refine list */
- if (sat_debug_level() >= DEBUG_2)
+ IF_POOLDEBUG (SAT_DEBUG_SOLUTIONS)
{
- sat_debug (DEBUG_2, "more than one solution found:\n");
+ POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "more than one solution found:\n");
for (i = disabledcnt; i < disabled.count; i++)
printproblem(solv, disabled.elements[i]);
}
@@ -2467,7 +2467,7 @@
for (i = 0; problem[i]; i++)
disableproblem(solv, problem[i]);
disableupdaterules(solv, job, -1);
- sat_debug (DEBUG_1,"refine_suggestion end\n");
+ POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "refine_suggestion end\n");
}
static void
@@ -2695,7 +2695,7 @@
continue;
if (obsoletesmap[p])
continue;
- sat_debug (ALWAYS, "erase %s\n", solvable2str(pool, s));
+ POOL_DEBUG(SAT_DEBUG_RESULT, "erase %s\n", solvable2str(pool, s));
}
}
@@ -2715,29 +2715,29 @@
if (!obsoletesmap[p])
{
- sat_debug (ALWAYS, "install %s", solvable2str(pool, s));
+ POOL_DEBUG(SAT_DEBUG_RESULT, "install %s", solvable2str(pool, s));
}
else
{
- sat_debug (ALWAYS, "update %s", solvable2str(pool, s));
- sat_debug (ALWAYS, " (obsoletes");
+ POOL_DEBUG(SAT_DEBUG_RESULT, "update %s", solvable2str(pool, s));
+ POOL_DEBUG(SAT_DEBUG_RESULT, " (obsoletes");
for (j = installed->start; j < installed->end; j++)
if (obsoletesmap[j] == p)
- sat_debug (ALWAYS," %s", solvable2str(pool, pool->solvables + j));
- sat_debug (ALWAYS,")");
+ POOL_DEBUG(SAT_DEBUG_RESULT, " %s", solvable2str(pool, pool->solvables + j));
+ POOL_DEBUG(SAT_DEBUG_RESULT, ")");
}
- sat_debug (ALWAYS, "\n");
+ POOL_DEBUG(SAT_DEBUG_RESULT, "\n");
}
xfree(obsoletesmap);
if (solv->suggestions.count)
{
- sat_debug (ALWAYS, "\nsuggested packages:\n");
+ POOL_DEBUG(SAT_DEBUG_RESULT, "\nsuggested packages:\n");
for (i = 0; i < solv->suggestions.count; i++)
{
s = pool->solvables + solv->suggestions.elements[i];
- sat_debug (ALWAYS, "- %s\n", solvable2str(pool, s));
+ POOL_DEBUG(SAT_DEBUG_RESULT, "- %s\n", solvable2str(pool, s));
}
}
}
@@ -2759,7 +2759,7 @@
{
if (p != pc)
continue;
- sat_debug (ALWAYS, "packags %s conflicts with %s, which is provided by %s\n", solvable2str(pool, s), dep2str(pool, con), solvable2str(pool, sc));
+ POOL_DEBUG(SAT_DEBUG_RESULT, "packags %s conflicts with %s, which is provided by %s\n", solvable2str(pool, s), dep2str(pool, con), solvable2str(pool, sc));
numc++;
}
}
@@ -2773,7 +2773,7 @@
{
if (p != pc)
continue;
- sat_debug (ALWAYS, "packags %s obsolets %s, which is provided by %s\n", solvable2str(pool, s), dep2str(pool, obs), solvable2str(pool, sc));
+ POOL_DEBUG(SAT_DEBUG_RESULT, "packags %s obsolets %s, which is provided by %s\n", solvable2str(pool, s), dep2str(pool, obs), solvable2str(pool, sc));
numc++;
}
}
@@ -2820,13 +2820,13 @@
switch (job->elements[ji])
{
case SOLVER_INSTALL_SOLVABLE_NAME:
- sat_debug (ALWAYS, "no solvable exists with name %s\n", dep2str(pool, what));
+ POOL_DEBUG(SAT_DEBUG_RESULT, "no solvable exists with name %s\n", dep2str(pool, what));
break;
case SOLVER_INSTALL_SOLVABLE_PROVIDES:
- sat_debug (ALWAYS, "no solvable provides %s\n", dep2str(pool, what));
+ POOL_DEBUG(SAT_DEBUG_RESULT, "no solvable provides %s\n", dep2str(pool, what));
break;
default:
- sat_debug (ALWAYS, "unknown job\n");
+ pool_debug(pool, SAT_FATAL, "unknown job\n");
abort();
}
return;
@@ -2840,8 +2840,8 @@
}
if (rn >= solv->jobrules)
{
- sat_debug (ALWAYS, "some job/system/learnt rule\n");
- printrule(solv, r);
+ POOL_DEBUG(SAT_DEBUG_RESULT, "some job/system/learnt rule\n");
+ printrule(solv, SAT_DEBUG_RESULT, r);
return;
}
if (p >= 0)
@@ -2858,34 +2858,34 @@
dp = pool_whatprovides(pool, req);
if (*dp)
continue;
- sat_debug (ALWAYS, "package %s requires %s, but no package provides it\n", solvable2str(pool, s), dep2str(pool, req));
+ POOL_DEBUG(SAT_DEBUG_RESULT, "package %s requires %s, but no package provides it\n", solvable2str(pool, s), dep2str(pool, req));
count++;
}
}
if (!count)
- sat_debug (ALWAYS, "package %s is not installable\n", solvable2str(pool, s));
+ POOL_DEBUG(SAT_DEBUG_RESULT, "package %s is not installable\n", solvable2str(pool, s));
return;
}
if (rn >= solv->learntrules)
{
/* learnt rule, ignore for now */
- sat_debug (ALWAYS, "some learnt rule...\n");
- printrule(solv, r);
+ POOL_DEBUG(SAT_DEBUG_RESULT, "some learnt rule...\n");
+ printrule(solv, SAT_DEBUG_RESULT, r);
return;
}
if (rn >= solv->systemrules)
{
/* system rule, ignore for now */
- sat_debug (ALWAYS, "some system rule...\n");
- printrule(solv, r);
+ POOL_DEBUG(SAT_DEBUG_RESULT, "some system rule...\n");
+ printrule(solv, SAT_DEBUG_RESULT, r);
return;
}
if (rn >= solv->jobrules)
{
/* job rule, ignore for now */
- sat_debug (ALWAYS, "some job rule...\n");
- printrule(solv, r);
+ POOL_DEBUG(SAT_DEBUG_RESULT, "some job rule...\n");
+ printrule(solv, SAT_DEBUG_RESULT, r);
return;
}
/* only rpm rules left... */
@@ -2901,7 +2901,7 @@
sd = pool->solvables + (-d);
if (sp->name == sd->name)
{
- sat_debug (ALWAYS, "cannot install both %s and %s\n", solvable2str(pool, sp), solvable2str(pool, sd));
+ POOL_DEBUG(SAT_DEBUG_RESULT, "cannot install both %s and %s\n", solvable2str(pool, sp), solvable2str(pool, sd));
}
else
{
@@ -2930,10 +2930,10 @@
}
if (!req)
{
- sat_debug (ALWAYS, "req not found\n");
+ pool_debug(pool, SAT_FATAL, "req not found\n");
abort();
}
- sat_debug (ALWAYS, "package %s requires %s, but none of its providers can be installed\n", solvable2str(pool, s), dep2str(pool, req));
+ POOL_DEBUG(SAT_DEBUG_RESULT, "package %s requires %s, but none of its providers can be installed\n", solvable2str(pool, s), dep2str(pool, req));
}
}
@@ -2946,15 +2946,15 @@
Id problem, solution, element;
Solvable *s, *sd;
- sat_debug (ALWAYS, "Encountered problems! Here are the solutions:\n\n");
+ POOL_DEBUG(SAT_DEBUG_RESULT, "Encountered problems! Here are the solutions:\n\n");
pcnt = 1;
problem = 0;
while ((problem = solver_next_problem(solv, problem)) != 0)
{
- sat_debug (ALWAYS, "Problem %d:\n", pcnt++);
- sat_debug (ALWAYS, "====================================\n");
+ POOL_DEBUG(SAT_DEBUG_RESULT, "Problem %d:\n", pcnt++);
+ POOL_DEBUG(SAT_DEBUG_RESULT, "====================================\n");
printprobleminfo(solv, job, problem);
- sat_debug (ALWAYS, "\n");
+ POOL_DEBUG(SAT_DEBUG_RESULT, "\n");
solution = 0;
while ((solution = solver_next_solution(solv, problem, solution)) != 0)
{
@@ -2970,35 +2970,35 @@
case SOLVER_INSTALL_SOLVABLE:
s = pool->solvables + what;
if (solv->installed && s->repo == solv->installed)
- sat_debug (ALWAYS, "- do not keep %s installed\n", solvable2str(pool, s));
+ POOL_DEBUG(SAT_DEBUG_RESULT, "- do not keep %s installed\n", solvable2str(pool, s));
else
- sat_debug (ALWAYS, "- do not install %s\n", solvable2str(pool, s));
+ POOL_DEBUG(SAT_DEBUG_RESULT, "- do not install %s\n", solvable2str(pool, s));
break;
case SOLVER_ERASE_SOLVABLE:
s = pool->solvables + what;
if (solv->installed && s->repo == solv->installed)
- sat_debug (ALWAYS, "- do not deinstall %s\n", solvable2str(pool, s));
+ POOL_DEBUG(SAT_DEBUG_RESULT, "- do not deinstall %s\n", solvable2str(pool, s));
else
- sat_debug (ALWAYS, "- do not forbid installation of %s\n", solvable2str(pool, s));
+ POOL_DEBUG(SAT_DEBUG_RESULT, "- do not forbid installation of %s\n", solvable2str(pool, s));
break;
case SOLVER_INSTALL_SOLVABLE_NAME:
- sat_debug (ALWAYS, "- do not install %s\n", id2str(pool, what));
+ POOL_DEBUG(SAT_DEBUG_RESULT, "- do not install %s\n", id2str(pool, what));
break;
case SOLVER_ERASE_SOLVABLE_NAME:
- sat_debug (ALWAYS, "- do not deinstall %s\n", id2str(pool, what));
+ POOL_DEBUG(SAT_DEBUG_RESULT, "- do not deinstall %s\n", id2str(pool, what));
break;
case SOLVER_INSTALL_SOLVABLE_PROVIDES:
- sat_debug (ALWAYS, "- do not install a solvable providing %s\n", dep2str(pool, what));
+ POOL_DEBUG(SAT_DEBUG_RESULT, "- do not install a solvable providing %s\n", dep2str(pool, what));
break;
case SOLVER_ERASE_SOLVABLE_PROVIDES:
- sat_debug (ALWAYS, "- do not deinstall all solvables providing %s\n", dep2str(pool, what));
+ POOL_DEBUG(SAT_DEBUG_RESULT, "- do not deinstall all solvables providing %s\n", dep2str(pool, what));
break;
case SOLVER_INSTALL_SOLVABLE_UPDATE:
s = pool->solvables + what;
- sat_debug (ALWAYS, "- do not install most recent version of %s\n", solvable2str(pool, s));
+ POOL_DEBUG(SAT_DEBUG_RESULT, "- do not install most recent version of %s\n", solvable2str(pool, s));
break;
default:
- sat_debug (ALWAYS, "- do something different\n");
+ POOL_DEBUG(SAT_DEBUG_RESULT, "- do something different\n");
break;
}
}
@@ -3012,33 +3012,33 @@
int gotone = 0;
if (!solv->allowdowngrade && evrcmp(pool, s->evr, sd->evr) > 0)
{
- sat_debug (ALWAYS, "- allow downgrade of %s to %s\n", solvable2str(pool, s), solvable2str(pool, sd));
+ POOL_DEBUG(SAT_DEBUG_RESULT, "- allow downgrade of %s to %s\n", solvable2str(pool, s), solvable2str(pool, sd));
gotone = 1;
}
if (!solv->allowarchchange && s->name == sd->name && s->arch != sd->arch && policy_illegal_archchange(pool, s, sd))
{
- sat_debug (ALWAYS, "- allow architecture change of %s to %s\n", solvable2str(pool, s), solvable2str(pool, sd));
+ POOL_DEBUG(SAT_DEBUG_RESULT, "- allow architecture change of %s to %s\n", solvable2str(pool, s), solvable2str(pool, sd));
gotone = 1;
}
if (!solv->allowvendorchange && s->name == sd->name && s->vendor != sd->vendor && policy_illegal_vendorchange(pool, s, sd))
{
if (sd->vendor)
- sat_debug (ALWAYS, "- allow vendor change from '%s' (%s) to '%s' (%s)\n", id2str(pool, s->vendor), solvable2str(pool, s), id2str(pool, sd->vendor), solvable2str(pool, sd));
+ POOL_DEBUG(SAT_DEBUG_RESULT, "- allow vendor change from '%s' (%s) to '%s' (%s)\n", id2str(pool, s->vendor), solvable2str(pool, s), id2str(pool, sd->vendor), solvable2str(pool, sd));
else
- sat_debug (ALWAYS, "- allow vendor change from '%s' (%s) to no vendor (%s)\n", id2str(pool, s->vendor), solvable2str(pool, s), solvable2str(pool, sd));
+ POOL_DEBUG(SAT_DEBUG_RESULT, "- allow vendor change from '%s' (%s) to no vendor (%s)\n", id2str(pool, s->vendor), solvable2str(pool, s), solvable2str(pool, sd));
gotone = 1;
}
if (!gotone)
- sat_debug (ALWAYS, "- allow replacement of %s with %s\n", solvable2str(pool, s), solvable2str(pool, sd));
+ POOL_DEBUG(SAT_DEBUG_RESULT, "- allow replacement of %s with %s\n", solvable2str(pool, s), solvable2str(pool, sd));
}
else
{
- sat_debug (ALWAYS, "- allow deinstallation of %s\n", solvable2str(pool, s));
+ POOL_DEBUG(SAT_DEBUG_RESULT, "- allow deinstallation of %s\n", solvable2str(pool, s));
}
}
}
- sat_debug (ALWAYS, "\n");
+ POOL_DEBUG(SAT_DEBUG_RESULT, "\n");
}
}
}
@@ -3090,7 +3090,7 @@
obsoletes[i] = n;
}
solv->obsoletes_data = obsoletes_data = xcalloc(n + 1, sizeof(Id));
- sat_debug (DEBUG_1, "obsoletes data: %d entries\n", n + 1);
+ POOL_DEBUG(SAT_DEBUG_STATS, "obsoletes data: %d entries\n", n + 1);
for (i = pool->nsolvables - 1; i > 0; i--)
{
s = pool->solvables + i;
@@ -3166,18 +3166,18 @@
if (installed)
{
oldnrules = solv->nrules;
- sat_debug (DEBUG_4, "*** create rpm rules for installed solvables ***\n");
+ POOL_DEBUG(SAT_DEBUG_SCHUBI, "*** create rpm rules for installed solvables ***\n");
FOR_REPO_SOLVABLES(installed, p, s)
addrpmrulesforsolvable(solv, s, &addedmap);
- sat_debug (DEBUG_1, "added %d rpm rules for installed solvables\n", solv->nrules - oldnrules);
- sat_debug (DEBUG_4, "*** create rpm rules for updaters of installed solvables ***\n");
+ POOL_DEBUG(SAT_DEBUG_STATS, "added %d rpm rules for installed solvables\n", solv->nrules - oldnrules);
+ POOL_DEBUG(SAT_DEBUG_SCHUBI, "*** create rpm rules for updaters of installed solvables ***\n");
oldnrules = solv->nrules;
FOR_REPO_SOLVABLES(installed, p, s)
addrpmrulesforupdaters(solv, s, &addedmap, 1);
- sat_debug (DEBUG_1, "added %d rpm rules for updaters of installed solvables\n", solv->nrules - oldnrules);
+ POOL_DEBUG(SAT_DEBUG_STATS, "added %d rpm rules for updaters of installed solvables\n", solv->nrules - oldnrules);
}
- sat_debug (DEBUG_4, "*** create rpm rules for packages involved with a job ***\n");
+ POOL_DEBUG(SAT_DEBUG_SCHUBI, "*** create rpm rules for packages involved with a job ***\n");
oldnrules = solv->nrules;
for (i = 0; i < job->count; i += 2)
{
@@ -3205,16 +3205,15 @@
break;
}
}
- sat_debug (DEBUG_1, "added %d rpm rules for packages involved in a job\n", solv->nrules - oldnrules);
+ POOL_DEBUG(SAT_DEBUG_STATS, "added %d rpm rules for packages involved in a job\n", solv->nrules - oldnrules);
- sat_debug (DEBUG_4, "*** create rpm rules for recommended/suggested packages ***\n");
+ POOL_DEBUG(SAT_DEBUG_SCHUBI, "*** create rpm rules for recommended/suggested packages ***\n");
oldnrules = solv->nrules;
addrpmrulesforweak(solv, &addedmap);
- sat_debug (DEBUG_1, "added %d rpm rules because of weak dependencies\n", solv->nrules - oldnrules);
+ POOL_DEBUG(SAT_DEBUG_STATS, "added %d rpm rules because of weak dependencies\n", solv->nrules - oldnrules);
-#if 1
- if (sat_debug_level() >= DEBUG_1)
+ IF_POOLDEBUG (SAT_DEBUG_STATS)
{
int possible = 0, installable = 0;
for (i = 1; i < pool->nsolvables; i++)
@@ -3224,9 +3223,8 @@
if (MAPTST(&addedmap, i))
possible++;
}
- sat_debug (DEBUG_1, "%d of %d installable solvables considered for solving\n", possible, installable);
+ POOL_DEBUG(SAT_DEBUG_STATS, "%d of %d installable solvables considered for solving\n", possible, installable);
}
-#endif
/*
* first pass done, we now have all the rpm rules we need.
@@ -3238,42 +3236,44 @@
unifyrules(solv); /* remove duplicate rpm rules */
- sat_debug (DEBUG_1, "decisions so far: %d\n", solv->decisionq.count);
- if (sat_debug_level() >= DEBUG_4)
+ POOL_DEBUG(SAT_DEBUG_STATS, "decisions so far: %d\n", solv->decisionq.count);
+ IF_POOLDEBUG (SAT_DEBUG_SCHUBI)
printdecisions (solv);
/*
* now add all job rules
*/
- sat_debug (DEBUG_4, "*** Add JOB rules ***\n");
+ POOL_DEBUG(SAT_DEBUG_SCHUBI, "*** Add JOB rules ***\n");
solv->jobrules = solv->nrules;
for (i = 0; i < job->count; i += 2)
{
+ int oldnrules = solv->nrules;
+
how = job->elements[i];
what = job->elements[i + 1];
switch(how)
{
case SOLVER_INSTALL_SOLVABLE: /* install specific solvable */
s = pool->solvables + what;
- sat_debug (DEBUG_1, "job: install solvable %s\n", solvable2str(pool, s));
+ POOL_DEBUG(SAT_DEBUG_JOB, "job: install solvable %s\n", solvable2str(pool, s));
addrule(solv, what, 0); /* install by Id */
queue_push(&solv->ruletojob, i);
break;
case SOLVER_ERASE_SOLVABLE:
s = pool->solvables + what;
- sat_debug (DEBUG_1, "job: erase solvable %s\n", solvable2str(pool, s));
+ POOL_DEBUG(SAT_DEBUG_JOB, "job: erase solvable %s\n", solvable2str(pool, s));
addrule(solv, -what, 0); /* remove by Id */
queue_push(&solv->ruletojob, i);
break;
case SOLVER_INSTALL_SOLVABLE_NAME: /* install by capability */
case SOLVER_INSTALL_SOLVABLE_PROVIDES:
if (how == SOLVER_INSTALL_SOLVABLE_NAME)
- sat_debug (DEBUG_1, "job: install name %s\n", id2str(pool, what));
+ POOL_DEBUG(SAT_DEBUG_JOB, "job: install name %s\n", id2str(pool, what));
if (how == SOLVER_INSTALL_SOLVABLE_PROVIDES)
- sat_debug (DEBUG_1, "job: install provides %s\n", dep2str(pool, what));
+ POOL_DEBUG(SAT_DEBUG_JOB, "job: install provides %s\n", dep2str(pool, what));
queue_empty(&q);
FOR_PROVIDES(p, pp, what)
{
@@ -3299,9 +3299,9 @@
case SOLVER_ERASE_SOLVABLE_NAME: /* remove by capability */
case SOLVER_ERASE_SOLVABLE_PROVIDES:
if (how == SOLVER_ERASE_SOLVABLE_NAME)
- sat_debug (DEBUG_1, "job: erase name %s\n", id2str(pool, what));
+ POOL_DEBUG(SAT_DEBUG_JOB, "job: erase name %s\n", id2str(pool, what));
if (how == SOLVER_ERASE_SOLVABLE_PROVIDES)
- sat_debug (DEBUG_1, "job: erase provides %s\n", dep2str(pool, what));
+ POOL_DEBUG(SAT_DEBUG_JOB, "job: erase provides %s\n", dep2str(pool, what));
FOR_PROVIDES(p, pp, what)
{
/* if by name, ensure that the name matches */
@@ -3313,11 +3313,22 @@
break;
case SOLVER_INSTALL_SOLVABLE_UPDATE: /* find update for solvable */
s = pool->solvables + what;
- sat_debug (DEBUG_1, "job: update %s\n", solvable2str(pool, s));
+ POOL_DEBUG(SAT_DEBUG_JOB, "job: update %s\n", solvable2str(pool, s));
addupdaterule(solv, s, 0);
queue_push(&solv->ruletojob, i);
break;
}
+ IF_POOLDEBUG (SAT_DEBUG_JOB)
+ {
+ int j;
+ if (solv->nrules == oldnrules)
+ POOL_DEBUG(SAT_DEBUG_JOB, " - no rule created");
+ for (j = oldnrules; j < solv->nrules; j++)
+ {
+ POOL_DEBUG(SAT_DEBUG_JOB, " - job ");
+ printrule(solv, SAT_DEBUG_JOB, solv->rules + j);
+ }
+ }
}
if (solv->ruletojob.count != solv->nrules - solv->jobrules)
@@ -3328,7 +3339,7 @@
*
*/
- sat_debug (DEBUG_4, "*** Add system rules ***\n");
+ POOL_DEBUG(SAT_DEBUG_SCHUBI, "*** Add system rules ***\n");
solv->systemrules = solv->nrules;
@@ -3396,7 +3407,7 @@
disableupdaterules(solv, job, -1);
makeruledecisions(solv);
- sat_debug (DEBUG_1, "problems so far: %d\n", solv->problems.count);
+ POOL_DEBUG(SAT_DEBUG_STATS, "problems so far: %d\n", solv->problems.count);
run_solver(solv, 1, 1);
Modified: trunk/sat-solver/src/util.c
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/util.c?rev=7967&r…
==============================================================================
--- trunk/sat-solver/src/util.c (original)
+++ trunk/sat-solver/src/util.c Wed Nov 28 17:56:00 2007
@@ -11,7 +11,6 @@
#include <string.h>
#include "util.h"
-#include "sat_debug.h"
void *
xmalloc(size_t len)
@@ -19,7 +18,7 @@
void *r = malloc(len ? len : 1);
if (r)
return r;
- sat_debug (ERROR, "Out of memory allocating %zu bytes!\n", len);
+ fprintf(stderr, "Out of memory allocating %zu bytes!\n", len);
exit(1);
}
@@ -28,7 +27,7 @@
{
if (len && (num * len) / len != num)
{
- sat_debug (ERROR, "Out of memory allocating %zu*%zu bytes!\n", num, len);
+ fprintf(stderr, "Out of memory allocating %zu*%zu bytes!\n", num, len);
exit(1);
}
return xmalloc(num * len);
@@ -43,7 +42,7 @@
old = realloc(old, len ? len : 1);
if (old)
return old;
- sat_debug (ERROR, "Out of memory reallocating %zu bytes!\n", len);
+ fprintf(stderr, "Out of memory reallocating %zu bytes!\n", len);
exit(1);
}
@@ -52,7 +51,7 @@
{
if (len && (num * len) / len != num)
{
- sat_debug (ERROR, "Out of memory allocating %zu*%zu bytes!\n", num, len);
+ fprintf(stderr, "Out of memory allocating %zu*%zu bytes!\n", num, len);
exit(1);
}
return xrealloc(old, num * len);
@@ -68,7 +67,7 @@
r = calloc(num, len);
if (r)
return r;
- sat_debug (ERROR, "Out of memory allocating %zu bytes!\n", num * len);
+ fprintf(stderr, "Out of memory allocating %zu bytes!\n", num * len);
exit(1);
}
Modified: trunk/sat-solver/testsuite/deptestomatic.c
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/testsuite/deptestomat…
==============================================================================
--- trunk/sat-solver/testsuite/deptestomatic.c (original)
+++ trunk/sat-solver/testsuite/deptestomatic.c Wed Nov 28 17:56:00 2007
@@ -30,7 +30,6 @@
#include "repo_solv.h"
#include "poolarch.h"
#include "evr.h"
-#include "sat_debug.h"
static int verbose = 0;
static int redcarpet = 0;
@@ -1216,7 +1215,6 @@
solv->allowuninstall = pd->allowuninstall;
solv->allowarchchange = pd->allowarchchange;
solv->noupdateprovide = 1;
- pd->pool->verbose = verbose;
// Solve !
solver_solve( solv, &pd->trials );
@@ -1537,7 +1535,7 @@
}
/* setting loglevel */
- sat_set_debug (verbose, 0); /* Without logging source code lines */
+ pool_setdebuglevel(pd.pool, verbose);
if (argp >= argc || !strcmp( argv[argp], "-h" ))
{
Modified: trunk/sat-solver/testsuite/yps.c
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/testsuite/yps.c?rev=7…
==============================================================================
--- trunk/sat-solver/testsuite/yps.c (original)
+++ trunk/sat-solver/testsuite/yps.c Wed Nov 28 17:56:00 2007
@@ -94,10 +94,10 @@
Id id;
int erase = 0;
int all = 0;
+ int debuglevel = 1;
pool = pool_create();
pool_setarch(pool, "i686");
- pool->verbose = 1;
queue_init(&job);
if (argc < 3)
@@ -128,13 +128,14 @@
}
if (!strcmp(argv[1], "-v"))
{
- pool->verbose++;
+ debuglevel++;
argc--;
argv++;
continue;
}
break;
}
+ pool_setdebuglevel(pool, debuglevel);
// Load system file (installed packages)
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
[zypp-commit] r7966 - /trunk/libzypp/devel/devel.ma/NewPool.cc
by mlandres@svn.opensuse.org 28 Nov '07
by mlandres@svn.opensuse.org 28 Nov '07
28 Nov '07
Author: mlandres
Date: Wed Nov 28 17:47:54 2007
New Revision: 7966
URL: http://svn.opensuse.org/viewcvs/zypp?rev=7966&view=rev
Log:
backup
Modified:
trunk/libzypp/devel/devel.ma/NewPool.cc
Modified: trunk/libzypp/devel/devel.ma/NewPool.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.ma/NewPool.c…
==============================================================================
--- trunk/libzypp/devel/devel.ma/NewPool.cc (original)
+++ trunk/libzypp/devel/devel.ma/NewPool.cc Wed Nov 28 17:47:54 2007
@@ -46,6 +46,8 @@
#include "zypp/sat/Solvable.h"
#include "zypp/sat/detail/PoolImpl.h"
+#include <boost/mpl/int.hpp>
+
using namespace std;
using namespace zypp;
using namespace zypp::functor;
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
[zypp-commit] r7965 - in /trunk/libzypp/zypp: pool/PoolImpl.cc pool/PoolImpl.h pool/Res2Sat.cc sat/IdStr.cc sat/Pool.cc sat/Pool.h sat/detail/PoolImpl.h
by mlandres@svn.opensuse.org 28 Nov '07
by mlandres@svn.opensuse.org 28 Nov '07
28 Nov '07
Author: mlandres
Date: Wed Nov 28 17:47:36 2007
New Revision: 7965
URL: http://svn.opensuse.org/viewcvs/zypp?rev=7965&view=rev
Log:
update satpool housekeeping data after sync.
Modified:
trunk/libzypp/zypp/pool/PoolImpl.cc
trunk/libzypp/zypp/pool/PoolImpl.h
trunk/libzypp/zypp/pool/Res2Sat.cc
trunk/libzypp/zypp/sat/IdStr.cc
trunk/libzypp/zypp/sat/Pool.cc
trunk/libzypp/zypp/sat/Pool.h
trunk/libzypp/zypp/sat/detail/PoolImpl.h
Modified: trunk/libzypp/zypp/pool/PoolImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/pool/PoolImpl.cc?re…
==============================================================================
--- trunk/libzypp/zypp/pool/PoolImpl.cc (original)
+++ trunk/libzypp/zypp/pool/PoolImpl.cc Wed Nov 28 17:47:36 2007
@@ -273,7 +273,9 @@
}
_satSyncRequired.remember( _serial );
+ sat::Pool::instance().prepare();
MIL << "Pool: " << _serial << ": In sync with sat-pool " << _satSyncRequired << endl;
+ MIL << "sat::Pool: " << sat::Pool::instance() << endl;
}
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/pool/PoolImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/pool/PoolImpl.h?rev…
==============================================================================
--- trunk/libzypp/zypp/pool/PoolImpl.h (original)
+++ trunk/libzypp/zypp/pool/PoolImpl.h Wed Nov 28 17:47:36 2007
@@ -346,7 +346,7 @@
SerialNumber _serial;
/** Watch for changes in /etc/sysconfig/storage. */
SerialNumberWatcher _watchFilesystemSysconfigStorage;
- /** Watch for changes in /etc/sysconfig/storage. */
+ /** Watch for changes \c _serial. */
SerialNumberWatcher _satSyncRequired;
public:
Modified: trunk/libzypp/zypp/pool/Res2Sat.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/pool/Res2Sat.cc?rev…
==============================================================================
--- trunk/libzypp/zypp/pool/Res2Sat.cc (original)
+++ trunk/libzypp/zypp/pool/Res2Sat.cc Wed Nov 28 17:47:36 2007
@@ -10,6 +10,7 @@
*
*/
#include <iostream>
+#include <boost/mpl/int.hpp>
#include "zypp/base/Easy.h"
#include "zypp/base/LogTools.h"
@@ -27,6 +28,8 @@
using std::endl;
+
+
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
@@ -45,14 +48,19 @@
inline void store( ::Offset & where_r, ::_Solvable * slv_r, const Dependencies & dep_r, Dep which_r )
{
+ enum SatIsRreq {
+ ISRREQ_NORMAL = 0,
+ ISRREQ_REQUIRES = 1,
+ ISRREQ_PREREQUIRES = 2
+ };
const CapSet & caps( dep_r[which_r] );
if ( caps.empty() )
return;
for_( it, caps.begin(), caps.end() )
{
- // check PREREQUIRES later
- int isreq = ( which_r == Dep::REQUIRES ? 1 : 0 );
+ // checking PREREQUIRES later
+ SatIsRreq isreq = ( which_r == Dep::REQUIRES ? ISRREQ_REQUIRES : ISRREQ_NORMAL );
std::string name;
Rel op;
@@ -71,29 +79,26 @@
name = (*it).asString();
}
- sat::IdStr nid;
+ ::Id nid = 0;
if ( refersTo<Package>( *it ) )
{
- nid = sat::IdStr( name );
+ store( nid, name );
}
else
{
- nid = sat::IdStr( str::form( "%s:%s",
- (*it).refers().asString().c_str(),
- name.c_str() ) );
+ store( nid, str::form( "%s:%s",
+ (*it).refers().asString().c_str(),
+ name.c_str() ) );
}
if ( op != Rel::ANY && ed != Edition::noedition )
{
sat::IdStr eid( ed.asString() );
#warning TBD calc rel and prereqcheck
- ::Id rid = ::rel2id( slv_r->repo->pool, nid.id(), eid.id(), REL_EQ, true );
- where_r = ::repo_addid_dep( slv_r->repo, where_r, rid, isreq );
- }
- else
- {
- where_r = ::repo_addid_dep( slv_r->repo, where_r, nid.id(), isreq );
+ nid = ::rel2id( slv_r->repo->pool, nid, eid.id(), op.bits(), true );
}
+
+ where_r = ::repo_addid_dep( slv_r->repo, where_r, nid, isreq );
}
}
Modified: trunk/libzypp/zypp/sat/IdStr.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/IdStr.cc?rev=79…
==============================================================================
--- trunk/libzypp/zypp/sat/IdStr.cc (original)
+++ trunk/libzypp/zypp/sat/IdStr.cc Wed Nov 28 17:47:36 2007
@@ -30,11 +30,11 @@
/////////////////////////////////////////////////////////////////
IdStr::IdStr( const char * str_r )
- : _id( ::stringpool_str2id( &myPool()->ss, str_r, true ) )
+ : _id( ::str2id( myPool().getPool(), str_r, true ) )
{}
IdStr::IdStr( const std::string & str_r )
- : _id( ::stringpool_str2id( &myPool()->ss, str_r.c_str(), true ) )
+ : _id( ::str2id( myPool().getPool(), str_r.c_str(), true ) )
{}
const char * IdStr::c_str() const
Modified: trunk/libzypp/zypp/sat/Pool.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/Pool.cc?rev=796…
==============================================================================
--- trunk/libzypp/zypp/sat/Pool.cc (original)
+++ trunk/libzypp/zypp/sat/Pool.cc Wed Nov 28 17:47:36 2007
@@ -43,6 +43,12 @@
const SerialNumber & Pool::serial() const
{ return myPool().serial(); }
+ void Pool::setDirty()
+ { return myPool().setDirty(); }
+
+ void Pool::prepare()
+ { return myPool().prepare(); }
+
bool Pool::reposEmpty() const
{ return myPool()->nrepos; }
Modified: trunk/libzypp/zypp/sat/Pool.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/Pool.h?rev=7965…
==============================================================================
--- trunk/libzypp/zypp/sat/Pool.h (original)
+++ trunk/libzypp/zypp/sat/Pool.h Wed Nov 28 17:47:36 2007
@@ -51,9 +51,15 @@
{}
public:
- /***/
+ /** */
const SerialNumber & serial() const;
+ /** Invalidate housekeeping data (e.g. whatprovides). */
+ void setDirty();
+
+ /** Update housekeeping data (e.g. whatprovides). */
+ void prepare();
+
public:
/** Whether \ref Pool contains repos. */
bool reposEmpty() const;
Modified: trunk/libzypp/zypp/sat/detail/PoolImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/detail/PoolImpl…
==============================================================================
--- trunk/libzypp/zypp/sat/detail/PoolImpl.h (original)
+++ trunk/libzypp/zypp/sat/detail/PoolImpl.h Wed Nov 28 17:47:36 2007
@@ -57,10 +57,24 @@
/** Serial number changing whenever the content changes. */
const SerialNumber & serial() const
{ return _serial; }
- /** */
+
+ /** Invalidate housekeeping data (e.g. whatprovides).
+ */
void setDirty()
{ _serial.setDirty(); }
+ /** Update housekeeping data (e.g. whatprovides).
+ * \todo actually requires a watcher.
+ */
+ void prepare()
+ {
+ if ( _serial.dirty() )
+ {
+ ::pool_createwhatprovides( _pool );
+ _serial.serial();
+ }
+ }
+
public:
/** a \c valid \ref Solvable has a non NULL repo pointer. */
bool validSolvable( const ::_Solvable & slv_r ) const
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
Author: mlandres
Date: Wed Nov 28 17:44:01 2007
New Revision: 7964
URL: http://svn.opensuse.org/viewcvs/zypp?rev=7964&view=rev
Log:
Support libsatsolver compatible Rel construction and conversion from/to unsigned.
Modified:
trunk/libzypp/zypp/Rel.h
Modified: trunk/libzypp/zypp/Rel.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Rel.h?rev=7964&r1=7…
==============================================================================
--- trunk/libzypp/zypp/Rel.h (original)
+++ trunk/libzypp/zypp/Rel.h Wed Nov 28 17:44:01 2007
@@ -59,8 +59,19 @@
/** Enumarators provided \b only for use \ref inSwitch statement.
* \see inSwitch
+ * \note Enumarator values also correspond to the values libsatsolver
+ * uses to encode these relations.
*/
- enum for_use_in_switch { EQ_e, NE_e, LT_e, LE_e, GT_e, GE_e, ANY_e, NONE_e };
+ enum for_use_in_switch {
+ NONE_e = 0U,
+ GT_e = 1U,
+ EQ_e = 2U,
+ LT_e = 4U,
+ GE_e = GT_e|EQ_e,
+ LE_e = LT_e|EQ_e,
+ NE_e = GT_e|LT_e,
+ ANY_e = GT_e|EQ_e|LT_e,
+ };
/** DefaultCtor ANY. */
Rel()
@@ -80,6 +91,12 @@
explicit
Rel( const std::string & strval_r );
+ /** Ctor from bits. */
+ explicit
+ Rel( unsigned bits_r )
+ : _op( for_use_in_switch(bits_r & ANY_e) )
+ {}
+
/** String representation of relational operator.
* \return "==", "!=", "<", "<=", ">", ">=", "ANY" or "NONE"
*/
@@ -107,6 +124,10 @@
for_use_in_switch inSwitch() const
{ return _op; }
+ /** Enumarator values suitable for libsatsolver. */
+ unsigned bits() const
+ { return _op; }
+
private:
/** Ctor to initialize the relational operator contants. */
Rel( for_use_in_switch op_r )
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
[zypp-commit] r7963 - in /trunk/libzypp/zypp: sat/SATResolver.cc solver/detail/Resolver.cc
by schubi2@svn.opensuse.org 28 Nov '07
by schubi2@svn.opensuse.org 28 Nov '07
28 Nov '07
Author: schubi2
Date: Wed Nov 28 17:36:28 2007
New Revision: 7963
URL: http://svn.opensuse.org/viewcvs/zypp?rev=7963&view=rev
Log:
some bugfixes, loggings
Modified:
trunk/libzypp/zypp/sat/SATResolver.cc
trunk/libzypp/zypp/solver/detail/Resolver.cc
Modified: trunk/libzypp/zypp/sat/SATResolver.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/SATResolver.cc?…
==============================================================================
--- trunk/libzypp/zypp/sat/SATResolver.cc (original)
+++ trunk/libzypp/zypp/sat/SATResolver.cc Wed Nov 28 17:36:28 2007
@@ -382,16 +382,14 @@
if (id == ID_NULL) {
ERR << "Install: " << *iter << " not found" << endl;
}
+ MIL << "Install " << *iter << " with the SAT-Pool ID: " << id << endl;
queue_push( &(jobQueue), SOLVER_INSTALL_SOLVABLE );
queue_push( &(jobQueue), id );
}
for (PoolItemList::const_iterator iter = _items_to_remove.begin(); iter != _items_to_remove.end(); iter++) {
- string packageName = str::form (_("%s:%s"),
- iter->resolvable()->kind().asString().c_str(),
- iter->resolvable()->name().c_str()
- );
- Id id = str2id( _SATPool, packageName.c_str(), 1 );
+ Id id = iter->satSolvable().id();
+ MIL << "Delete " << *iter << " with the SAT-Pool ID: " << id << endl;
queue_push( &(jobQueue), SOLVER_ERASE_SOLVABLE_NAME );
queue_push( &(jobQueue), id);
}
@@ -416,8 +414,10 @@
_SATPool->verbose = true;
// Solve !
+ MIL << "Starting solving...." << endl;
solver_solve( solv, &(jobQueue) );
-
+ MIL << "....Solver end" << endl;
+
// copying solution back to zypp pool
//-----------------------------------------
Id p;
Modified: trunk/libzypp/zypp/solver/detail/Resolver.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/solver/detail/Resol…
==============================================================================
--- trunk/libzypp/zypp/solver/detail/Resolver.cc (original)
+++ trunk/libzypp/zypp/solver/detail/Resolver.cc Wed Nov 28 17:36:28 2007
@@ -18,6 +18,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307, USA.
*/
+#include <boost/static_assert.hpp>
#include "zypp/solver/detail/Resolver.h"
#include "zypp/solver/detail/Helper.h"
@@ -26,7 +27,6 @@
#include "zypp/base/Logger.h"
#include "zypp/base/String.h"
#include "zypp/base/Gettext.h"
-
#include "zypp/base/Algorithm.h"
#include "zypp/ResPool.h"
#include "zypp/ResFilters.h"
@@ -36,9 +36,9 @@
#include "zypp/solver/detail/ResolverInfoNeededBy.h"
#include "zypp/capability/FilesystemCap.h"
#include "zypp/sat/Pool.h"
+#include "zypp/sat/Solvable.h"
#include "zypp/sat/SATResolver.h"
-
/////////////////////////////////////////////////////////////////////////
namespace zypp
{ ///////////////////////////////////////////////////////////////////////
@@ -1289,6 +1289,12 @@
// syncing with sat pool
sat::Pool satPool( sat::Pool::instance() );
_pool.satSync();
+ MIL << "------SAT-Pool------" << endl;
+ for (sat::Pool::SolvableIterator i = satPool.solvablesBegin();
+ i != satPool.solvablesEnd(); i++ ) {
+ MIL << *i << " ID: " << i->id() << endl;
+ }
+ MIL << "------SAT-Pool end------" << endl;
SATResolver satResolver(_pool, satPool.get());
return satResolver.resolvePool();
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
[zypp-commit] r7962 - in /trunk/libzypp/zypp: sat/SATResolver.cc solver/detail/Resolver.cc
by schubi2@svn.opensuse.org 28 Nov '07
by schubi2@svn.opensuse.org 28 Nov '07
28 Nov '07
Author: schubi2
Date: Wed Nov 28 15:58:02 2007
New Revision: 7962
URL: http://svn.opensuse.org/viewcvs/zypp?rev=7962&view=rev
Log:
API for SAT solver added
Modified:
trunk/libzypp/zypp/sat/SATResolver.cc
trunk/libzypp/zypp/solver/detail/Resolver.cc
Modified: trunk/libzypp/zypp/sat/SATResolver.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/SATResolver.cc?…
==============================================================================
--- trunk/libzypp/zypp/sat/SATResolver.cc (original)
+++ trunk/libzypp/zypp/sat/SATResolver.cc Wed Nov 28 15:58:02 2007
@@ -185,10 +185,10 @@
// if data != NULL, set as APPL_LOW (from establishPool())
static void
-solution_to_pool (PoolItem_Ref item, const ResStatus & status, const ResStatus::TransactByValue causer)
+SATSolutionToPool (PoolItem_Ref item, const ResStatus & status, const ResStatus::TransactByValue causer)
{
if (triggeredSolution.find(item) != triggeredSolution.end()) {
- _XDEBUG("solution_to_pool(" << item << ") is already in the pool --> skip");
+ _XDEBUG("SATSolutionToPool(" << item << ") is already in the pool --> skip");
return;
}
@@ -201,30 +201,30 @@
if (status.isToBeInstalled()) {
r = item.status().setToBeInstalled (causer);
- _XDEBUG("solution_to_pool(" << item << ", " << status << ") install !" << r);
+ _XDEBUG("SATSolutionToPool(" << item << ", " << status << ") install !" << r);
}
else if (status.isToBeUninstalledDueToUpgrade()) {
r = item.status().setToBeUninstalledDueToUpgrade (causer);
- _XDEBUG("solution_to_pool(" << item << ", " << status << ") upgrade !" << r);
+ _XDEBUG("SATSolutionToPool(" << item << ", " << status << ") upgrade !" << r);
}
else if (status.isToBeUninstalled()) {
r = item.status().setToBeUninstalled (causer);
- _XDEBUG("solution_to_pool(" << item << ", " << status << ") remove !" << r);
+ _XDEBUG("SATSolutionToPool(" << item << ", " << status << ") remove !" << r);
}
else if (status.isIncomplete()
|| status.isNeeded()) {
r = item.status().setIncomplete();
- _XDEBUG("solution_to_pool(" << item << ", " << status << ") incomplete !" << r);
+ _XDEBUG("SATSolutionToPool(" << item << ", " << status << ") incomplete !" << r);
}
else if (status.isUnneeded()) {
r = item.status().setUnneeded();
- _XDEBUG("solution_to_pool(" << item << ", " << status << ") unneeded !" << r);
+ _XDEBUG("SATSolutionToPool(" << item << ", " << status << ") unneeded !" << r);
}
else if (status.isSatisfied()) {
r = item.status().setSatisfied();
- _XDEBUG("solution_to_pool(" << item << ", " << status << ") satisfied !" << r);
+ _XDEBUG("SATSolutionToPool(" << item << ", " << status << ") satisfied !" << r);
} else {
- _XDEBUG("solution_to_pool(" << item << ", " << status << ") unchanged !");
+ _XDEBUG("SATSolutionToPool(" << item << ", " << status << ") unchanged !");
}
return;
}
@@ -292,18 +292,18 @@
//------------------------------------------------------------------------------------------------------------
-struct CollectTransact : public resfilter::PoolItemFilterFunctor
+struct SATCollectTransact : public resfilter::PoolItemFilterFunctor
{
SATResolver & resolver;
- CollectTransact (SATResolver & r)
+ SATCollectTransact (SATResolver & r)
: resolver (r)
{ }
bool operator()( PoolItem_Ref item ) // only transacts() items go here
{
ResStatus status = item.status();
- _XDEBUG( "CollectTransact(" << item << ")" );
+ _XDEBUG( "SATCollectTransact(" << item << ")" );
bool by_solver = (status.isBySolver() || status.isByApplLow());
if (by_solver) {
@@ -357,10 +357,12 @@
bool
SATResolver::resolvePool()
{
- CollectTransact info (*this);
+ SATCollectTransact info (*this);
MIL << "SATResolver::resolvePool()" << endl;
+ queue_init( &jobQueue );
+
invokeOnEach ( _pool.begin(), _pool.end(),
resfilter::ByTransact( ), // collect transacts from Pool to resolver queue
functor::functorRef<bool,PoolItem>(info) );
@@ -430,7 +432,7 @@
if (poolItem) {
ResStatus status;
status.isToBeUninstalled();
- solution_to_pool (poolItem, status, ResStatus::SOLVER);
+ SATSolutionToPool (poolItem, status, ResStatus::SOLVER);
} else {
ERR << "id " << i << " not found in ZYPP pool." << endl;
}
@@ -449,7 +451,7 @@
if (poolItem) {
ResStatus status;
status.isToBeInstalled();
- solution_to_pool (poolItem, status, ResStatus::SOLVER);
+ SATSolutionToPool (poolItem, status, ResStatus::SOLVER);
} else {
ERR << "id " << p << " not found in ZYPP pool." << endl;
}
@@ -471,7 +473,7 @@
//----------------------------------------------------------------------------
string
-conflictsString(Solver *solv, Solvable *s, Id pc)
+SATconflictsString(Solver *solv, Solvable *s, Id pc)
{
Pool *pool = solv->pool;
Solvable *sc = pool->solvables + pc;
@@ -503,7 +505,7 @@
string
-probleminfoString(Solver *solv, const Queue *job, Id problem)
+SATprobleminfoString(Solver *solv, const Queue *job, Id problem)
{
Pool *pool = solv->pool;
Rule *r;
@@ -608,8 +610,8 @@
if (sp->name == sd->name) {
ret += str::form ("cannot install both %s and %s\n", solvable2str(pool, sp), solvable2str(pool, sd));
} else {
- ret += conflictsString (solv, pool->solvables + (-p), -d);
- ret += conflictsString (solv, pool->solvables + (-d), -p);
+ ret += SATconflictsString (solv, pool->solvables + (-p), -d);
+ ret += SATconflictsString (solv, pool->solvables + (-d), -p);
}
} else {
/* find requires of p that corresponds with our rule */
@@ -652,7 +654,7 @@
while ((problem = solver_next_problem(solv, problem)) != 0) {
MIL << "Problem " << pcnt << ":" << endl;
MIL << "====================================" << endl;
- string whatString = probleminfoString(solv, &jobQueue, problem);
+ string whatString = SATprobleminfoString(solv, &jobQueue, problem);
ResolverProblem_Ptr resolverProblem = new ResolverProblem (whatString, "");
solution = 0;
while ((solution = solver_next_solution(solv, problem, solution)) != 0) {
Modified: trunk/libzypp/zypp/solver/detail/Resolver.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/solver/detail/Resol…
==============================================================================
--- trunk/libzypp/zypp/solver/detail/Resolver.cc (original)
+++ trunk/libzypp/zypp/solver/detail/Resolver.cc Wed Nov 28 15:58:02 2007
@@ -35,6 +35,8 @@
#include "zypp/SystemResObject.h"
#include "zypp/solver/detail/ResolverInfoNeededBy.h"
#include "zypp/capability/FilesystemCap.h"
+#include "zypp/sat/Pool.h"
+#include "zypp/sat/SATResolver.h"
/////////////////////////////////////////////////////////////////////////
@@ -1280,6 +1282,18 @@
bool
Resolver::resolvePool( bool tryAllPossibilities )
{
+
+ // Solving with the satsolver
+ if ( getenv("ZYPP_SAT_SOLVER") ) {
+ MIL << "-------------- Calling SAT Solver -------------------" << endl;
+ // syncing with sat pool
+ sat::Pool satPool( sat::Pool::instance() );
+ _pool.satSync();
+
+ SATResolver satResolver(_pool, satPool.get());
+ return satResolver.resolvePool();
+ }
+
ResolverContext_Ptr saveContext = _best_context;
CollectTransact info (*this);
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0