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

qpkg: turn pkg->installed into pkg->flags, allowing for future expansion

- qpkg.h (enum flags, struct pkg): replaced "installed" with "flags", one
  of them being QPKG_INSTALLED
- gobble.c (compact_pkg, gobble_buf), prereq.c (push, resolve): adapted
  for above change
This commit is contained in:
Werner Almesberger 2010-11-20 12:25:45 -03:00
parent 3d1ef02aba
commit a63823e26a
3 changed files with 11 additions and 7 deletions

View File

@ -103,7 +103,7 @@ static void compact_pkg(struct pkg *new)
compact:
new->id->jrb->val = new->more;
old->installed = old->installed || new->installed;
old->flags |= new->flags;
/* @@@ we may leak a little */
free(new);
}
@ -290,7 +290,7 @@ package:
pkg->version = NULL;
pkg->conflicts = pkg->depends = NULL;
pkg->filename = NULL;
pkg->installed = 0;
pkg->flags = 0;
pkg->mark = 0;
goto eol;
@ -306,7 +306,7 @@ provides:
goto skip_data;
status:
pkg->installed = 1;
pkg->flags |= QPKG_INSTALLED;
/* @@@ later */
goto skip_data;

View File

@ -125,7 +125,7 @@ static void push(struct pkg *pkg)
}
stack[n_stack++] = pkg;
assert(!pkg->mark && !pkg->installed);
assert(!pkg->mark && !(pkg->flags & QPKG_INSTALLED));
pkg->mark = 1;
}
@ -197,12 +197,12 @@ fprintf(stderr, "%.*s %p", ID2S(pkg->id), pkg);
if (pkg->version)
fprintf(stderr, " %.*s", ID2S(pkg->version));
if (pkg->mark) fprintf(stderr, " +");
if (pkg->installed) fprintf(stderr, " ***");
if (pkg->flags & QPKG_INSTALLED) fprintf(stderr, " ***");
fprintf(stderr, "\n");
#endif
if (!satisfies(pkg, dep))
continue;
if (pkg->installed || pkg->mark) {
if ((pkg->flags & QPKG_INSTALLED) || pkg->mark) {
assert(!conflicts(pkg, conf));
resolve(next_dep, dep->next, conf);
continue;

View File

@ -13,6 +13,10 @@
#ifndef QPKG_H
#define QPKG_H
enum flags {
QPKG_INSTALLED = 1 << 0, /* installed on target */
};
enum relop {
rel_eq,
rel_ge,
@ -34,7 +38,7 @@ struct pkg {
struct ref *conflicts;
struct ref *depends;
const char *filename;
int installed;
int flags; /* see enum flags */
struct pkg *more;
int mark;
};