Просмотр исходного кода

handle multiple --{tar,diff,dsc}-only options correctly

David Kalnischkies лет назад: 16
Родитель
Сommit
8545b536e3
2 измененных файлов с 19 добавлено и 14 удалено
  1. 18 14
      cmdline/apt-get.cc
  2. 1 0
      debian/changelog

+ 18 - 14
cmdline/apt-get.cc

@@ -2271,6 +2271,14 @@ bool DoSource(CommandLine &CmdL)
    // insert all downloaded uris into this set to avoid downloading them
    // twice
    set<string> queued;
+
+   // Diff only mode only fetches .diff files
+   bool const diffOnly = _config->FindB("APT::Get::Diff-Only", false);
+   // Tar only mode only fetches .tar files
+   bool const tarOnly = _config->FindB("APT::Get::Tar-Only", false);
+   // Dsc only mode only fetches .dsc files
+   bool const dscOnly = _config->FindB("APT::Get::Dsc-Only", false);
+
    // Load the requestd sources into the fetcher
    unsigned J = 0;
    for (const char **I = CmdL.FileList + 1; *I != 0; I++, J++)
@@ -2297,21 +2305,17 @@ bool DoSource(CommandLine &CmdL)
 	    Dsc[J].Version = Last->Version();
 	    Dsc[J].Dsc = flNotDir(I->Path);
 	 }
-	 
-	 // Diff only mode only fetches .diff files
-	 if (_config->FindB("APT::Get::Diff-Only",false) == true &&
-	     I->Type != "diff")
-	    continue;
-	 
-	 // Tar only mode only fetches .tar files
-	 if (_config->FindB("APT::Get::Tar-Only",false) == true &&
-	     I->Type != "tar")
-	    continue;
 
-	 // Dsc only mode only fetches .dsc files
-	 if (_config->FindB("APT::Get::Dsc-Only",false) == true &&
-	     I->Type != "dsc")
-	    continue;
+	 // Handle the only options so that multiple can be used at once
+	 if (diffOnly == true || tarOnly == true || dscOnly == true)
+	 {
+	    if ((diffOnly == true && I->Type == "diff") ||
+	        (tarOnly == true && I->Type == "tar") ||
+	        (dscOnly == true && I->Type == "dsc"))
+		; // Fine, we want this file downloaded
+	    else
+	       continue;
+	 }
 
 	 // don't download the same uri twice (should this be moved to
 	 // the fetcher interface itself?)

+ 1 - 0
debian/changelog

@@ -4,6 +4,7 @@ apt (0.7.26~exp5) UNRELEASED; urgency=low
   * cmdline/apt-get.cc:
     - rerun dpkg-source in source if --fix-broken is given (Closes: #576752)
     - don't suggest held packages as they are installed (Closes: #578135)
+    - handle multiple --{tar,diff,dsc}-only options correctly
   * cmdline/apt-cache.cc:
     - use GroupCount for package names in stats and add a package struct line
   * methods/rred.cc: