mirror of
git://projects.qi-hardware.com/wernermisc.git
synced 2024-11-15 09:13: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:
parent
3d1ef02aba
commit
a63823e26a
@ -103,7 +103,7 @@ static void compact_pkg(struct pkg *new)
|
|||||||
|
|
||||||
compact:
|
compact:
|
||||||
new->id->jrb->val = new->more;
|
new->id->jrb->val = new->more;
|
||||||
old->installed = old->installed || new->installed;
|
old->flags |= new->flags;
|
||||||
/* @@@ we may leak a little */
|
/* @@@ we may leak a little */
|
||||||
free(new);
|
free(new);
|
||||||
}
|
}
|
||||||
@ -290,7 +290,7 @@ package:
|
|||||||
pkg->version = NULL;
|
pkg->version = NULL;
|
||||||
pkg->conflicts = pkg->depends = NULL;
|
pkg->conflicts = pkg->depends = NULL;
|
||||||
pkg->filename = NULL;
|
pkg->filename = NULL;
|
||||||
pkg->installed = 0;
|
pkg->flags = 0;
|
||||||
pkg->mark = 0;
|
pkg->mark = 0;
|
||||||
goto eol;
|
goto eol;
|
||||||
|
|
||||||
@ -306,7 +306,7 @@ provides:
|
|||||||
goto skip_data;
|
goto skip_data;
|
||||||
|
|
||||||
status:
|
status:
|
||||||
pkg->installed = 1;
|
pkg->flags |= QPKG_INSTALLED;
|
||||||
/* @@@ later */
|
/* @@@ later */
|
||||||
goto skip_data;
|
goto skip_data;
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ static void push(struct pkg *pkg)
|
|||||||
|
|
||||||
}
|
}
|
||||||
stack[n_stack++] = pkg;
|
stack[n_stack++] = pkg;
|
||||||
assert(!pkg->mark && !pkg->installed);
|
assert(!pkg->mark && !(pkg->flags & QPKG_INSTALLED));
|
||||||
pkg->mark = 1;
|
pkg->mark = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,12 +197,12 @@ fprintf(stderr, "%.*s %p", ID2S(pkg->id), pkg);
|
|||||||
if (pkg->version)
|
if (pkg->version)
|
||||||
fprintf(stderr, " %.*s", ID2S(pkg->version));
|
fprintf(stderr, " %.*s", ID2S(pkg->version));
|
||||||
if (pkg->mark) fprintf(stderr, " +");
|
if (pkg->mark) fprintf(stderr, " +");
|
||||||
if (pkg->installed) fprintf(stderr, " ***");
|
if (pkg->flags & QPKG_INSTALLED) fprintf(stderr, " ***");
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
#endif
|
#endif
|
||||||
if (!satisfies(pkg, dep))
|
if (!satisfies(pkg, dep))
|
||||||
continue;
|
continue;
|
||||||
if (pkg->installed || pkg->mark) {
|
if ((pkg->flags & QPKG_INSTALLED) || pkg->mark) {
|
||||||
assert(!conflicts(pkg, conf));
|
assert(!conflicts(pkg, conf));
|
||||||
resolve(next_dep, dep->next, conf);
|
resolve(next_dep, dep->next, conf);
|
||||||
continue;
|
continue;
|
||||||
|
@ -13,6 +13,10 @@
|
|||||||
#ifndef QPKG_H
|
#ifndef QPKG_H
|
||||||
#define QPKG_H
|
#define QPKG_H
|
||||||
|
|
||||||
|
enum flags {
|
||||||
|
QPKG_INSTALLED = 1 << 0, /* installed on target */
|
||||||
|
};
|
||||||
|
|
||||||
enum relop {
|
enum relop {
|
||||||
rel_eq,
|
rel_eq,
|
||||||
rel_ge,
|
rel_ge,
|
||||||
@ -34,7 +38,7 @@ struct pkg {
|
|||||||
struct ref *conflicts;
|
struct ref *conflicts;
|
||||||
struct ref *depends;
|
struct ref *depends;
|
||||||
const char *filename;
|
const char *filename;
|
||||||
int installed;
|
int flags; /* see enum flags */
|
||||||
struct pkg *more;
|
struct pkg *more;
|
||||||
int mark;
|
int mark;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user