Skip to content
This repository has been archived by the owner on Feb 25, 2020. It is now read-only.

Commit

Permalink
backport path fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
aparcar committed Aug 17, 2019
1 parent 06d46df commit 0ba620f
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions patches/001-create-json-info-files.diff
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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":
Expand All @@ -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
Expand Down

0 comments on commit 0ba620f

Please sign in to comment.