Message ID | 97a9cde33a41915b3b4a9cb4f66ca891873ca767.1661071280.git.yann.morin.1998@free.fr |
---|---|
State | Accepted |
Headers | show |
Series | utils/genrandconfig: fix host-glibc version check (branch yem/gerandconfig-fixups) | expand |
>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes: > Unless explicitly told otherwise, subprocess.check_output() returns > bytes objects [0]. > When we try to check the C library version (to check the Linaro > toolchain is usable), genrandconfig currently fails with: > TypeError: cannot use a string pattern on a bytes-like object > So, as suggested in the python documentation, decocde() the output of > subprocess.check_output() before we can use it. > [0] https://docs.python.org/3/library/subprocess.html#subprocess.check_output > Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr> Committed to 2022.05.x and 2022.02.x, thanks.
diff --git a/utils/genrandconfig b/utils/genrandconfig index c6b3123feb..21d4592049 100755 --- a/utils/genrandconfig +++ b/utils/genrandconfig @@ -181,7 +181,7 @@ def is_toolchain_usable(configfile, config): 'BR2_TOOLCHAIN_EXTERNAL_LINARO_AARCH64_BE=y\n' in configlines or \ 'BR2_TOOLCHAIN_EXTERNAL_LINARO_ARMEB=y\n' in configlines: ldd_version_output = subprocess.check_output(['ldd', '--version']) - glibc_version = ldd_version_output.splitlines()[0].split()[-1] + glibc_version = ldd_version_output.decode().splitlines()[0].split()[-1] if StrictVersion('2.14') > StrictVersion(glibc_version): print("WARN: ignoring the Linaro ARM toolchains because too old host glibc", file=sys.stderr) return False
Unless explicitly told otherwise, subprocess.check_output() returns bytes objects [0]. When we try to check the C library version (to check the Linaro toolchain is usable), genrandconfig currently fails with: TypeError: cannot use a string pattern on a bytes-like object So, as suggested in the python documentation, decocde() the output of subprocess.check_output() before we can use it. [0] https://docs.python.org/3/library/subprocess.html#subprocess.check_output Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr> --- utils/genrandconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)