package rpmfile
Build not checkedInstall
dune-project
Dependency
Authors
Maintainers
Sources
md5=1018b63f5f086a0e778dc51bb0bbebbe
sha512=17a1c968e4766e419d1b9617fbf0bc21985563893cef1599fe06df4eccf490341ddea09039b6ed0a001a7fbcfa44fc0a9c34eb6c6f85d359f5824ecea693d048
Description
A library for reading metadata from RPM packages, providing an Angstrom parser and a simple interface for accessing values
README
rpmfile
A library for reading metadata from RPM packages (supports version 3.0 and partially 4.0), providing an Angstrom parser and a simple interface for accessing values.
Usage
Before you can read an RPM package, you must create a Reader module with a selector (predicate for parsing only necessary tags) passed to it.
module Rpm_reader = Rpmfile.Reader (Rpmfile.Selector.All)
let metadata = Rpm_reader.of_file_exn "hello-2.12.1-1.7.x86_64.rpm"
Rpmfile.summary metadata
(* - : string = "A Friendly Greeting Program" *)You can also have “direct” access to values by tag using the get function. Example of getting file sizes:
Rpmfile.get Rpmfile.D.(array int) 1028 metadata
(* int list = [35000; 0; 93787; ...]*)If there's a retrieval error, the Rpmfile.Not_found exception will be thrown.
Custom selector
module SelectNameOnly = struct
include Rpmfile.Selector.All
let select_header_tag = function
| 1000 (* name *) -> true
| _ -> false
end
module _ = Rpmfile.Reader (SelectNameOnly)CLI utility
You can also use rpmfile as a CLI utility to get information about a package, similar to rpm -qi.
rpmfile hello-2.12.1-1.7.x86_64.rpmAchtung
For integer representation, native int is used by default, which is theoretically sufficient on 64-bit systems. Otherwise, use manual decoding of the value.
Documentation
- Lookup documentation using
odig - Tutorial in Russian on ocamlportal.ru
References
- Package File Format, V4 Package format
Related
- Alternative my implementation in TypeScript — rpm-parser
- Live coding stream (in Russian) demo version of the parser
Contribution
The project is stable, but the library could be more complete. I look forward to your pull requests! If you encounter a bug, then please create an issue.
Dependencies (4)
-
angstrom-unix
>= "0.15" -
angstrom
>= "0.15" -
dune
>= "3.16" -
ocaml
> "4.14"
Optional Dependencies
None
Used by
None
Conflicts
None
Build status
Results of building rpmfile with each compiler on check.ci.ocaml.org, run of against opam-repository 8d8d144. All results for this package.
Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.
This version is not in the latest run; the versions below are.
| Version | OCaml 4.11 | OCaml 4.14 | OCaml 5.2 | OCaml 5.4 | OCaml 5.5 |
|---|---|---|---|---|---|
| 1.1.0 | n/a | n/a | n/a | good | good |
| 0.8.0 | n/a | good | good | good | good |
- good Package successfully built
- partial One of the dependencies failed to build
- bad Package failed to build
- n/a Package is not available in this environment
- internal Internal failure