diff options
author | David Kalnischkies <david@kalnischkies.de> | 2020-11-07 21:23:57 +0100 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2020-11-07 21:48:21 +0100 |
commit | 9e1398b164f55238990907f63dfdef60588d9b24 (patch) | |
tree | 1d0976f1eea0c74711a60ed069c0232fbb55f284 /apt-private | |
parent | 645ad0c97334265bbfef82a4bdfdc8337cdd0630 (diff) |
Prepare rred binary for external usage
Merging patches is a bit of non-trivial code we have for client-side
work, but as we support also server-side merging we can export this
functionality so that server software can reuse it.
Note that this just cleans up and makes rred behave a bit more like all
our other binaries by supporting setting configuration at runtime and
supporting --help and --version. If you can make due without this, the
now advertised functionality is provided already in earlier versions.
Diffstat (limited to 'apt-private')
-rw-r--r-- | apt-private/private-cmndline.cc | 11 | ||||
-rw-r--r-- | apt-private/private-cmndline.h | 1 | ||||
-rw-r--r-- | apt-private/private-main.cc | 1 |
3 files changed, 12 insertions, 1 deletions
diff --git a/apt-private/private-cmndline.cc b/apt-private/private-cmndline.cc index bcafe785b..b6c5ca90a 100644 --- a/apt-private/private-cmndline.cc +++ b/apt-private/private-cmndline.cc @@ -362,6 +362,13 @@ static bool addArgumentsAPT(std::vector<CommandLine::Args> &Args, char const * c return true; } /*}}}*/ +static bool addArgumentsRred(std::vector<CommandLine::Args> &Args, char const * const /*Cmd*/)/*{{{*/ +{ + addArg('t', nullptr, "Rred::T", 0); + addArg('f', nullptr, "Rred::F", 0); + return true; +} + /*}}}*/ std::vector<CommandLine::Args> getCommandArgs(APT_CMD const Program, char const * const Cmd)/*{{{*/ { std::vector<CommandLine::Args> Args; @@ -384,6 +391,7 @@ std::vector<CommandLine::Args> getCommandArgs(APT_CMD const Program, char const case APT_CMD::APT_INTERNAL_SOLVER: addArgumentsAPTInternalSolver(Args, Cmd); break; case APT_CMD::APT_MARK: addArgumentsAPTMark(Args, Cmd); break; case APT_CMD::APT_SORTPKG: addArgumentsAPTSortPkgs(Args, Cmd); break; + case APT_CMD::RRED: addArgumentsRred(Args, Cmd); break; } // options without a command @@ -441,11 +449,12 @@ static bool ShowCommonHelp(APT_CMD const Binary, CommandLine &CmdL, std::vector< case APT_CMD::APT_INTERNAL_SOLVER: cmd = nullptr; break; case APT_CMD::APT_MARK: cmd = "apt-mark(8)"; break; case APT_CMD::APT_SORTPKG: cmd = "apt-sortpkgs(1)"; break; + case APT_CMD::RRED: cmd = nullptr; break; } if (cmd != nullptr) ioprintf(std::cout, _("See %s for more information about the available commands."), cmd); if (Binary != APT_CMD::APT_DUMP_SOLVER && Binary != APT_CMD::APT_INTERNAL_SOLVER && - Binary != APT_CMD::APT_INTERNAL_PLANNER) + Binary != APT_CMD::APT_INTERNAL_PLANNER && Binary != APT_CMD::RRED) std::cout << std::endl << _("Configuration options and syntax is detailed in apt.conf(5).\n" "Information about how to configure sources can be found in sources.list(5).\n" diff --git a/apt-private/private-cmndline.h b/apt-private/private-cmndline.h index 37fe2c91a..22e25d280 100644 --- a/apt-private/private-cmndline.h +++ b/apt-private/private-cmndline.h @@ -23,6 +23,7 @@ enum class APT_CMD { APT_SORTPKG, APT_DUMP_SOLVER, APT_INTERNAL_PLANNER, + RRED, }; struct aptDispatchWithHelp { diff --git a/apt-private/private-main.cc b/apt-private/private-main.cc index e9f65bd83..d4ce0ab2a 100644 --- a/apt-private/private-main.cc +++ b/apt-private/private-main.cc @@ -33,6 +33,7 @@ void InitLocale(APT_CMD const binary) /*{{{*/ case APT_CMD::APT_HELPER: case APT_CMD::APT_GET: case APT_CMD::APT_MARK: + case APT_CMD::RRED: textdomain("apt"); break; case APT_CMD::APT_EXTRACTTEMPLATES: |