handle multiple --{tar,diff,dsc}-only options correctly
authorDavid Kalnischkies <kalnischkies@gmail.com>
Fri, 14 May 2010 10:12:23 +0000 (12:12 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Fri, 14 May 2010 10:12:23 +0000 (12:12 +0200)
cmdline/apt-get.cc
debian/changelog

index 00da085..dd5ef17 100644 (file)
@@ -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?)
index 2ad9fbd..cb0bd6a 100644 (file)
@@ -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: