diff --git a/patches/001-create-json-info-files.diff b/patches/001-create-json-info-files.diff index 4cae25b..2025766 100644 --- a/patches/001-create-json-info-files.diff +++ b/patches/001-create-json-info-files.diff @@ -100,10 +100,10 @@ index 00000000000..31b8d1c123f + json.dump(device_info, json_file, sort_keys=True, indent=" ") diff --git a/scripts/json_device_merge.py b/scripts/json_device_merge.py new file mode 100755 -index 00000000000..ac2c10902bc +index 0000000000..3d8f70a95f --- /dev/null +++ b/scripts/json_device_merge.py -@@ -0,0 +1,62 @@ +@@ -0,0 +1,60 @@ +#!/usr/bin/env python3 + +import json @@ -119,14 +119,11 @@ index 00000000000..ac2c10902bc +targets_dir = os.path.join(bin_dir, "targets") + +for root, dirs, files in os.walk(targets_dir): ++ current_dir = root[len(targets_dir) + 1 :] + # check if root contains one slash aka target/subtarget -+ if len(root[len(targets_dir) + 1 :].count("/")) == 1: ++ if current_dir.count("/") == 1: + # initialize maps.json for target/subtarget -+ dev_map = { -+ "metadata_version": 1, -+ "target": root, -+ "devices": {}, -+ } ++ dev_map = {"metadata_version": 1, "target": current_dir, "devices": {}} + for file in files: + # ignore existing map.json files + if file.endswith(".json") and file != "map.json": @@ -141,20 +138,21 @@ index 00000000000..ac2c10902bc + # generate map entry for each supported device + for supported in dev_info["supported_devices"]: + dev_map["devices"][supported] = {} -+ dev_map["devices"][supported]["id"] = dev_info["id"] ++ dev_map["devices"][supported]["info"] = file + dev_map["devices"][supported]["sha256"] = dev_sha256 + + # path from overview.json to device info files -+ dev_path = "{}/{}/{}".format( -+ dev_info["target"], dev_info["subtarget"], file -+ ) ++ dev_path = "{}/{}".format(dev_info["target"], file) + + # add title(s) to overview + for title in dev_info.get("title"): + if title in dev_overview["devices"]: + print( -+ "WARNING: {} already exists in overview and will be overwritten".format( -+ title ++ "WARNING: '{}' pointing to '{}' already exists in overview and will be overwritten with '{}/{}'".format( ++ title, ++ dev_overview["devices"][title], ++ dev_info["target"], ++ file, + ) + ) + dev_overview["devices"][title] = dev_path