[openwrt/openwrt] build,json: 3rd fixup of default_packages

LEDE Commits lede-commits at lists.infradead.org
Thu Mar 25 22:44:48 GMT 2021


aparcar pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/7880a648484eb9d9cda87078660567f2e7e565e2

commit 7880a648484eb9d9cda87078660567f2e7e565e2
Author: Paul Spooren <mail at aparcar.org>
AuthorDate: Thu Mar 25 10:25:54 2021 -1000

    build,json: 3rd fixup of default_packages
    
    This became a bit of a tragedy, caused by a corner cases which wasn't
    put into account during testing. DEFAULT_PACKAGES are defined in
    target/linux/<target>/Makefile but also in
    target/linux/<target>/<subtarget>/target.mk.
    
    The latter was no longer imported when using DUMP=1, however not using
    DUMP=1 while running the Makefile in target/linux/<target>/ caused duplicate
    packages in the list.
    
    As a solution, which should have been used from day 0, `make` runs in
    target/linux/ without DUMP=1, resulting in no duplicate packages and all
    inclusions from include/target.mk, linux/target/<target>/{Makefile,
    <subtarget>/target.mk}
    
    While at it, sort the list of default packages.
    
    Signed-off-by: Paul Spooren <mail at aparcar.org>
---
 scripts/json_overview_image_info.py | 23 +++++------------------
 1 file changed, 5 insertions(+), 18 deletions(-)

diff --git a/scripts/json_overview_image_info.py b/scripts/json_overview_image_info.py
index cd814a19c0..8dbd24af2d 100755
--- a/scripts/json_overview_image_info.py
+++ b/scripts/json_overview_image_info.py
@@ -33,28 +33,13 @@ for json_file in work_dir.glob("*.json"):
             )
 
 if output:
-    output["default_packages"] = run(
+    default_packages, output["arch_packages"] = run(
         [
             "make",
             "--no-print-directory",
             "-C",
-            "target/linux/{}".format(output["target"].split("/")[0]),
+            "target/linux/",
             "val.DEFAULT_PACKAGES",
-            "DUMP=1",
-        ],
-        stdout=PIPE,
-        stderr=PIPE,
-        check=True,
-        env=environ.copy().update({"TOPDIR": Path().cwd()}),
-        universal_newlines=True,
-    ).stdout.split()
-
-    output["arch_packages"] = run(
-        [
-            "make",
-            "--no-print-directory",
-            "-C",
-            "target/linux/{}".format(output["target"].split("/")[0]),
             "val.ARCH_PACKAGES",
         ],
         stdout=PIPE,
@@ -62,7 +47,9 @@ if output:
         check=True,
         env=environ.copy().update({"TOPDIR": Path().cwd()}),
         universal_newlines=True,
-    ).stdout.strip()
+    ).stdout.splitlines()
+
+    output["default_packages"] = sorted(default_packages.split())
 
     output_path.write_text(json.dumps(output, sort_keys=True, separators=(",", ":")))
 else:



More information about the lede-commits mailing list