poldek: poldek/install3/misc.c - bugfix: when POLDEK_TS_REINSTALL is set, t...

megabajt megabajt at pld-linux.org
Mon Aug 18 11:26:46 CEST 2008


Author: megabajt                     Date: Mon Aug 18 09:26:46 2008 GMT
Module: poldek                        Tag: HEAD
---- Log message:
- bugfix: when POLDEK_TS_REINSTALL is set, the same package can be installed and removed in one transaction

---- Files affected:
poldek/poldek/install3:
   misc.c (1.11 -> 1.12) 

---- Diffs:

================================================================
Index: poldek/poldek/install3/misc.c
diff -u poldek/poldek/install3/misc.c:1.11 poldek/poldek/install3/misc.c:1.12
--- poldek/poldek/install3/misc.c:1.11	Sun May 25 12:58:54 2008
+++ poldek/poldek/install3/misc.c	Mon Aug 18 11:26:41 2008
@@ -341,7 +341,7 @@
                 const struct pkg *pkg, const struct capreq *req,
                 struct pkg **best_pkg, tn_array *candidates)
 {
-    tn_array *suspkgs = NULL, *tmpkgs;;
+    tn_array *suspkgs = NULL, *tmpkgs;
     int found = 0;
 
     *best_pkg = NULL;
@@ -355,23 +355,27 @@
 
     n_assert(n_array_size(suspkgs) > 0);
     
-    /* remove marked for removal items from suspected packages */
-    tmpkgs = n_array_clone(suspkgs);
-    while (n_array_size(suspkgs)) {
-        struct pkg *suspkg = n_array_shift(suspkgs);
+    /* remove marked for removal items from suspected packages, but do it only
+       when POLDEK_TS_REINSTALL is not set, otherwise removing and installing
+       the same package is possible */
+    if (!poldek_ts_issetf(ictx->ts, POLDEK_TS_REINSTALL)) {
+        tmpkgs = n_array_clone(suspkgs);
+        while (n_array_size(suspkgs)) {
+            struct pkg *suspkg = n_array_shift(suspkgs);
 
-        /* possible when the same package exists in both available
-           and already installed set */
-        if (i3_is_marked_for_removal(ictx, suspkg)) {
-            pkg_free(suspkg);
-            continue;
-        }
+            /* possible when the same package exists in both available
+               and already installed set */
+            if (i3_is_marked_for_removal(ictx, suspkg)) {
+                pkg_free(suspkg);
+                continue;
+            }
         
-        n_array_push(tmpkgs, suspkg);
-    }
+            n_array_push(tmpkgs, suspkg);
+        }
     
-    n_array_free(suspkgs);
-    suspkgs = tmpkgs;
+        n_array_free(suspkgs);
+        suspkgs = tmpkgs;
+    }
 
     //trace(indent, "after removed rmmarked -> %d package(s)",
     //      n_array_size(suspkgs));
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/poldek/poldek/install3/misc.c?r1=1.11&r2=1.12&f=u



More information about the pld-cvs-commit mailing list