diff --git a/qpkg/prereq.c b/qpkg/prereq.c index f00e9f6..a99518b 100644 --- a/qpkg/prereq.c +++ b/qpkg/prereq.c @@ -111,7 +111,7 @@ static int satisfies(const struct pkg *pkg, const struct ref *ref) } -static int conflicts(const struct pkg *pkg, const struct list *conf) +static int old_conflicts(const struct pkg *pkg, const struct list *conf) { const struct ref *ref; @@ -125,6 +125,21 @@ static int conflicts(const struct pkg *pkg, const struct list *conf) } +static int new_conflicts(const struct ref *refs) +{ + const struct ref *ref; + const struct pkg *pkg; + + for (ref = refs; ref; ref = ref->next) + for (pkg = ref->pkg->jrb->val; pkg; pkg = pkg->more) + if ((pkg->flags & (QPKG_INSTALLED | QPKG_ADDING)) || + pkg->mark) + if (satisfies(pkg, ref)) + return 1; + return 0; +} + + /* ----- Recurse through lists and layers of dependencies ------------------ */ @@ -186,11 +201,13 @@ static void resolve(struct list *next_dep, const struct ref *dep, exit(1); } if ((pkg->flags & QPKG_INSTALLED) || pkg->mark) { - assert(!conflicts(pkg, conf)); + assert(!old_conflicts(pkg, conf)); resolve(next_dep, dep->next, top, conf); continue; } - if (conflicts(pkg, conf)) + if (old_conflicts(pkg, conf)) + continue; + if (new_conflicts(pkg->conflicts)) continue; level++; append_install(pkg); @@ -268,7 +285,7 @@ struct pkg **prereq(struct pkg *pkg) .next = installed_conflicts() }; - if (conflicts(pkg, &conf)) { + if (old_conflicts(pkg, &conf) || new_conflicts(pkg->conflicts)) { fprintf(stderr, "%.*s conflicts with installed packages\n", ID2PF(pkg->id)); exit(1); diff --git a/qpkg/test/conflict b/qpkg/test/conflict index aa72f81..314fbc7 100755 --- a/qpkg/test/conflict +++ b/qpkg/test/conflict @@ -155,3 +155,70 @@ EOF expect <