]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commit
recipetool: create_npm: reuse license utils
authorEnguerrand de Ribaucourt <enguerrand.de-ribaucourt@savoirfairelinux.com>
Mon, 12 Aug 2024 12:28:29 +0000 (14:28 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 23 Aug 2024 08:49:13 +0000 (09:49 +0100)
commit7bc18bed63b94689890bcde63402d7cc1cedffa9
tree38ffef9f229295cbccac98c87247bb237300e4fa
parentf1ec28feaea8ea6a2df894dd4ddba561c8a04ed2
recipetool: create_npm: reuse license utils

create_npm.py duplicated the logic for matching licenses from files and
also finding them. This patch refactors the code to reuse the license
utils. This will make the code more maintainable and also align both
behaviors. For instance, some licenses weren't matched properly because
the duplicate logic did not support the difference in format in the md5
tables for COMMON_LICENSE_DIR and licenses.csv.

This is also faster since the license files were being read twice.
The result is slightly more accurate since the utils have better
implementations, and I was able to reuse the logic for the root PN
package, as well as the base LICENSE variable.

I chose to extract generate_common_licenses_chksums into create.py
since it can be considered a general utility function to allow
other recipetool creators to refer to COMMON_LICENSE_DIR files.

I updated the wording in the code when appropriate.

v3:
 - added commit
 - this replaces the commit that added all the COMMON_LICENSE_DIR md5
   to licenses.csv

Signed-off-by: Enguerrand de Ribaucourt <enguerrand.de-ribaucourt@savoirfairelinux.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/lib/recipetool/create.py
scripts/lib/recipetool/create_npm.py