poky/bitbake/bin
Martin Jansa 58155ea1a3 bitbake: bitbake-diffsigs: fix walking the task dependencies and show better error
* when comparing 2 tmp/stamps/*do_configure.sigdata* I got
  TypeError("filename must be a str or bytes object, or a file")
  but both files I was comparing were
  Zstandard compressed data (v0.8+), Dictionary ID: None
  according to "file"

  with TypeError catched to show which file it failed to open I got better
  error which shows it was trying to read "do_prepare_recipe_sysroot.sigdata"
  file now and after a while you might notice that it's not just the expected
  file, but a dict with 'path', 'sstate', 'time'.

  Fix that in bitbake-diffsigs but keep the TypeError and add OSError
  in case it will eventually walk on file which isn't zstd compressed
  pipecompress throws CompressionError.

ERROR: Failed to open {'path': '5.15.do_prepare_recipe_sysroot.sigdata.99b12a401341a0df7c3553cb00c87a7674295496bd5c25ed71764ee0d0fb8eb8', 'sstate': False, 'time': 1707136354.991718}: filename must be a str or bytes object, or a file
Traceback (most recent call last):
  File "bitbake/bin/bitbake-diffsigs", line 192, in <module>
    output = bb.siggen.compare_sigfiles(options.sigdatafile1, options.sigdatafile2, recursecb, color=color)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "bitbake/lib/bb/siggen.py", line 1039, in compare_sigfiles
    recout = recursecb(dep, a[dep], b[dep])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "bitbake/bin/bitbake-diffsigs", line 102, in recursecb
    out2 = bb.siggen.compare_sigfiles(hashfiles[hash1], hashfiles[hash2], recursecb, color=color)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "bitbake/lib/bb/siggen.py", line 857, in compare_sigfiles
    raise err
  File "bitbake/lib/bb/siggen.py", line 853, in compare_sigfiles
    with bb.compress.zstd.open(a, "rt", encoding="utf-8", num_threads=1) as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "bitbake/lib/bb/compress/zstd.py", line 12, in open
    return bb.compress._pipecompress.open_wrap(ZstdFile, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "bitbake/lib/bb/compress/_pipecompress.py", line 59, in open_wrap
    raise TypeError("filename must be a str or bytes object, or a file")
TypeError: filename must be a str or bytes object, or a file

* if I replace zstd file with just plaintext it fails with:
  $ echo foo > foo
  $ echo foo > bar
  $ bitbake-diffsigs foo bar
  zstd: /*stdin*\: unsupported format
  ERROR: Process died with 1
  sys:1: ResourceWarning: unclosed file <_io.BufferedReader name='foo'>

  with this change it shows the name of the file which it failed to uncompress:

  $ bitbake-diffsigs foo bar
  zstd: /*stdin*\: unsupported format
  ERROR: Failed to open sigdata file 'foo': Process died with 1
  ERROR: Process died with 1
  sys:1: ResourceWarning: unclosed file <_io.BufferedReader name='foo'>

(Bitbake rev: f3f843a4fd6e0a9e8f6edef5dd3cf1fce29c50ba)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-08 10:59:32 +00:00
..
bitbake bitbake: bitbake: Version bump for inherit_defer addition 2024-01-26 16:25:39 +00:00
bitbake-diffsigs bitbake: bitbake-diffsigs: fix walking the task dependencies and show better error 2024-02-08 10:59:32 +00:00
bitbake-dumpsig bitbake: bitbake-diffsigs: Merge with bitbake-dumpsig 2019-01-03 12:36:55 +00:00
bitbake-getvar bitbake: bitbake-getvar: Treat undefined variables as empty with --value 2023-09-28 12:38:26 +01:00
bitbake-hashclient bitbake: bitbake-hashclient: Add commands to get hashes 2023-12-02 18:04:23 +00:00
bitbake-hashserv bitbake: bitbake-hashserv: Add description of permissions 2023-12-18 09:18:01 +00:00
bitbake-layers bitbake: bitbake-layers: initialize tinfoil before registering command line arguments 2022-09-01 10:07:00 +01:00
bitbake-prserv bitbake: bitbake: Add copyright headers where missing 2022-08-12 11:49:29 +01:00
bitbake-selftest bitbake: bitbake: enable python warnings at the first opportunity 2021-09-19 11:33:14 +01:00
bitbake-server bitbake: bin/utils: Ensure locale en_US.UTF-8 is available on the system 2022-12-08 10:49:53 +00:00
bitbake-worker bitbake: bitbake-worker: add header with length of message 2023-11-06 16:45:11 +00:00
git-make-shallow bitbake: bitbake: Add copyright headers where missing 2022-08-12 11:49:29 +01:00
toaster bitbake: toaster: Write logs to BUILDDIR/toaster_logs 2023-10-27 08:32:29 +01:00
toaster-eventreplay bitbake: toaster: Added new feature to import eventlogs from command line into toaster using replay functionality 2023-12-12 15:58:57 +00:00