kumquat-buildroot/support
Gregory CLEMENT 7d2779ecbb support/script/pkg-stats: handle exception when version comparison fails
With python 3, when a package has a version number x-y-z instead of
x.y.z, then the version returned by LooseVersion can't be compared
which raises a TypeError exception:

Traceback (most recent call last):
  File "./support/scripts/pkg-stats", line 1062, in <module>
    __main__()
  File "./support/scripts/pkg-stats", line 1051, in __main__
    check_package_cves(args.nvd_path, {p.name: p for p in packages})
  File "./support/scripts/pkg-stats", line 613, in check_package_cves
    if pkg_name in packages and cve.affects(packages[pkg_name]):
  File "./support/scripts/pkg-stats", line 386, in affects
    return pkg_version <= cve_affected_version
  File "/usr/lib64/python3.8/distutils/version.py", line 58, in __le__
    c = self._cmp(other)
  File "/usr/lib64/python3.8/distutils/version.py", line 337, in _cmp
    if self.version < other.version:
TypeError: '<' not supported between instances of 'str' and 'int'

This patch handles this exception by adding a new return value when
the comparison can't be done. The code is adjusted to take of this
change. For now, a return value of CVE_UNKNOWN is handled the same way
as a CVE_DOESNT_AFFECT return value, but this can be improved later
on.

Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2020-07-12 21:22:55 +02:00
..
config-fragments support/config-fragments/autobuild: update OpenRISC toolchain 2020-04-02 23:42:24 +02:00
dependencies support/dependencies: add BR2_NEEDS_HOST_GCC_PLUGIN_SUPPORT 2020-07-12 11:20:27 +02:00
docker support/docker: add python3 2019-10-27 20:24:10 +01:00
download suport/download: fix git wrapper with submodules on older git versions 2020-06-17 22:58:22 +02:00
gnuconfig support/gnuconfig: update to 2020-04-26 2020-05-09 14:18:49 +02:00
kconfig support/kconfig/merge_config.sh: avoid false positive matches from comment lines 2018-11-24 10:11:15 +01:00
legal-info core/legal-info: update list of saved material in README 2020-01-18 18:38:42 +01:00
libtool support/libtool: add patch for newer versions 2014-12-21 13:21:56 +01:00
misc Makefile: make-4.3 now longer un-escapes \# in macros 2020-03-31 21:37:45 +02:00
scripts support/script/pkg-stats: handle exception when version comparison fails 2020-07-12 21:22:55 +02:00
testing support/testing: add python-gpiozero test 2020-06-18 21:45:00 +02:00