rpmdb

package
Version: v0.0.0-...-9249993 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2021 License: MIT Imports: 9 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// ref. https://github.com/rpm-software-management/rpm/blob/rpm-4.14.3-release/lib/rpmtag.h#L34
	RPMTAG_HEADERIMAGE      = 61
	RPMTAG_HEADERSIGNATURES = 62
	RPMTAG_HEADERIMMUTABLE  = 63
	HEADER_I18NTABLE        = 100
	RPMTAG_HEADERI18NTABLE  = HEADER_I18NTABLE

	// rpmTag_e
	// ref. https://github.com/rpm-software-management/rpm/blob/rpm-4.14.3-release/lib/rpmtag.h#L34
	RPMTAG_NAME       = 1000
	RPMTAG_VERSION    = 1001
	RPMTAG_RELEASE    = 1002
	RPMTAG_EPOCH      = 1003
	RPMTAG_ARCH       = 1022
	RPMTAG_SOURCERPM  = 1044
	RPMTAG_SIZE       = 1009
	RPMTAG_LICENSE    = 1014
	RPMTAG_VENDOR     = 1011
	RPMTAG_DIRINDEXES = 1116
	RPMTAG_BASENAMES  = 1117
	RPMTAG_DIRNAMES   = 1118

	// rpmTag_enhances
	// https://github.com/rpm-software-management/rpm/blob/rpm-4.16.0-release/lib/rpmtag.h#L375
	RPMTAG_MODULARITYLABEL = 5096

	// rpmTagType_e
	// ref. https://github.com/rpm-software-management/rpm/blob/rpm-4.14.3-release/lib/rpmtag.h#L431
	RPM_MIN_TYPE          = 0
	RPM_NULL_TYPE         = 0
	RPM_CHAR_TYPE         = 1
	RPM_INT8_TYPE         = 2
	RPM_INT16_TYPE        = 3
	RPM_INT32_TYPE        = 4
	RPM_INT64_TYPE        = 5
	RPM_STRING_TYPE       = 6
	RPM_BIN_TYPE          = 7
	RPM_STRING_ARRAY_TYPE = 8
	RPM_I18NSTRING_TYPE   = 9
	RPM_MAX_TYPE          = 9
)

Variables

View Source
var (
	// docker run --rm -it centos:5 bash
	// rpm -qa --queryformat "\{%{EPOCH}, \"%{NAME}\", \"%{VERSION}\", \"%{RELEASE}\", \"%{ARCH}\"\, \"%{SOURCERPM}\", %{SIZE}, \"%{LICENSE}\", \"%{VENDOR}\", \"\", nil, nil, nil\},\n" | sed "s/(none)/0/g"
	CentOS5Plain = []*PackageInfo{}/* 110 elements not displayed */

	// docker run --rm -it centos:6 bash
	// yum groupinstall -y "Development tools"
	// rpm -qa --queryformat "\{%{EPOCH}, \"%{NAME}\", \"%{VERSION}\", \"%{RELEASE}\", \"%{ARCH}\", \"%{SOURCERPM}\", %{SIZE}, \"%{LICENSE}\", \"%{VENDOR}\", \"\", nil, nil, nil\},\n" | sed "s/^{(none)/{0/g" | sed "s/(none)//g"
	CentOS6DevTools = []*PackageInfo{}/* 263 elements not displayed */

	// docker run --rm -it centos:6 bash
	// yum groupinstall -y "Development tools"
	// yum install -y rpm-build redhat-rpm-config asciidoc hmaccalc perl-ExtUtils-Embed pesign xmlto
	// yum install -y audit-libs-devel binutils-devel elfutils-devel elfutils-libelf-devel java-devel
	// yum install -y ncurses-devel newt-devel numactl-devel pciutils-devel python-devel zlib-devel
	// yum install -y net-tools bc
	// rpm -qa --queryformat "\{%{EPOCH}, \"%{NAME}\", \"%{VERSION}\", \"%{RELEASE}\", \"%{ARCH}\", \"%{SOURCERPM}\", %{SIZE}, \"%{LICENSE}\", \"%{VENDOR}\", \"\", nil, nil, nil\},\n" | sed "s/^{(none)/{0/g" | sed "s/(none)//g"
	CentOS6Many = []*PackageInfo{}/* 326 elements not displayed */

	// docker run --rm -it centos:6 bash
	// rpm -qa --queryformat "\{%{EPOCH}, \"%{NAME}\", \"%{VERSION}\", \"%{RELEASE}\", \"%{ARCH}\"\, \"%{SOURCERPM}\", %{SIZE}, \"%{LICENSE}\", \"%{VENDOR}\", \"\", nil, nil, nil\},\n" | sed "s/(none)/0/g"
	CentOS6Plain = []*PackageInfo{}/* 129 elements not displayed */

	// docker run --rm -it centos:7 bash
	// yum groupinstall -y "Development tools"
	// rpm -qa --queryformat "\{%{EPOCH}, \"%{NAME}\", \"%{VERSION}\", \"%{RELEASE}\", \"%{ARCH}\", \"%{SOURCERPM}\", %{SIZE}, \"%{LICENSE}\", \"%{VENDOR}\", \"\", nil, nil, nil\},\n" | sed "s/^{(none)/{0/g" | sed "s/(none)//g"
	CentOS7DevTools = []*PackageInfo{}/* 264 elements not displayed */

	// docker run --rm -it centos/httpd-24-centos7 bash
	// rpm -qa --queryformat "\{%{EPOCH}, \"%{NAME}\", \"%{VERSION}\", \"%{RELEASE}\", \"%{ARCH}\", \"%{SOURCERPM}\", %{SIZE}, \"%{LICENSE}\", \"%{VENDOR}\", \"\", nil, nil, nil\},\n" | sed "s/^{(none)/{0/g" | sed "s/(none)//g"
	CentOS7Httpd24 = []*PackageInfo{}/* 225 elements not displayed */

	// docker run --rm -it centos:7 bash
	// yum groupinstall -y "Development tools"
	// yum install -y rpm-build redhat-rpm-config asciidoc hmaccalc perl-ExtUtils-Embed pesign xmlto
	// yum install -y audit-libs-devel binutils-devel elfutils-devel elfutils-libelf-devel java-devel
	// yum install -y ncurses-devel newt-devel numactl-devel pciutils-devel python-devel zlib-devel
	// yum install -y net-tools bc
	// rpm -qa --queryformat "\{%{EPOCH}, \"%{NAME}\", \"%{VERSION}\", \"%{RELEASE}\", \"%{ARCH}\", \"%{SOURCERPM}\", %{SIZE}, \"%{LICENSE}\", \"%{VENDOR}\", \"\", nil, nil, nil\},\n" | sed "s/^{(none)/{0/g" | sed "s/(none)//g"
	CentOS7Many = []*PackageInfo{}/* 396 elements not displayed */

	// docker run --rm -it centos:7 bash
	// rpm -qa --queryformat "\{%{EPOCH}, \"%{NAME}\", \"%{VERSION}\", \"%{RELEASE}\", \"%{ARCH}\", \"%{SOURCERPM}\", %{SIZE}, \"%{LICENSE}\", \"%{VENDOR}\", \"\", nil, nil, nil\},\n" | sed "s/(none)/0/g"
	CentOS7Plain = []*PackageInfo{}/* 144 elements not displayed */

	// docker run --rm -it centos/python-35-centos7 bash
	// rpm -qa --queryformat "\{%{EPOCH}, \"%{NAME}\", \"%{VERSION}\", \"%{RELEASE}\", \"%{ARCH}\", \"%{SOURCERPM}\", %{SIZE}, \"%{LICENSE}\", \"%{VENDOR}\", \"\", nil, nil, nil\},\n" | sed "s/^{(none)/{0/g" | sed "s/(none)//g"
	CentOS7Python35 = []*PackageInfo{}/* 344 elements not displayed */

	// docker run --rm -it centos:8 bash
	// yum module install -y container-tools
	// yum groupinstall -y "Development tools"
	// yum -y install nodejs podman-docker
	// rpm -qa --queryformat "\{%{EPOCH}, \"%{NAME}\", \"%{VERSION}\", \"%{RELEASE}\", \"%{ARCH}\", \"%{SOURCERPM}\", %{SIZE}, \"%{LICENSE}\", \"%{VENDOR}\", \"%{MODULARITYLABEL}\", nil, nil, nil\},\n" | sed "s/^{(none)/{0/g" | sed "s/(none)//g"
	CentOS8Modularitylabel = []*PackageInfo{}/* 518 elements not displayed */

	// rpm -ql python --dbpath /path/to/testdata/centos5-plain | awk '{printf "\"%s\",\n", $1}'
	CentOS5PythonInstalledFiles = []string{
		"/usr/bin/pydoc",
		"/usr/bin/python",
		"/usr/bin/python2",
		"/usr/bin/python2.4",
		"/usr/share/doc/python-2.4.3",
		"/usr/share/doc/python-2.4.3/LICENSE",
		"/usr/share/doc/python-2.4.3/README",
		"/usr/share/man/man1/python.1.gz",
	}

	// rpm -ql glibc --dbpath /path/to/testdata/centos6-plain | awk '{printf "\"%s\",\n", $1}'
	CentOS6GlibcInstalledFiles = []string{}/* 327 elements not displayed */

	CentOS8NodejsInstalledFiles = []string{
		"/usr/bin/node",
		"/usr/lib/.build-id",
		"/usr/lib/.build-id/4c",
		"/usr/lib/.build-id/4c/1f16ab7e1bbbf8f56dfbf1a098b6e6a6a9bbe4",
		"/usr/lib/node_modules",
		"/usr/lib/rpm/fileattrs/nodejs_native.attr",
		"/usr/lib/rpm/nodejs_native.req",
		"/usr/share/doc/nodejs",
		"/usr/share/doc/nodejs/AUTHORS",
		"/usr/share/doc/nodejs/CHANGELOG.md",
		"/usr/share/doc/nodejs/COLLABORATOR_GUIDE.md",
		"/usr/share/doc/nodejs/GOVERNANCE.md",
		"/usr/share/doc/nodejs/README.md",
		"/usr/share/licenses/nodejs",
		"/usr/share/licenses/nodejs/LICENSE",
		"/usr/share/man/man1/node.1.gz",
		"/usr/share/node",
		"/usr/share/systemtap",
		"/usr/share/systemtap/tapset",
		"/usr/share/systemtap/tapset/node.stp",
	}
)

Functions

func Htonl

func Htonl(val int32) int32

func HtonlU

func HtonlU(val uint32) uint32

Types

type PackageInfo

type PackageInfo struct {
	Epoch           int
	Name            string
	Version         string
	Release         string
	Arch            string
	SourceRpm       string
	Size            int
	License         string
	Vendor          string
	Modularitylabel string

	BaseNames  []string
	DirIndexes []int
	DirNames   []string
}

func (*PackageInfo) InstalledFiles

func (p *PackageInfo) InstalledFiles() ([]string, error)

type RpmDB

type RpmDB struct {
	// contains filtered or unexported fields
}

func Open

func Open(path string) (*RpmDB, error)

func (*RpmDB) ListPackages

func (d *RpmDB) ListPackages() ([]*PackageInfo, error)

func (*RpmDB) Package

func (d *RpmDB) Package(name string) (*PackageInfo, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL