From 6d5c434b1419f2c5c84549d5ef48b73f52f9e9d6 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Fri, 24 Nov 2023 05:10:12 -0500 Subject: [PATCH 1/2] build: ensure silent Make behavior for json scripts Run the invocation of Make with verbosity in order to prevent the printing of Makefile level and subtarget status. e.g. make[3] -C target/linux val.DEFAULT_PACKAGES val.ARCH_PACKAGES Remove piping of stderr, which is only useful when using the "communicate" method over the "run" method, and this script would not be written to handle a captured error anyway. For error testing, stdout and stderr can be set to a file object with the open() function like this: out = open('json_out', 'w') err = open('json_err', 'w') ... ... stdout=out, stderr=err, Signed-off-by: Michael Pratt (cherry picked from commit fd3376c5eeccc1f1753483ed31ffff03808ce31d) --- scripts/json_overview_image_info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/json_overview_image_info.py b/scripts/json_overview_image_info.py index 89b7d4fe20..0d2cf7f1ef 100755 --- a/scripts/json_overview_image_info.py +++ b/scripts/json_overview_image_info.py @@ -55,9 +55,9 @@ if output: "target/linux/", "val.DEFAULT_PACKAGES", "val.ARCH_PACKAGES", + "V=s", ], stdout=PIPE, - stderr=PIPE, check=True, env=environ.copy().update({"TOPDIR": Path().cwd()}), universal_newlines=True, From db554fd4502b2e9fb2ff669a9fbd65573f0b2007 Mon Sep 17 00:00:00 2001 From: Eric Fahlgren Date: Fri, 22 Nov 2024 09:00:25 -0800 Subject: [PATCH 2/2] build: profiles.json: add kernel version information MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently downstream tools like ASU lack information about kernel version to find out the relevant kmod build folder on downloads server. So lets fix it by providing a new `linux_kernel` JSON array which would for the start provide Linux kernel version, revision and vermagic information. "linux_kernel": { "release": "1", "vermagic": "b57450c07d3a786158c3601fc5cee57d", "version": "6.6.61" }, Fixes: openwrt/openwrt#17036 Fixes: efahl/owut#9 Co-developed-by: Petr Štetiar Signed-off-by: Eric Fahlgren Link: https://github.com/openwrt/openwrt/pull/17042 Signed-off-by: Petr Štetiar (cherry picked from commit c857145e034f623e31ab2028049a547ecd94ce85) --- scripts/json_overview_image_info.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/scripts/json_overview_image_info.py b/scripts/json_overview_image_info.py index 0d2cf7f1ef..96921c2743 100755 --- a/scripts/json_overview_image_info.py +++ b/scripts/json_overview_image_info.py @@ -47,7 +47,13 @@ for device_id, profile in output.get("profiles", {}).items(): if output: - default_packages, output["arch_packages"] = run( + ( + default_packages, + output["arch_packages"], + linux_version, + linux_release, + linux_vermagic, + ) = run( [ "make", "--no-print-directory", @@ -55,6 +61,9 @@ if output: "target/linux/", "val.DEFAULT_PACKAGES", "val.ARCH_PACKAGES", + "val.LINUX_VERSION", + "val.LINUX_RELEASE", + "val.LINUX_VERMAGIC", "V=s", ], stdout=PIPE, @@ -64,7 +73,11 @@ if output: ).stdout.splitlines() output["default_packages"] = sorted(default_packages.split()) - + output["linux_kernel"] = { + "version": linux_version, + "release": linux_release, + "vermagic": linux_vermagic, + } output_path.write_text(json.dumps(output, sort_keys=True, separators=(",", ":"))) else: print("JSON info file script could not find any JSON files for target")