stuckliste-cli

Crates.iostuckliste-cli
lib.rsstuckliste-cli
version0.3.7
sourcesrc
created_at2024-12-08 13:29:09.351495
updated_at2024-12-08 18:53:18.50986
descriptionA command-line utility for reading and writing MacOS bill-of-materials (BOM) files.
homepagehttps://github.com/igankevich/stuckliste
repositoryhttps://github.com/igankevich/stuckliste
max_upload_size
id1476296
size36,768
Ivan Gankevich (igankevich)

documentation

https://docs.rs/stuckliste-cli

README

stuckliste

Crates.io Version Docs dependency status

MacOS's bill-of-materials (BOM) files reader/writer library that is fuzz-tested against the original mkbom and lsbom utilities. Includes re-implementation of these utilities as well.

Introduction

stuckliste is a library that offers types and methods for reading/writing MacOS bill-of-materials (BOM) files. These files are generic storage container for various type of information with the most common type being receipts — files that contains a list of all files and directories owned by a package and that are usually stored under /Library/Receipts. The library is fuzz-tested against MacOS's mkbom and lsbom utilities ensuring that it produces structurely the same output.

Installation

The easiest way to use stuckliste is via command line interface.

cargo install stuckliste-cli

Usage

As a command-line application

mkbom /tmp /tmp/receipt.bom
lsbom /tmp/receipt.bom

As a library

use std::fs::File;
use std::io::Error;
use stuckliste::receipt::{Receipt, ReceiptBuilder};

fn create_receipt() -> Result<(), Error> {
    let file = File::create("/tmp/receipt.bom")?;
    let receipt = ReceiptBuilder::new().create("/tmp")?;
    receipt.write(file)?;
    Ok(())
}

fn read_receipt() -> Result<(), Error> {
    let file = File::open("/tmp/receipt.bom")?;
    let receipt = Receipt::read(file)?;
    for (path, metadata) in receipt.entries()?.into_iter() {
        println!("{:?}: {:?}", path, metadata);
    }
    Ok(())
}

BOM reference

The BOM file structure is explained in a separate document.

References

This work is based on the following reverse-engineering efforts.

Commit count: 7

cargo fmt