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

Daniel Burrows dburrows at costa.debian.org
Wed Sep 21 20:37:03 UTC 2005


Author: dburrows
Date: Wed Sep 21 20:36:59 2005
New Revision: 4152

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/cmdline/cmdline_do_action.cc
   branches/aptitude-0.3/aptitude/src/generic/aptcache.cc
   branches/aptitude-0.3/aptitude/src/generic/aptcache.h
   branches/aptitude-0.3/aptitude/src/ui.cc
Log:
Fix a problem reported by Michael Vogt: command-line upgrades should
ignore sticky removals to be consistent with other command-line actions.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Wed Sep 21 20:36:59 2005
@@ -1,5 +1,14 @@
 2005-09-21  Daniel Burrows  <dburrows at debian.org>
 
+	* src/cmdline/cmdline_do_action.cc, src/generic/aptcache.cc, src/generic/aptcache.h, src/ui.cc:
+
+	  Upgrade packages that were to-be-removed when doing a
+	  dist-upgrade from the command line.  This is achieved by adding
+	  a new flag to mark_all_upgradable that selects one or the other
+	  behavior; also fixed the handling of Unknown packages in
+	  mark_all_upgradable (it was just wrong before, and probably
+	  wasn't noticed because that case should never come up anyway).
+
 	* src/broken_indicator.cc, src/dep_item.h, src/download_bar.h, src/download_list.h, src/edit_pkg_hier.h, src/mine/cmine.h, src/pkg_info_screen.h, src/pkg_tree.h, src/pkg_ver_item.h, src/pkg_view.cc, src/solution_dialog.cc, src/solution_screen.cc, src/ui.cc, src/view_changelog.cc, src/vscreen/vs_button.h, src/vscreen/vs_center.h, src/vscreen/vscreen_widget.h, src/vscreen/vs_editline.h, src/vscreen/vs_frame.h, src/vscreen/vs_label.cc, src/vscreen/vs_label.h, src/vscreen/vs_menubar.h, src/vscreen/vs_menu.h, src/vscreen/vs_minibuf_win.h, src/vscreen/vs_multiplex.h, src/vscreen/vs_pager.h, src/vscreen/vs_scrollbar.h, src/vscreen/vs_size_box.h, src/vscreen/vs_stacked.h, src/vscreen/vs_statuschoice.h, src/vscreen/vs_table.h, src/vscreen/vs_text_layout.h, src/vscreen/vs_togglebutton.h, src/vscreen/vs_transient.h, src/vscreen/vs_tree.h:
 
 	  Make the reference count of vscreen_widgets default to 1, not 0.

Modified: branches/aptitude-0.3/aptitude/src/cmdline/cmdline_do_action.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/cmdline/cmdline_do_action.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/cmdline/cmdline_do_action.cc	Wed Sep 21 20:36:59 2005
@@ -123,7 +123,7 @@
 
 	}
 
-      (*apt_cache_file)->mark_all_upgradable(true, NULL);
+      (*apt_cache_file)->mark_all_upgradable(true, false, NULL);
     }
   /*else if(argc==1 && default_action==cmdline_install)
     {

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 21 20:36:59 2005
@@ -393,7 +393,7 @@
 
   if(aptcfg->FindB(PACKAGE "::Auto-Upgrade", false) && do_initselections)
     mark_all_upgradable(aptcfg->FindB(PACKAGE "::Auto-Install", true),
-			NULL);
+			true, NULL);
   else
     {
       // Normally this was done in the mark_all_upgradable, but we no
@@ -410,6 +410,7 @@
 }
 
 void aptitudeDepCache::mark_all_upgradable(bool with_autoinst,
+					   bool ignore_removed,
 					   undo_group *undo)
 {
   begin_action_group();
@@ -438,33 +439,36 @@
 	  StateCache &state=(*this)[i];
 	  aptitude_state &estate=get_ext_state(i);
 
-	  switch(estate.selection_state)
-	    {
+	  if(i.CurrentVer().end())
+	    continue;
+
+	  bool do_upgrade = false;
 
-	      // This case shouldn't really happen:
-	    case pkgCache::State::Unknown:
-	      if(!i.CurrentVer().end())
-		estate.selection_state=pkgCache::State::DeInstall;
-	      else
+	  if(!ignore_removed)
+	    do_upgrade = state.Status > 0 && !is_held(i);
+	  else
+	    {
+	      switch(estate.selection_state)
 		{
+		  // This case shouldn't really happen:
+		case pkgCache::State::Unknown:
 		  estate.selection_state=pkgCache::State::Install;
-		  if(state.Status>0 && !is_held(i))
-		    {
-		      dirty=true;
 
-		      MarkInstall(i, do_autoinstall);
-		    }
+		  // Fall through
+		case pkgCache::State::Install:
+		  if(state.Status > 0 && !is_held(i))
+		    do_upgrade = true;
+		  break;
+		default:
+		  break;
 		}
-	      break;
-	    case pkgCache::State::Install:
-	      if(!i.CurrentVer().end() && state.Status>0 && !is_held(i))
-		{
-		  dirty=true;
+	    }
 
-		  MarkInstall(i, do_autoinstall);
-		}
-	    default:
-	      break;
+	  if(do_upgrade)
+	    {
+	      dirty = true;
+
+	      MarkInstall(i, do_autoinstall);
 	    }
 	}
     }

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 21 20:36:59 2005
@@ -316,8 +316,20 @@
   void forbid_upgrade(const pkgCache::PkgIterator &pkg,
 		      std::string verstr, undo_group *undo);
 
-  void mark_all_upgradable(bool with_autoinst, undo_group *undo);
-  // Marks any upgradable packages for upgrade.
+  /** Marks all upgradable and non-held packages for upgrade.
+   *
+   *  \param with_autoinst if \b true, the dependencies of packages
+   *  begin upgraded will automatically be installed.
+   *
+   *  \param ignore_selections if \b false, all upgradable packages
+   *  that are not held back will be upgraded; otherwise, packages
+   *  that are going to be removed will be ignored.
+   *
+   *  \param undo an undo group with which the actions taken by this
+   *  routine will be registered, or \b NULL.
+   */
+  void mark_all_upgradable(bool with_autoinst, bool ignore_removed,
+			   undo_group *undo);
 
   void mark_single_install(const PkgIterator &pkg, undo_group *undo);
   // Marks this package to be install, and all other packages to be kept.

Modified: branches/aptitude-0.3/aptitude/src/ui.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/ui.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/ui.cc	Wed Sep 21 20:36:59 2005
@@ -1375,7 +1375,7 @@
     {
       undo_group *undo=new apt_undo_group;
 
-      (*apt_cache_file)->mark_all_upgradable(true, undo);
+      (*apt_cache_file)->mark_all_upgradable(true, true, undo);
 
       if(!undo->empty())
 	apt_undos->add_item(undo);



More information about the Aptitude-svn-commit mailing list