[openwrt/openwrt] build, json: fix build failure in case no data is found

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


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

commit 78f57fbce61ca26a04d2fcab4887228290ee2303
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Fri Jul 3 21:57:52 2020 +0100

    build,json: fix build failure in case no data is found
    
    Only collect arch_packages if actually generating any output.
    
    Fixes: commit f09b9319 ("build,json: store arch_packages in profiles.json"(
    Signed-off-by: Daniel Golle <daniel at makrotopia.org>
    Signed-off-by: Paul Spooren <mail at aparcar.org>
    (cherry picked from commit 3b0f698760ae3a62173a28f18e9e1e3adef9c492)
---
 scripts/json_overview_image_info.py | 34 ++++++++++++++++------------------
 1 file changed, 16 insertions(+), 18 deletions(-)

diff --git a/scripts/json_overview_image_info.py b/scripts/json_overview_image_info.py
index 20b14f236b..8f3525f890 100755
--- a/scripts/json_overview_image_info.py
+++ b/scripts/json_overview_image_info.py
@@ -32,25 +32,23 @@ for json_file in work_dir.glob("*.json"):
                 image_info["profiles"][device_id]["images"][0]
             )
 
-
-default_packages, output["arch_packages"] = run(
-    [
-        "make",
-        "--no-print-directory",
-        "-C",
-        f"target/linux/{output['target'].split('/')[0]}",
-        "val.DEFAULT_PACKAGES",
-        "val.ARCH_PACKAGES",
-    ],
-    capture_output=True,
-    check=True,
-    env=environ.copy().update({"TOPDIR": Path().cwd()}),
-    text=True,
-).stdout.splitlines()
-
-output["default_packages"] = default_packages.split()
-
 if output:
+    default_packages, output["arch_packages"] = run(
+        [
+            "make",
+            "--no-print-directory",
+            "-C",
+            f"target/linux/{output['target'].split('/')[0]}",
+            "val.DEFAULT_PACKAGES",
+            "val.ARCH_PACKAGES",
+        ],
+        capture_output=True,
+        check=True,
+        env=environ.copy().update({"TOPDIR": Path().cwd()}),
+        text=True,
+    ).stdout.splitlines()
+
+    output["default_packages"] = default_packages.split()
     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")



More information about the lede-commits mailing list