I want to generate a list of trending Arch/AUR packages that focuses on user-facing applications rather than background libraries and dependencies.
I wrote a script that uses the data from pkgstats to show non-dependency packages sorted by popularity. However, it doesn’t distinguish between applications and libraries, so the output isn’t very useful.
I want to identify and separate standalone applications from libraries and dependencies for both Arch official repositories and AUR packages. Not just for installed packages but for all of them.
pamac, Graphical Package Manager for Manjaro Linux with Alpm, AUR, Appstream, Flatpak and Snap support, seems to identify applications vs libraries/dependencies when grouping packages into categories like “Music & Audio” or “Games”. As seen in this code, pamac gets categorized package lists and populates the UI accordingly.
Since it may not be clear what libraries or dependencies are and I’m already using pamac as an example. I’ll consider packages that appear in pamac’s categories like Games and Music & Audio as applications, and other packages as libraries/dependencies.
As an alternative, I would consider end-user software the ones that aren’t required by any other packages. This isn’t perfect, just good enough. For example, this is how I would do this for installed packages.
How can I identify standalone applications and separate them from libraries/dependencies in the Arch/AUR package lists? The end goal is a trending packages list focused on end-user software rather than background components.
I would start by looking at what files are included. There’s the obvious
.desktop
entry, but also checking if there are any files put into/bin/
,/usr/bin/
,/usr/sbin/
etc. should suffice.If you consider some of these packages as “dependencies” then look at if anything depends on it. But there are application-packages that others depend on, such as coreutils.
Is that for installed packages or for all repo packages as I want to check?
I meant for all packages. But when it comes to the actual details on how to do it, I’m not super sure. I know pacman is pretty sophisticated so it might support querying the package repo (or local package db) somehow. I would start by looking up the
-F
option.
Look for AppStream metadata files like .desktop and .metainfo.xml. Presence of these suggests the package provides a graphical application.
I want to check all the packages in the Arch/AUR repositories, not just installed packages.
To get a list of all installed Arch/AUR packages that aren’t libraries or dependencies, i.e., they aren’t required by any other packages, you can use the
pacman
command with the-Qent
flag. This will list all explicitly installed native packages that are not direct or optional dependencies:pacman -Qent
However, this command will only list packages from the official repositories and not the AUR packages. To get a list of all installed AUR packages, you can use the
pacman -Qmq
command:pacman -Qmq
To filter out AUR packages that are not required by any other packages, you can combine the output of the above commands with some additional scripting. Here’s an example of how you can achieve this:
comm -23 <(pacman -Qmq | sort) <(pacman -Qqg base | sort -u)
This command will list all installed AUR packages that are not required by any other packages. Note that this command assumes that you have the
comm
utility installed on your system. If you don’t have it, you can install it by installing thecoreutils
package:sudo pacman -S coreutils
Keep in mind that this approach might not be perfect, as it may still include some packages that are indirectly required by other packages. However, it should give you a good starting point for identifying packages that are not libraries or dependencies.