peridot/vendor/github.com/sassoftware/go-rpmutils
2023-08-27 06:00:13 +02:00
..
cpio govendor 2023-08-27 06:00:13 +02:00
fileutil govendor 2023-08-27 06:00:13 +02:00
.gitignore govendor 2023-08-27 06:00:13 +02:00
BUILD govendor 2023-08-27 06:00:13 +02:00
ContributorAgreement.txt govendor 2023-08-27 06:00:13 +02:00
errors.go govendor 2023-08-27 06:00:13 +02:00
fileinfo.go govendor 2023-08-27 06:00:13 +02:00
filesigs.go govendor 2023-08-27 06:00:13 +02:00
header.go govendor 2023-08-27 06:00:13 +02:00
LICENSE govendor 2023-08-27 06:00:13 +02:00
nevra.go govendor 2023-08-27 06:00:13 +02:00
payload.go govendor 2023-08-27 06:00:13 +02:00
README.md govendor 2023-08-27 06:00:13 +02:00
rpmutils.go govendor 2023-08-27 06:00:13 +02:00
signatures.go govendor 2023-08-27 06:00:13 +02:00
SUPPORT.md govendor 2023-08-27 06:00:13 +02:00
tags.go govendor 2023-08-27 06:00:13 +02:00
uncompress.go govendor 2023-08-27 06:00:13 +02:00
uncompress_cgo.go govendor 2023-08-27 06:00:13 +02:00
uncompress_nocgo.go govendor 2023-08-27 06:00:13 +02:00
vercmp.go govendor 2023-08-27 06:00:13 +02:00
verify.go govendor 2023-08-27 06:00:13 +02:00
writeheader.go govendor 2023-08-27 06:00:13 +02:00

Go RPM Utils

Go Reference

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

  1. Read contributor agreement
  2. Fork it
  3. Create your feature branch (git checkout -b my-new-feature)
  4. Commit your changes (git commit -a). Make sure to include a Signed-off-by line per the contributor agreement.
  5. Push to the branch (git push origin my-new-feature)
  6. Create new Pull Request

License

go-rpmutils is released under the Apache 2.0 license. See LICENSE.