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

Re: question of aptitude with important/standard



On Mon, Aug 09, 2004 at 09:11:28AM -0400, Daniel Burrows <dburrows@debian.org> was heard to say:
>   I can fix this by changing InstVerIter to CandVerIter on line 300 of
> cmdline_action.cc, but I want to check whether I did this for a reason
> first so I don't reopen another bug :-).

  Ok...first of all, that's the wrong line to change.  Second: I think
that change should only be in targets that have to do with installing
and upgrading packages: install, hold, and forbid-version.  Remove and
purge will look at the current version of a package, and the rest will
look at whatever version is going to be installed.

  This isn't perfect, but since the pattern language currently lacks a
way to explicitly say which version should be used, I need to make an
arbitrary decision.  (I could just make all targets look at the candidate
version, but that would make it hard to remove packages based on their
current state :( )

  A patch against current SVN is attached.  Is this important enough
that you want to try to squeeze it into t-p-u?

  Daniel

-- 
/-------------------- Daniel Burrows <dburrows@debian.org> -------------------\
|                The only thing worse than infinite recursion                 |
|                is infinite recursion.                                       |
\---------------------- A duck! -- http://www.python.org ---------------------/
Index: src/cmdline/cmdline_action.cc
===================================================================
--- src/cmdline/cmdline_action.cc	(revision 2679)
+++ src/cmdline/cmdline_action.cc	(working copy)
@@ -297,7 +297,7 @@
 	      for(pkgCache::PkgIterator j=(*apt_cache_file)->PkgBegin();
 		  !j.end(); ++j)
 		{
-		  if(m->matches(j, (*apt_cache_file)[j].InstVerIter(*apt_cache_file)))
+		  if(m->matches(j, (*apt_cache_file)[j].CandidateVerIter(*apt_cache_file)))
 		    possible.push_back(j);
 		}
 
@@ -333,12 +333,24 @@
 
       for(pkgCache::PkgIterator pkg=(*apt_cache_file)->PkgBegin();
 	  !pkg.end(); ++pkg)
-	if(m->matches(pkg, (*apt_cache_file)[pkg].InstVerIter(**apt_cache_file)))
-	  rval=cmdline_applyaction(action, fixer, pkg,
-				   to_install, to_hold, to_remove, to_purge,
-				   verbose, source,
-				   sourcestr) && rval;
+	{
+	  pkgCache::VerIterator testver;
 
+	  if(action==cmdline_install || action==cmdline_hold ||
+	     action==cmdline_forbid_version)
+	    testver=(*apt_cache_file)[pkg].CandidateVerIter(*apt_cache_file);
+	  else if(actions==cmdline_remove || action==cmdline_purge)
+	    testver=pkg.CurrentVer();
+	  else
+	    testver=(*apt_cache_file)[pkg].InstVerIter(*apt_cache_file);
+
+	  if(m->matches(pkg, testver))
+	    rval=cmdline_applyaction(action, fixer, pkg,
+				     to_install, to_hold, to_remove, to_purge,
+				     verbose, source,
+				     sourcestr) && rval;
+	}
+
       delete m;
     }
 

Reply to: