| 1 | [Home](https://kellyjonbrazil.github.io/jc/) |
| 2 | <a id="jc.parsers.rpm_qi"></a> |
| 3 | |
| 4 | # jc.parsers.rpm_qi |
| 5 | |
| 6 | jc - JSON Convert `rpm -qi` command output parser |
| 7 | |
| 8 | Works with `rpm -qi [package]` or `rpm -qia`. |
| 9 | |
| 10 | The `..._epoch` calculated timestamp fields are naive. (i.e. based on the |
| 11 | local time of the system the parser is run on) |
| 12 | |
| 13 | The `..._epoch_utc` calculated timestamp fields are timezone-aware and are |
| 14 | only available if the timezone field is UTC. |
| 15 | |
| 16 | Usage (cli): |
| 17 | |
| 18 | $ rpm -qia | jc --rpm-qi |
| 19 | |
| 20 | or |
| 21 | |
| 22 | $ jc rpm -qia |
| 23 | |
| 24 | Usage (module): |
| 25 | |
| 26 | import jc |
| 27 | result = jc.parse('rpm_qi', rpm_qi_command_output) |
| 28 | |
| 29 | Schema: |
| 30 | |
| 31 | [ |
| 32 | { |
| 33 | "name": string, |
| 34 | "epoch": integer, |
| 35 | "version": string, |
| 36 | "release": string, |
| 37 | "architecture": string, |
| 38 | "install_date": string, |
| 39 | "install_date_epoch": integer, # [0] |
| 40 | "install_date_epoch_utc": integer, # [1] |
| 41 | "group": string, |
| 42 | "size": integer, |
| 43 | "license": string, |
| 44 | "signature": string, |
| 45 | "source_rpm": string, |
| 46 | "build_date": string, |
| 47 | "build_epoch": integer, # [0] |
| 48 | "build_epoch_utc": integer, # [1] |
| 49 | "build_host": string, |
| 50 | "relocations": string, |
| 51 | "depends": [ |
| 52 | string |
| 53 | ], |
| 54 | "pre_depends": [ |
| 55 | string |
| 56 | ], |
| 57 | "recommends": [ |
| 58 | string |
| 59 | ], |
| 60 | "suggests": [ |
| 61 | string |
| 62 | ], |
| 63 | "conflicts": [ |
| 64 | string |
| 65 | ], |
| 66 | "breaks": [ |
| 67 | string |
| 68 | ], |
| 69 | "tag": [ |
| 70 | string |
| 71 | ], |
| 72 | "replaces": [ |
| 73 | string |
| 74 | ], |
| 75 | "packager": string, |
| 76 | "vendor": string, |
| 77 | "url": string, |
| 78 | "summary": string, |
| 79 | "description": string |
| 80 | } |
| 81 | ] |
| 82 | |
| 83 | [0] naive timestamp |
| 84 | [1] Aware timestamp if timezone is UTC |
| 85 | |
| 86 | Examples: |
| 87 | |
| 88 | $ rpm -qia | jc --rpm-qi -p |
| 89 | [ |
| 90 | { |
| 91 | "name": "make", |
| 92 | "epoch": 1, |
| 93 | "version": "3.82", |
| 94 | "release": "24.el7", |
| 95 | "architecture": "x86_64", |
| 96 | "install_date": "Wed 16 Oct 2019 09:21:42 AM PDT", |
| 97 | "group": "Development/Tools", |
| 98 | "size": 1160660, |
| 99 | "license": "GPLv2+", |
| 100 | "signature": "RSA/SHA256, Thu 22 Aug 2019 02:34:59 PM PDT, Key ...", |
| 101 | "source_rpm": "make-3.82-24.el7.src.rpm", |
| 102 | "build_date": "Thu 08 Aug 2019 05:47:25 PM PDT", |
| 103 | "build_host": "x86-01.bsys.centos.org", |
| 104 | "relocations": "(not relocatable)", |
| 105 | "packager": "CentOS BuildSystem <http://bugs.centos.org>", |
| 106 | "vendor": "CentOS", |
| 107 | "url": "http://www.gnu.org/software/make/", |
| 108 | "summary": "A GNU tool which simplifies the build process for ...", |
| 109 | "description": "A GNU tool for controlling the generation of ex...", |
| 110 | "build_epoch": 1565311645, |
| 111 | "build_epoch_utc": null, |
| 112 | "install_date_epoch": 1571242902, |
| 113 | "install_date_epoch_utc": null |
| 114 | }, |
| 115 | { |
| 116 | "name": "kbd-legacy", |
| 117 | "version": "1.15.5", |
| 118 | "release": "15.el7", |
| 119 | "architecture": "noarch", |
| 120 | "install_date": "Thu 15 Aug 2019 10:53:08 AM PDT", |
| 121 | "group": "System Environment/Base", |
| 122 | "size": 503608, |
| 123 | "license": "GPLv2+", |
| 124 | "signature": "RSA/SHA256, Mon 12 Nov 2018 07:17:49 AM PST, Key ...", |
| 125 | "source_rpm": "kbd-1.15.5-15.el7.src.rpm", |
| 126 | "build_date": "Tue 30 Oct 2018 03:40:00 PM PDT", |
| 127 | "build_host": "x86-01.bsys.centos.org", |
| 128 | "relocations": "(not relocatable)", |
| 129 | "packager": "CentOS BuildSystem <http://bugs.centos.org>", |
| 130 | "vendor": "CentOS", |
| 131 | "url": "http://ftp.altlinux.org/pub/people/legion/kbd", |
| 132 | "summary": "Legacy data for kbd package", |
| 133 | "description": "The kbd-legacy package contains original keymap...", |
| 134 | "build_epoch": 1540939200, |
| 135 | "build_epoch_utc": null, |
| 136 | "install_date_epoch": 1565891588, |
| 137 | "install_date_epoch_utc": null |
| 138 | }, |
| 139 | ... |
| 140 | ] |
| 141 | |
| 142 | $ rpm -qia | jc --rpm-qi -p -r |
| 143 | [ |
| 144 | { |
| 145 | "name": "make", |
| 146 | "epoch": "1", |
| 147 | "version": "3.82", |
| 148 | "release": "24.el7", |
| 149 | "architecture": "x86_64", |
| 150 | "install_date": "Wed 16 Oct 2019 09:21:42 AM PDT", |
| 151 | "group": "Development/Tools", |
| 152 | "size": "1160660", |
| 153 | "license": "GPLv2+", |
| 154 | "signature": "RSA/SHA256, Thu 22 Aug 2019 02:34:59 PM PDT, Key ...", |
| 155 | "source_rpm": "make-3.82-24.el7.src.rpm", |
| 156 | "build_date": "Thu 08 Aug 2019 05:47:25 PM PDT", |
| 157 | "build_host": "x86-01.bsys.centos.org", |
| 158 | "relocations": "(not relocatable)", |
| 159 | "packager": "CentOS BuildSystem <http://bugs.centos.org>", |
| 160 | "vendor": "CentOS", |
| 161 | "url": "http://www.gnu.org/software/make/", |
| 162 | "summary": "A GNU tool which simplifies the build process for...", |
| 163 | "description": "A GNU tool for controlling the generation of exe..." |
| 164 | }, |
| 165 | { |
| 166 | "name": "kbd-legacy", |
| 167 | "version": "1.15.5", |
| 168 | "release": "15.el7", |
| 169 | "architecture": "noarch", |
| 170 | "install_date": "Thu 15 Aug 2019 10:53:08 AM PDT", |
| 171 | "group": "System Environment/Base", |
| 172 | "size": "503608", |
| 173 | "license": "GPLv2+", |
| 174 | "signature": "RSA/SHA256, Mon 12 Nov 2018 07:17:49 AM PST, Key ...", |
| 175 | "source_rpm": "kbd-1.15.5-15.el7.src.rpm", |
| 176 | "build_date": "Tue 30 Oct 2018 03:40:00 PM PDT", |
| 177 | "build_host": "x86-01.bsys.centos.org", |
| 178 | "relocations": "(not relocatable)", |
| 179 | "packager": "CentOS BuildSystem <http://bugs.centos.org>", |
| 180 | "vendor": "CentOS", |
| 181 | "url": "http://ftp.altlinux.org/pub/people/legion/kbd", |
| 182 | "summary": "Legacy data for kbd package", |
| 183 | "description": "The kbd-legacy package contains original keymaps..." |
| 184 | }, |
| 185 | ... |
| 186 | ] |
| 187 | |
| 188 | <a id="jc.parsers.rpm_qi.parse"></a> |
| 189 | |
| 190 | ### parse |
| 191 | |
| 192 | ```python |
| 193 | def parse(data, raw=False, quiet=False) |
| 194 | ``` |
| 195 | |
| 196 | Main text parsing function |
| 197 | |
| 198 | Parameters: |
| 199 | |
| 200 | data: (string) text data to parse |
| 201 | raw: (boolean) unprocessed output if True |
| 202 | quiet: (boolean) suppress warning messages if True |
| 203 | |
| 204 | Returns: |
| 205 | |
| 206 | List of Dictionaries. Raw or processed structured data. |
| 207 | |
| 208 | ### Parser Information |
| 209 | Compatibility: linux |
| 210 | |
| 211 | Source: [`jc/parsers/rpm_qi.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/rpm_qi.py) |
| 212 | |
| 213 | Version 1.9 by Kelly Brazil ([email protected]) |