kellyjonbrazil / jc

CLI tool and python library that converts the output of popular command-line tools, file-types, and common strings to JSON, YAML, or Dictionaries. This allows piping of output to tools like jq and simplifying automation scripts.
MIT License
7.91k stars 210 forks source link

Debian Package index file parsing problem #613

Open scentoni opened 5 hours ago

scentoni commented 5 hours ago

This Debian Package index file has 20 stanzas, but jc is only returning 2. A little experimentation with modifying the input shows it's specifically returning only the first and last stanza listed in the input.

$ curl -sSO 'http://repo.aptly.info/dists/squeeze/main/binary-amd64/Packages'
$ grep Filename Packages |wc -l
      20
$ jc <Packages --pkg-index-deb |jq length                                                       
2
kellyjonbrazil commented 4 hours ago

Hi - thanks for reporting this. I wonder if this has to do with all of the packages having the same name. Hopefully won't be too hard to fix!

kellyjonbrazil commented 2 hours ago

I have a fix in the dev branch that will go in the next release. You can test the new parser by downloading the file[1] below to your parser plugin directory:

https://github.com/kellyjonbrazil/jc/blob/dev/jc/parsers/rpm_qi.py

Let me know if you run into any issues!

[1] Note that --pkg-index-deb is really just an alias to --rpm-qi