1
0
mirror of git://projects.qi-hardware.com/wernermisc.git synced 2024-11-15 04:33:08 +02:00

qpkg/prereq.c (resolve): cleaned up the debugging output mechanism

This commit is contained in:
Werner Almesberger 2010-11-21 10:26:17 -03:00
parent 5a0444fd7e
commit 9272f5057d

View File

@ -34,6 +34,7 @@ static struct pkg **installs = NULL;
static int n_best; /* undefined if best == NULL */
static int n_install = 0;
static int install_max = 0;
static int debug = 0;
static int epoch(const char **s, const struct id *id)
@ -111,7 +112,6 @@ static void done(void)
static void append_install(struct pkg *pkg)
{
//fprintf(stderr, "push %.*s\n", ID2PF(pkg->id));
if (n_install == install_max) {
install_max = (install_max+1)*2;
installs = realloc(installs, sizeof(*installs)*install_max);
@ -170,7 +170,7 @@ static int conflicts(const struct pkg *pkg, const struct list *conf)
static void resolve(struct list *next_dep, const struct ref *dep,
struct list *conf)
{
static int level = 0;
static int level = 0;
struct list more_deps;
struct list more_conf = {
.next = conf
@ -188,15 +188,17 @@ static int level = 0;
for (pkg = dep->pkg->jrb->val; pkg; pkg = pkg->more) {
if (best && n_install == n_best)
return;
#if 0
fprintf(stderr, "%*s", level, "");
fprintf(stderr, "%.*s %p", ID2PF(pkg->id), pkg);
if (pkg->version)
fprintf(stderr, " %.*s", ID2PF(pkg->version));
if (pkg->mark) fprintf(stderr, " +");
if (pkg->flags & QPKG_INSTALLED) fprintf(stderr, " ***");
fprintf(stderr, "\n");
#endif
if (debug) {
fprintf(stderr, "%*s", level, "");
fprintf(stderr, "%.*s %p", ID2PF(pkg->id), pkg);
if (pkg->version)
fprintf(stderr, " %.*s", ID2PF(pkg->version));
if (pkg->mark)
fprintf(stderr, " +");
if (pkg->flags & QPKG_INSTALLED)
fprintf(stderr, " ***");
fprintf(stderr, "\n");
}
if (!satisfies(pkg, dep))
continue;
if ((pkg->flags & QPKG_INSTALLED) || pkg->mark) {
@ -206,7 +208,7 @@ fprintf(stderr, "\n");
}
if (conflicts(pkg, conf))
continue;
level++;
level++;
append_install(pkg);
more_deps.refs = pkg->depends;
more_deps.next = next_dep;
@ -215,7 +217,7 @@ level++;
resolve(&more_deps, dep->next, &more_conf);
next_dep = more_deps.next;
backtrack();
level--;
level--;
}
}