Skip to content

Commit

Permalink
Consistently use "removing" instead of "erasing" packages
Browse files Browse the repository at this point in the history
A Fedora user noticed that an output of "dnf remove" command marks
transaction actions as "Erasing" instead of "Removing"
<https://lists.fedoraproject.org/archives/list/[email protected]/thread/GL3RTOI5FUSZUQU3L2PVY2U5LQDB5BDI/>:

    # dnf remove dontpanic
    Package                          Arch      Version                          Repository             Size
    Removing:
     dontpanic                       x86_64    1.02-16.fc41                     f42-build          49.5 KiB

    Transaction Summary:
     Removing:           1 package

    Is this ok [y/N]: y

    Running transaction
    [1/2] Prepare transaction                                      100% |  15.0   B/s |   1.0   B |  00m00s
    [2/2] Erasing dontpanic-0:1.02-16.fc41.x8 100% [==================] | 225.0   B/s |  13.0   B | -00m00s
    >>> Running trigger-post-uninstall scriptlet: glibc-common-0:2.40.9000-1.fc42.x86_64warning: posix.fork(): .fork(), .exec(), .wait() and .redirect2null() are deprecated, use rpm.spawn() or rpm.execute() instead
    warning: posix.wait(): .fork(), .exec(), .wait() and .redirect2null() are deprecated, use rpm.spawn() or rpm.execute() instead
    warning: posix.exec(): .fork(), .exec(), .wait() and .redirect2null() are deprecated, use rpm.spawn() o[2/2] Erasing dontpanic-0:1.02-16.fc41.x86_64                  100% |  50.0   B/s |  13.0   B |  00m00s
    Complete!

That's not only inconsistent with other "Removing:" and "Removed:" titles, it
also promotes "erase" word and people try running "dnf erase" which is an old
alias never implemented in DNF5.

This patch changes "erase" to "remove" everywhere in the output, a documentation, and
code comments where appropriate.
  • Loading branch information
ppisar authored and kontura committed Sep 27, 2024
1 parent f27f1d4 commit ce289e9
Show file tree
Hide file tree
Showing 16 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void TransactionCallbacksSimple::install_start(
void TransactionCallbacksSimple::uninstall_start(
const libdnf5::base::TransactionPackage & item, [[maybe_unused]] uint64_t total) {
if (item.get_action() == libdnf5::transaction::TransactionItemAction::REMOVE) {
output_stream << " Erasing ";
output_stream << " Removing ";
} else {
output_stream << " Cleanup ";
}
Expand Down
2 changes: 1 addition & 1 deletion dnf5/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ void RpmTransCB::uninstall_start(const libdnf5::base::TransactionPackage & item,
const char * msg{nullptr};
if (item.get_action() == libdnf5::transaction::TransactionItemAction::REMOVE ||
item.get_action() == libdnf5::transaction::TransactionItemAction::REPLACED) {
msg = _("Erasing {}");
msg = _("Removing {}");
}
if (!msg) {
msg = _("Cleanup {}");
Expand Down
2 changes: 1 addition & 1 deletion dnf5/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@ static void print_resolve_hints(dnf5::Context & context) {
const std::string_view arg{"--allowerasing"};
if (has_named_arg(command, arg.substr(2))) {
hints.emplace_back(
libdnf5::utils::sformat(_("{} to allow erasing of installed packages to resolve problems"), arg));
libdnf5::utils::sformat(_("{} to allow removing of installed packages to resolve problems"), arg));
}
}

Expand Down
2 changes: 1 addition & 1 deletion dnf5/shared_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
namespace dnf5 {

AllowErasingOption::AllowErasingOption(libdnf5::cli::session::Command & command)
: BoolOption(command, "allowerasing", '\0', _("Allow erasing of installed packages to resolve problems"), false) {}
: BoolOption(command, "allowerasing", '\0', _("Allow removing of installed packages to resolve problems"), false) {}

AllowErasingOption::~AllowErasingOption() = default;

Expand Down
2 changes: 1 addition & 1 deletion dnf5daemon-client/callbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ void TransactionCB::action_start(sdbus::Signal & signal) {
msg = "Installing";
break;
case dnfdaemon::RpmTransactionItemActions::ERASE:
msg = "Erasing";
msg = "Removing";
break;
case dnfdaemon::RpmTransactionItemActions::DOWNGRADE:
msg = "Downgrading";
Expand Down
2 changes: 1 addition & 1 deletion doc/commands/debuginfo-install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Options
=======

``--allowerasing``
| Allow erasing of installed packages to resolve any potential dependency problems.
| Allow removing of installed packages to resolve any potential dependency problems.
``--skip-broken``
| Resolve any dependency problems by removing packages that are causing problems from the transaction.
Expand Down
2 changes: 1 addition & 1 deletion doc/commands/distro-sync.8.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Options
=======

``--allowerasing``
| Allow erasing of installed packages to resolve any potential dependency problems.
| Allow removing of installed packages to resolve any potential dependency problems.
``--skip-broken``
| Resolve any dependency problems by removing packages that are causing problems from the transaction.
Expand Down
4 changes: 2 additions & 2 deletions doc/commands/downgrade.8.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Options
=======

``--allowerasing``
| Allow erasing of installed packages to resolve any potential dependency problems.
| Allow removing of installed packages to resolve any potential dependency problems.
``--skip-broken``
| Resolve any dependency problems by removing packages that are causing problems from the transaction.
Expand Down Expand Up @@ -68,7 +68,7 @@ Examples
| Downgrade the ``nano`` package to the given version.
``dnf5 downgrade gcc glibc --allowerasing``
| Downgrade ``gcc``, ``glibc`` packages and allow erasing of installed packages when needed.
| Downgrade ``gcc``, ``glibc`` packages and allow removing of installed packages when needed.

See Also
Expand Down
2 changes: 1 addition & 1 deletion doc/commands/group.8.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Options for ``install``, ``remove`` and ``upgrade``
| Used with ``install`` and ``remove`` commands.
``--allowerasing``
| Allow erasing of installed packages to resolve any potential dependency problems.
| Allow removing of installed packages to resolve any potential dependency problems.
| Used with ``install`` and ``upgrade`` commands.
``--skip-broken``
Expand Down
2 changes: 1 addition & 1 deletion doc/commands/install.8.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Options
=======

``--allowerasing``
| Allow erasing of installed packages to resolve any potential dependency problems.
| Allow removing of installed packages to resolve any potential dependency problems.
``--skip-broken``
| Resolve any dependency problems by removing packages that are causing problems from the transaction.
Expand Down
2 changes: 1 addition & 1 deletion doc/commands/reinstall.8.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Options
=======

``--allowerasing``
| Allow erasing of installed packages to resolve any potential dependency problems.
| Allow removing of installed packages to resolve any potential dependency problems.
``--skip-broken``
| Resolve any dependency problems by removing packages that are causing problems from the transaction.
Expand Down
2 changes: 1 addition & 1 deletion doc/commands/swap.8.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Options
=======

``--allowerasing``
| Allow erasing of installed packages to resolve any potential dependency problems.
| Allow removing of installed packages to resolve any potential dependency problems.
``--offline``
| Store the transaction to be performed offline. See :manpage:`dnf5-offline(8)`, :ref:`Offline command <offline_command_ref-label>`.
Expand Down
2 changes: 1 addition & 1 deletion doc/commands/upgrade.8.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Options
| that fix advisories matching selected advisory properties
``--allowerasing``
| Allow erasing of installed packages to resolve any potential dependency problems.
| Allow removing of installed packages to resolve any potential dependency problems.
``--skip-unavailable``
| Allow skipping packages that are not possible to upgrade. All remaining packages will be upgraded.
Expand Down
2 changes: 1 addition & 1 deletion doc/dnf5_plugins/builddep.8.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Options
| Enable or disable conditional build OPTION when parsing spec files. Does not apply for source rpm files.
``--allowerasing``
| Allow erasing of installed packages to resolve any potential dependency problems.
| Allow removing of installed packages to resolve any potential dependency problems.
``--skip-unavailable``
| Allow skipping packages that are not possible to downgrade. All remaining packages will be downgraded.
Expand Down
4 changes: 2 additions & 2 deletions libdnf5/rpm/solv/goal_private.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void construct_job(
void init_solver(libdnf5::solv::Pool & pool, libdnf5::solv::Solver & solver) {
solver.init(pool);

/* don't erase packages that are no longer in repo during distupgrade */
/* don't remove packages that are no longer in repo during distupgrade */
solver.set_flag(SOLVER_FLAG_KEEP_ORPHANS, 1);
/* no arch change for forcebest */
solver.set_flag(SOLVER_FLAG_BEST_OBEY_POLICY, 1);
Expand Down Expand Up @@ -424,7 +424,7 @@ libdnf5::GoalProblem GoalPrivate::resolve() {

// either allow solutions callback or installonlies, both at the same time are not supported
if (limit_installonly_packages(job, protected_running_kernel.id)) {
// allow erasing non-installonly packages that depend on a kernel about to be erased
// allow removing non-installonly packages that depend on a kernel about to be removed
allow_uninstall_all_but_protected(*pool, job, protected_packages.get(), protected_running_kernel);
if (libsolv_solver.solve(job)) {
return libdnf5::GoalProblem::SOLVER_ERROR;
Expand Down
8 changes: 4 additions & 4 deletions libdnf5/rpm/transaction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ class Transaction {
CallbacksHolder callbacks_holder{nullptr, this, nullptr};
FD_t fd_in_cb{nullptr}; // file descriptor used by transaction in callback (install/reinstall package)

base::TransactionPackage * last_added_item{nullptr}; // item added by last install/reinstall/erase/...
base::TransactionPackage * last_added_item{nullptr}; // item added by last install/reinstall/remove/...
bool last_item_added_ts_element{false}; // Did the last item add the element ts?

std::map<unsigned int, rpmte> implicit_ts_elements; // elements added to the librpm transaction by librpm itself
Expand Down Expand Up @@ -385,14 +385,14 @@ class Transaction {
/// @param item item to be reinstalled
void reinstall(base::TransactionPackage & item);

/// Add package to be erased to transaction set.
/// Add package to be removed to transaction set.
/// @param item item to be erased
void erase(base::TransactionPackage & item);

/// Add package to be installed to transaction set.
/// The transaction set is checked for duplicate package names.
/// If found, the package with the "newest" EVR will be replaced.
/// @param item item to be erased
/// @param item item to be removed
/// @param action one of TransactionItemAction::UPGRADE,
/// TransactionItemAction::DOWNGRADE, TransactionItemAction::INSTALL
void install_up_down(base::TransactionPackage & item, libdnf5::transaction::TransactionItemAction action);
Expand All @@ -401,7 +401,7 @@ class Transaction {

/// Function triggered by rpmtsNotifyChange()
///
/// On explicit install/erase add events, "other" is NULL, on implicit
/// On explicit install/remove add events, "other" is NULL, on implicit
/// add events (erasures due to obsolete/upgrade/reinstall, replaced by newer)
/// it points to the replacing package.
///
Expand Down

0 comments on commit ce289e9

Please sign in to comment.