Date:2010-11-23 01:12:23 (8 years 7 months ago)
Author:Werner Almesberger
Commit:068264ed61d8bb024c1042c7e41c456a3d7753cf
Message: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
Files: qpkg/prereq.c (5 diffs)

Change Details

qpkg/prereq.c
166166}
167167
168168
169static void resolve(struct list *next_dep, const struct ref *dep,
169static void resolve(struct list *next_deps, const struct ref *dep,
170170    struct stack *top, struct list *conf)
171171{
172172    static int level = 0;
...... 
178178    struct pkg *pkg;
179179
180180    while (!dep) {
181        if (!next_dep) {
181        if (!next_deps) {
182182            done();
183183            return;
184184        }
185185        assert(top->pkg->flags & QPKG_ADDING);
186186        top->pkg->flags &= ~QPKG_ADDING;
187187        top = top->next;
188        dep = next_dep->refs;
189        next_dep = next_dep->next;
188        dep = next_deps->refs;
189        next_deps = next_deps->next;
190190    }
191191    for (pkg = dep->pkg->jrb->val; pkg; pkg = pkg->more) {
192192        if (best && n_install == n_best)
193            return;
193            break;
194        if (pkg->flags & QPKG_PROVIDED)
195            continue;
194196        if (debug)
195197            print_debug(pkg, top, level);
196198        if (!satisfies(pkg, dep))
...... 
203205        }
204206        if ((pkg->flags & QPKG_INSTALLED) || pkg->mark) {
205207            assert(!old_conflicts(pkg, conf));
206            resolve(next_dep, dep->next, top, conf);
208            resolve(next_deps, dep->next, top, conf);
207209            continue;
208210        }
209211        if (old_conflicts(pkg, conf))
...... 
213215        level++;
214216        append_install(pkg);
215217        more_deps.refs = dep->next;
216        more_deps.next = next_dep;
218        more_deps.next = next_deps;
217219        more_conf.refs = pkg->conflicts;
218220        more_conf.next = conf;
219221        stack.pkg = pkg;
...... 
225227    }
226228
227229    /*
228     * @@@ this shouldn't be all of the story yet. if we fail a dependency
230     * @@@ this shouldn't be all of the story yet. If we fail a dependency
229231     * due to a conflict, the current algorithm may leave packages marked
230232     * as QPKG_ADDING, possibly triggering a false cyclic dependency error.
233     * See test/bug-adding for an example.
231234     *
232     * In the case if cycle detection, we could avoid all the hassle of
235     * In the case of cycle detection, we could avoid all the hassle of
233236     * maintaining this flag and just walk down the stack to see if we're
234237     * already trying to add the package (the stack should be correct with
235238     * the current algorithm), but we'll need this kind of accurate

Archive Download the corresponding diff file

Branches:
master



interactive