Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/knqyf263/go-rpmdb
RPM DB bindings for go
https://github.com/knqyf263/go-rpmdb
Last synced: 13 days ago
JSON representation
RPM DB bindings for go
- Host: GitHub
- URL: https://github.com/knqyf263/go-rpmdb
- Owner: knqyf263
- License: mit
- Created: 2019-04-27T07:36:56.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-05-23T04:49:43.000Z (6 months ago)
- Last Synced: 2024-10-14T20:36:44.072Z (29 days ago)
- Language: Go
- Size: 24.2 MB
- Stars: 59
- Watchers: 5
- Forks: 54
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-rpmdb
Library for enumerating packages in an RPM DB `Packages` file (without bindings).```go
package mainimport (
"fmt"
"log"rpmdb "github.com/knqyf263/go-rpmdb/pkg"
)func main() {
if err := run(); err != nil {
log.Fatal(err)
}
}
func run() error {
db, err := rpmdb.Open("./Packages")
if err != nil {
return err
}
pkgList, err := db.ListPackages()
if err != nil {
return err
}
defer db.Close()fmt.Println("Packages:")
for _, pkg := range pkgList {
fmt.Printf("\t%+v\n", *pkg)
// {Epoch:0 Name:m4 Version:1.4.16 Release:10.el7 Arch:x86_64}
// {Epoch:0 Name:zip Version:3.0 Release:11.el7 Arch:x86_64}
// ...
}
fmt.Printf("[Total Packages: %d]\n", len(pkgList))
return nil
}
```