[Aptitude-svn-commit] r4077 - in branches/aptitude-0.3/aptitude: . src/generic

Daniel Burrows dburrows at costa.debian.org
Wed Sep 14 15:54:15 UTC 2005


Author: dburrows
Date: Wed Sep 14 15:54:12 2005
New Revision: 4077

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/generic/aptcache.cc
   branches/aptitude-0.3/aptitude/src/generic/aptcache.h
Log:
Add a signal that readers can use to detect that the cache is
*about to be* changed; needed for background threads to be sanely stopped.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Wed Sep 14 15:54:12 2005
@@ -1,3 +1,12 @@
+2005-09-14  Daniel Burrows  <dburrows at debian.org>
+
+	* src/generic/aptcache.cc, src/generic/aptcache.h:
+
+	  Add a new signal that gets called *before* the package states
+	  change; this is needed to run the resolver in the background
+	  (since it's a reader of the depcache, it has to be killed before
+	  anything writes back to the depcache).
+
 2005-09-13  Daniel Burrows  <dburrows at debian.org>
 
 	* src/generic/aptcache.cc:

Modified: branches/aptitude-0.3/aptitude/src/generic/aptcache.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/generic/aptcache.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/generic/aptcache.cc	Wed Sep 14 15:54:12 2005
@@ -743,6 +743,7 @@
 					     undo_group *undo,
 					     bool do_mark_and_sweep)
 {
+  pre_package_state_changed();
   dirty=true;
 
   // Only change the install reason if the package was not previously
@@ -781,6 +782,7 @@
 					    undo_group *undo,
 					    bool do_mark_and_sweep)
 {
+  pre_package_state_changed();
   dirty=true;
 
   bool previously_to_delete=(*this)[Pkg].Delete();
@@ -816,6 +818,7 @@
 
 void aptitudeDepCache::internal_mark_keep(const PkgIterator &Pkg, bool Soft, bool SetHold, undo_group *undo, bool do_mark_and_sweep)
 {
+  pre_package_state_changed();
   dirty=true;
 
   pkgDepCache::MarkKeep(Pkg, Soft);
@@ -861,6 +864,7 @@
 
   if(!ver.end())
     {
+      pre_package_state_changed();
       // Use the InstVerIter instead of GetCandidateVersion, since
       // that seems to store the currently to-be-installed version.
       VerIterator prev=(*this)[(ver.ParentPkg())].InstVerIter(GetCache());
@@ -903,6 +907,8 @@
 
   if(verstr!=estate.forbidver)
     {
+      pre_package_state_changed();
+
       pkgCache::VerIterator candver=(*this)[pkg].CandidateVerIter(*this);
 
       dirty=true;
@@ -926,6 +932,7 @@
 
 void aptitudeDepCache::mark_single_install(const PkgIterator &Pkg, undo_group *undo)
 {
+  pre_package_state_changed();
   dirty=true;
 
   for(PkgIterator i=PkgBegin(); !i.end(); i++)
@@ -949,6 +956,7 @@
 					   bool set_auto,
 					   undo_group *undo)
 {
+  pre_package_state_changed();
   dirty=true;
 
   get_ext_state(Pkg).install_reason=set_auto?user_auto:manual;
@@ -967,6 +975,8 @@
 
 bool aptitudeDepCache::all_upgrade(bool with_autoinst, undo_group *undo)
 {
+  pre_package_state_changed();
+
   pkgProblemResolver fixer(this);
 
   if(BrokenCount()!=0)
@@ -1000,6 +1010,7 @@
 
 bool aptitudeDepCache::try_fix_broken(pkgProblemResolver &fixer, undo_group *undo)
 {
+  pre_package_state_changed();
   dirty=true;
   bool founderr=false;
   if(!fixer.Resolve(true))

Modified: branches/aptitude-0.3/aptitude/src/generic/aptcache.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/generic/aptcache.h	(original)
+++ branches/aptitude-0.3/aptitude/src/generic/aptcache.h	Wed Sep 14 15:54:12 2005
@@ -551,7 +551,13 @@
   void restore_apt_state(const apt_state_snapshot *snapshot);
   // Restores the *APT* cache to the given state.
 
-  /** This signal is emitted if any package's install state is
+  /** This signal is emitted *before* any package's install state is
+   *  changed.  It may be emitted more than once per state change; if
+   *  no states actually change, it might not be emitted at all.
+   */
+  sigc::signal0<void> pre_package_state_changed;
+
+  /** This signal is emitted when any package's install state is
    *  changed.
    */
   sigc::signal0<void> package_state_changed;



More information about the Aptitude-svn-commit mailing list