소스 검색

cmdline/apt-cache.cc: Change behavior of showsrc to match the one of show (Closes: #512046).

Julian Andres Klode 16 년 전
부모
커밋
0458a81120
2개의 변경된 파일16개의 추가작업 그리고 3개의 파일을 삭제
  1. 14 3
      cmdline/apt-cache.cc
  2. 2 0
      debian/changelog

+ 14 - 3
cmdline/apt-cache.cc

@@ -1498,15 +1498,26 @@ bool ShowSrcPackage(CommandLine &CmdL)
    if (_error->PendingError() == true)
       return false;
 
+   unsigned found = 0;
    for (const char **I = CmdL.FileList + 1; *I != 0; I++)
    {
       SrcRecs.Restart();
       
       pkgSrcRecords::Parser *Parse;
-      while ((Parse = SrcRecs.Find(*I,false)) != 0)
-	 cout << Parse->AsStr() << endl;;
+      unsigned found_this = 0;
+      while ((Parse = SrcRecs.Find(*I,false)) != 0) {
+        cout << Parse->AsStr() << endl;;
+        found++;
+        found_this++;
+      }
+      if (found_this == 0) {
+        _error->Warning(_("Unable to locate package %s"),*I);
+        continue;
+      }
    }      
-   return true;
+   if (found > 0)
+        return true;
+   return _error->Error(_("No packages found"));
 }
 									/*}}}*/
 // Policy - Show the results of the preferences file			/*{{{*/

+ 2 - 0
debian/changelog

@@ -9,6 +9,8 @@ apt (0.7.26~exp3) UNRELEASED; urgency=low
     that package that was providing some manpages for APT utilities.
 
   [ Julian Andres Klode ]
+  * cmdline/apt-cache.cc:
+    - Change behavior of showsrc to match the one of show (Closes: #512046).
   * cmdline/apt-key:
     - Honor Apt::GPGV::TrustedKeyring (Closes: #316390)
   * cmdline/apt-mark: