1
0
mirror of git://projects.qi-hardware.com/wernermisc.git synced 2024-11-15 08:34:05 +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_best; /* undefined if best == NULL */
static int n_install = 0; static int n_install = 0;
static int install_max = 0; static int install_max = 0;
static int debug = 0;
static int epoch(const char **s, const struct id *id) 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) static void append_install(struct pkg *pkg)
{ {
//fprintf(stderr, "push %.*s\n", ID2PF(pkg->id));
if (n_install == install_max) { if (n_install == install_max) {
install_max = (install_max+1)*2; install_max = (install_max+1)*2;
installs = realloc(installs, sizeof(*installs)*install_max); 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, static void resolve(struct list *next_dep, const struct ref *dep,
struct list *conf) struct list *conf)
{ {
static int level = 0; static int level = 0;
struct list more_deps; struct list more_deps;
struct list more_conf = { struct list more_conf = {
.next = conf .next = conf
@ -188,15 +188,17 @@ static int level = 0;
for (pkg = dep->pkg->jrb->val; pkg; pkg = pkg->more) { for (pkg = dep->pkg->jrb->val; pkg; pkg = pkg->more) {
if (best && n_install == n_best) if (best && n_install == n_best)
return; return;
#if 0 if (debug) {
fprintf(stderr, "%*s", level, ""); fprintf(stderr, "%*s", level, "");
fprintf(stderr, "%.*s %p", ID2PF(pkg->id), pkg); fprintf(stderr, "%.*s %p", ID2PF(pkg->id), pkg);
if (pkg->version) if (pkg->version)
fprintf(stderr, " %.*s", ID2PF(pkg->version)); fprintf(stderr, " %.*s", ID2PF(pkg->version));
if (pkg->mark) fprintf(stderr, " +"); if (pkg->mark)
if (pkg->flags & QPKG_INSTALLED) fprintf(stderr, " ***"); fprintf(stderr, " +");
fprintf(stderr, "\n"); if (pkg->flags & QPKG_INSTALLED)
#endif fprintf(stderr, " ***");
fprintf(stderr, "\n");
}
if (!satisfies(pkg, dep)) if (!satisfies(pkg, dep))
continue; continue;
if ((pkg->flags & QPKG_INSTALLED) || pkg->mark) { if ((pkg->flags & QPKG_INSTALLED) || pkg->mark) {
@ -206,7 +208,7 @@ fprintf(stderr, "\n");
} }
if (conflicts(pkg, conf)) if (conflicts(pkg, conf))
continue; continue;
level++; level++;
append_install(pkg); append_install(pkg);
more_deps.refs = pkg->depends; more_deps.refs = pkg->depends;
more_deps.next = next_dep; more_deps.next = next_dep;
@ -215,7 +217,7 @@ level++;
resolve(&more_deps, dep->next, &more_conf); resolve(&more_deps, dep->next, &more_conf);
next_dep = more_deps.next; next_dep = more_deps.next;
backtrack(); backtrack();
level--; level--;
} }
} }