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
boot-qemu-image.py
br2-external br2-external: make version of external trees available 2023-05-13 12:06:08 +02:00
brpkgutil.py
check-bin-arch
check-dotconfig.py
check-host-rpath
check-kernel-headers.sh
check-merged-usr.sh
cve.py support/scripts/cve: fix running on older ijson versions 2024-02-29 18:47:16 +01:00
expunge-gconv-modules
fix-configure-powerpc64.sh
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
graph-build-time
graph-depends
hardlink-or-copy
mkmakefile
mkusers
pkg-stats support/scripts/pkg-stats: fix running on older python versions 2024-02-29 17:04:29 +01:00
pyinstaller.py
setlocalversion
size-stats