forked from Imagelibrary/rtems
31
rtems-bsps
31
rtems-bsps
@@ -32,11 +32,18 @@ from __future__ import print_function
|
|||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
rtems_version = 6
|
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:
|
class ArchBsps:
|
||||||
"""Collects and processes the BSPs for a range of architectures
|
"""Collects and processes the BSPs for a range of architectures
|
||||||
creating output in text, markdown and HTML ir pandoc is installed"""
|
creating output in text, markdown and HTML ir pandoc is installed"""
|
||||||
@@ -44,10 +51,10 @@ class ArchBsps:
|
|||||||
self.trace = trace
|
self.trace = trace
|
||||||
self._output = []
|
self._output = []
|
||||||
self.top = os.path.realpath(path)
|
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.configs = []
|
||||||
self.archs = {}
|
self.archs = {}
|
||||||
self._collect('.cfg')
|
self._collect('.yml')
|
||||||
self._process()
|
self._process()
|
||||||
|
|
||||||
def _clear(self):
|
def _clear(self):
|
||||||
@@ -70,17 +77,15 @@ class ArchBsps:
|
|||||||
"""Process the collected list of config files."""
|
"""Process the collected list of config files."""
|
||||||
self.archs = {}
|
self.archs = {}
|
||||||
for cfg in self.configs:
|
for cfg in self.configs:
|
||||||
config_path = cfg[len(self.base) + 1:]
|
with open(cfg, 'r') as cfg_file:
|
||||||
config_parts = config_path.split(os.sep)
|
content = cfg_file.read()
|
||||||
if len(config_parts) == 4:
|
if _BUILD_TYPE_BSP.search(content):
|
||||||
arch = config_parts[0]
|
arch = _ARCH.search(content).group(1)
|
||||||
family = config_parts[1]
|
family = _FAMILY.search(content).group(1)
|
||||||
bsp = os.path.splitext(config_parts[3])[0]
|
bsp = _BSP.search(content).group(1)
|
||||||
if arch not in self.archs:
|
self.archs.setdefault(arch, {})
|
||||||
self.archs[arch] = {}
|
self.archs[arch].setdefault(family, {})
|
||||||
if family not in self.archs[arch]:
|
self.archs[arch][family][bsp] = cfg[len(self.base) + 1:]
|
||||||
self.archs[arch][family] = {}
|
|
||||||
self.archs[arch][family][bsp] = config_path
|
|
||||||
|
|
||||||
def _max_arch_len(self):
|
def _max_arch_len(self):
|
||||||
"""Finds the longest arch label"""
|
"""Finds the longest arch label"""
|
||||||
|
|||||||
Reference in New Issue
Block a user