Skip to content

Commit

Permalink
reposync: Rename --source to --srpm
Browse files Browse the repository at this point in the history
To unify the DNF behavior across different commands use the same option
to operate on source packages everywhere.
  • Loading branch information
m-blaha committed Nov 26, 2024
1 parent 51ef27b commit 4381744
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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'
18 changes: 9 additions & 9 deletions dnf5-plugins/reposync_plugin/reposync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<libdnf5::cli::session::BoolOption>(
*this, "newest-only", 'n', "Download only newest packages per-repo", false);
Expand Down
2 changes: 1 addition & 1 deletion doc/dnf5_plugins/reposync.8.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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``
Expand Down

0 comments on commit 4381744

Please sign in to comment.