1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-21 00:19:42 +02:00
Files
jc/docs/parsers/rpm_qi.md

207 lines
5.7 KiB
Markdown
Raw Normal View History

[Home](https://kellyjonbrazil.github.io/jc/)
2022-01-25 17:07:47 -08:00
<a id="jc.parsers.rpm_qi"></a>
# jc.parsers.rpm\_qi
2021-04-06 18:32:47 -07:00
jc - JSON CLI output utility `rpm -qi` command output parser
Works with `rpm -qi [package]` or `rpm -qia`.
2022-01-19 17:30:14 -08:00
The `..._epoch` calculated timestamp fields are naive. (i.e. based on the
local time of the system the parser is run on)
2021-04-06 18:32:47 -07:00
2022-01-19 17:30:14 -08:00
The `..._epoch_utc` calculated timestamp fields are timezone-aware and is
only available if the timezone field is UTC.
2021-04-06 18:32:47 -07:00
Usage (cli):
2022-01-25 17:07:47 -08:00
$ rpm -qia | jc --rpm-qi
2021-04-06 18:32:47 -07:00
2022-01-25 17:07:47 -08:00
or
2021-04-06 18:32:47 -07:00
2022-01-25 17:07:47 -08:00
$ jc rpm -qia
2021-04-06 18:32:47 -07:00
Usage (module):
2022-01-25 17:07:47 -08:00
import jc
result = jc.parse('rpm_qi', rpm_qi_command_output)
2022-01-18 15:38:03 -08:00
2022-01-25 17:07:47 -08:00
or
2022-01-18 15:38:03 -08:00
2022-01-25 17:07:47 -08:00
import jc.parsers.rpm_qi
result = jc.parsers.rpm_qi.parse(rpm_qi_command_output)
2021-04-06 18:32:47 -07:00
2021-04-08 15:52:49 -07:00
Schema:
2022-01-25 17:07:47 -08:00
[
{
"name": string,
"epoch": integer,
"version": string,
"release": string,
"architecture": string,
"install_date": string,
"install_date_epoch": integer, # [0]
"install_date_epoch_utc": integer, # [1]
"group": string,
"size": integer,
"license": string,
"signature": string,
"source_rpm": string,
"build_date": string,
"build_epoch": integer, # [0]
"build_epoch_utc": integer, # [1]
"build_host": string,
"relocations": string,
"packager": string,
"vendor": string,
"url": string,
"summary": string,
"description": string
}
]
[0] naive timestamp
[1] Aware timestamp if timezone is UTC
**Examples**:
$ rpm -qia | jc --rpm-qi -p
[
{
- `"name"` - "make",
- `"epoch"` - 1,
- `"version"` - "3.82",
- `"release"` - "24.el7",
- `"architecture"` - "x86_64",
- `"install_date"` - "Wed 16 Oct 2019 09:21:42 AM PDT",
- `"group"` - "Development/Tools",
- `"size"` - 1160660,
- `"license"` - "GPLv2+",
- `"signature"` - "RSA/SHA256, Thu 22 Aug 2019 02:34:59 PM PDT, Key ...",
- `"source_rpm"` - "make-3.82-24.el7.src.rpm",
- `"build_date"` - "Thu 08 Aug 2019 05:47:25 PM PDT",
- `"build_host"` - "x86-01.bsys.centos.org",
- `"relocations"` - "(not relocatable)",
- `"packager"` - "CentOS BuildSystem <http://bugs.centos.org>",
- `"vendor"` - "CentOS",
- `"url"` - "http://www.gnu.org/software/make/",
- `"summary"` - "A GNU tool which simplifies the build process for ...",
- `"description"` - "A GNU tool for controlling the generation of ex...",
- `"build_epoch"` - 1565311645,
- `"build_epoch_utc"` - null,
- `"install_date_epoch"` - 1571242902,
- `"install_date_epoch_utc"` - null
},
{
- `"name"` - "kbd-legacy",
- `"version"` - "1.15.5",
- `"release"` - "15.el7",
- `"architecture"` - "noarch",
- `"install_date"` - "Thu 15 Aug 2019 10:53:08 AM PDT",
- `"group"` - "System Environment/Base",
- `"size"` - 503608,
- `"license"` - "GPLv2+",
- `"signature"` - "RSA/SHA256, Mon 12 Nov 2018 07:17:49 AM PST, Key ...",
- `"source_rpm"` - "kbd-1.15.5-15.el7.src.rpm",
- `"build_date"` - "Tue 30 Oct 2018 03:40:00 PM PDT",
- `"build_host"` - "x86-01.bsys.centos.org",
- `"relocations"` - "(not relocatable)",
- `"packager"` - "CentOS BuildSystem <http://bugs.centos.org>",
- `"vendor"` - "CentOS",
- `"url"` - "http://ftp.altlinux.org/pub/people/legion/kbd",
- `"summary"` - "Legacy data for kbd package",
- `"description"` - "The kbd-legacy package contains original keymap...",
- `"build_epoch"` - 1540939200,
- `"build_epoch_utc"` - null,
- `"install_date_epoch"` - 1565891588,
- `"install_date_epoch_utc"` - null
},
...
]
$ rpm -qia | jc --rpm-qi -p -r
[
{
- `"name"` - "make",
- `"epoch"` - "1",
- `"version"` - "3.82",
- `"release"` - "24.el7",
- `"architecture"` - "x86_64",
- `"install_date"` - "Wed 16 Oct 2019 09:21:42 AM PDT",
- `"group"` - "Development/Tools",
- `"size"` - "1160660",
- `"license"` - "GPLv2+",
- `"signature"` - "RSA/SHA256, Thu 22 Aug 2019 02:34:59 PM PDT, Key ...",
- `"source_rpm"` - "make-3.82-24.el7.src.rpm",
- `"build_date"` - "Thu 08 Aug 2019 05:47:25 PM PDT",
- `"build_host"` - "x86-01.bsys.centos.org",
- `"relocations"` - "(not relocatable)",
- `"packager"` - "CentOS BuildSystem <http://bugs.centos.org>",
- `"vendor"` - "CentOS",
- `"url"` - "http://www.gnu.org/software/make/",
- `"summary"` - "A GNU tool which simplifies the build process for...",
- `"description"` - "A GNU tool for controlling the generation of exe..."
},
{
- `"name"` - "kbd-legacy",
- `"version"` - "1.15.5",
- `"release"` - "15.el7",
- `"architecture"` - "noarch",
- `"install_date"` - "Thu 15 Aug 2019 10:53:08 AM PDT",
- `"group"` - "System Environment/Base",
- `"size"` - "503608",
- `"license"` - "GPLv2+",
- `"signature"` - "RSA/SHA256, Mon 12 Nov 2018 07:17:49 AM PST, Key ...",
- `"source_rpm"` - "kbd-1.15.5-15.el7.src.rpm",
- `"build_date"` - "Tue 30 Oct 2018 03:40:00 PM PDT",
- `"build_host"` - "x86-01.bsys.centos.org",
- `"relocations"` - "(not relocatable)",
- `"packager"` - "CentOS BuildSystem <http://bugs.centos.org>",
- `"vendor"` - "CentOS",
- `"url"` - "http://ftp.altlinux.org/pub/people/legion/kbd",
- `"summary"` - "Legacy data for kbd package",
- `"description"` - "The kbd-legacy package contains original keymaps..."
},
...
]
<a id="jc.parsers.rpm_qi.info"></a>
## info Objects
2021-04-06 18:32:47 -07:00
```python
2022-01-25 17:07:47 -08:00
class info()
2021-04-06 18:32:47 -07:00
```
2022-01-25 17:07:47 -08:00
2021-04-08 15:52:49 -07:00
Provides parser metadata (version, author, etc.)
2021-04-06 18:32:47 -07:00
2022-01-25 17:07:47 -08:00
<a id="jc.parsers.rpm_qi.parse"></a>
#### parse
2021-04-06 18:32:47 -07:00
```python
2022-01-25 17:07:47 -08:00
def parse(data, raw=False, quiet=False)
2021-04-06 18:32:47 -07:00
```
Main text parsing function
2022-01-25 17:07:47 -08:00
**Arguments**:
2021-04-06 18:32:47 -07:00
2022-01-25 17:07:47 -08:00
- `data` - (string) text data to parse
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
2021-04-06 18:32:47 -07:00
2022-01-25 17:07:47 -08:00
**Returns**:
2021-04-06 18:32:47 -07:00
2022-01-25 17:07:47 -08:00
List of Dictionaries. Raw or processed structured data.
2021-04-06 18:32:47 -07:00
## Parser Information
Compatibility: linux
2021-12-01 16:12:51 -08:00
Version 1.4 by Kelly Brazil (kellyjonbrazil@gmail.com)