mirror of
git://projects.qi-hardware.com/wernermisc.git
synced 2024-12-22 06:11:09 +02:00
qpkg: light cleanup of prereq.c:resolve and change forgotten in last commit
- prereq.c (resolve): do not consider installing virtual packages (forgotten in previous commit) - prereq.c (resolve): renamed "next_dep" to "next_deps" to emphasize that this is a list - prereq.c (resolve): use "break" instead of "return" to abandon a non-optimal path, so that we'll run future cleanup code - prereq.c (resolve): fixed typos in explanation of QPKG_ADDING cleanup - prereq.c (resolve): reference test/bug-adding in explanation
This commit is contained in:
parent
c95d064f9e
commit
068264ed61
@ -166,7 +166,7 @@ static void print_debug(const struct pkg *pkg, const struct stack *top,
|
||||
}
|
||||
|
||||
|
||||
static void resolve(struct list *next_dep, const struct ref *dep,
|
||||
static void resolve(struct list *next_deps, const struct ref *dep,
|
||||
struct stack *top, struct list *conf)
|
||||
{
|
||||
static int level = 0;
|
||||
@ -178,19 +178,21 @@ static void resolve(struct list *next_dep, const struct ref *dep,
|
||||
struct pkg *pkg;
|
||||
|
||||
while (!dep) {
|
||||
if (!next_dep) {
|
||||
if (!next_deps) {
|
||||
done();
|
||||
return;
|
||||
}
|
||||
assert(top->pkg->flags & QPKG_ADDING);
|
||||
top->pkg->flags &= ~QPKG_ADDING;
|
||||
top = top->next;
|
||||
dep = next_dep->refs;
|
||||
next_dep = next_dep->next;
|
||||
dep = next_deps->refs;
|
||||
next_deps = next_deps->next;
|
||||
}
|
||||
for (pkg = dep->pkg->jrb->val; pkg; pkg = pkg->more) {
|
||||
if (best && n_install == n_best)
|
||||
return;
|
||||
break;
|
||||
if (pkg->flags & QPKG_PROVIDED)
|
||||
continue;
|
||||
if (debug)
|
||||
print_debug(pkg, top, level);
|
||||
if (!satisfies(pkg, dep))
|
||||
@ -203,7 +205,7 @@ static void resolve(struct list *next_dep, const struct ref *dep,
|
||||
}
|
||||
if ((pkg->flags & QPKG_INSTALLED) || pkg->mark) {
|
||||
assert(!old_conflicts(pkg, conf));
|
||||
resolve(next_dep, dep->next, top, conf);
|
||||
resolve(next_deps, dep->next, top, conf);
|
||||
continue;
|
||||
}
|
||||
if (old_conflicts(pkg, conf))
|
||||
@ -213,7 +215,7 @@ static void resolve(struct list *next_dep, const struct ref *dep,
|
||||
level++;
|
||||
append_install(pkg);
|
||||
more_deps.refs = dep->next;
|
||||
more_deps.next = next_dep;
|
||||
more_deps.next = next_deps;
|
||||
more_conf.refs = pkg->conflicts;
|
||||
more_conf.next = conf;
|
||||
stack.pkg = pkg;
|
||||
@ -225,11 +227,12 @@ static void resolve(struct list *next_dep, const struct ref *dep,
|
||||
}
|
||||
|
||||
/*
|
||||
* @@@ this shouldn't be all of the story yet. if we fail a dependency
|
||||
* @@@ this shouldn't be all of the story yet. If we fail a dependency
|
||||
* due to a conflict, the current algorithm may leave packages marked
|
||||
* as QPKG_ADDING, possibly triggering a false cyclic dependency error.
|
||||
* See test/bug-adding for an example.
|
||||
*
|
||||
* In the case if cycle detection, we could avoid all the hassle of
|
||||
* In the case of cycle detection, we could avoid all the hassle of
|
||||
* maintaining this flag and just walk down the stack to see if we're
|
||||
* already trying to add the package (the stack should be correct with
|
||||
* the current algorithm), but we'll need this kind of accurate
|
||||
|
Loading…
Reference in New Issue
Block a user