mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-24 06:29:19 +00:00
config-tools: change name for board XML
Use file name as the board xml name instead of using the name in 'board' field in board XML. e.g. 1. Initial filename is "my_potato.xml" 2. User imports my_potato.xml into the Configurator 3. Resulting file is my_potato.board.xml Tracked-On: #7521 Signed-off-by: Conghui <conghui.chen@intel.com>
This commit is contained in:
parent
777cfae536
commit
6a0ada0a91
@ -22,8 +22,9 @@ class PythonObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
loadBoard(boardXMLText) {
|
loadBoard(boardXMLText, path) {
|
||||||
return this.api('loadBoard', 'json', boardXMLText)
|
return this.api('loadBoard', 'json', boardXMLText, path)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
loadScenario(scenarioXMLText) {
|
loadScenario(scenarioXMLText) {
|
||||||
@ -120,7 +121,7 @@ class Configurator {
|
|||||||
if (syntactical_errors !== "") {
|
if (syntactical_errors !== "") {
|
||||||
throw Error("The file has broken structure.");
|
throw Error("The file has broken structure.");
|
||||||
}
|
}
|
||||||
return this.pythonObject.loadBoard(fileContent);
|
return this.pythonObject.loadBoard(fileContent, path);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,13 +2,15 @@
|
|||||||
__package__ = 'configurator.pyodide'
|
__package__ = 'configurator.pyodide'
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
import logging
|
||||||
|
import re
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
|
||||||
import elementpath
|
import elementpath
|
||||||
import lxml.etree as etree
|
import lxml.etree as etree
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
from . import convert_result, nuc11_board, scenario_json_schema
|
from . import convert_result, nuc11_board, scenario_json_schema,nuc11_board_path
|
||||||
|
|
||||||
|
|
||||||
def get_dynamic_scenario(board):
|
def get_dynamic_scenario(board):
|
||||||
@ -73,10 +75,17 @@ def get_dynamic_scenario(board):
|
|||||||
return form_schemas
|
return form_schemas
|
||||||
|
|
||||||
|
|
||||||
def get_board_info(board):
|
def get_board_info(board, path):
|
||||||
soup = BeautifulSoup(board, 'xml')
|
soup = BeautifulSoup(board, 'xml')
|
||||||
|
try:
|
||||||
|
board_name = re.split('[\\\\/.]', path)[-2]
|
||||||
|
if board_name == 'board':
|
||||||
|
board_name = re.split('[\\\\/.]', path)[-3]
|
||||||
|
except IndexError as e:
|
||||||
|
logging.warning(e)
|
||||||
|
board_name = 'default'
|
||||||
result = {
|
result = {
|
||||||
'name': soup.select_one('acrn-config').attrs['board'] + '.board.xml',
|
'name': board_name + '.board.xml',
|
||||||
'content': board,
|
'content': board,
|
||||||
'BIOS_INFO': soup.select_one('BIOS_INFO').text,
|
'BIOS_INFO': soup.select_one('BIOS_INFO').text,
|
||||||
'BASE_BOARD_INFO': soup.select_one('BASE_BOARD_INFO').text
|
'BASE_BOARD_INFO': soup.select_one('BASE_BOARD_INFO').text
|
||||||
@ -84,16 +93,16 @@ def get_board_info(board):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def load_board(board):
|
def load_board(board, path):
|
||||||
result = {
|
result = {
|
||||||
'scenarioJSONSchema': get_dynamic_scenario(board),
|
'scenarioJSONSchema': get_dynamic_scenario(board),
|
||||||
'boardInfo': get_board_info(board)
|
'boardInfo': get_board_info(board, path)
|
||||||
}
|
}
|
||||||
return convert_result(result)
|
return convert_result(result)
|
||||||
|
|
||||||
|
|
||||||
def test():
|
def test():
|
||||||
load_board(nuc11_board)
|
load_board(nuc11_board, nuc11_board_path)
|
||||||
|
|
||||||
|
|
||||||
main = load_board
|
main = load_board
|
||||||
|
@ -27,6 +27,7 @@ scenario_xml_schema_path = schema_dir / 'sliced.xsd'
|
|||||||
datachecks_xml_schema_path = schema_dir / 'allchecks.xsd'
|
datachecks_xml_schema_path = schema_dir / 'allchecks.xsd'
|
||||||
|
|
||||||
nuc11_folder = LazyPath(config_tools_dir / 'data' / 'nuc11tnbi5')
|
nuc11_folder = LazyPath(config_tools_dir / 'data' / 'nuc11tnbi5')
|
||||||
|
nuc11_board_path = nuc11_folder / 'nuc11tnbi5.xml'
|
||||||
|
|
||||||
# file define
|
# file define
|
||||||
nuc11_board = file_text(nuc11_folder / 'nuc11tnbi5.xml')
|
nuc11_board = file_text(nuc11_folder / 'nuc11tnbi5.xml')
|
||||||
|
Loading…
Reference in New Issue
Block a user