I created some simple helper functions for pacman - Pacext
I wrote a script that wraps some more complicated features of pacman
. You can get it from the AUR if you’re on Arch
at aur/pacext-git or manually on
GitHub
Motivation
Pacman is ArchLinux’s excellent package manager. Its main philosophies are to provide an open interface to your
packages that can be utilised in other programs to do more complicated things. Because of this, it’s feature set can be
a little daunting when you first look into it. For example, say you wanted to find the program that provides a binary,
say grep
. How would you do it?
In the Enterprise Linux world, dnf
provides a very intuitive subcommand, provides
. You just type:
$ dnf provides grep
and dnf
will spit the package plus anywhere else that you could get the package from:
$ dnf provides grep
grep-2.20-3.el8.x86_64 : Pattern matching utilities
Repo : base
grep-2.20-3.el8.x86_64 : Pattern matching utilities
Repo : @anaconda
Now lets say you wanted to do this for ArchLinux’s pacman
. What subcommand would you use? Well, pacman
defines its
subcommands like so:
- A hyphen
-
- A capital letter, denoting an “operation”
- Zero or many lowercase letters, denoting options to apply to that operation
In this case, the correct options are capital “Q” for the Query operation, lowercase “o” for querying the owner of the file. So in full:
$ pacman -Qo grep
/usr/bin/grep is owned by grep 3.7-1
Okay, that’s not too terrible. But what if you wanted to list the packages dependencies? What if you also needed those dependencies’ descriptions? What if you needed a list of packages that depended on the given package, plus their descriptions. Most modern package managers provide a vast amount of options to allow for this, but Arch tries not to repeat itself with more functions that aren’t strictly necessary, since you can get all this through the highly programmable pre-existing interface.
That being said, it’s always nice to have these functions, which is why I’ve written them.
Example usages
So what are some examples of how pacext
could be used. Well we can take the two examples from before:
Listing dependencies and their descriptions
pacext
lets us do this with either the --whatdepends
flag or -d
for short:
$ pacext -d grep
glibc 2.33-5
GNU C Library
pcre 8.45-1
A library that implements Perl 5-style regular expressions
As you can see, we get the descriptions and versions of the given packages.
Listing what packages depend on this package + their descriptions
Similarly, we can do this with --whatrequires
or -r
:
$ pacext -r grep
base 2-2
Minimal package set to define a basic Arch Linux installation
git 2.34.1-1
the fast distributed version control system
mkinitcpio 31-2
Modular initramfs image creation utility
Other features
The design of this tool makes it easy to add other features because of its shell script nature. You’re welcome to help with a pull request if you know how to code and use ArchLinux.