poldek: poldek/uninstall.c - fix: display marked as orphaned packa...

mis mis at pld-linux.org
Sun Mar 2 21:06:01 CET 2008


Author: mis                          Date: Sun Mar  2 20:06:01 2008 GMT
Module: poldek                        Tag: HEAD
---- Log message:
- fix: display marked as orphaned packages in summary
- fix: remove self-required packages too

---- Files affected:
poldek/poldek:
   uninstall.c (1.47 -> 1.48) 

---- Diffs:

================================================================
Index: poldek/poldek/uninstall.c
diff -u poldek/poldek/uninstall.c:1.47 poldek/poldek/uninstall.c:1.48
--- poldek/poldek/uninstall.c:1.47	Sat Feb  2 22:49:04 2008
+++ poldek/poldek/uninstall.c	Sun Mar  2 21:05:56 2008
@@ -122,17 +122,22 @@
 static int pkg_leave_orphans(struct uninstall_ctx *uctx, struct pkg *pkg)
 {
     struct capreq *selfcap;
+    tn_array *exclude;
     int i;
     
+    exclude = n_array_dup(uctx->unpkgs, (tn_fn_dup)pkg_link);
+    /* yep, there are packages which requires themselves */
+    n_array_push(exclude, pkg_link(pkg)); 
+    
     capreq_new_name_a(pkg->name, selfcap);
-    if (pkgdb_q_is_required(uctx->db, selfcap, uctx->unpkgs))
-        return 1;
+    if (pkgdb_q_is_required(uctx->db, selfcap, exclude))
+        goto l_yes;
 
     if (pkg->caps)
         for (i=0; i < n_array_size(pkg->caps); i++) {
             struct capreq *cap = n_array_nth(pkg->caps, i);
-            if (pkgdb_q_is_required(uctx->db, cap, uctx->unpkgs))
-                return 1;
+            if (pkgdb_q_is_required(uctx->db, cap, exclude))
+                goto l_yes;
         }
     
     if (pkg->fl) {
@@ -143,13 +148,20 @@
         while ((path = pkgfl_it_get(&it, NULL))) {
             struct capreq *cap;
             capreq_new_name_a(path, cap);
-            if (pkgdb_q_is_required(uctx->db, cap, uctx->unpkgs))
-                return 1;
+            if (pkgdb_q_is_required(uctx->db, cap, exclude))
+                goto l_yes;
         }
     }
+
     
+    n_array_free(exclude);
     return 0;
+    
+l_yes:
+    n_array_free(exclude);
+    return 1;
 }
+        
 
 
 /*
@@ -194,6 +206,8 @@
             pkg_set_mf(uctx->pms, dbpkg, DBPKG_REV_ORPHANED);
             pkg_dep_mark(uctx->ts->pms, dbpkg);
             n_array_push(uctx->unpkgs, pkg_link(dbpkg));
+            uctx->ndep++;
+            
             if (uctx->rev_orphans_deep > deep)
                 process_pkg_rev_orphans(indent + 2, uctx, dbpkg, deep + 1);
         }
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/poldek/poldek/uninstall.c?r1=1.47&r2=1.48&f=u



More information about the pld-cvs-commit mailing list