Page
Library
Module
Module type
Parameter
Class
Class type
Source

A pure OCaml library for parsing RPM files (supports V3 and partly V4 package versions).
You can install the rpmfile library using the OPAM package manager or any other method you prefer.
$ opam install rpmfile.1.0.0You can also get the latest version of the upstream (developer) branch.
$ opam pin rpmfile.dev https://github.com/dx3mod/rpmfile.gitIf you are using Dune, please add the rpmfile library to your dependencies.
Each RPM package consists of four sections: Lead, Signature, Header, and Payload. The first three are meta information about the package. It contains a description, a dependency list, and so on.
The information in the Signature and Header sections is stored on a key-value basis, where the key is called a tag. The value can be a number, a string or an array. The Payload section usually contains a compressed Cpio archive that already contains the package's files.
For more information, please see the materials.
Below is an example of simply reading an RPM file and obtaining the package name and version.
let () =
let metadata =
In_channel.with_open_bin
"hello.rpm"
Rpmfile.Reader.from_channel_without_payload
in
let name, release = Rpmfile.View.(name metadata, release metadata) in
Printf.printf "%s.%s\n" name release
(* hello.1.3 *)For more details, see API references and examples/ directory.
Package format specification:
Reference implementations in other languages:
The project is licensed under the MIT License, which allows for all permissions. Just use it and enjoy yourself without fear. We are always open to pull requests!