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

Daniel Burrows dburrows at costa.debian.org
Mon Sep 26 21:06:15 UTC 2005


Author: dburrows
Date: Mon Sep 26 21:06:12 2005
New Revision: 4295

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/cmdline/cmdline_show.cc
Log:
Abort with an error if the user tries to show a nonexistant package.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Mon Sep 26 21:06:12 2005
@@ -1,5 +1,11 @@
 2005-09-26  Daniel Burrows  <dburrows at debian.org>
 
+	* src/cmdline/cmdline_show.cc:
+
+	  Abort with an error message if some of the packages the user
+	  tried to show don't exist, and return non-zero if errors were
+	  generated while showing packages.  (Closes: #301291)
+
 	* doc/en/aptitude.xml, doc/en/manpage.xml, src/generic/apt/apt.cc, src/main.cc:
 
 	  Change Aptitude::Cmdline::Simulate to Aptitude::Simulate; if it

Modified: branches/aptitude-0.3/aptitude/src/cmdline/cmdline_show.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/cmdline/cmdline_show.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/cmdline/cmdline_show.cc	Mon Sep 26 21:06:12 2005
@@ -369,7 +369,15 @@
   pkgCache::PkgIterator pkg;
 
   if(!is_pattern)
-    pkg=(*apt_cache_file)->FindPkg(s);
+    {
+      pkg=(*apt_cache_file)->FindPkg(s);
+
+      if(pkg.end())
+	{
+	  _error->Error(_("Unable to locate package %s"), s.c_str());
+	  return true;
+	}
+    }
   if(!is_pattern && !pkg.end())
     {
       if(!pkg.VersionList().end())
@@ -388,8 +396,7 @@
 
       if(!m)
 	{
-	  _error->Error("Unable to parse pattern %s", s.c_str());
-	  _error->DumpErrors();
+	  _error->Error(_("Unable to parse pattern %s"), s.c_str());
 	  return false;
 	}
 
@@ -429,7 +436,16 @@
 
   for(int i=1; i<argc; ++i)
     if(!do_cmdline_show(argv[i], verbose))
+      {
+	_error->DumpErrors();
+	return -1;
+      }
+
+  if(_error->PendingError())
+    {
+      _error->DumpErrors();
       return -1;
+    }
 
   return 0;
 }



More information about the Aptitude-svn-commit mailing list