You are not logged in.

#1 2016-03-29 20:26:26

44gala
Member
Registered: 2016-03-29
Posts: 3

Pacman Database format

I am working on a project to bring some of pacman's and alpm's functionality to a Java library, but i cant in any way read the pacman database files.

core.db
community.db
extra.db
etc.

I tried SQLite 2 and 3 and both failed to open the databse.

Is it a non-standard database format? Is it encrypted?

tl:dr what format is the pacman database?

Offline

#2 2016-03-29 20:27:43

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: Pacman Database format

I believe it's tar.xz


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#3 2016-03-29 20:30:47

44gala
Member
Registered: 2016-03-29
Posts: 3

Re: Pacman Database format

graysky wrote:

I believe it's tar.xz

It is. Thanks.

That seems a little primitive to store a database like that. Why wasn't a more complex format used, like for example sqlite?

Offline

#4 2016-03-29 20:34:04

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: Pacman Database format

Why make it difficult?  Arch operates on a KISS principal.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#5 2016-03-29 20:36:24

44gala
Member
Registered: 2016-03-29
Posts: 3

Re: Pacman Database format

graysky wrote:

Why make it difficult?  Arch operates on a KISS principal.

KISS would be a single sqlite table, not a double-tarred archive with a folder for each package.

Oh well, it was developed a long time ago, maybe sqlite wasnt even a thing.

Offline

#6 2016-03-29 21:32:39

ayekat
Member
Registered: 2011-01-17
Posts: 1,590

Re: Pacman Database format

I believe that, by relying on the filesystem to organise data rather than a database program, there are less moving parts, making the package manager more robust to bugs and less limiting in terms of accessibility (basically you can inspect a local repository with `cd`, `ls` and your text editor of choice).

Maybe performance is an argument [citation needed], but looking around in the package manager ecosystem, I don't think that pacman is currently in need of a performance boost. smile


pkgshackscfgblag

Offline

#7 2016-03-29 21:37:03

headkase
Member
Registered: 2011-12-06
Posts: 1,977

Re: Pacman Database format

On a tangent from ayekat: Linus Torvalds on C++.

The gist of it is "don't depend on unnecessary complexity that hides details from you because eventually something that was hidden from you will break and it won't be obvious why."  Making the pacman database format use sqlite would be adding complexity and therefore, regardless of pros and cons, hide some details that may not be obvious and could be very important.

Offline

#8 2016-03-29 22:47:39

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

Re: Pacman Database format

ayekat wrote:

Maybe performance is an argument [citation needed]

Not for the sync databases - the numbers come out even.   The local database (which is not tarred up) is another story...

Offline

#9 2016-03-30 00:53:29

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,534
Website

Re: Pacman Database format

44gala wrote:

Why wasn't a more complex format used

You want complexity ... just for the sake of complexity??  And you use arch linux?

Now I've seen everything.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#10 2016-05-03 08:29:00

bagol
Member
Registered: 2015-01-29
Posts: 28

Re: Pacman Database format

It's gz not xz

Offline

#11 2016-05-03 08:33:54

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

Re: Pacman Database format

It is actually any compression scheme supported by libarchive.   Arch Linux just chooses gz.

Offline

#12 2016-05-03 12:47:23

oliver
Member
Registered: 2007-12-12
Posts: 448

Re: Pacman Database format

As an aside, /usr/bin/file would have told you it was a gzipped file which would have led you to the right content format.

$ file /var/lib/pacman/sync/core.db
/var/lib/pacman/sync/core.db: gzip compressed data, last modified: Mon May  2 12:14:00 2016, from Unix

Offline

Board footer

Powered by FluxBB