[Rpm-maint] [rpm-software-management/rpm] How to use C librpm API to query database and get package's header ? (Discussion #3322)

Daniel Alley notifications at github.com
Fri Sep 4 20:54:32 UTC 2026


Example using librpm.rs (the Rust bindings):

```Rust
use librpm::{Db, Index};

fn main() {
    librpm::init().expect("failed to initialize librpm");

    let db = Db::open().expect("failed to open RPM database");

    // Look up a package by name (exact match)
    println!("=== Find by Name ===");
    for pkg in db.find(Index::Name, "rpm") {
        println!("  {} — {}", pkg.nevra(), pkg.summary());
    }
}
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/discussions/3322#discussioncomment-18296157
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/repo-discussions/3322/comments/18296157 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20260904/7ddf4667/attachment.htm>


More information about the Rpm-maint mailing list