Crate rpm[][src]

Expand description

rpm-rs

A library providing API to parse rpms as well as creating rpms from individual files.

Example


use rpm::{
	signature::pgp::{
		Signer,
		Verifier
	}
};
use std::str::FromStr;

let raw_secret_key = std::fs::read("./test_assets/secret_key.asc")?;
let pkg = rpm::RPMBuilder::new("test", "1.0.0", "MIT", "x86_64", "some awesome package")
            .compression(rpm::Compressor::from_str("gzip")?)
            .with_file(
                "./test_assets/awesome.toml",
                rpm::RPMFileOptions::new("/etc/awesome/config.toml")
					.is_config(),
            )?
            // file mode is inherited from source file
            .with_file(
                "./test_assets/awesome.py",
                rpm::RPMFileOptions::new("/usr/bin/awesome"),
            )?
             .with_file(
                "./test_assets/awesome.toml",
                // you can set a custom mode and custom user too
                rpm::RPMFileOptions::new("/etc/awesome/second.toml")
						.mode(0o100744)
						.user("hugo"),
            )?
            .pre_install_script("echo preinst")
            .add_changelog_entry("me", "was awesome, eh?", 123123123)
            .add_changelog_entry("you", "yeah, it was", 12312312)
            .requires(rpm::Dependency::any("wget"))
            .build_and_sign(
				Signer::load_from_asc_bytes(&raw_secret_key)?
			)?;
let mut f = std::fs::File::create("./target/awesome.rpm")?;
pkg.write(&mut f)?;

// reading
let raw_pub_key = std::fs::read("./test_assets/public_key.asc")?;
let rpm_file = std::fs::File::open("./target/awesome.rpm")?;
let mut buf_reader = std::io::BufReader::new(rpm_file);
let pkg = rpm::RPMPackage::parse(&mut buf_reader)?;
// verifying
pkg.verify_signature(Verifier::load_from_asc_bytes(&raw_pub_key)?)?;

Modules

Structs

Description of a dependency as present in a RPM header record.

Initial empty builder.

User facing accessor type for a file entry with contextual information

User facing accessor type representing a file mode

User facing accessor type representing ownership of a file

Lead of an rpm header.

Builder pattern for a full rpm file.

Describes a file present in the rpm file.

Description of file modes.

A complete rpm file.

base signature header builder

Builder beyond the empty stage, already containing a digest.

Builder already has a hash and is ready for completion.

Enums

Declaration what category this file belongs to @todo must be bitflags

Constants

Traits

A marker trait for builder stages

Header tag.