]>
Commit | Line | Data |
---|---|---|
b6afb58d MB |
1 | Index: uninstall.c |
2 | =================================================================== | |
3 | RCS file: /cvsroot/poldek/poldek/uninstall.c,v | |
4 | retrieving revision 1.47 | |
5 | retrieving revision 1.48 | |
6 | diff -u -r1.47 -r1.48 | |
7 | --- uninstall.c 2 Feb 2008 21:49:04 -0000 1.47 | |
8 | +++ uninstall.c 2 Mar 2008 20:05:56 -0000 1.48 | |
9 | @@ -11,7 +11,7 @@ | |
10 | */ | |
11 | ||
12 | /* | |
13 | - $Id$ | |
14 | + $Id$ | |
15 | */ | |
16 | ||
17 | #include <errno.h> | |
18 | @@ -122,17 +122,22 @@ | |
19 | static int pkg_leave_orphans(struct uninstall_ctx *uctx, struct pkg *pkg) | |
20 | { | |
21 | struct capreq *selfcap; | |
22 | + tn_array *exclude; | |
23 | int i; | |
24 | ||
25 | + exclude = n_array_dup(uctx->unpkgs, (tn_fn_dup)pkg_link); | |
26 | + /* yep, there are packages which requires themselves */ | |
27 | + n_array_push(exclude, pkg_link(pkg)); | |
28 | + | |
29 | capreq_new_name_a(pkg->name, selfcap); | |
30 | - if (pkgdb_q_is_required(uctx->db, selfcap, uctx->unpkgs)) | |
31 | - return 1; | |
32 | + if (pkgdb_q_is_required(uctx->db, selfcap, exclude)) | |
33 | + goto l_yes; | |
34 | ||
35 | if (pkg->caps) | |
36 | for (i=0; i < n_array_size(pkg->caps); i++) { | |
37 | struct capreq *cap = n_array_nth(pkg->caps, i); | |
38 | - if (pkgdb_q_is_required(uctx->db, cap, uctx->unpkgs)) | |
39 | - return 1; | |
40 | + if (pkgdb_q_is_required(uctx->db, cap, exclude)) | |
41 | + goto l_yes; | |
42 | } | |
43 | ||
44 | if (pkg->fl) { | |
45 | @@ -143,13 +148,20 @@ | |
46 | while ((path = pkgfl_it_get(&it, NULL))) { | |
47 | struct capreq *cap; | |
48 | capreq_new_name_a(path, cap); | |
49 | - if (pkgdb_q_is_required(uctx->db, cap, uctx->unpkgs)) | |
50 | - return 1; | |
51 | + if (pkgdb_q_is_required(uctx->db, cap, exclude)) | |
52 | + goto l_yes; | |
53 | } | |
54 | } | |
55 | + | |
56 | ||
57 | + n_array_free(exclude); | |
58 | return 0; | |
59 | + | |
60 | +l_yes: | |
61 | + n_array_free(exclude); | |
62 | + return 1; | |
63 | } | |
64 | + | |
65 | ||
66 | ||
67 | /* | |
68 | @@ -194,6 +206,8 @@ | |
69 | pkg_set_mf(uctx->pms, dbpkg, DBPKG_REV_ORPHANED); | |
70 | pkg_dep_mark(uctx->ts->pms, dbpkg); | |
71 | n_array_push(uctx->unpkgs, pkg_link(dbpkg)); | |
72 | + uctx->ndep++; | |
73 | + | |
74 | if (uctx->rev_orphans_deep > deep) | |
75 | process_pkg_rev_orphans(indent + 2, uctx, dbpkg, deep + 1); | |
76 | } |