Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 705976 - Add JSON/YAML version of 'Packages' index file for easier machine parsing
Summary: Add JSON/YAML version of 'Packages' index file for easier machine parsing
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Binary packages support (show other bugs)
Hardware: All Linux
: Low enhancement (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-20 22:58 UTC by Michael 'veremitz' Everitt
Modified: 2020-01-21 00:06 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
script to convert ${PKGDIR}/Packages file to JSON (packages-to-json.py,693 bytes, text/x-python)
2020-01-20 23:45 UTC, Zac Medico
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael 'veremitz' Everitt 2020-01-20 22:58:04 UTC
Whilst the existing Packages index file may make sense for the current portage codebase, it's not the friendliest interchange format for searching/filtering.

Formatting into a JSON or YAML struct should make for much easier/quicker parsing with python Dictionaries, and in other tools/languages.

This could make filtering/indexing using such tools as emaint much faster (eg. for cleaning functions), especially when binpkg-multi-instance is in use, and multiple versions of a pkg-version may be present.
Comment 1 Fedja Beader 2020-01-20 23:02:54 UTC
JSON/YAML would make it really painful for shell parsing.
Comment 2 Michael 'veremitz' Everitt 2020-01-20 23:05:08 UTC
(In reply to Fedja Beader from comment #1)
> JSON/YAML would make it really painful for shell parsing.

The idea wouldn't necessarily be to replace the existing format (since we all know how much people love their shell scripts .. ;) ]
Comment 3 Zac Medico gentoo-dev 2020-01-20 23:45:39 UTC
Created attachment 603842 [details]
script to convert ${PKGDIR}/Packages file to JSON

$ python ./packages-to-json.py -h
usage: packages-to-json.py [-h] [input_file]

convert ${PKGDIR}/Packages file to JSON

positional arguments:
  input_file  default is stdin

optional arguments:
  -h, --help  show this help message and exit
Comment 4 Michael 'veremitz' Everitt 2020-01-21 00:06:38 UTC
(In reply to Zac Medico from comment #3)
> Created attachment 603842 [details]
> script to convert ${PKGDIR}/Packages file to JSON
> 
That's ..uh .. beautiful. Merge pl0x ?! :P