You are not logged in.
Pages: 1
Currently I'm going through the source code of Pacman (for learning purpose) and one thing that utterly confuses me is internal working of Pacman databases. There are two major types of database in my /var/lib/pacman (namely local, sync) which I don't understand their differences. Also, What format is used in sync databases and how can I read them independently from Pacman?
I'd appreciate it if someone could shed some light on the general design of these database or point me to some references ( I was unable to find any).
Last edited by newdave (2011-08-16 18:17:01)
Offline
As far as I know, the local database contains all the metadata (files, dependencies, etc) for the installed packages in your system, whereas the sync databases are a snapshot of the packages available in each repository you have enabled in pacman.conf (I mean the package metadata, not the actual tar.xz packages). The sync databases are updated each time you do pacman -Sy.
Last edited by Foucault (2011-08-16 16:28:04)
Offline
As far as I know, the local database contains all the metadata (files, dependencies, etc) for the installed packages in your system, whereas the sync databases are a snapshot of the packages available in each repository you have enabled in pacman.conf (I mean the package metadata, not the actual tar.xz packages). The sync databases are updated each time you do pacman -Sy.
Thanks for the reply but I was hoping for a more detailed explanation...
Offline
Well the (sync) databases are basically tar.gzed archives. Copy one in a folder and tar xvfz it to confirm it. There is a great deal of libraries that deal with tarballs; pacman uses libarchive. Regarding the internals, although I have messed around with libalpm a bit, it would be better if someone more involved with the subject replies in order to avoid any confusion. However, you can find the definition and implementation of the database type that is used through pacman and libalpm in the source code of pacman (specifically in the lib/libalpm/db.{c,h} files of the source distribution).
Last edited by Foucault (2011-08-16 16:53:14)
Offline
Foucault wrote:As far as I know, the local database contains all the metadata (files, dependencies, etc) for the installed packages in your system, whereas the sync databases are a snapshot of the packages available in each repository you have enabled in pacman.conf (I mean the package metadata, not the actual tar.xz packages). The sync databases are updated each time you do pacman -Sy.
Thanks for the reply but I was hoping for a more detailed explanation...
You mean http://projects.archlinux.org/pacman.gi … ?id=v3.5.0 ?
http://projects.archlinux.org/pacman.gi … 9580a75099
Offline
Well the (sync) databases are basically tar.gzed archives. Copy one in a folder and tar xvfz it to confirm it. There is a great deal of libraries that deal with tarballs; pacman uses libarchive. Regarding the internals, although I have messed around with libalpm a bit, it would be better if someone more involved with the subject replies in order to avoid any confusion. However, you can find the definition and implementation of the database type that is used through pacman and libalpm in the source code of pacman (specifically in the lib/libalpm/db.{c,h} files of the source distribution).
Now it does make more sense. So basically the database is a tar.gz archive and each package has it's own desc, depends files. But is this really the best design out there? I mean is it the most efficient one?
As to the libalpm, I haven't got to it yet. Pacman is fairly big software ( I think it has more than 20,000 lines of code) and I'm still playing with the frontend part.
Offline
Now it does make more sense. So basically the database is a tar.gz archive and each package has it's own desc, depends files. But is this really the best design out there? I mean is it the most efficient one?
No database corruption possible ;P
Define 'efficient' - size, speed, ease of use?
Offline
newdave wrote:Now it does make more sense. So basically the database is a tar.gz archive and each package has it's own desc, depends files. But is this really the best design out there? I mean is it the most efficient one?
No database corruption possible ;P
Define 'efficient' - size, speed, ease of use?
speed and size.
BTW, the links you mentioned didn't provide much insight into what I was looking for.
Offline
As far as speed and size goes, reading directly from the tarball is pretty damn fast (and no-one has show a real database backend to be any more efficient). The local database format could be improved...
Offline
As far as speed and size goes, reading directly from the tarball is pretty damn fast (and no-one has show a real database backend to be any more efficient). The local database format could be improved...
I've done some research about other package managers and apparently Redhat uses Berkeley DB for RPM package manager. What do you think of it?
Offline
Overly complex for little gain.
Offline
moved to Arch Discussion.
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
I see it's [solved], but there has been some interest in sqlite in the past (from a user, not a dev) https://bugs.archlinux.org/task/8586#comment55711
Offline
I've just been hacking away at pacman to see if sqlite and a little of my own local db reorganizing will improve efficiency. All without notice of this thread. Weird.
I'll post some patches on pacman-dev if I find anything compelling. ![]()
Offline
Pages: 1