You are not logged in.

#1 2021-03-29 08:09:39

schard
Member
From: Hannover
Registered: 2016-05-06
Posts: 1,148
Website

[SOLVED] Documentation of package database structure

I require documentation for the package database structure required by pacman.
I could not find anything in the wiki or man pages of either pacman, makepkg or repo-add.
By having a look at a reference database, it looks like the database is an optionally compressed tar archive containing a folder for each package with its name and version, which in turn contain a text file named "desc" which contains key / value pairs.
Is there a full documentation available on the overall structure and the desc file in particular?
Which of the key / value pairs of a desc file are mandatory, which are optional?
What is the purpose of those key / value pairs, especially, what is the difference e.g. between CSIZE and ISIZE?
Where can I get the full documentation when reverse-enginering does not get me further?

Last edited by schard (2021-04-24 19:56:54)

Offline

#2 2021-03-30 21:46:04

eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 4,052

Re: [SOLVED] Documentation of package database structure

There is no documentation. The database is currently an internal implementation detail of the synchronized implementations of:

- libalpm, which reads it (written in C)
- /usr/bin/repo-add, which creates it (written in bash)

I have been writing manual pages in my spare time for pkg.tar(5), and may or may not end up writing one for the repo db format, I dunno.
https://pkgbuild.com/~eschwartz/pacman- … tar.5.html

...

Note that from the repo-add perspective, every single field is "optional -- only written to the db if it is present in the .PKGINFO" so what you really want to know, mostly, is, which fields are required in a .PKGINFO

(check out the reverse-engineering implications of db_write_entry.)

On your specific question for CSIZE vs ISIZE, the latter is mapped to the "size = ..." key in the .PKGINFO, that is to say, it is the "Installed Size". The former is the "Download Size". I'm not actually sure of the significance of the C, but the I used to be a U back in 2006 so good luck with the archaeology?


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#3 2021-03-30 23:42:08

schard
Member
From: Hannover
Registered: 2016-05-06
Posts: 1,148
Website

Re: [SOLVED] Documentation of package database structure

Thanks for the feedback. I hoped to get around digging into pacman's source code.
But now I at least have a plan for the weekend, lol.

Offline

#4 2021-03-31 00:02:39

progandy
Member
Registered: 2012-05-17
Posts: 4,285

Re: [SOLVED] Documentation of package database structure

I'd guess CSIZE/USIZE stand for compressed/uncompressed size.


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

Offline

#5 2021-03-31 00:41:40

eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 4,052

Re: [SOLVED] Documentation of package database structure

The pkg.tar(5) manpage should (as in I should enhance it to do this) list which .PKGINFO fields are required (EDIT: note that pacman can read any package that contains, at minimum, "pkgname" and "pkgver"; however, printing the metadata will prove quite anemic). Again, the repo-add database mapping is essentially just converting .PKGINFO key/value format, key by key, into the database

%KEY%
contents

%KEY%
contents

format.

progandy, that's a very logical insight! Shame on me for missing it after I traced down the historic USIZE and everything. I guess my mind was stuck on the current state of affairs.

Last edited by eschwartz (2021-03-31 00:55:06)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#6 2021-04-24 19:56:40

schard
Member
From: Hannover
Registered: 2016-05-06
Posts: 1,148
Website

Re: [SOLVED] Documentation of package database structure

Offline

Board footer

Powered by FluxBB