diff options
author | Wade Fife <wade.fife@ettus.com> | 2022-04-11 17:22:48 -0500 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2022-04-12 13:31:19 -0700 |
commit | c1f1f32d0b66d2f7bc9b59924792f2d8eb773710 (patch) | |
tree | 11a8f41e422b803e115730c317d63487f6164aa3 | |
parent | fc2242994be5234a93b5cc6f5677fdc0e0d3d093 (diff) | |
download | uhd-c1f1f32d0b66d2f7bc9b59924792f2d8eb773710.tar.gz uhd-c1f1f32d0b66d2f7bc9b59924792f2d8eb773710.tar.bz2 uhd-c1f1f32d0b66d2f7bc9b59924792f2d8eb773710.zip |
rfnoc: Update image builder to check for deprecated blocks
Adds checks for deprecated blocks (e.g., radio_1x64.yml instead of
radio.yml) as well as deprecated IO signature types (e.g., ctrl_port
instead of ctrlport).
Deprecated block descriptions are no longer parsed. Old IO signature
types are automatically converted to the new type. Warnings are
printed in both cases.
-rw-r--r-- | host/python/uhd/imgbuilder/image_builder.py | 76 |
1 files changed, 49 insertions, 27 deletions
diff --git a/host/python/uhd/imgbuilder/image_builder.py b/host/python/uhd/imgbuilder/image_builder.py index 54a06a02c..67ceb6fa9 100644 --- a/host/python/uhd/imgbuilder/image_builder.py +++ b/host/python/uhd/imgbuilder/image_builder.py @@ -57,6 +57,38 @@ DEVICE_DEFAULTTARGET_MAP = { 'n320': 'N320_XG', } +# List of blocks that have been replaced (old name : new name) +deprecated_block_yml_map = { + "radio_1x64.yml" : "radio.yml", + "radio_2x64.yml" : "radio.yml", + "axi_ram_fifo_2x64.yml" : "axi_ram_fifo.yml", + "axi_ram_fifo_4x64.yml" : "axi_ram_fifo.yml", +} + +# List of port names that have been replaced (old name : new name) +deprecated_port_name_map = { + "x300_radio" : "radio", + "radio_iface" : "radio", + "x300_radio0" : "radio0", + "x300_radio1" : "radio1", + "radio_ch0" : "radio0", + "radio_ch1" : "radio1", + "ctrl_port" : "ctrlport", + "ctrlport_radio" : "ctrlport", + "timekeeper" : "time", + "time_keeper" : "time", +} + +# List of IO signature types that have been replaced (old name : new name) +deprecated_port_type_map = { + "ctrl_port" : "ctrlport", + "time_keeper" : "timekeeper", + "radio_1x32" : "radio", + "radio_2x32" : "radio", + "radio_8x32" : "radio", + "x300_radio" : "radio", +} + # Adapted from code found at # https://stackoverflow.com/questions/5121931/ @@ -112,6 +144,13 @@ def expand_io_port_desc(io_ports, signatures): """ for io_port in io_ports.values(): wires = [] + if io_port["type"] in deprecated_port_type_map: + logging.warning( + "The IO signature type '" + io_port["type"] + + "' has been deprecated. Please update your block YAML to use '" + + deprecated_port_type_map[io_port["type"]] + "'." + ) + io_port["type"] = deprecated_port_type_map[io_port["type"]] for signature in signatures[io_port["type"]]["ports"]: width = signature.get("width", 1) wire_type = signature.get("type", None) @@ -192,48 +231,28 @@ class ImageBuilderConfig: Check if the configuration uses deprecated IO signatures or block descriptions. """ - # List of blocks that have been replaced (old name : new name) - block_yml_map = { - "radio_1x64.yml" : "radio.yml", - "radio_2x64.yml" : "radio.yml", - "axi_ram_fifo_2x64.yml" : "axi_ram_fifo.yml", - "axi_ram_fifo_4x64.yml" : "axi_ram_fifo.yml", - } - # List of port names that have been replaced (old name : new name) - port_name_map = { - "x300_radio" : "radio", - "radio_iface" : "radio", - "x300_radio0" : "radio0", - "x300_radio1" : "radio1", - "radio_ch0" : "radio0", - "radio_ch1" : "radio1", - "ctrl_port" : "ctrlport", - "ctrlport_radio" : "ctrlport", - "timekeeper" : "time", - "time_keeper" : "time", - } # Go through blocks and look for any deprecated descriptions for name, block in self.noc_blocks.items(): desc = block['block_desc'] - if desc in block_yml_map: + if desc in deprecated_block_yml_map: logging.warning( "The block description '" + desc + "' has been deprecated. Please update your image to use '" + - block_yml_map[desc] + "'." + deprecated_block_yml_map[desc] + "'." ) # Override the block with the new version - block['block_desc'] = block_yml_map[desc] + block['block_desc'] = deprecated_block_yml_map[desc] # Go through port connections and look for deprecated names for con in self.connections: for port in ('srcport', 'dstport'): - if con[port] in port_name_map: + if con[port] in deprecated_port_name_map: logging.warning( "The port name '" + con[port] + "' has been deprecated. " "Please update your image to use '" + - port_name_map[con[port]] + "'." + deprecated_port_name_map[con[port]] + "'." ) # Override the name with the new version - con[port] = port_name_map[con[port]] + con[port] = deprecated_port_name_map[con[port]] def _check_configuration(self): """ @@ -668,7 +687,10 @@ def read_block_descriptions(signatures, *paths): if re.match(r".*\.yml$", filename): with open(os.path.join(root, filename)) as stream: block = ordered_load(stream) - if "schema" in block and \ + if filename in deprecated_block_yml_map: + logging.warning("Skipping deprecated block description " + "%s (%s).", filename, os.path.normpath(root)) + elif "schema" in block and \ block["schema"] == "rfnoc_modtool_args": logging.info("Adding block description from " "%s (%s).", filename, os.path.normpath(root)) |