You are not logged in.
Is there a way to query a specific repository database (ie, foobar.db.tar.gz) for information on a specific package, without necessarily having that repository configured in pacman.conf (like the -p option to -Q)?
I want to query a specific repo database to determine if a given package (or packages) are present, but the repository may or may not be in pacman.conf
The best I have at the moment (assuming the repo IS configured in pacman.conf) is:
pacman -Sl foobar | cut -d' ' -f2 | grep -P '^package$"(EDIT: foobat is foobar's long long cousin)
Last edited by fukawi2 (2013-03-27 23:02:22)
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
I use a second pacman config where I have a bunch of unofficial repos listed, so I can search for some package, like so:
$ pacman --config /etc/pac2.conf -Sl | grep opera
community opera 12.14.1738-1
archstuff opera-devel 10.70_6396-1
herecura-stable opera-adblock-elements 20130324-1
herecura-stable opera-adblock-main 20130324-1
herecura-stable opera-adblock-stat 20130324-1
herecura-testing opera-next 12.15_1745-1I think you can use the '-q' switch instead of cutting:
pacman -Slq foobar | grep -P '^package$"Last edited by karol (2013-03-28 03:10:56)
Offline
You should consider using the json interface. xyne does this in his package downloader
https://bbs.archlinux.org/viewtopic.php?id=160069
Edit: If you want to query a local database file you could also write something with pyalpm.
Last edited by progandy (2013-03-28 03:38:04)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |
Offline
I use a second pacman config where I have a bunch of unofficial repos listed, so I can search for some package, like so:
...
I think you can use the '-q' switch instead of cutting:
I'm aiming for something completely independent... Worst case I'll have to extract the DB to a temp location and check that way.
You should consider using the json interface. xyne does this in his package downloader
https://bbs.archlinux.org/viewtopic.php?id=160069
There's no JSON interface for a repo I've created myself using repo-add ![]()
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
If you simply want to read a package, here is something. Using pyalpm seems to be a bit too much ![]()
# query info for a specific package (allow any version and pkgrel)
bsdtar -Oxf /var/lib/pacman/sync/extra.db "zip-?*-?*/desc"
# query info for a specific package version:
bsdtar -Oxf /var/lib/pacman/sync/extra.db zip-3.0-3/desc
# check for existence of a package with specific version but any pkgrel
bsdtar -tf /var/lib/pacman/sync/extra.db zip-3.0-?*/desc
# list all packages
bsdtar -tf /var/lib/pacman/sync/extra.db | grep "/\$"Last edited by progandy (2013-03-28 04:00:41)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |
Offline
# query info for a specific package (allow any version and pkgrel)
bsdtar -Oxf /var/lib/pacman/sync/extra.db "zip-?*-?*/desc"Not quite... For example, searching for "PostgreSQL" returns:
postgresql
postgresql-docs
postgresql-libs
postgresql-old-upgrade
If "postgresql" didn't actually exist, I'd have a false-positive ![]()
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
falconindy has a patchset for pacman that allows you to add repos to your pacman.conf for only things like searching or explicitly installing from (e.g. "pacman -S foo" will not work, but "pacman -S bar/foo" will is the "bar" repo is set with limited usage).
Offline
Then you'll have to combine it with grep for better patterns. The only other thing you can do with a glob pattern is to force a number after the first dash:
"zip-[0-9]*-?*/desc"
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |
Offline