libdnf icon indicating copy to clipboard operation
libdnf copied to clipboard

[dnf5] Get dnf closer to zypper by adding command aliases

Open dmach opened this issue 2 years ago • 15 comments

We're adding aliases only to the most commonly used commands. They may be appreciated by the dnf users as well, because they provide shortcuts to the commonly used commands.

TODO:

  • [ ] Make the aliases work (requires changes in argument parser)
  • [ ] Consider renaming distro-sync to dist-upgrade (apt-get, zypper has it), make distro-sync a compat alias

dmach avatar Jun 27 '22 10:06 dmach

Can we have the aliases synced from dnf4 in here? I think that'd be more useful than just the zypper ones.

Conan-Kudo avatar Jun 27 '22 15:06 Conan-Kudo

I'd rather not rename distro-sync since it's a more accurate name than dist-upgrade. And dist-upgrade does different things in apt and zypper, so I'd rather not make people think it's the same.

Conan-Kudo avatar Jun 27 '22 15:06 Conan-Kudo

I am really sorry, but I am not in favor to add more hard coded aliases. Each distribution or each group of users has some preferences and in long term the list is only growing. Also more aliases creates a confusion on user side (I got that imperession from bugzilla reports). On the other side we have a plan to support better handling of configurable aliases by distribution like alias plugin provided. The aliases can be stored in a human readable format therefore maintaining will be easier.

j-mracek avatar Jun 29 '22 04:06 j-mracek

I am really sorry, but I am not in favor to add more hard coded aliases. Each distribution or each group of users has some preferences and in long term the list is only growing. Also more aliases creates a confusion on user side (I got that imperession from bugzilla reports). On the other side we have a plan to support better handling of configurable aliases by distribution like alias plugin provided. The aliases can be stored in a human readable format therefore maintaining will be easier.

Do you plan to introduce the alias plugin any time soon? If there's no such plan, how about to wrap these aliases in #ifdef DNF5_SUSE_ALIASES or something similar?

dmach avatar Jun 29 '22 19:06 dmach

Do you plan to introduce the alias plugin any time soon? If there's no such plan, how about to wrap these aliases in #ifdef DNF5_SUSE_ALIASES or something similar?

What for? Do you actually really need them at this stage?

lukash avatar Jun 30 '22 13:06 lukash

We do need aliases, yes. We're considering DNF 5 for openSUSE ALP, which is in active development right now, slated for GA release late next year.

Conan-Kudo avatar Jun 30 '22 13:06 Conan-Kudo

First lets don't call them aliases but let say abbreviations. In general we want DNF 5 have less clutter and less commands aliases in general. On the other side abbreviations are not a bad idea, but we should not have more then 1 per normal command (i. e. remove -> rm), then it just bring more hard coded clutter into the code base.

Wrt the alias plugin, i am not really a fan. Not really seeing real value here (as a Product Owner ;)). As for whom is this really useful. No admin in they right mind will ever configure their own aliases for commands (ofc you can do that, but if you really want that you can just do it in other ways). Imagine that you are installing RHEL for 100ths or 1000ds of machines at the same time, you will never bother to do this alias configuration. Ofc there maybe other uses, but there are more important things to be done in DNF 5 then an alias plugin.

mcurlej avatar Jun 30 '22 15:06 mcurlej

First lets don't call them aliases but let say abbreviations...

Not sure you're entirely on the same page with us, the PR is not about abbreviation aliases, it's about compatibility aliases with zypper, that is to make dnf have the same command names as zypper does.

lukash avatar Jul 01 '22 11:07 lukash

We do need aliases, yes. We're considering DNF 5 for openSUSE ALP, which is in active development right now, slated for GA release late next year.

Is it an official requirement that dnf has the same command names as zypper for that? The rest of the CLI interface will still be different, so the command names are really just a tip of the iceberg. One could even think it'd be better to keep the command names the same, as it will just bring more confusion with tutorials around the net having different dnf commands depending on which distro the author is running and their personal preference / habit. I would say for this sole reason it would be better to just not have the aliases.

Note the most important command names are the same (install, remove, upgrade, repoquery, ...). The differences aren't that many.

lukash avatar Jul 01 '22 11:07 lukash

First lets don't call them aliases but let say abbreviations...

Not sure you're entirely on the same page with us, the PR is not about abbreviation aliases, it's about compatibility aliases with zypper, that is to make dnf have the same command names as zypper does.

It's about both: It adds abbreviations to the selected commands. The abbreviations come from zypper (why would I create my own if I can I use something existing?) Full compatibility layer with zypper is not the goal. Reasonable compatibility with zypper's most used commands is goal. If you find it too SUSE specific, I'll be happy with the #ifdef so I can enable it where I need to.

I believe even existing dnf users would benefit from this change too. Yes, we do have bash completion, but it is not always available (e.g. various minimalistic environments such as containers). And typing dnf in/rm/up is quite addictive, trust me :)

dmach avatar Jul 04 '22 07:07 dmach

If you find it too SUSE specific, I'll be happy with the #ifdef so I can enable it where I need to.

Tbh. I find this the worst solution. With that, some dnf5 builds will have the aliases and some won't, increasing the variance and confusion of users. Imagine an internet howto about some dnf operation, a user will follow it and wonder why it gives them "command not found" errors. Only to find out hanlf an hour later the author was running SUSE and they're on Fedora.

Imagine someone writing a script for SUSE that won't work on a Fedora just because it has used an alias.

I don't find this a good case for an #ifdef and I'm against it. IMO SUSE should have the same command names Fedora dnf has.

I think the abbreviations are the only aliases where a case can be made for them being generally useful and I'd be willing to discuss hardcoded support for those. An alternative for them would be a special config (distributed in an extra rpm package or bundled, depending on distro decision I guess) once we have that supported. But having them in a config which is distributed in rpms brings the ambiguity described above again.

lukash avatar Jul 11 '22 08:07 lukash

Any update on this? Is there any chance to get this merged (as it is or after some modifications)? If not, could you prioritize writing support for aliases? It is a problem for nearly anyone who would use dnf5 instead of zypper on openSUSE.

dmach avatar Aug 08 '22 09:08 dmach

Thank you Dan for highlighting the issue related to aliases. We will prioritize the plugin. It means we will provide a solution without hard coded aliases in the code.

j-mracek avatar Aug 10 '22 06:08 j-mracek

I don't want to add any aliases to the source code. And I want to remove already existing aliases. From my point of view, aliases in source code are only a temporary solution until support for aliases defined using configuration files is ready.

I started writing support for defining aliases using configuration files: PR https://github.com/rpm-software-management/dnf5/pull/19 .

jrohel avatar Aug 27 '22 07:08 jrohel

Update: All aliases were removed from the source code. https://github.com/rpm-software-management/dnf5/pull/19 https://github.com/rpm-software-management/dnf5/pull/41

Aliases are now defined in configuration file. A distribution can add its own aliases. Be aware many aliases can confuse users.

jrohel avatar Sep 22 '22 12:09 jrohel

I'm closing DNF 5 related pull requests here because DNF 5 is now developed at https://github.com/rpm-software-management/dnf5

If your changes are still relevant there, please submit them there.

Conan-Kudo avatar Sep 08 '23 14:09 Conan-Kudo