A pure rust library for parsing and creating RPM files.
RPM has a lot of cryptic features. I do not want to reimplement 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.
```rust
use rpm;
let pkg = rpm::RPMBuilder::new("test", "1.0.0", "MIT", "x8664", "some awesome package")
.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)
.addchangelog_entry("you", "yeah, it was", 12312312)
.requires(Dependency::any("wget"))
.build()?;
let mut f = std::fs::File::create("./awesome.rpm")?;
pkg.write(&mut f)?;
// reading let rpmfile = std::fs::File::open("testassets/389-ds-base-devel-1.3.8.4-15.el7.x8664.rpm").expect("should be able to open rpm file"); let mut bufreader = std::io::BufReader::new(rpmfile); let pkg = rpm::RPMPackage::parse(&mut bufreader)?; ```