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

qpkg/prereq.c (print_debug, resolve): moved debug output to separate function

This commit is contained in:
Werner Almesberger 2010-11-21 20:48:24 -03:00
parent 0bc4b6046b
commit e1404bb6a2

View File

@ -171,6 +171,28 @@ static int conflicts(const struct pkg *pkg, const struct list *conf)
}
static void print_debug(const struct pkg *pkg, const struct stack *top,
int level)
{
const struct stack *p;
fprintf(stderr, "%*s", level, "");
fprintf(stderr, "%.*s %p", ID2PF(pkg->id), pkg);
if (pkg->version)
fprintf(stderr, " %.*s", ID2PF(pkg->version));
fprintf(stderr, " (");
for (p = top; p; p = p->next)
fprintf(stderr, "%s%.*s",
p == top ? "" : " ", ID2PF(p->pkg->id));
fprintf(stderr, ")");
if (pkg->mark)
fprintf(stderr, " +");
if (pkg->flags & QPKG_INSTALLED)
fprintf(stderr, " ***");
fprintf(stderr, "\n");
}
static void resolve(struct list *next_dep, const struct ref *dep,
struct stack *top, struct list *conf)
{
@ -196,24 +218,8 @@ static void resolve(struct list *next_dep, const struct ref *dep,
for (pkg = dep->pkg->jrb->val; pkg; pkg = pkg->more) {
if (best && n_install == n_best)
return;
if (debug) {
struct stack *p;
fprintf(stderr, "%*s", level, "");
fprintf(stderr, "%.*s %p", ID2PF(pkg->id), pkg);
if (pkg->version)
fprintf(stderr, " %.*s", ID2PF(pkg->version));
fprintf(stderr, " (");
for (p = top; p; p = p->next)
fprintf(stderr, "%s%.*s",
p == top ? "" : " ", ID2PF(p->pkg->id));
fprintf(stderr, ")");
if (pkg->mark)
fprintf(stderr, " +");
if (pkg->flags & QPKG_INSTALLED)
fprintf(stderr, " ***");
fprintf(stderr, "\n");
}
if (debug)
print_debug(pkg, top, level);
if (!satisfies(pkg, dep))
continue;
if (pkg->flags & QPKG_ADDING) {