From 43817448cda55fff3bf40f20b847baa1eee92e43 Mon Sep 17 00:00:00 2001 From: Marek Blaha Date: Tue, 26 Nov 2024 08:23:17 +0100 Subject: [PATCH] reposync: Rename --source to --srpm To unify the DNF behavior across different commands use the same option to operate on source packages everywhere. --- .../dnf5/aliases.d/compatibility-reposync.conf | 5 +++++ dnf5-plugins/reposync_plugin/reposync.cpp | 18 +++++++++--------- doc/dnf5_plugins/reposync.8.rst | 2 +- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/dnf5-plugins/reposync_plugin/config/usr/share/dnf5/aliases.d/compatibility-reposync.conf b/dnf5-plugins/reposync_plugin/config/usr/share/dnf5/aliases.d/compatibility-reposync.conf index 4290867dc..9f7d3c85c 100644 --- a/dnf5-plugins/reposync_plugin/config/usr/share/dnf5/aliases.d/compatibility-reposync.conf +++ b/dnf5-plugins/reposync_plugin/config/usr/share/dnf5/aliases.d/compatibility-reposync.conf @@ -5,3 +5,8 @@ type = 'cloned_named_arg' long_name = 'download-path' short_name = 'p' source = 'reposync.destdir' + +['reposync.source'] +type = 'cloned_named_arg' +long_name = 'source' +source = 'reposync.srpm' diff --git a/dnf5-plugins/reposync_plugin/reposync.cpp b/dnf5-plugins/reposync_plugin/reposync.cpp index 05f2cdfbb..ff443b514 100644 --- a/dnf5-plugins/reposync_plugin/reposync.cpp +++ b/dnf5-plugins/reposync_plugin/reposync.cpp @@ -83,18 +83,18 @@ void ReposyncCommand::set_argument_parser() { }); cmd.register_named_arg(arch_arg); - auto * source_arg = parser.add_new_named_arg("source"); - source_arg->set_long_name("source"); - source_arg->set_description("Download source packages"); - source_arg->set_has_value(false); - source_arg->set_parse_hook_func([this]( - [[maybe_unused]] libdnf5::cli::ArgumentParser::NamedArg * arg, - [[maybe_unused]] const char * option, - [[maybe_unused]] const char * value) { + auto * srpm_arg = parser.add_new_named_arg("srpm"); + srpm_arg->set_long_name("srpm"); + srpm_arg->set_description("Download source packages"); + srpm_arg->set_has_value(false); + srpm_arg->set_parse_hook_func([this]( + [[maybe_unused]] libdnf5::cli::ArgumentParser::NamedArg * arg, + [[maybe_unused]] const char * option, + [[maybe_unused]] const char * value) { arch_option.emplace("src"); return true; }); - cmd.register_named_arg(source_arg); + cmd.register_named_arg(srpm_arg); newest_option = std::make_unique( *this, "newest-only", 'n', "Download only newest packages per-repo", false); diff --git a/doc/dnf5_plugins/reposync.8.rst b/doc/dnf5_plugins/reposync.8.rst index 2f292ac58..6270d881e 100644 --- a/doc/dnf5_plugins/reposync.8.rst +++ b/doc/dnf5_plugins/reposync.8.rst @@ -92,7 +92,7 @@ Options Caution: Any file under the ``safe-write-path`` can be overwritten. This option can only be used when syncing a single repository. -``--source`` +``--srpm`` Downloads source packages. Equivalent to using ``--arch=src``. ``--urls, -u``