dnf5: Support --installed-from-repo= for upgrade/downgrade/distro-sync
This commit is contained in:
parent
6aae040dd8
commit
6d7a798446
|
@ -55,6 +55,7 @@ void DistroSyncCommand::set_argument_parser() {
|
|||
allow_erasing = std::make_unique<AllowErasingOption>(*this);
|
||||
auto skip_broken = std::make_unique<SkipBrokenOption>(*this);
|
||||
auto skip_unavailable = std::make_unique<SkipUnavailableOption>(*this);
|
||||
create_installed_from_repo_option(*this, installed_from_repos, true);
|
||||
create_from_repo_option(*this, from_repos, true);
|
||||
create_downloadonly_option(*this);
|
||||
create_offline_option(*this);
|
||||
|
@ -71,6 +72,7 @@ void DistroSyncCommand::run() {
|
|||
auto goal = get_context().get_goal();
|
||||
goal->set_allow_erasing(allow_erasing->get_value());
|
||||
auto settings = libdnf5::GoalJobSettings();
|
||||
settings.set_from_repo_ids(installed_from_repos);
|
||||
if (patterns_to_distro_sync_options->empty()) {
|
||||
goal->add_rpm_distro_sync(settings);
|
||||
} else {
|
||||
|
|
|
@ -43,6 +43,7 @@ public:
|
|||
std::vector<std::unique_ptr<libdnf5::Option>> * patterns_to_distro_sync_options{nullptr};
|
||||
|
||||
std::unique_ptr<AllowErasingOption> allow_erasing;
|
||||
std::vector<std::string> installed_from_repos;
|
||||
std::vector<std::string> from_repos;
|
||||
};
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ void DowngradeCommand::set_argument_parser() {
|
|||
auto skip_broken = std::make_unique<SkipBrokenOption>(*this);
|
||||
auto skip_unavailable = std::make_unique<SkipUnavailableOption>(*this);
|
||||
create_allow_downgrade_options(*this);
|
||||
create_installed_from_repo_option(*this, installed_from_repos, true);
|
||||
create_from_repo_option(*this, from_repos, true);
|
||||
create_downloadonly_option(*this);
|
||||
create_offline_option(*this);
|
||||
|
@ -74,6 +75,7 @@ void DowngradeCommand::run() {
|
|||
auto goal = get_context().get_goal();
|
||||
goal->set_allow_erasing(allow_erasing->get_value());
|
||||
auto settings = libdnf5::GoalJobSettings();
|
||||
settings.set_from_repo_ids(installed_from_repos);
|
||||
settings.set_to_repo_ids(from_repos);
|
||||
for (const auto & spec : pkg_specs) {
|
||||
goal->add_downgrade(spec, settings);
|
||||
|
|
|
@ -42,6 +42,7 @@ public:
|
|||
private:
|
||||
std::vector<std::string> pkg_specs;
|
||||
std::unique_ptr<AllowErasingOption> allow_erasing;
|
||||
std::vector<std::string> installed_from_repos;
|
||||
std::vector<std::string> from_repos;
|
||||
};
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@ void UpgradeCommand::set_argument_parser() {
|
|||
allow_erasing = std::make_unique<AllowErasingOption>(*this);
|
||||
auto skip_unavailable = std::make_unique<SkipUnavailableOption>(*this);
|
||||
create_allow_downgrade_options(*this);
|
||||
create_installed_from_repo_option(*this, installed_from_repos, true);
|
||||
create_from_repo_option(*this, from_repos, true);
|
||||
create_destdir_option(*this);
|
||||
create_downloadonly_option(*this);
|
||||
|
@ -126,6 +127,7 @@ void UpgradeCommand::run() {
|
|||
}
|
||||
}
|
||||
|
||||
settings.set_from_repo_ids(installed_from_repos);
|
||||
|
||||
auto advisories = advisory_query_from_cli_input(
|
||||
ctx.get_base(),
|
||||
|
|
|
@ -45,6 +45,7 @@ protected:
|
|||
|
||||
std::unique_ptr<AllowErasingOption> allow_erasing;
|
||||
|
||||
std::vector<std::string> installed_from_repos;
|
||||
std::vector<std::string> from_repos;
|
||||
|
||||
std::unique_ptr<AdvisoryOption> advisory_name;
|
||||
|
|
|
@ -50,6 +50,8 @@ Options
|
|||
``--skip-unavailable``
|
||||
| Allow skipping packages that are not possible to synchronize. All remaining packages will be synchronized.
|
||||
|
||||
.. include:: ../_shared/options/installed-from-repo.rst
|
||||
|
||||
.. include:: ../_shared/options/from-repo.rst
|
||||
|
||||
``--downloadonly``
|
||||
|
|
|
@ -54,6 +54,8 @@ Options
|
|||
``--no-allow-downgrade``
|
||||
| Disable downgrade of dependencies when resolving the requested operation.
|
||||
|
||||
.. include:: ../_shared/options/installed-from-repo.rst
|
||||
|
||||
.. include:: ../_shared/options/from-repo.rst
|
||||
|
||||
``--downloadonly``
|
||||
|
|
|
@ -64,6 +64,8 @@ Options
|
|||
| Set directory used for downloading packages to. Default location is to the current working directory.
|
||||
| Automatically sets the ``downloadonly`` option.
|
||||
|
||||
.. include:: ../_shared/options/installed-from-repo.rst
|
||||
|
||||
.. include:: ../_shared/options/from-repo.rst
|
||||
|
||||
``--downloadonly``
|
||||
|
|
Loading…
Reference in New Issue