Date:2010-11-22 10:52:53 (8 years 7 months ago)
Author:Werner Almesberger
Commit:b89bcdfd93a60417649340a18ca3bb573b1d9691
Message: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
Files: qpkg/prereq.c (4 diffs)
qpkg/test/conflict (1 diff)
qpkg/test/instconf (1 diff)

Change Details

qpkg/prereq.c
111111}
112112
113113
114static int conflicts(const struct pkg *pkg, const struct list *conf)
114static int old_conflicts(const struct pkg *pkg, const struct list *conf)
115115{
116116    const struct ref *ref;
117117
...... 
125125}
126126
127127
128static int new_conflicts(const struct ref *refs)
129{
130    const struct ref *ref;
131    const struct pkg *pkg;
132
133    for (ref = refs; ref; ref = ref->next)
134        for (pkg = ref->pkg->jrb->val; pkg; pkg = pkg->more)
135            if ((pkg->flags & (QPKG_INSTALLED | QPKG_ADDING)) ||
136                pkg->mark)
137                if (satisfies(pkg, ref))
138                    return 1;
139    return 0;
140}
141
142
128143/* ----- Recurse through lists and layers of dependencies ------------------ */
129144
130145
...... 
186201                exit(1);
187202        }
188203        if ((pkg->flags & QPKG_INSTALLED) || pkg->mark) {
189            assert(!conflicts(pkg, conf));
204            assert(!old_conflicts(pkg, conf));
190205            resolve(next_dep, dep->next, top, conf);
191206            continue;
192207        }
193        if (conflicts(pkg, conf))
208        if (old_conflicts(pkg, conf))
209            continue;
210        if (new_conflicts(pkg->conflicts))
194211            continue;
195212        level++;
196213        append_install(pkg);
...... 
268285        .next = installed_conflicts()
269286    };
270287
271    if (conflicts(pkg, &conf)) {
288    if (old_conflicts(pkg, &conf) || new_conflicts(pkg->conflicts)) {
272289        fprintf(stderr, "%.*s conflicts with installed packages\n",
273290          ID2PF(pkg->id));
274291        exit(1);
qpkg/test/conflict
155155expect <<EOF
156156bar_0
157157EOF
158
159###############################################################################
160
161qpkg_fail "prerequisite conflicts with dependant" prereq A <<EOF
162Package: B
163Version: 0
164Architecture: test
165Conflicts: A
166Filename: B
167
168Package: A
169Version: 0
170Architecture: test
171Depends: B
172Filename: A
173EOF
174expect <<EOF
175can't resolve A
176EOF
177
178###############################################################################
179
180qpkg_fail "prerequisite conflicts with considered package (1)" prereq A <<EOF
181Package: B
182Version: 0
183Architecture: test
184Conflicts: C
185Filename: B
186
187Package: C
188Version: 0
189Architecture: test
190Filename: C
191
192Package: A
193Version: 0
194Architecture: test
195Depends: B, C
196Filename: A
197EOF
198expect <<EOF
199can't resolve A
200EOF
201
202###############################################################################
203
204qpkg_fail "prerequisite conflicts with considered package (1)" prereq A <<EOF
205Package: B
206Version: 0
207Architecture: test
208Filename: B
209
210Package: C
211Version: 0
212Architecture: test
213Conflicts: B
214Filename: C
215
216Package: A
217Version: 0
218Architecture: test
219Depends: B, C
220Filename: A
221EOF
222expect <<EOF
223can't resolve A
224EOF
qpkg/test/instconf
4848expect <<EOF
4949A conflicts with installed packages
5050EOF
51
52###############################################################################
53
54qpkg_fail "prerequisite conflicts with installed package" prereq A <<EOF
55Package: B
56Version: 0
57Architecture: test
58Conflicts: C
59Filename: B
60
61Package: A
62Version: 0
63Architecture: test
64Depends: B
65Filename: A
66
67Package: C
68Version: 0
69Architecture: test
70Status: installed
71EOF
72expect <<EOF
73can't resolve A
74EOF
75
76###############################################################################
77
78qpkg_fail "initial package conflicts with installed package" prereq A <<EOF
79Package: A
80Version: 0
81Architecture: test
82Conflicts: C
83Filename: A
84
85Package: C
86Version: 0
87Architecture: test
88Status: installed
89EOF
90expect <<EOF
91A conflicts with installed packages

Archive Download the corresponding diff file

Branches:
master



interactive