XBPS-UHELPER(1)

πŸ“¦ version 0.60.6, in alpine 3.24, nixos 26.05, nixpkgs unstable

πŸ’… xbps-uhelper β€” the little helper that does it ALL, bestie

okay so picture this: you're deep in XBPS land, you've got package strings flying everywhere, and you just need to know what is the name, what is the version, does this even match β€” and that's literally what xbps-uhelper from the XBPS manual is here for. It's a grab-bag of tiny utilities for poking at XBPS and XBPS packages, and honestly it eats. πŸŽ€


✨ SYNOPSIS ✨

xbps-uhelper [OPTIONS] ACTION [ARGUMENTS]

no cap, that's the whole shape of it: options first, then the action, then whatever arguments that action wants. slay. 🫢


🌸 DESCRIPTION 🌸

The xbps-uhelper utility provides various utilities for interacting with XBPS and XBPS packages.

lowkey it's the utility belt of the XBPS cinematic universe β€” every little string-parsing, version-comparing, name-extracting task you could want. main character energy fr fr. πŸ’…


πŸ¦‹ ARGUMENT TYPES πŸ¦‹

before we get into the actions, we gotta talk about the flavors of string this thing snacks on. there are three, and yes you need to know them.

πŸ“ BINPKG

A binpkg argument is a string of the format <pkgname>-<version>_<revision>.<arch>.xbps, like the filename of a binary package.

so basically the whole filename, with everything in it. iconic.

🧚 PKGVER

A pkgver argument is a string of the format <pkgname>-<version>_<revision>, like the pkgver property.

same energy as a binpkg but the arch part dipped. πŸ’€

⭐ PKGPATTERN

A pkgpattern argument is package expression specifying a package name and version separated by any of the following version comparators:

  • < β€” less than
  • > β€” greater than
  • <= β€” less or equal than
  • >= β€” greater or equal than

Example: β€œfoo>=2.0”.

that's it, that's the pattern. compara-tor and all. 🎯


πŸ‘‘ OPTIONS πŸ‘‘

every single flag, bestie, no skips:

  • -C, --config dir β€” Specifies a path to the XBPS configuration directory. If the first character is not / then it's a relative path of rootdir.
  • -d, --debug β€” Enables extra debugging shown to stderr.
  • -h, --help β€” Show the help message. bestie behavior honestly.
  • -r, --rootdir dir β€” Specifies a full path for the target root directory.
  • -v, --verbose β€” Enables verbose messages.
  • -V, --version β€” Show the version information.
ngl -C is a sneaky one: relative means relative to rootdir, not to wherever you happen to be standing. noted. πŸ“

πŸ”₯ ACTIONS πŸ”₯

here's the whole menu. pick your fighter.

  • arch β€” Prints the XBPS native arch.
  • binpkgarch binpkg ... β€” Prints the arch of binpkg strings.
  • binpkgver binpkg ... β€” Prints the pkgver of binpkg strings.
  • cmpver instver reqver β€” Compare two pkgver strings, instver (installed) vs reqver (required). See β€œEXIT STATUS” for more information. If --verbose is specified, also prints "instver <|=|> reqver".
  • getname string ... β€” Prints the pkgname of pkgpatterns and/or pkgvers. This is a combination of getpkgdepname and getpkgname.
  • getversion string ... β€” Prints the version of pkgpatterns and/or pkgvers. This is a combination of getpkgdepversion and getpkgversion.
  • getpkgdepname pkgpattern ... β€” Prints the pkgname of package dependency patterns.
  • getpkgdepversion pkgpattern β€” Prints the version of package dependency patterns.
  • getpkgname pkgver ... β€” Prints the name of package strings.
  • getpkgrevision pkgver ... β€” Prints the revision of package strings.
  • getpkgversion pkgver ... β€” Prints the version of package strings.
  • getsystemdir β€” Prints the xbps system directory (<sharedir>/xbps.d).
  • pkgmatch pkgver pkgpattern β€” Matches a pkgver with a pkgpattern. See β€œEXIT STATUS” for more information. If --verbose is specified, also prints "pkgver matches|does not match pkgpattern", or an error.
  • real-version pkgname ... β€” Prints the version of installed real packages.
  • version pkgname ... β€” Prints the version of installed packages.
🫢 tiny heads-up: getpkgdepversion and pkgmatch each take things a little differently than their neighbors β€” check the arg shapes above before you yeet a whole list at them.

πŸ’€ EXIT STATUS πŸ’€

A descriptive error message will be printed to stderr. Exceptions to this are:

cmpver instver reqver

  • 1 β€” if instver is greater than reqver.
  • 0 β€” if instver is equal to reqver.
  • 255 β€” if instver is less than reqver.

pkgmatch pkgver pkgpattern

  • 1 β€” pkgver matches pkgpattern.
  • 0 β€” pkgver does not match pkgpattern.
  • 255 β€” An error occurred.
😭 okay so yes, these two flip the usual "0 means good" thing β€” pay attention, because cmpver returning 1 is "installed is newer" and 0 is "same version", which is not what your shell instincts are screaming at you. and pkgmatch returning 1 means it matches. do not get got by this. πŸ™ˆ

🌈 EXAMPLES 🌈

these are the moments. the whole vibe. ✨

Compare package versions:

$ xbps-uhelper cmpver 'foo-1.0_1' 'foo-2.1_1'
$ xbps-uhelper cmpver 1.0 2.1

Get the package name for dependency pattern β€œfoo>=0”:

$ xbps-uhelper getpkgdepname 'foo>=0'

Get the version expression for the dependency pattern β€œfoo>=0”:

$ xbps-uhelper getpkgdepversion 'foo>=0'

Get the package name for pkgver β€œfoo-2.0_1”:

$ xbps-uhelper getpkgname foo-2.0_1

Get the revision for pkgver β€œfoo-2.0_1”:

$ xbps-uhelper getpkgrevision foo-2.0_1

Get the version for pkgver β€œfoo-2.0_1”:

$ xbps-uhelper getpkgversion foo-2.0_1

Check if the pkgver β€œfoo-1.0_1” matches the dependency pattern β€œfoo>=1.0”:

$ xbps-uhelper pkgmatch foo-1.0_1 'foo>=1.0'

Get the version for the installed package β€œfoo”:

$ xbps-uhelper version foo

Get the names of packages from a list of pkgvers:

$ xbps-query -Rp pkgver -s foo | cut -d: -f1 | xargs xbps-uhelper
getpkgname

Get the names of dependencies for a package:

$ xbps-query -Rp run_depends xf86-video-amdgpu | xargs
xbps-uhelper getname
🧚 that last two? piping xbps-query straight into xargs xbps-uhelper is the move. it's giving productivity. it's giving pipeline. obsessed.

πŸ’– ENVIRONMENT πŸ’–

  • XBPS_ARCH β€” Overrides uname(2) machine result with this value. Useful to install packages with a fake architecture.
  • XBPS_TARGET_ARCH β€” Sets the target architecture to this value. This variable differs from XBPS_ARCH in that it allows you to install packages partially, because configuration phase is skipped (the target binaries might not be compatible with the native architecture).
⭐ real talk: XBPS_TARGET_ARCH is the wild one β€” it lets you install packages partially because the configuration phase gets skipped, and that's exactly because the target binaries might not be compatible with your native architecture. don't say i didn't warn you. 🫢

πŸŽ€ FILES πŸŽ€

eyeballs on these paths, bestie:

  • /etc/xbps.d β€” Default configuration directory.
  • /usr/share/xbps.d β€” Default system configuration directory.
  • /var/db/xbps/.<pkgname>-files.plist β€” Package files metadata.
  • /var/db/xbps/pkgdb-0.38.plist β€” Default package database (0.38 format). Keeps track of installed packages and properties.
  • /var/cache/xbps β€” Default cache directory to store downloaded binary packages.

🌸 SEE ALSO 🌸

the whole friend group, literally: xbps-checkvers(1), xbps-create(1), xbps-dgraph(1), xbps-digest(1), xbps-fbulk(1), xbps-fetch(1), xbps-install(1), xbps-pkgdb(1), xbps-query(1), xbps-reconfigure(1), xbps-remove(1), xbps-rindex(1), xbps-uchroot(1), xbps-uunshare(1), xbps.d(5).

go say hi. πŸ‘‹


πŸ’œ AUTHORS πŸ’œ

Juan Romero Pardines <xtraeme@gmail.com> β€” the icon who made this. πŸ‘‘


πŸ¦‹ BUGS πŸ¦‹

Report bugs at https://github.com/void-linux/xbps/issues

(and pls be nice about it, bug reports are a love language 🫢)


k bye bestie β€” this was XBPS-UHELPER(1), general commands manual, from the Debian build dated Feb 11, 2023. go parse some package strings and slay βœ¨πŸ’…πŸŽ€

πŸ“¦ where this page comes from