/
View dependency graph
Depends on
- dh-golang (dh-golang)
- golang-defaults (golang-any)
- golang-github-ulikunitz-xz (golang-github-ulikunitz-xz-dev)
- golang-go.crypto (golang-golang-x-crypto-dev)
- golang-testify (golang-github-stretchr-testify-dev)
- golang-uber-goleak (golang-uber-goleak-dev)
- debhelper-compat, golang-github-datadog-zstd-dev, golang-github-xi2-xz-dev
README (full)
Go RPM Utils
go-rpmutils is a library written in go for parsing and extracting content from RPMs.
Overview
go-rpmutils provides a few interfaces for handling RPM packages. There is a highlevel Rpm struct that provides access to the RPM header and CPIO payload. The CPIO payload can be extracted to a filesystem location via the ExpandPayload function or through a Reader interface, similar to the tar implementation in the go standard library.
Example
// Opening a RPM file
f, err := os.Open("foo.rpm")
if err != nil {
panic(err)
}
rpm, err := rpmutils.ReadRpm(f)
if err != nil {
panic(err)
}
// Getting metadata
nevra, err := rpm.Header.GetNEVRA()
if err != nil {
panic(err)
}
fmt.Println(nevra)
provides, err := rpm.Header.GetStrings(rpmutils.PROVIDENAME)
if err != nil {
panic(err)
}
fmt.Println("Provides:")
for _, p := range provides {
fmt.Println(p)
}
// Extracting payload
if err := rpm.ExpandPayload("destdir"); err != nil {
panic(err)
}
Contributing
- Read contributor agreement
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -a). Make sure to include a Signed-off-by line per the contributor agreement. - Push to the branch (
git push origin my-new-feature) - Create new Pull Request
License
go-rpmutils is released under the Apache 2.0 license. See LICENSE.
| dir | cpio/ |
| dir | debian/ |
| dir | fileutil/ |
| dir | testdata/ |
| file | .gitignore |
| file | ContributorAgreement.txt |
| file | LICENSE |
| file | README.md |
| file | SUPPORT.md |
| file | errors.go |
| file | fileinfo.go |
| file | filesigs.go |
| file | go.mod |
| file | go.sum |
| file | header.go |
| file | nevra.go |
| file | payload.go |
| file | rpmutils.go |
| file | rpmutils_test.go |
| file | signatures.go |
| file | signatures_test.go |
| file | tags.go |
| file | uncompress.go |
| file | uncompress_cgo.go |
| file | uncompress_nocgo.go |
| file | uncompress_test.go |
| file | vercmp.go |
| file | vercmp_test.go |
| file | verify.go |
| file | writeheader.go |