-
Notifications
You must be signed in to change notification settings - Fork 48
Support for other package managers #50
Comments
While it would certainly be great if users of other distributions contributed how to get the number of installed packages on their systems, it'd be possible to take up the mantle yourself with Docker without polluting your system or bothering with full-fledged virtual machines.
And bam!, you're at a shell on a Fedora system. |
I went ahead and got a feel for what this looks like across the distroverse. Turns out it's an utter mess, but I do think the Alpine Linuxcount lines matching Arch Linux (and derivatives)count level-1 directories in Bedrock Linux(╯°□°)╯︵ ┻━┻ CRUXcount blank lines in Debian (and derivatives?)? Fedora
Gentoo Linuxcount level-2 directories in GoboLinuxcount level-1 directories in Slackwarecount level-1 files in Soluscount level-1 directories in Void Linuxcount |
I hate to say it, but it increasingly seems like shelling out might be the best option. It'd be a lot easier to support/ debug/ add to. The work to results ratio isn't good enough to right a unique method for each package manager. (especially regarding Fedora's case). Anything else will probably end up begin too complicated and much too error prone. In which case, adding support for other package managers is as simple as pillaging neofetch's source code 😏 |
Latest commit in the branch |
Hm... any reason not to do something like this? FILE *proc = popen("pacman -Qq | wc -l", "r");
fscanf(proc, "%d", &num_packages); I know it looks like we're basically just scripting at this point, but it's almost as fast as forking and definitely a lot cleaner. We could just have a map from distro -> command that contains what to run such that concatenating
We're essentially tripling our runtime either way, but I'd understand if you wanted to stay with the |
In the realm of shaving off milliseconds, I managed to cut off a couple by forking at the very start rather than when |
That's awesome that forking early saves as much time as it does; I think we should definitely go with that approach. Now it's just a matter of making We offload the distribution detection to the Makefile, since we can nice-and-neatly just source This did do away with some error-checking, but I'm almost positive that file will always exist on any Linux system. |
Wow that looks really good- I especially like the idea of determining the distro at build time |
Is your implementation of query_package_database done enough to start a PR for it? |
With bedrock linux, you can just do what neofetch seems to do, search for all of those other distros' package manager files and display all of them. |
I've been mulling over how best to account for fancy situations (such as Flatpak and Bedrock) without severely impacting our performance, but I haven't been able to come up with anything that strikes me as a satisfactory compromise. On the one hand, we could just have a list of every package manager and how to get its count, and just "try it and see" irrespective of distro. This would probably take us from our current sub-centisecond execution time to somewhere in the neighborhood of 10x that, which would suck. Alternatively, we proceed with the drafted approach and special-case things like Flatpak and Bedrock, which feels a little sloppy but is probably the better way. |
I would like for paleofetch to support package managers other than pacman. But since I only have pacman installed on my computer, it's difficult for me to figure how to do that.
If you want paleofetch to support your favorite package manager, please reply to this issue with the following information:
/var/lib/pacman/local
)ls -la
in this directoryThe text was updated successfully, but these errors were encountered: