Bladeren bron

* Have apt-cache show exit with an error if it cannot f...
Author: mdz
Date: 2003-07-22 03:10:01 GMT
* Have apt-cache show exit with an error if it cannot find any of the
specified packages (Closes: #101490)

Arch Librarian 22 jaren geleden
bovenliggende
commit
9d366c89f1
2 gewijzigde bestanden met toevoegingen van 11 en 2 verwijderingen
  1. 9 2
      cmdline/apt-cache.cc
  2. 2 0
      debian/changelog

+ 9 - 2
cmdline/apt-cache.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // Description								/*{{{*/
-// $Id: apt-cache.cc,v 1.64 2003/05/15 09:39:38 piefel Exp $
+// $Id: apt-cache.cc,v 1.65 2003/07/22 03:10:01 mdz Exp $
 /* ######################################################################
 /* ######################################################################
    
    
    apt-cache - Manages the cache files
    apt-cache - Manages the cache files
@@ -1344,6 +1344,8 @@ bool ShowPackage(CommandLine &CmdL)
 {   
 {   
    pkgCache &Cache = *GCache;
    pkgCache &Cache = *GCache;
    pkgDepCache::Policy Plcy;
    pkgDepCache::Policy Plcy;
+
+   unsigned found = 0;
    
    
    for (const char **I = CmdL.FileList + 1; *I != 0; I++)
    for (const char **I = CmdL.FileList + 1; *I != 0; I++)
    {
    {
@@ -1354,6 +1356,8 @@ bool ShowPackage(CommandLine &CmdL)
 	 continue;
 	 continue;
       }
       }
 
 
+      ++found;
+
       // Find the proper version to use.
       // Find the proper version to use.
       if (_config->FindB("APT::Cache::AllVersions","true") == true)
       if (_config->FindB("APT::Cache::AllVersions","true") == true)
       {
       {
@@ -1373,7 +1377,10 @@ bool ShowPackage(CommandLine &CmdL)
 	    return false;
 	    return false;
       }      
       }      
    }
    }
-   return true;
+
+   if (found > 0)
+        return true;
+   return _error->Error(_("No packages found"));
 }
 }
 									/*}}}*/
 									/*}}}*/
 // ShowPkgNames - Show package names					/*{{{*/
 // ShowPkgNames - Show package names					/*{{{*/

+ 2 - 0
debian/changelog

@@ -6,6 +6,8 @@ apt (0.5.7) unstable; urgency=low
     archives and not changing the system (Closes: #190862)
     archives and not changing the system (Closes: #190862)
   * Skip version check if a build-dependency is provided by an installed package
   * Skip version check if a build-dependency is provided by an installed package
     (Closes: #126938)
     (Closes: #126938)
+  * Have apt-cache show exit with an error if it cannot find any of the
+    specified packages (Closes: #101490)
 
 
  --
  --