[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

kdenonbeta/kdedebian/kapture



CVS commit by mornfall: 

Use problem resolver for keep operation, should avoid broken packages on
partial upgrade. Few fixes to upgrade-tree, so it actually works as
expected. Fix PkgStatusFilter to report only installed packages in
'upgradable' mode. TODO ++.


  M +5 -0      TODO   1.47
  M +22 -7     libcapture/filters.cpp   1.22
  M +1 -0      libcapture/filters.h   1.22
  M +1 -1      libcapture/groupermanager.cpp   1.5
  M +4 -0      libcapture/pkgmanager.cpp   1.35


--- kdenonbeta/kdedebian/kapture/TODO  #1.46:1.47
@@ -176,4 +176,9 @@
   their stuff into the embedded konsole.
 
+  MAKE CHANGES MORE ROBUST [done: 15%]
+  - make use of apt-pkg's problem resolver
+  - check for various error conditions
+  - add broken-fixing (-f) mode
+
   PROGRESS/DPKG EMBEDDED INTO KAPTURE WINDOW [done: 40%]
   Embed acqprogress, dpkg and stuff into main kapture window and create

--- kdenonbeta/kdedebian/kapture/libcapture/filters.cpp  #1.21:1.22
@@ -203,4 +203,5 @@ GROUPER_CONSTR_B (PkgStatusFilter, Filte
 {
     string s = ParamStr::value (Param::get (a, "string"));
+    cerr << "PkgStatusFilter (" << s << ");" << endl;
     if (s == "inst" || s == "install")
         m_status = PkgCache::PkgInstall;
@@ -221,8 +222,13 @@ bool PkgStatusFilter::filterCondition (T
     PkgCElemPtr e = pkgCElem (**n);
     if (! e) return false;
-    if (m_string == "upgradable")
-        return (PkgManager::cache() -> GetCandidateVer (*e))
-            != *(e -> CurrentVer ());
     int s = PkgManager::cache () -> packageState (*e);
+    if (m_string == "upgradable") {
+        bool r = s == PkgCache::PkgKeepI &&
+            (PkgManager::cache() -> GetCandidateVer (*e))
+            != *(e -> CurrentVer ());
+        if (r)
+            std::cerr << "upgradable: " << e -> Name () << std::endl;
+        return r;
+    }
     return s == m_status;
 }
@@ -242,9 +248,11 @@ GROUPER_CONSTR_B (FilterOrGroup, FilterG
             _a << std::endl;
         string t = ParamStr::value (Param::get (a, _t));
-        std::cerr << "type: " << t << std::endl;
+        Param::Map submap = ParamT<Param::Map>::value (Param::get (a, _a),
+                Param::Map ());
+        std::cerr << "type: " << t << ", submap: " << Param::mapToString
+            (submap) << std::endl;
         m_vec . push_back (
-                dynamic_cast <FilterGrouper *> (GrouperFactory (t,
-                    ParamT<Param::Map>::value (Param::get (a, _a),
-                        Param::Map ())) . instantiate ()));
+                dynamic_cast <FilterGrouper *> (GrouperFactory (t, submap)
+                    . instantiate ()));
     }
 }
@@ -259,2 +267,9 @@ bool FilterOrGroup::filterCondition (Tre
 }
                                                                 /* }}} */
+bool FilterOrGroup::affected (long f)
+{
+    bool a = 0;
+    for (t_FiltVec::iterator i = m_vec . begin (); i != m_vec . end (); i ++)
+        a |= (* i) -> affected (f);
+    return a;
+}

--- kdenonbeta/kdedebian/kapture/libcapture/filters.h  #1.21:1.22
@@ -62,4 +62,5 @@ namespace capture {
             FILT_CLASS (FilterOrGroup, "OR Group");
             FILT_FLAGS (IsSystem);
+            bool affected (long c);
     };
                                                                     /* }}} */

--- kdenonbeta/kdedebian/kapture/libcapture/groupermanager.cpp  #1.4:1.5
@@ -86,5 +86,5 @@ void GrouperManager::setupDefault (void)
     Param::Map upgr;
     Param::set (upgr, "string", ParamStr::create ("upgradable"));
-    Param::set (uoc, "change-a", ParamT<Param::Map>::create (upgr));
+    Param::set (uoc, "upgrade-a", ParamT<Param::Map>::create (upgr));
 
     c = new GrouperChain ("upgrade-tree");

--- kdenonbeta/kdedebian/kapture/libcapture/pkgmanager.cpp  #1.34:1.35
@@ -352,6 +352,10 @@ bool PkgManager::_install (pkgCache::Pkg
 bool PkgManager::_keep (pkgCache::PkgIterator i)
 {
+    pkgProblemResolver fix (cache ());
+    /* fix . Clear (i);
+    fix . Protect (i); */
     cache () -> MarkKeep (i, true);
     m_changes |= InstallChange;
+    fix . ResolveByKeep ();
     _notifyRefresh ();
     return true;




Reply to: