kumquat-buildroot/support/scripts
Yann E. MORIN 5f253e3e04 support/scripts/cve: fix running on older ijson versions
Commit 22b6945552 (support/scripts/cve.py: switch from NVD to FKIE for
the JSON files) had to change the decompressor from gz to xz, as the new
location is using xz compression.

That commit mentioned that it was spawning an external xz process to do
the decompression, on the pretence that "there is no xz decompressor in
Python stdlib."

Before version 3.1, ijson.items() only accepted a file-like object as
input (that file-like object could yield bytes() or str(), both were
supported). Starting with version 3.1, ijson.items() also accepts that
it be directly passed bytes() or str() directly. subprocess.check_output()
means we are now passing bytes() to ijson.items(), so it fails on ijson
versions before 3.1, with failures such as:

    [...]
      File "/usr/lib/python3/dist-packages/ijson/backends/python.py", line 25, in Lexer
        if type(f.read(0)) == bytetype:
    AttributeError: 'bytes' object has no attribute 'read'

Ubuntu 20.04, on which the pkg-stats run to generate the daily report,
only has ijson 2.3. More recent distros have more recent versions of
ijson, like Fedora 39 that has 3.2.3, recent enough to support being fed
bytes(). Commit 22b6945552 was tested on Fedora 39, so did not catch
the issue.

However, the reasoning in 22b6945552 is wrong: there *is* the lzma
module, at least since python 3.3 (that is, aeons ago), which is able to
read xz-compressed files; it also has an API similar to the gzip module,
and can provide a file-like object that exposes the decompressed data.

So, do just that: provide an lzma-wrapped file-like object to ijson, so
that we can eventually recover our daily reports that everything is
broken! :-]

Note that this construct still works on recent versions!

Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2024-02-29 18:47:16 +01:00
..
apply-patches.sh support/scripts/: remove -E flag from patch call 2022-01-03 21:14:32 +01:00
boot-qemu-image.py support/scripts/boot-qemu-image.py: increase the timeout by 10 2022-07-27 15:56:57 +02:00
br2-external br2-external: make version of external trees available 2023-05-13 12:06:08 +02:00
brpkgutil.py support/scripts: use show-info to extract dependency graph 2019-05-07 23:03:41 +02:00
check-bin-arch package/guile: bump to version 3.0.4 2020-08-08 18:59:19 +02:00
check-dotconfig.py support: fix flake8 error E741 ambiguous variable name 2021-10-18 22:31:11 +02:00
check-host-rpath support/scripts: fix TABs/spaces in check-host-rpath 2022-07-30 18:15:08 +02:00
check-kernel-headers.sh support/scripts/check-kernel-headers.sh: do not print error for loose checks 2020-03-21 15:47:03 +01:00
check-merged-usr.sh skeleton-custom: use a script to check merged usr structure 2019-02-06 17:03:30 +01:00
cve.py support/scripts/cve: fix running on older ijson versions 2024-02-29 18:47:16 +01:00
expunge-gconv-modules toolchain: support gconv modules from glibc >= 2.34 2022-10-21 21:02:40 +02:00
fix-configure-powerpc64.sh support/scripts: fix shebang with bash 2017-06-08 21:43:05 +02:00
fix-rpath support/scripts: fix fix-rpath 2023-08-07 23:20:31 +02:00
gen-bootlin-toolchains support/scripts/gen-bootlin-toolchains: generate BR2_ARCH_NEEDS_GCC_AT_LEAST_X guard 2023-08-13 18:04:47 +02:00
generate-gitlab-ci-yml support/misc/gitlab-ci.yml.in: pass emulator builtin binaries as artifacts 2023-07-18 23:03:23 +02:00
genimage.sh support/scripts/genimage.sh: pass an empty rootpath to genimage 2019-10-27 12:19:32 +01:00
graph-build-time support/scripts/graph-build-time: add support for timeline graphing 2022-03-20 23:52:24 +01:00
graph-depends support: utils: use python3 explicitly 2021-09-22 21:30:24 +02:00
hardlink-or-copy support/scripts: fix shebang with bash 2017-06-08 21:43:05 +02:00
mkmakefile support/scripts/mkmakefile: make wrapper silent by default 2018-11-02 21:23:02 +01:00
mkusers support/scripts/mkusers: allow option for system uid/gid 2022-02-05 23:09:31 +01:00
pkg-stats support/scripts/pkg-stats: fix running on older python versions 2024-02-29 17:04:29 +01:00
pyinstaller.py package/pkg-python: clean conflicting pep517 packages before install 2022-08-22 11:54:25 +02:00
setlocalversion support/scripts/setlocalversion: fix/improve Mercurial output 2020-10-03 09:11:03 +02:00
size-stats support/scripts/size-stats: count compiled python (.pyc) files 2022-09-24 10:34:30 +02:00