apkgquery
A command-line tool to query the metadata of aports or other repositories with
APKBUILDs files.
Installation
go install gitlab.alpinelinux.org/kdaudt/apkgquery@latest
Usage
apkgquery [-r|--root <path>] <query>
Option |
Description |
-r / --root |
Path to directory with packages. |
Query language
This tool uses expr as a query language. A pkg
object with the type
Apkbuild is exposed with the metadata of a package. When the
query expression evaluates to true, the package name is printed.
In addition to the functions provided by expr
, this tool also provides some
convience functions:
Function |
Description |
print(msg) |
Always evaluates to true. Can be chained with && to print aditional information for each found package. |
Examples
Pkgrel is larger then 10
apkgquery -r ~/aports/ 'int(pkg.Pkgrel) > 10'
Includes MIT as license
apkgquery -r ~/aports/ '"MIT" in split(pkg.License, " ")'
Provides version is incorrect and therefore considered part of the package name
apkgquery -r ~/aports/ 'any(pkg.Provides, {.Constraint == ""}) && any(pkg.Provides, {.Pkgname matches "\\d+.\\d+-r?\\d$" && print(.Pkgname)})'
Provides virtual package without setting a provider_priority
apkgquery -r ~/aports/ 'any(pkg.Provides, {.Constraint == ""}) && pkg.ProviderPriority == "" && print(pkg.Provides[0].Pkgname)'