diff options
Diffstat (limited to 'apt-private/private-cmndline.cc')
-rw-r--r-- | apt-private/private-cmndline.cc | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/apt-private/private-cmndline.cc b/apt-private/private-cmndline.cc index d0cda08a6..de3992a00 100644 --- a/apt-private/private-cmndline.cc +++ b/apt-private/private-cmndline.cc @@ -220,6 +220,8 @@ static bool addArgumentsAPTGet(std::vector<CommandLine::Args> &Args, char const addArg('P', "build-profiles", "APT::Build-Profiles", CommandLine::HasArg); addArg(0, "purge", "APT::Get::Purge", 0); addArg(0, "solver", "APT::Solver", CommandLine::HasArg); + addArg(0,"arch-only","APT::Get::Arch-Only",0); + addArg(0,"indep-only","APT::Get::Indep-Only",0); // this has no effect *but* sbuild is using it (see LP: #1255806) // once sbuild is fixed, this option can be removed addArg('f', "fix-broken", "APT::Get::Fix-Broken", 0); @@ -270,7 +272,6 @@ static bool addArgumentsAPTGet(std::vector<CommandLine::Args> &Args, char const addArg(0,"trivial-only","APT::Get::Trivial-Only",0); addArg(0,"remove","APT::Get::Remove",0); addArg(0,"only-source","APT::Get::Only-Source",0); - addArg(0,"arch-only","APT::Get::Arch-Only",0); addArg(0,"allow-unauthenticated","APT::Get::AllowUnauthenticated",0); addArg(0,"allow-insecure-repositories","Acquire::AllowInsecureRepositories",0); addArg(0,"allow-weak-repositories","Acquire::AllowWeakRepositories",0); @@ -473,6 +474,16 @@ static void BinaryCommandSpecificConfiguration(char const * const Binary, char c std::string const binary = flNotDir(Binary); if (binary == "apt-get" && CmdMatches("update")) _config->CndSet("Binary::apt-get::Acquire::AllowInsecureRepositories", true); + if ((binary == "apt" || binary == "apt-get") && CmdMatches("upgrade", "dist-upgrade", "full-upgrade")) + { + //FIXME: the option is documented to apply only for install/remove, so + // we force it false for configuration files where users can be confused if + // we support it anyhow, but allow it on the commandline to take effect + // even through it isn't documented as a user who doesn't want it wouldn't + // ask for it + _config->Set("Binary::apt-get::APT::Get::AutomaticRemove", false); + _config->Set("Binary::apt::APT::Get::AutomaticRemove", false); + } } #undef CmdMatches /*}}}*/ @@ -500,9 +511,6 @@ std::vector<CommandLine::Dispatch> ParseCommandLine(CommandLine &CmdL, APT_CMD c for (auto const& cmd : CmdsWithHelp) Cmds.push_back({cmd.Match, cmd.Handler}); - // Args running out of scope invalidates the pointer stored in CmdL, - // but we don't use the pointer after this function, so we ignore - // this problem for now and figure something out if we have to. char const * CmdCalled = nullptr; if (Cmds.empty() == false && Cmds[0].Handler != nullptr) CmdCalled = CommandLine::GetCommand(Cmds.data(), argc, argv); @@ -510,6 +518,10 @@ std::vector<CommandLine::Dispatch> ParseCommandLine(CommandLine &CmdL, APT_CMD c BinaryCommandSpecificConfiguration(argv[0], CmdCalled); std::string const conf = "Binary::" + _config->Find("Binary"); _config->MoveSubTree(conf.c_str(), nullptr); + + // Args running out of scope invalidates the pointer stored in CmdL, + // but we don't use the pointer after this function, so we ignore + // this problem for now and figure something out if we have to. auto Args = getCommandArgs(Binary, CmdCalled); CmdL = CommandLine(Args.data(), _config); |