diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2010-05-14 12:12:23 +0200 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2010-05-14 12:12:23 +0200 |
commit | 8545b536e3459a06fa007e2c307a77188e5de4b1 (patch) | |
tree | df57c13d1befae5c25d257455abf9f16e27d858a /cmdline | |
parent | 10df254bd756cea401e2564d465bbb4a99ee8e9e (diff) |
handle multiple --{tar,diff,dsc}-only options correctly
Diffstat (limited to 'cmdline')
-rw-r--r-- | cmdline/apt-get.cc | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 00da0855f..dd5ef1743 100644 --- a/cmdline/apt-get.cc +++ b/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?) |