summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-11-02 19:43:20 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-11-05 21:14:54 +0100
commit4cd885c3059005a0d63b7f07ac8fa09f61f1d9cf (patch)
treeda4a464bd6841cb19cbe8363a4082390c24c476b
parent6cf0c559dca2532b2ebb1ea7003496e0e75fd0e4 (diff)
downloadrtems-4cd885c3059005a0d63b7f07ac8fa09f61f1d9cf.tar.bz2
rtems-bsps: Use build specification items
Close #4123.
-rwxr-xr-xrtems-bsps31
1 files changed, 18 insertions, 13 deletions
diff --git a/rtems-bsps b/rtems-bsps
index 574ba1aad4..8f3a887b9d 100755
--- a/rtems-bsps
+++ b/rtems-bsps
@@ -32,11 +32,18 @@ from __future__ import print_function
import argparse
import os
import os.path
+import re
import sys
rtems_version = 6
+_BUILD_TYPE_BSP = re.compile(r"build-type:\s*bsp\n")
+_ARCH = re.compile(r"arch:\s*(\S+)\n")
+_FAMILY = re.compile(r"family:\s*(\S+)\n")
+_BSP = re.compile(r"bsp:\s*(\S+)\n")
+
+
class ArchBsps:
"""Collects and processes the BSPs for a range of architectures
creating output in text, markdown and HTML ir pandoc is installed"""
@@ -44,10 +51,10 @@ class ArchBsps:
self.trace = trace
self._output = []
self.top = os.path.realpath(path)
- self.base = os.path.join(self.top, 'bsps')
+ self.base = os.path.join(self.top, 'spec', 'build', 'bsps')
self.configs = []
self.archs = {}
- self._collect('.cfg')
+ self._collect('.yml')
self._process()
def _clear(self):
@@ -70,17 +77,15 @@ class ArchBsps:
"""Process the collected list of config files."""
self.archs = {}
for cfg in self.configs:
- config_path = cfg[len(self.base) + 1:]
- config_parts = config_path.split(os.sep)
- if len(config_parts) == 4:
- arch = config_parts[0]
- family = config_parts[1]
- bsp = os.path.splitext(config_parts[3])[0]
- if arch not in self.archs:
- self.archs[arch] = {}
- if family not in self.archs[arch]:
- self.archs[arch][family] = {}
- self.archs[arch][family][bsp] = config_path
+ with open(cfg, 'r') as cfg_file:
+ content = cfg_file.read()
+ if _BUILD_TYPE_BSP.search(content):
+ arch = _ARCH.search(content).group(1)
+ family = _FAMILY.search(content).group(1)
+ bsp = _BSP.search(content).group(1)
+ self.archs.setdefault(arch, {})
+ self.archs[arch].setdefault(family, {})
+ self.archs[arch][family][bsp] = cfg[len(self.base) + 1:]
def _max_arch_len(self):
"""Finds the longest arch label"""