RPM-RS
A pure rust library for parsing and creating RPM files.
Goals
- Easy to use API
- Pure rust to make it easy to use in larger Projects
- Independence of Spec files. Pure programmatic interface for Packaging.
- Compatibility from Enterprise Linux 8 (RHEL, Alma, Rocky, CentOS Stream) to Fedora (I may extend test cases for SUSE)
Non Goals
RPM has a lot of cryptic features. I do not want to re-implement all of them. This library focuses on the ones that I assume as useful. This library does not build software like rpmbuild. It is meant for finished artifacts that need to be packaged as RPM.
Status
- RPM Creation
- Basic RPM Reading
- RPM Signing and Signature Verification
- High Level API for RPM Reading
Examples
use ;
let raw_secret_key = read?;
// It's recommended to use timestamp of last commit in your VCS
let source_date = 1_600_000_000;
let pkg = new
.compression
.with_file?
// file mode is inherited from source file
.with_file?
.with_file?
.pre_install_script
// Alternatively, use scriptlet builder api to specify flags and interpreter/arguments
.post_trans_script
// If you don't need reproducible builds,
// you can remove the following line
.source_date
.build_host
.add_changelog_entry
.add_changelog_entry
.requires
.vendor
.url
.vcs
.build_and_sign?;
pkg.write_file?;
// reading
let raw_pub_key = read?;
let pkg = open?;
let name = pkg.metadata.get_name?;
let version = pkg.metadata.get_version?;
let release = pkg.metadata.get_release?;
let arch = pkg.metadata.get_arch?;
println!;
for changelog in pkg.metadata.get_changelog_entries?
// verifying
pkg.verify_signature?;