package rpmfile

  1. Overview
  2. Docs
RPM package metadata reader

Install

Dune Dependency

Authors

Maintainers

Sources

0.2.0.tar.gz
md5=1018b63f5f086a0e778dc51bb0bbebbe
sha512=17a1c968e4766e419d1b9617fbf0bc21985563893cef1599fe06df4eccf490341ddea09039b6ed0a001a7fbcfa44fc0a9c34eb6c6f85d359f5824ecea693d048

Description

A library for reading metadata from RPM packages, providing an Angstrom parser and a simple interface for accessing values

Tags

rpm parser

Published: 21 Jul 2024

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.rpm
Achtung

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

References

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)

  1. angstrom-unix >= "0.15"
  2. angstrom >= "0.15"
  3. dune >= "3.16"
  4. ocaml > "4.14"

Dev Dependencies (2)

  1. odoc with-doc
  2. alcotest with-test

Used by

None

Conflicts

None

OCaml

Innovation. Community. Security.