Hello. I am trying to write a script to parse a JSON file from mediathekviewweb API to script some movie downloading. However, this is working on my PC but not on my device. After some debugging I stumbled upon an unexpected error:
user@device:~$ cat resp10.txt | jq '.result.results | .[0].title | scan("foo")'
jq: error (at <stdin>:0): jq was compiled without ONIGURUMA regex libary. match/test/sub and related functions are not available.
Unfortunately, installing the oniguruma package does not help. I would like to ask for a second package version with onigurma as a dependency, so jq can perform regular expressions. I am not experienced enough to do this, I never compiled anything, I am used to scripting. I can work around this by using python and its json module, but this is an overkill of resources.
May I ask if someone is so kind to do this for me at some time?
Thank you all!
You may be able to accomplish your goal with the already installed tools on the router, if you are willing for it to be semi non-portable. Check out jsonfilter:
Well, I do not see any advantage over jq or I am too blind to see how I can use regex with jsonfilter. Althouh I could deal without for my specific use case it would be less generic. I prefer the more powerful jq and would like to use regex. I also want to use the functions scan (fails now), select and inside. The possibility to combine them in one statement is way easier and more efficient than doing this in shell loops. I guess this is what you mean with "semi non-portable".
Therefore, I would like to continue this feature request.
Yes, absolutely. As I said, I can work around this. Still, jq is a powerfull language and I would like to use it in its full feature-set.
I mean, we do have packages like mtr-json and mtr-nojson and a difference in size of 739 bytes (at least for my platform). The size difference for jq and jq-oniguruma would be sth. like 96641 bytes vs. 96641+170733 bytes. This is still better than higher level languages, enough to provide 2 packages and powerful enough to beat sed/awk in first place.
I may be a rare case, I can understand that. Still I think it is reasonable, is it?
That looks like a good idea to me. I just created my first github account and will create an issue the next days - when I am sure not to sth. stupid there.
There is precedent for having packages with different features versus size tradeoffs. For example, there are 9 different versions of wpad, supporting different TLS libraries and enabled features. So perhaps you can propose a "jq-full" package that has everything enabled.
It has been a while since my last attempt in this. After creating my Issue on github there has been no reaction for 3 month now. So I decided to do it myself.
Now, my problem is that I am a noob in relation to github. What would be the best way now? I have an idea about a pull request, but I do not know how to create one. Also, I am afraid there would be no reaction as like in the past 3 months. What would be the best in this case? Forking the jq package and become the maintainer of my own package jq-full? Sounds silly to me. Or can someone force a pull request? I do not have a good feeling with that either.
I modified the makefile, so that it will build two packages: jq and jq-full. The former will remain unchanged and the latter will have a dependency to the oniguruma library, so jq-full will have regex functions enabled.
It would not be smart to compile everything in, when the library is already there. The version without oniguruma was just told not to use it. So here are the numbers:
root@Ar150Van:~# opkg info jq
Package: jq
Version: 1.7.1-r1
Depends: libc
Status: install ok installed
Section: utils
Architecture: mips_24kc
Size: 118360
Filename: jq_1.7.1-r1_mips_24kc.ipk
Description: Lightweight and flexible command-line JSON processor.
root@Ar150Van:~# opkg info oniguruma5
Package: oniguruma5
Version: 6.9.9-r1
Depends: libc
Provides: oniguruma
Status: unknown ok not-installed
Section: libs
Architecture: mips_24kc
Size: 174816
Filename: oniguruma5_6.9.9-r1_mips_24kc.ipk
Description: Oniguruma is a modern and flexible regular expressions library.
It encompasses features from different regular expression implementations that
traditionally exist in different languages.
Character encoding can be specified per regular expression object.
The restricted jq version is 118360 bytes and the jq-full version is 120677 large. That is 2317 bytes difference.
Of course you have to add the oniguruma package, which is a dependency in jq-full. Its size is 174963 bytes in on my testing system (which is an ath79/genericGL.iNet GL-AR150). That is the real difference.