RPM-RS

A pure rust library for parsing and creating RPM files.

Goals

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

Examples

```rust use rpm; use rpm::signature::pgp::{Signer,Verifier};

let rawsecretkey = std::fs::read("/path/to/gpg.secret.key")?; let pkg = rpm::RPMBuilder::new("test", "1.0.0", "MIT", "x8664", "some awesome package") .compression(rpm::Compressor::fromstr("gzip")?) .withfile( "./awesome-config.toml", RPMFileOptions::new("/etc/awesome/config.toml").isconfig(), )? // file mode is inherited from source file .withfile( "./awesome-bin", RPMFileOptions::new("/usr/bin/awesome"), )? .withfile( "./awesome-config.toml", // you can set a custom mode and custom user too RPMFileOptions::new("/etc/awesome/second.toml").mode(0o100744).user("hugo"), )? .preinstallscript("echo preinst") .addchangelogentry("me", "was awesome, eh?", 123123123) .addchangelogentry("you", "yeah, it was", 12312312) .requires(Dependency::any("wget")) .buildandsign(Signer::loadfromascbytes(&rawsecretkey)?) .vendor("corporation or individual") .url("www.github.com/repo") .vcs("git:repo=examplerepo:branch=examplebranch:sha=examplesha") let mut f = std::fs::File::create("./awesome.rpm")?; pkg.write(&mut f)?;

// reading let rawpubkey = std::fs::read("/path/to/gpg.key.pub")?; let rpmfile = std::fs::File::open("testassets/389-ds-base-devel-1.3.8.4-15.el7.x8664.rpm")?; let mut bufreader = std::io::BufReader::new(rpmfile); let pkg = rpm::RPMPackage::parse(&mut bufreader)?; // verifying pkg.verifysignature(Verifier::loadfromascbytes(&rawpubkey)?)?; ```