build: store default/device packages in JSON
authorPaul Spooren <mail@aparcar.org>
Tue, 30 Jun 2020 11:02:43 +0000 (01:02 -1000)
committerDaniel Golle <daniel@makrotopia.org>
Tue, 30 Jun 2020 22:21:10 +0000 (23:21 +0100)
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@makrotopia.org>
Signed-off-by: Paul Spooren <mail@aparcar.org>
include/image.mk
scripts/json_add_image_info.py
scripts/json_overview_image_info.py

index 984b64fb9c73d419e9f198efe2a50c5fba42a767..300f7a66195a30dffd5aa0718d69736578f49a8b 100644 (file)
@@ -592,6 +592,7 @@ define Device/Build/image
        DEVICE_ALT2_MODEL="$(DEVICE_ALT2_MODEL)" \
        DEVICE_ALT2_VARIANT="$(DEVICE_ALT2_VARIANT)" \
        DEVICE_TITLE="$(DEVICE_TITLE)" \
+       DEVICE_PACKAGES="$(DEVICE_PACKAGES)" \
        TARGET="$(BOARD)" \
        SUBTARGET="$(if $(SUBTARGET),$(SUBTARGET),generic)" \
        VERSION_NUMBER="$(VERSION_NUMBER)" \
index b6628113acbb01816bc4eb3141f74d8dd18d71b6..768bb102541ba3f4011c228c52b739709b950c11 100755 (executable)
@@ -54,6 +54,7 @@ image_info = {
                     "sha256": image_hash,
                 }
             ],
+            "device_packages": getenv("DEVICE_PACKAGES").split(),
             "supported_devices": getenv("SUPPORTED_DEVICES").split(),
             "titles": get_titles(),
         }
index a1418e366d6f963aa5ad8c4458aed996207bfd89..59d69df314e9e2820cbf4b28aea1959a93577fa3 100755 (executable)
@@ -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: