[openwrt/openwrt] build: store default/device packages in JSON

LEDE Commits lede-commits at lists.infradead.org
Mon Jul 13 16:46:48 EDT 2020


dangole pushed a commit to openwrt/openwrt.git, branch openwrt-19.07:
https://git.openwrt.org/e3618eb2cc210763fe1b309fd7e337fdf8a98f0b

commit e3618eb2cc210763fe1b309fd7e337fdf8a98f0b
Author: Paul Spooren <mail at aparcar.org>
AuthorDate: Tue Jun 30 01:02:43 2020 -1000

    build: store default/device packages in JSON
    
    With this commit the `profiles.json` contain both the target specific
    `default_packages` as well as the device specific `device_packages` as a
    array of strings.
    
    This information is required for downstream projects like the various
    web-based interactive firmware generators.
    
    Signed-off-by: Daniel Golle <daniel at makrotopia.org>
    Signed-off-by: Paul Spooren <mail at aparcar.org>
    (cherry picked from commit 263f7e5bbd119ebed1f514c16f659a2e2a2b132c)
---
 include/image.mk                    |  1 +
 scripts/json_add_image_info.py      |  1 +
 scripts/json_overview_image_info.py | 20 ++++++++++++++++++--
 3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/include/image.mk b/include/image.mk
index 15f4fe9d3b..a13f37f886 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -536,6 +536,7 @@ define Device/Build/image
 	IMAGE_TYPE=$(word 1,$(subst ., ,$(2))) \
 	IMAGE_PREFIX="$(IMAGE_PREFIX)" \
 	DEVICE_TITLE="$(DEVICE_TITLE)" \
+	DEVICE_PACKAGES="$(DEVICE_PACKAGES)" \
 	TARGET="$(BOARD)" \
 	SUBTARGET="$(if $(SUBTARGET),$(SUBTARGET),generic)" \
 	VERSION_NUMBER="$(VERSION_NUMBER)" \
diff --git a/scripts/json_add_image_info.py b/scripts/json_add_image_info.py
index b4d2dd8d71..d1599b514a 100755
--- a/scripts/json_add_image_info.py
+++ b/scripts/json_add_image_info.py
@@ -41,6 +41,7 @@ image_info = {
                     "sha256": image_hash,
                 }
             ],
+            "device_packages": getenv("DEVICE_PACKAGES").split(),
             "supported_devices": getenv("SUPPORTED_DEVICES").split(),
             "titles": get_titles(),
         }
diff --git a/scripts/json_overview_image_info.py b/scripts/json_overview_image_info.py
index a1418e366d..59d69df314 100755
--- a/scripts/json_overview_image_info.py
+++ b/scripts/json_overview_image_info.py
@@ -1,9 +1,10 @@
 #!/usr/bin/env python3
 
-import json
+from os import getenv, environ
 from pathlib import Path
-from os import getenv
+from subprocess import run
 from sys import argv
+import json
 
 if len(argv) != 2:
     print("JSON info files script requires ouput file as argument")
@@ -31,6 +32,21 @@ for json_file in work_dir.glob("*.json"):
                 image_info["profiles"][device_id]["images"][0]
             )
 
+
+output["default_packages"] = run(
+    [
+        "make",
+        "--no-print-directory",
+        "-C",
+        f"target/linux/{output['target'].split('/')[0]}",
+        "val.DEFAULT_PACKAGES",
+    ],
+    capture_output=True,
+    check=True,
+    env=environ.copy().update({"TOPDIR": Path().cwd()}),
+    text=True,
+).stdout.split()
+
 if output:
     output_path.write_text(json.dumps(output, sort_keys=True, separators=(",", ":")))
 else:



More information about the lede-commits mailing list