dnf5: distro-sync: Argument "--from-repo"
The `--from-repo` argument allows the user to run distro-sync on packages in the specified repositories. However, any dependency resolution takes into account packages from all allowed repositories. Multiple repository ids can be specified, separated by commas, and globs can be used. Usage is similar to the `install` command.
This commit is contained in:
parent
54fabbcd4b
commit
cfe3c38801
|
@ -19,6 +19,8 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
|
|||
|
||||
#include "distro-sync.hpp"
|
||||
|
||||
#include "../from_repo.hpp"
|
||||
|
||||
#include <dnf5/shared_options.hpp>
|
||||
#include <libdnf5/conf/option_string.hpp>
|
||||
#include <libdnf5/utils/bgettext/bgettext-lib.h>
|
||||
|
@ -53,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_from_repo_option(*this, from_repos, true);
|
||||
create_downloadonly_option(*this);
|
||||
create_offline_option(*this);
|
||||
create_store_option(*this);
|
||||
|
@ -67,12 +70,14 @@ void DistroSyncCommand::configure() {
|
|||
void DistroSyncCommand::run() {
|
||||
auto goal = get_context().get_goal();
|
||||
goal->set_allow_erasing(allow_erasing->get_value());
|
||||
auto settings = libdnf5::GoalJobSettings();
|
||||
settings.set_to_repo_ids(from_repos);
|
||||
if (patterns_to_distro_sync_options->empty()) {
|
||||
goal->add_rpm_distro_sync();
|
||||
goal->add_rpm_distro_sync(settings);
|
||||
} else {
|
||||
for (auto & pattern : *patterns_to_distro_sync_options) {
|
||||
auto option = dynamic_cast<libdnf5::OptionString *>(pattern.get());
|
||||
goal->add_rpm_distro_sync(option->get_value());
|
||||
goal->add_rpm_distro_sync(option->get_value(), settings);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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> from_repos;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -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/from-repo.rst
|
||||
|
||||
``--downloadonly``
|
||||
| Download the resolved package set without executing an RPM transaction.
|
||||
|
||||
|
|
Loading…
Reference in New Issue