You are not logged in.

#1 2021-11-10 07:19:07

aquilarubra
Member
From: Trieste, Italy
Registered: 2018-11-24
Posts: 87

Querying a local repo db

Hello, I have some confusion about pacman options. Maybe somebody can clarify.

"pacman -Si package" queries the sync db (what is that? The online Arch repo, I suppose)
"pacman -Qi package" queries the local db (what is that? The local copy of the Arch repo after I do a "pacman -Syu", I suppose)
"pacman -Fi package" queries the file db (what is that? Somewhere I find that it queries all available sources, online and offline, despite the name seems to imply that I can point it to a local file db)

Those clarified, I explain what I want to do. I created a local repo to which I add some custom AUR like packages (but not necessarily AUR).
I want to query it with pacman (or other means), without syncing the db, to know which version of a package is in there.

So far, I tried to pass pacman a custom pacman.conf file, with the --config option. Then I tried to query it with "pacman --config /tmp/pacman.conf -Qi package", but I get inconsistent results.
The pacman.conf file contains only a file:// repository, pointing to the directory with my local db and package files.

How should it be done correctly?

Offline

#2 2021-11-10 07:31:35

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,365
Website

Re: Querying a local repo db

sync db = "database" of packages you download with -Sy
local db = "database" of installed packages
files db = sync "database" with additional file lists for packages (download with -Fy)

Offline

#3 2021-11-10 08:42:25

a821
Member
Registered: 2012-10-31
Posts: 381

Re: Querying a local repo db

You can use checkupdates(8) for downloading the sync databases without running pacman -Sy. The sync database can be queried with pacman using "/tmp/checkup-db-$UID" (if CHECKUPDATES_DB is unset) as dbpath (see -b, --dbpath in pacman(8)).

Offline

#4 2021-11-10 09:06:27

aquilarubra
Member
From: Trieste, Italy
Registered: 2018-11-24
Posts: 87

Re: Querying a local repo db

Thank you all. I didn't grasp how to use checkupdates, but thanks to the tips and investigating the filesystem, I could move a step forward. I need to use both --dbpath and --config. The custom pacman.conf must have a repo defined, pointing to the directory where I hold the local repository.

pacman --dbpath /path/repo --config /path/repo/pacman.conf -Syi mypackage

Now, this does not remove the need for syncing, even if the dbpath is the same of my local repository pointed to by pacman.conf. Actually, it creates 2 directories, local and sync. Inside the sync directory, it resyncs my repo db files.

Offline

#5 2021-11-10 15:23:53

progandy
Member
Registered: 2012-05-17
Posts: 5,184

Re: Querying a local repo db

You can create a temporary directory and symlink your db file there. Here are some examples with expac / pacutils (though pacman should work as well) and bash/zsh process substitution.

mkdir -d /tmp/tempdb/sync
ln -s ~/localdb/test.db /tmp/tempdb/sync/test.db

expac -S --config <(printf "[options]\nDBPath=/tmp/tempdb \n [test]") "%n : %v"
# or 
pacsift --config=<(echo "[test]") --dbpath=/tmp | pacinfo --config=<(echo "[test]") --dbpath=/tmp --short

rm -r /tmp/tempdb

Otherwise you'll have to create a parser for the db format and directly extract the values you are interested in, e.g.

bsdtar -Oxf /tmp/test.db | sed -n '/^%NAME%$/{n;h} ; /^%VERSION%$/{n;x;G;s/\n/ /p}'

Last edited by progandy (2021-11-10 16:18:01)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

Board footer

Powered by FluxBB