Open FrostyX opened 2 years ago
Maybe we could go through all package managers that Tracer can work with and see if they are available on the system.
That's not necessarily the best idea. I've had problems with other tools that do that, because apt
is installed on my Fedora system. It's not the system package manager, but it's there and available. Too many tools see that, and jump right to the conclusion that it's a Debian-derived install when in reality nothing could be further from the truth. A certain package manager merely being available says... well, exactly nothing, honestly.
A better test might be to find some way to query what backend PackageKit is using on the host, which should be representative of the system package manager.
Thank you for the insight @ferdnyc, I didn't think of that.
@FrostyX Yeah, I don't think I would have either, if I hadn't been bitten by it enough times. 🫤
Currently, we have a hardcoded dictionary in
System.package_manager
saying what package managers should be used on what distributions. I think this is no longer a good enough solution.Maybe we could go through all package managers that Tracer can work with and see if they are available on the system. Each implementation of
IPackageManager
could provideis_available
method running whatever check is necessary to decide whether such package manager is available on the system. If no package manager is found, we will raise an exception.We should also do something like this for
if System.distribution() in ["rhel", "fedora", "centos", "centos-7", "mageia", "suse", "ol"]:
conditions.