How can I find details on the binary representation of the RPM DB? #2211
-
I am trying to find an RPM version agnostic way to find details on installed software on any Linux distro that uses RPM packages. A co-worker found for one version of RPM that the magic byte array/slice Is there any documentation for the binary representation of the RPM DB for each RPM version I could look at? If there is no documentation for this, where can I find the relevant part of the source code for the |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 26 replies
-
That's the wrong end to be looking at, totally. 'rpm -q' with --queryformat gives you access to every single bit of data in the rpmdb. The other option is the librpm API, whether through C or Python bindings. The API for database access is largely unchanged in the last 14-15 years. |
Beta Was this translation helpful? Give feedback.
-
The details of the database format are OFF-LIMITS TO EXTERNAL USERS! Sqlite is but one of the possible database formats. If you want to access the rpm database, you do so through the librpm API. |
Beta Was this translation helpful? Give feedback.
-
Nothing wrong with curiosity, and this being open source, obviously nobody can prevent people from looking. The rpmdb format is undocumented because it is a private implementation detail which rpm is free to change at will. |
Beta Was this translation helpful? Give feedback.
-
@DemiMarie yes, i was just reading about how to parse C code with cGo to do that and was reading intensively the librpm code to do so... i finished to read all the database content without fond any alternative easy way to get some data from there. It looks like metadata of packages are inside a blob field. I was also reading the Python API to go the same way to parse rpmlib with cGo. Edit ==>@shanebishop actually, this package from knqyf263 repo seems to have something wrong with rpm Fedora sqlite3 database file. I have to dig on that. Thank you very much @DemiMarie , @shanebishop and @pmatilai for your quick help with that, i do appreciate it. |
Beta Was this translation helpful? Give feedback.
-
The rpmdb as a database is completely uninteresting. It's just a fairly dumb storage for header blobs, which is where all the actual data is. go-rpmdb seems to be a reimplementation of rpm bits and pieces up to the level where it can read some of the more common bits of data from the header. That's interesting in its own right and nothing wrong with that, but it seems rather incomplete, rpm knows about ~260 tags whereas go-rpmdb lists circa 30 of them. And, like noted above, the format of the rpmdb is a private implementation detail and there's absolutely zero regard to outside users of that data so accessing it without going through librpm can and eventually will break with no notice. |
Beta Was this translation helpful? Give feedback.
That's the wrong end to be looking at, totally.
'rpm -q' with --queryformat gives you access to every single bit of data in the rpmdb.
The other option is the librpm API, whether through C or Python bindings. The API for database access is largely unchanged in the last 14-15 years.