rpmdb

package module
v0.0.0-...-b871822 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2019 License: MIT Imports: 6 Imported by: 0

README

go-rpmdb

rpm database information

godoc.org

Example

pkgs, err := NVRs()
if err != nil { 
	// do the thing
}
for _, pkg := range pkgs {
	info, err := Info(pkg)
	if err != nil { 
		// do the thing
	}
	fmt.Printf("%s-%s-%s :: %s\n", info.Name(), info.Version(), info.Release(), info.Sourcerpm())
	//fmt.Printf("%#v\n", info)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NVRs

func NVRs() ([]string, error)

NVRs returns the set unique name-version-release of packages installed.

func NVRsAtPath

func NVRsAtPath(path string) ([]string, error)

NVRsAtPath returns the set unique name-version-release of packages installed at specified rootfs.

func Names

func Names() ([]string, error)

Names returns the list of RPM packages installed, on the current host's rootfs.

This is _just_ the simple name, which with kernels and multiarch can have duplicates. If you need unique keys, use NVRs().

func NamesAtPath

func NamesAtPath(path string) ([]string, error)

NamesAtPath returns the list of RPM packages installed at specified rootfs.

Types

type RPMHeader

type RPMHeader struct {
	XMLName xml.Name `xml:"rpmHeader" json:"-"`
	Tags    []RPMTag `xml:"rpmTag"`
}

RPMHeader is the root structure from rpmdb per package installed

func Info

func Info(nvr string) (*RPMHeader, error)

Info collects detailed information on the unique package name (or NVR) provided.

func InfoAtPath

func InfoAtPath(path, nvr string) (*RPMHeader, error)

InfoAtPath collects detailed information on the unique package name (or NVR) provided at the specified path.

func (RPMHeader) Arch

func (hdr RPMHeader) Arch() string

Arch is a convience for "Arch" tag name

func (RPMHeader) License

func (hdr RPMHeader) License() string

License is a convience for "License" tag name

func (RPMHeader) Name

func (hdr RPMHeader) Name() string

Name is a convience for "Name" tag name

func (RPMHeader) Release

func (hdr RPMHeader) Release() string

Release is a convience for "Release" tag name

func (RPMHeader) Sourcerpm

func (hdr RPMHeader) Sourcerpm() string

Sourcerpm is a convience for "Sourcerpm" tag name

func (RPMHeader) Tag

func (hdr RPMHeader) Tag(tagname string) []string

Tag fetches the set of information for the provided tag name

func (RPMHeader) TagNames

func (hdr RPMHeader) TagNames() []string

TagNames show the names of the tags available on this package object

func (RPMHeader) Version

func (hdr RPMHeader) Version() string

Version is a convience for "Version" tag name

type RPMTag

type RPMTag struct {
	Name   string   `xml:"name,attr"`
	Values []string `xml:",any"`
}

RPMTag is the encapsulation for each set of info per package

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL