8000
Skip to content

Conversation

@classabbyamp
Copy link
Member
@classabbyamp classabbyamp commented Feb 9, 2023
  • allow multiple arguments for many actions

Only implemented where it makes sense to, i.e., not cmpver, pkgmatch, arch, getsystemdir, digest, and fetch.

Tests show a large speed-up is possible when processing a large number of inputs (1718 in this case):

Before

xbps-query -Rp pkgver -s python  0.18s user 0.02s system 99% cpu 0.199 total
cut -d: -f1  0.00s user 0.00s system 0% cpu 0.198 total
xargs -n1 xbps-uhelper getpkgname > /dev/null  0.49s user 1.17s system 94% cpu 1.761 total

After

xbps-query -Rp pkgver -s python  0.17s user 0.03s system 99% cpu 0.200 total
cut -d: -f1  0.00s user 0.00s system 0% cpu 0.200 total
xargs ./bin/xbps-uhelper/xbps-uhelper getpkgname > /dev/null  0.00s user 0.00s system 1% cpu 0.197 total

(note the lack of -n1 in the second one)

  • add getname and getversion actions

These actions are kind of "meta" actions, combining getpkgdepname and getpkgname (and the respective version actions) so that a list of mixed pkgvers and package patterns can be interpreted. This uses the internal format check of xbps_pkgpattern_{name,version}() to allow for a fallback to xbps_pkg_{name,version}() for exact versions, then falls back to displaying an error message if that also fails.


this will also be somewhat intertwined with an xbps-uhelper manpage, like in #533

@leahneukirchen
Copy link
Member

Useful!

these actions are kind of "meta" actions, combining getpkgdepname and
getpkgname (and the respective version actions) so that a list of mixed
pkgvers and package patterns can be interpreted. This uses the internal
format check of `xbps_pkgpattern_{name,version}()` to allow for a
fallback to `xbps_pkg_{name,version}()` for exact versions, then falls
back to displaying an error message if that also fails.
@classabbyamp classabbyamp marked this pull request as ready for review February 9, 2023 23:54
@classabbyamp
Copy link
Member Author

Useful!

would this be helpful for any xtools? I see xpkg uses sed at the moment

@Duncaen Duncaen merged commit 7391a7b into void-linux:master Feb 10, 2023
@classabbyamp classabbyamp deleted the uhelper/moar-args branch February 10, 2023 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0