Metadata-Version: 2.1
Name: pyrpmdb
Version: 0.1.14
Summary: A utility to extract rpm package information from rpm database
Home-page: https://github.com/Mikemoore63/pyrpmdb
Author: Mike Moore
Author-email: z_z_zebra@yahoo.com
License: MIT
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
License-File: LICENSE

A python package that extracts go build information from go based executables, go.mod and go.sum files  and shared libraries. The package leverages the golang debug/buildinfo and golang.org/x/mod/modfile packages to extract the information hence relies on a shared library to do this work.

Example usage

```python

from pyrpmdb import get_rpm_db_info
import json


def test_get_info(file):
    res = get_rpm_db_info(file)
    print(json.dumps(res, indent=4))


test_get_info("foo/bar")
test_get_info("/usr/bin/du")
test_get_info("/Users/auser/go/src/spire/support/oidc-discovery-provider/oidc-discovery-provider.elf")
test_get_info("/Users/auser/go/src/spire/support/oidc-discovery-provider/oidc-discovery-provider.exe")
test_get_info("/Users/auser/go/src/spire/support/oidc-discovery-provider/oidc-discovery-provider")
test_get_info("/Users/auser/go/pygobuildinfo/pybuildInfo/_pyGoBuildinfo.cpython-39-darwin.so")
test_go_mod("/Users/auser/go/src/pygobuildInfo/go.mod")
test_go_sum("/Users/auser/go/src/pygobuildInfo/go.sum")
```

The result returned is always a dict object for errors  the dictionary returned contains a key;
"error" like;
```python
{
    "error": "path error:foo/bar"
}
```
or
```python
{
    "error": "/usr/bin/du: could not read Go build info from /usr/bin/du: unrecognized file format"
}
```
on success a python list of rpm package info struct is returned of this go structure serialized

```go
type PackageInfo struct {
	Epoch           *int
	Name            string
	Version         string
	Release         string
	Arch            string
	SourceRpm       string
	Size            int
	License         string
	Vendor          string
	Modularitylabel string
	Summary         string
	PGP             string
	SigMD5          string
	DigestAlgorithm DigestAlgorithm
	InstallTime     int
	BaseNames       []string
	DirIndexes      []int32
	DirNames        []string
	FileSizes       []int32
	FileDigests     []string
	FileModes       []uint16
	FileFlags       []int32
	UserNames       []string
	GroupNames      []string

	Provides []string
	Requires []string
}
```
```python
[
    {
        "Name": "package_name",
        "Version": "version"
    }
]
```
This spackage relies on a shared go library that leverages https://pkg.go.dev/github.com/knqyf263/go-rpmdb/pkg

So relies on this for database support.

