mirror of
git://projects.qi-hardware.com/wernermisc.git
synced 2024-11-15 06:54:04 +02:00
qpkg: also consider conflicts introduced by package about to be added
- prereq.c (conflicts, resolve, prereq): renamed "conflicts" to "old_conflicts" - prereq.c (new_conflicts, resolve, prereq): also test whether any of the conflicts of the package we're about to add matches an installed or considered package - test/conflict, test/instconf: test for conflicts introduced by package about to be added
This commit is contained in:
parent
c44510ade1
commit
b89bcdfd93
@ -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);
|
||||
|
@ -155,3 +155,70 @@ EOF
|
||||
expect <<EOF
|
||||
bar_0
|
||||
EOF
|
||||
|
||||
###############################################################################
|
||||
|
||||
qpkg_fail "prerequisite conflicts with dependant" prereq A <<EOF
|
||||
Package: B
|
||||
Version: 0
|
||||
Architecture: test
|
||||
Conflicts: A
|
||||
Filename: B
|
||||
|
||||
Package: A
|
||||
Version: 0
|
||||
Architecture: test
|
||||
Depends: B
|
||||
Filename: A
|
||||
EOF
|
||||
expect <<EOF
|
||||
can't resolve A
|
||||
EOF
|
||||
|
||||
###############################################################################
|
||||
|
||||
qpkg_fail "prerequisite conflicts with considered package (1)" prereq A <<EOF
|
||||
Package: B
|
||||
Version: 0
|
||||
Architecture: test
|
||||
Conflicts: C
|
||||
Filename: B
|
||||
|
||||
Package: C
|
||||
Version: 0
|
||||
Architecture: test
|
||||
Filename: C
|
||||
|
||||
Package: A
|
||||
Version: 0
|
||||
Architecture: test
|
||||
Depends: B, C
|
||||
Filename: A
|
||||
EOF
|
||||
expect <<EOF
|
||||
can't resolve A
|
||||
EOF
|
||||
|
||||
###############################################################################
|
||||
|
||||
qpkg_fail "prerequisite conflicts with considered package (1)" prereq A <<EOF
|
||||
Package: B
|
||||
Version: 0
|
||||
Architecture: test
|
||||
Filename: B
|
||||
|
||||
Package: C
|
||||
Version: 0
|
||||
Architecture: test
|
||||
Conflicts: B
|
||||
Filename: C
|
||||
|
||||
Package: A
|
||||
Version: 0
|
||||
Architecture: test
|
||||
Depends: B, C
|
||||
Filename: A
|
||||
EOF
|
||||
expect <<EOF
|
||||
can't resolve A
|
||||
EOF
|
||||
|
@ -48,3 +48,44 @@ EOF
|
||||
expect <<EOF
|
||||
A conflicts with installed packages
|
||||
EOF
|
||||
|
||||
###############################################################################
|
||||
|
||||
qpkg_fail "prerequisite conflicts with installed package" prereq A <<EOF
|
||||
Package: B
|
||||
Version: 0
|
||||
Architecture: test
|
||||
Conflicts: C
|
||||
Filename: B
|
||||
|
||||
Package: A
|
||||
Version: 0
|
||||
Architecture: test
|
||||
Depends: B
|
||||
Filename: A
|
||||
|
||||
Package: C
|
||||
Version: 0
|
||||
Architecture: test
|
||||
Status: installed
|
||||
EOF
|
||||
expect <<EOF
|
||||
can't resolve A
|
||||
EOF
|
||||
|
||||
###############################################################################
|
||||
|
||||
qpkg_fail "initial package conflicts with installed package" prereq A <<EOF
|
||||
Package: A
|
||||
Version: 0
|
||||
Architecture: test
|
||||
Conflicts: C
|
||||
Filename: A
|
||||
|
||||
Package: C
|
||||
Version: 0
|
||||
Architecture: test
|
||||
Status: installed
|
||||
EOF
|
||||
expect <<EOF
|
||||
A conflicts with installed packages
|
||||
|
Loading…
Reference in New Issue
Block a user