mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-13 01:20:24 +02:00
add install_date calculated fields
This commit is contained in:
12
EXAMPLES.md
12
EXAMPLES.md
@ -2503,9 +2503,11 @@ rpm_qia | jc --rpm_qi -p # or: jc -p rpm -qia
|
|||||||
"vendor": "CentOS",
|
"vendor": "CentOS",
|
||||||
"url": "http://www.gnu.org/software/make/",
|
"url": "http://www.gnu.org/software/make/",
|
||||||
"summary": "A GNU tool which simplifies the build process for users",
|
"summary": "A GNU tool which simplifies the build process for users",
|
||||||
"description": "A GNU tool for controlling the generation of executables and other non-source...",
|
"description": "A GNU tool for controlling the generation of executables and other...",
|
||||||
"build_epoch": 1565311645,
|
"build_epoch": 1565311645,
|
||||||
"build_epoch_utc": null
|
"build_epoch_utc": null,
|
||||||
|
"install_date_epoch": 1571242902,
|
||||||
|
"install_date_epoch_utc": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "kbd-legacy",
|
"name": "kbd-legacy",
|
||||||
@ -2525,9 +2527,11 @@ rpm_qia | jc --rpm_qi -p # or: jc -p rpm -qia
|
|||||||
"vendor": "CentOS",
|
"vendor": "CentOS",
|
||||||
"url": "http://ftp.altlinux.org/pub/people/legion/kbd",
|
"url": "http://ftp.altlinux.org/pub/people/legion/kbd",
|
||||||
"summary": "Legacy data for kbd package",
|
"summary": "Legacy data for kbd package",
|
||||||
"description": "The kbd-legacy package contains original keymaps for kbd package. Please note...",
|
"description": "The kbd-legacy package contains original keymaps for kbd package...",
|
||||||
"build_epoch": 1540939200,
|
"build_epoch": 1540939200,
|
||||||
"build_epoch_utc": null
|
"build_epoch_utc": null,
|
||||||
|
"install_date_epoch": 1565891588,
|
||||||
|
"install_date_epoch_utc": null
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
@ -5,9 +5,9 @@ jc - JSON CLI output utility `rpm -qi` command output parser
|
|||||||
|
|
||||||
Works with `rpm -qi [package]` or `rpm -qia`.
|
Works with `rpm -qi [package]` or `rpm -qia`.
|
||||||
|
|
||||||
The `build_epoch` calculated timestamp field is naive (i.e. based on the local time of the system the parser is run on)
|
The `..._epoch` calculated timestamp fields are naive (i.e. based on the local time of the system the parser is run on)
|
||||||
|
|
||||||
The `build_epoch_utc` calculated timestamp field is timezone-aware and is only available if the timezone field is UTC.
|
The `..._epoch_utc` calculated timestamp fields are timezone-aware and is only available if the timezone field is UTC.
|
||||||
|
|
||||||
Usage (cli):
|
Usage (cli):
|
||||||
|
|
||||||
@ -32,6 +32,8 @@ Schema:
|
|||||||
"release": string,
|
"release": string,
|
||||||
"architecture": string,
|
"architecture": string,
|
||||||
"install_date": string,
|
"install_date": string,
|
||||||
|
"install_date_epoch": integer, # naive timestamp
|
||||||
|
"install_date_epoch_utc": integer, # Aware timestamp if timezone is UTC
|
||||||
"group": string,
|
"group": string,
|
||||||
"size": integer,
|
"size": integer,
|
||||||
"license": string,
|
"license": string,
|
||||||
@ -73,9 +75,11 @@ Examples:
|
|||||||
"vendor": "CentOS",
|
"vendor": "CentOS",
|
||||||
"url": "http://www.gnu.org/software/make/",
|
"url": "http://www.gnu.org/software/make/",
|
||||||
"summary": "A GNU tool which simplifies the build process for users",
|
"summary": "A GNU tool which simplifies the build process for users",
|
||||||
"description": "A GNU tool for controlling the generation of executables and other non-source...",
|
"description": "A GNU tool for controlling the generation of executables and other...",
|
||||||
"build_epoch": 1565311645,
|
"build_epoch": 1565311645,
|
||||||
"build_epoch_utc": null
|
"build_epoch_utc": null,
|
||||||
|
"install_date_epoch": 1571242902,
|
||||||
|
"install_date_epoch_utc": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "kbd-legacy",
|
"name": "kbd-legacy",
|
||||||
@ -95,9 +99,11 @@ Examples:
|
|||||||
"vendor": "CentOS",
|
"vendor": "CentOS",
|
||||||
"url": "http://ftp.altlinux.org/pub/people/legion/kbd",
|
"url": "http://ftp.altlinux.org/pub/people/legion/kbd",
|
||||||
"summary": "Legacy data for kbd package",
|
"summary": "Legacy data for kbd package",
|
||||||
"description": "The kbd-legacy package contains original keymaps for kbd package. Please note...",
|
"description": "The kbd-legacy package contains original keymaps for kbd package...",
|
||||||
"build_epoch": 1540939200,
|
"build_epoch": 1540939200,
|
||||||
"build_epoch_utc": null
|
"build_epoch_utc": null,
|
||||||
|
"install_date_epoch": 1565891588,
|
||||||
|
"install_date_epoch_utc": null
|
||||||
},
|
},
|
||||||
...
|
...
|
||||||
]
|
]
|
||||||
@ -175,4 +181,4 @@ Returns:
|
|||||||
## Parser Information
|
## Parser Information
|
||||||
Compatibility: linux
|
Compatibility: linux
|
||||||
|
|
||||||
Version 1.1 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|
||||||
|
BIN
jc/man/jc.1.gz
BIN
jc/man/jc.1.gz
Binary file not shown.
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
Works with `rpm -qi [package]` or `rpm -qia`.
|
Works with `rpm -qi [package]` or `rpm -qia`.
|
||||||
|
|
||||||
The `build_epoch` calculated timestamp field is naive (i.e. based on the local time of the system the parser is run on)
|
The `..._epoch` calculated timestamp fields are naive (i.e. based on the local time of the system the parser is run on)
|
||||||
|
|
||||||
The `build_epoch_utc` calculated timestamp field is timezone-aware and is only available if the timezone field is UTC.
|
The `..._epoch_utc` calculated timestamp fields are timezone-aware and is only available if the timezone field is UTC.
|
||||||
|
|
||||||
Usage (cli):
|
Usage (cli):
|
||||||
|
|
||||||
@ -29,6 +29,8 @@ Schema:
|
|||||||
"release": string,
|
"release": string,
|
||||||
"architecture": string,
|
"architecture": string,
|
||||||
"install_date": string,
|
"install_date": string,
|
||||||
|
"install_date_epoch": integer, # naive timestamp
|
||||||
|
"install_date_epoch_utc": integer, # Aware timestamp if timezone is UTC
|
||||||
"group": string,
|
"group": string,
|
||||||
"size": integer,
|
"size": integer,
|
||||||
"license": string,
|
"license": string,
|
||||||
@ -70,9 +72,11 @@ Examples:
|
|||||||
"vendor": "CentOS",
|
"vendor": "CentOS",
|
||||||
"url": "http://www.gnu.org/software/make/",
|
"url": "http://www.gnu.org/software/make/",
|
||||||
"summary": "A GNU tool which simplifies the build process for users",
|
"summary": "A GNU tool which simplifies the build process for users",
|
||||||
"description": "A GNU tool for controlling the generation of executables and other non-source...",
|
"description": "A GNU tool for controlling the generation of executables and other...",
|
||||||
"build_epoch": 1565311645,
|
"build_epoch": 1565311645,
|
||||||
"build_epoch_utc": null
|
"build_epoch_utc": null,
|
||||||
|
"install_date_epoch": 1571242902,
|
||||||
|
"install_date_epoch_utc": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "kbd-legacy",
|
"name": "kbd-legacy",
|
||||||
@ -92,9 +96,11 @@ Examples:
|
|||||||
"vendor": "CentOS",
|
"vendor": "CentOS",
|
||||||
"url": "http://ftp.altlinux.org/pub/people/legion/kbd",
|
"url": "http://ftp.altlinux.org/pub/people/legion/kbd",
|
||||||
"summary": "Legacy data for kbd package",
|
"summary": "Legacy data for kbd package",
|
||||||
"description": "The kbd-legacy package contains original keymaps for kbd package. Please note...",
|
"description": "The kbd-legacy package contains original keymaps for kbd package...",
|
||||||
"build_epoch": 1540939200,
|
"build_epoch": 1540939200,
|
||||||
"build_epoch_utc": null
|
"build_epoch_utc": null,
|
||||||
|
"install_date_epoch": 1565891588,
|
||||||
|
"install_date_epoch_utc": null
|
||||||
},
|
},
|
||||||
...
|
...
|
||||||
]
|
]
|
||||||
@ -150,7 +156,7 @@ import jc.utils
|
|||||||
|
|
||||||
class info():
|
class info():
|
||||||
"""Provides parser metadata (version, author, etc.)"""
|
"""Provides parser metadata (version, author, etc.)"""
|
||||||
version = '1.1'
|
version = '1.2'
|
||||||
description = '`rpm -qi` command parser'
|
description = '`rpm -qi` command parser'
|
||||||
author = 'Kelly Brazil'
|
author = 'Kelly Brazil'
|
||||||
author_email = 'kellyjonbrazil@gmail.com'
|
author_email = 'kellyjonbrazil@gmail.com'
|
||||||
@ -191,6 +197,11 @@ def _process(proc_data):
|
|||||||
entry['build_epoch'] = timestamp.naive
|
entry['build_epoch'] = timestamp.naive
|
||||||
entry['build_epoch_utc'] = timestamp.utc
|
entry['build_epoch_utc'] = timestamp.utc
|
||||||
|
|
||||||
|
if 'install_date' in entry:
|
||||||
|
timestamp = jc.utils.timestamp(entry['install_date'])
|
||||||
|
entry['install_date_epoch'] = timestamp.naive
|
||||||
|
entry['install_date_epoch_utc'] = timestamp.utc
|
||||||
|
|
||||||
return proc_data
|
return proc_data
|
||||||
|
|
||||||
|
|
||||||
|
BIN
man/jc.1.gz
BIN
man/jc.1.gz
Binary file not shown.
2
tests/fixtures/centos-7.7/rpm-qai.json
vendored
2
tests/fixtures/centos-7.7/rpm-qai.json
vendored
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
|||||||
[{"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 ID 24c6a8a7f4a80eb5","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 users","description":"A GNU tool for controlling the generation of executables and other non-source files of a program from the program's source files. Make allows users to build and install packages without any significant knowledge about the details of the build process. The details about how the program should be built are provided for make in the program's makefile.","build_epoch":1565311645,"build_epoch_utc":null}]
|
[{"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 ID 24c6a8a7f4a80eb5","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 users","description":"A GNU tool for controlling the generation of executables and other non-source files of a program from the program's source files. Make allows users to build and install packages without any significant knowledge about the details of the build process. The details about how the program should be built are provided for make in the program's makefile.","build_epoch":1565311645,"build_epoch_utc":null,"install_date_epoch":1571242902,"install_date_epoch_utc":null}]
|
||||||
|
Reference in New Issue
Block a user