summaryrefslogtreecommitdiffstats
path: root/bitbake/bin/bitbake-diffsigs
AgeCommit message (Collapse)Author
2024-02-08bitbake: bitbake-diffsigs: fix walking the task dependencies and show better ↵Martin Jansa
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-01-05bitbake: bitbake-diffsigs/runqueue: adapt to reworked find_siginfo()Alexander Kanavin
In particular having 'time' explicitly used as a sorting key should make it more clear how the entries are being sorted. (Bitbake rev: 5439aca056c84ab4410aaf24bdb68e896191d8e1) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-04-21bitbake: bitbake-diffsigs: Make PEP8 compliantMarius Kriegerowski
This ignores flake8 rules: * E402 module level import not at top of file * E501 line too long (Bitbake rev: e8b176de448dc387c7a578c92b52aef28591038f) Signed-off-by: Marius Kriegerowski <marius.kriegerowski@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-11-03bitbake: lib/bb: Clean up use of len()Richard Purdie
(Bitbake rev: bbbc843e86639604d00d76b1949b94a78cf1d95d) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-09-19bitbake: bitbake: enable python warnings at the first opportunityAlexander Kanavin
We really do want to see those, as they tend to turn into hard errors eventually, as what happened with collections vs collections.abc in python 3.10. (Bitbake rev: bc43fbb86361a21dc2d5deb910810c5a77fdabe8) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-04bitbake: bitbake: Drop duplicate license boilerplace textRichard Purdie
With the introduction of SPDX-License-Identifier headers, we don't need a ton of header boilerplate in every file. Simplify the files and rely on the top level for the full licence text. (Bitbake rev: 695d84397b68cc003186e22f395caa378b06bc75) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-04bitbake: bitbake: Add initial pass of SPDX license headers to source codeRichard Purdie
This adds the SPDX-License-Identifier license headers to the majority of our source files to make it clearer exactly which license files are under. The bulk of the files are under GPL v2.0 with one found to be under V2.0 or later, some under MIT and some have dual license. There are some files which are potentially harder to classify where we've imported upstream code and those can be handled specifically in later commits. The COPYING file is replaced with LICENSE.X files which contain the full license texts. (Bitbake rev: ff237c33337f4da2ca06c3a2c49699bc26608a6b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-04-23bitbake: bitbake-diffsigs: Use 4 spaces as indent for recursecbRobert Yang
It used 2 spaces as indent which wasn't clear enough, and might cause confusions, people might think it was in wrong format. Fixed: $ bitbake bc-native -ccleansstate -Snone $ bitbake bc-native -ccleansstate -Snone $ bitbake-diffsigs tmp/stamps/x86_64-linux/bc-native/1.07.1-r0.do_cleansstate.sigdata.* * Before: Hash for dependent task bc/bc_1.07.1.bb.do_clean:virtual:native changed from [foo] Taint (by forced/invalidated task) changed from [foo] Taint (by forced/invalidated task) changed from [foo] * Now Hash for dependent task bc/bc_1.07.1.bb.do_clean:virtual:native changed from [foo] Taint (by forced/invalidated task) changed from [foo] Taint (by forced/invalidated task) changed from [foo] (Bitbake rev: 5127a8d8e6d53f5f43a6ada7fd09b6b0c24ae989) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-01-03bitbake: bitbake-diffsigs: Support recursive deps with signature filesPeter Kjellerstedt
Follow dependent hash changes recursively also when specifying two signature files explicitly. Previously this was only done when using the --task option. (Bitbake rev: 353f0f3c77c3cdd75c1be2a565234a5e53dba3ef) Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-01-03bitbake: bitbake-diffsigs: Merge with bitbake-dumpsigPeter Kjellerstedt
The functionalities of bitbake-diffsigs and bitbake-dumpsig are so similar that they can be merged into one. Add an option --dump to make bitbake-diffsigs dump the last signature data instead of comparing it. Keep bitbake-dumpsig as a symbolic link to bitbake-diffsigs. When it is called as bitbake-dumpsig, it behaves as if --dump was specified. Also make -D the short option for --debug again (the way it used to be, and still was for bitbake-dumpsig), so that -d can be used as the short option for --dump. (Bitbake rev: 3635b829e4eb940ada2b52bfb5b5e5be93a3b0aa) Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-27bitbake: bitbake-diffsigs: fix regression after recent server changesPaul Eggleton
We were bridging the gap between the server and UI here by calling a bb.siggen.find_siginfo, a function defined and set on that module from the metadata. This worked from the UI side before but since the recent server changes is no longer accessible. Create a new command so this can execute on the server side and return the result by way of a new event. (We're still running compare_sigfiles() on the signature generator but that isn't quite the same thing and does still work.) Fixes [YOCTO #11844]. (Bitbake rev: fdcea991baa4f83d9c98d468d7b49c8c388a4a15) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-04-11bitbake: bitbake-diffsigs: fix traceback with no argumentsPaul Eggleton
In the move over to argparse we've made the two signature file arguments optional and thus if -t is not in use we need to explicitly check if at least one signature file has been specified - and if not, show an error and the command-line help. (Bitbake rev: 9011366689b26305281fcb2d412dcacece917e18) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-04-10bitbake: bitbake-diffsigs: colourise outputPaul Eggleton
If the output is a TTY, add colour to the output in order to make it easier to read. At the moment this is fairly basic, just add colour to the "titles" of each change and to the diff output. I tried to introduce this without changing the code too much - rather than moving everything over to the new python formatting style, I've introduced a color_format() function which takes care of the colour formatting, either accepting additional format arguments or alternatively leaving the caller to use the old-style formatting (%) to insert values. (Bitbake rev: 04a023c8fdea1e1812fcdcaf00345aab59f9abe1) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-04-10bitbake: bitbake-diffsigs: add an option to find and compare specific signaturesPaul Eggleton
With the -t option which recurses to find the ultimate cause of a signature change, it was hardcoded to take the last two executions of the specified task. On the other hand, if you have two specific task hashes (say from bitbake output, or some other tool) then you'll want to pick those, so provide an option to specify those as well. (Note, the new -s option needs to be specified alongside -t rather than instead of it.) (Bitbake rev: d9813b1a4223cf8dc80cab90e467ddf4bf8d1078) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-04-10bitbake: bitbake-diffsigs: change to use argparsePaul Eggleton
Argparse is a bit easier to deal with than optparse, and since we're about to add some options, migrate this script over. (Bitbake rev: 7f130e0b5ce6cfc6b35176465f260092cd3b3d64) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-04-10bitbake: lib/bb/siggen: show a diff when dumping changes to multi-line valuesPaul Eggleton
When dumping changes to signatures e.g. output of bitbake -s printdiff, if for example a function has changed, it's much more readable to see a unified diff of the changes rather than just printing the old function followed by the new function, so use difflib to do that. Note: I elected to keep to one item in the returned list per change, rather than one line per line of output, so that the caller can still look at changes individually if needed. Thus I've added some handling to bitbake-diffsigs to split the change into lines so that each line is displayed indented. (Bitbake rev: 4d254ae63a35231c98e3f73f669b040ed1144042) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-04-10bitbake: bitbake-diffsigs: drop naive logic for removing duplicate filesPaul Eggleton
This logic doesn't work in practice, certainly not with current versions where sigdata files are preserved in the stamps directory and therefore there will often be multiple sigdata files - you can now easily get files for the same signature from sstate and the stamps directory with the result that bitbake-diffsigs reports nothing has changed. Instead, let's change the find_siginfo function in OE-Core to simply not return duplicates so we don't have to filter them out here. (Bitbake rev: f0d7ab259d8ef95643e7229474b7850608aa4426) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-04-10bitbake: bitbake-diffsigs: properly report which signature is missingPaul Eggleton
If just one of the two signatures we want to compare aren't available, report that one rather than misleadingly claiming both are missing. (Bitbake rev: c87764b9147792a10efad3ed5378f36f0a055bc6) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-04-10bitbake: bitbake-diffsigs: fix -t picking wrong files to comparePaul Eggleton
We weren't picking the right files to compare here - according to the order in which the list is sorted (by mtime), we need to be taking the last two items and not the first two. (Bitbake rev: 99f49b56115b1f8d1a0a0b911da62ffd1f997b5f) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-27bitbake: lib/bb/msg: introduce logger_create() functionPaul Eggleton
We use this code to set up a logger with colour in a number of different places, so create one function that does this and make some of bitbake's utility scripts use it. (Bitbake rev: b1ba7d1cc8ec33e2d081230287abd07f52136097) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-23bitbake: bitbake-diffsigs: Add debug supportPeter Kjellerstedt
Currently shows the name of the signature files that were found when --task is used. (Bitbake rev: 751b06c25d22eea8240f9429cb49874082245e52) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-02bitbake: bitbake-diffsigs/bitbake-layers: Ensure tinfoil is shut down correctlyPaul Eggleton
We should always shut down tinfoil when we're finished with it, either by explicitly calling the shutdown() method or by using it as a context manager ("with ..."). (Bitbake rev: 131e6dc4bbd197774d35d2b266bfb0816f6e6b1e) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-06-02bitbake: bitbake: Convert to python 3Richard Purdie
Various misc changes to convert bitbake to python3 which don't warrant separation into separate commits. (Bitbake rev: d0f904d407f57998419bd9c305ce53e5eaa36b24) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-11bitbake: bin, toaster: Fix print and exception syntaxRichard Purdie
This updates the print "" syntax to print() and fixes some exception handling syntax such that its compatible with python v2 and v3. (Bitbake rev: 58304fcce9727fd89564436771356c033ecd22a3) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-04-17bitbake: bitbake-diffsigs: consider the situation where sigdata and siginfo ↵Chen Qi
files having the same hash values For now, `bitbake-diffsigs -t <recipe> <task>' doesn't work. It always outputs nothing. The problem is that bitbake-diffsigs are comparing sigdata and siginfo files that have the same hash value. This is not what we want. These two files are actually duplicates considering the purpose of bitbake-diffsigs. So we need to remove one of them so that bitbake-diffsigs could actually compare the correct signature files. (Bitbake rev: c34613eb69fd19770cbfc78ab8384221f10d5587) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-04-27bitbake: bitbake-diffsigs: Fix runtime error when no arguments are givenJacob Kroon
If bitbake-diffsigs is run without arguments it will error: Traceback (most recent call last): File "./bin/bitbake-diffsigs", line 121, in <module> if output: NameError: name 'output' is not defined Fix this by moving the check for output into the inner else-clause. (Bitbake rev: 7d3545a66863ad7183a7650b2af57eee091c45ae) Signed-off-by: Jacob Kroon <jacob.kroon@mikrodidakt.se> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-10-07bitbake: bitbake-diffsigs: improve error handlingPaul Eggleton
* Set up a logger independent of BitBake so we can log errors ourselves * Handle common errors without printing a traceback (Bitbake rev: 77b5f5b8dca4deebb06eeb06a8e7f2ccdbfff46f) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-10-07bitbake: bitbake-diffsigs: refactor argument parsing slightlyPaul Eggleton
* Use OptionParser to parse the two options to -t rather than trying to pick them out ourselves. * Add a description shown with --help output (Bitbake rev: daab42d19463b4108968fc88b207936e5ac84154) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-10-07bitbake: bitbake-diffsigs: handle if task name is specified without do_ prefixPaul Eggleton
Adjust the task name automatically if the -t option is specified with a task name that doesn't start with do_ (e.g. "configure" instead of "do_configure"). (Bitbake rev: d182cbc63745303ef2dc9fa2cbbf5d87a68e0b52) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-01-25bitbake: bitbake-diffigs: Don't pull in tinfoil unless we really need/plan ↵Richard Purdie
to use it This means we can run in parallel with other bitbake processed we're not in task mode. (Bitbake rev: 20222f2f16130e91eed5e68286188ee0e8f8f3bf) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-07bitbake: bitbake-diffsigs: allow specifying task & follow deps recursivelyPaul Eggleton
Add the ability to compare the two most recent runs of a specified task, and follow dependent hash changes recursively. This enables you to trace back and find exactly why a task was re-run after the fact. Note that this relies on the metadata providing a function, hooked in as bb.siggen.find_siginfo, which allows searching in the appropriate places to find signature data files. (Bitbake rev: cc70181659c07e04c205e17832846acf1ff31d28) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-07bitbake: lib/bb/siggen.py: make signature dump/compare functions return a listPaul Eggleton
These functions become a little bit more reusable if they return a list containing the output rather than just printing it. (Bitbake rev: a0ad2a947b71abcc0a1244cf139b9e9dfd8ee049) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2010-09-30bitbake/bitbake-sigdiff: Extend to handle dumping single state siginfo filesRichard Purdie
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2010-09-03bitbake: Add missing signature filesRichard Purdie
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>