mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-01-06 16:15:00 +00:00
config-tools: support absolute path
1. Support absolute path for scenario file. 2. Use the scenario xml file name as scenario name, but if it is 'scenario.xml', use the upper level directory name. e.g. SCENARIO=<pathxxx>/shared/scenario.xml Then scenario name would be 'shared'. 3. Change 'realpath' to 'abspath' as we should keep the original path for scenario file even it is a link file. This will make sure the scenario name is always consistent with file set in 'SCENARIO='. Tracked-On: #7345 Signed-off-by: Conghui <conghui.chen@intel.com> Reviewed-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
@@ -54,7 +54,12 @@ define determine_config =
|
||||
ifneq ($($(1)),)
|
||||
ifneq ($(realpath $($(1))),)
|
||||
override $(1)_FILE := $($(1))
|
||||
override $(1) := $$(shell xmllint --xpath 'string(/acrn-config/@$(shell echo $(1) | tr A-Z a-z))' $$($(1)_FILE))
|
||||
ifneq (SCENARIO, $(1))
|
||||
override $(1) := $$(shell xmllint --xpath 'string(/acrn-config/@$(shell echo $(1) | tr A-Z a-z))' $$($(1)_FILE))
|
||||
else
|
||||
scenario_name := $(subst .xml,,$(notdir $($(1))))
|
||||
override $(1) := $$(if $$(subst scenario,,$$(scenario_name)),$$(scenario_name),$(notdir $(abspath $(dir $($(1))))))
|
||||
endif
|
||||
else
|
||||
override $(1)_FILE := $(HV_PREDEFINED_DATA_DIR)/$$(BOARD)/$$($(1)).xml
|
||||
ifeq ($$(realpath $$($(1)_FILE)),)
|
||||
@@ -201,11 +206,11 @@ $(HV_BOARD_XML):
|
||||
$(HV_SCENARIO_XML):
|
||||
@if [ ! -f $(HV_SCENARIO_XML) ]; then \
|
||||
if [ -f $(SCENARIO_FILE) ]; then \
|
||||
echo "Scenario XML is being fetched from $(realpath $(SCENARIO_FILE))"; \
|
||||
echo "Scenario XML is being fetched from $(abspath $(SCENARIO_FILE))"; \
|
||||
mkdir -p $(dir $(HV_SCENARIO_XML)); \
|
||||
python3 $(HV_CONFIG_TOOL_DIR)/scenario_config/default_populator.py $(SCENARIO_FILE) $(HV_SCENARIO_XML); \
|
||||
if [ -z $$(xmllint --xpath 'string(//@scenario)' $(HV_SCENARIO_XML)) ]; then \
|
||||
sed "s#<acrn-config#<acrn-config scenario=\"$(subst .xml,,$(notdir $(SCENARIO_FILE)))\"#g" -i $(HV_SCENARIO_XML); \
|
||||
sed "s#<acrn-config#<acrn-config scenario=\"$(SCENARIO)\"#g" -i $(HV_SCENARIO_XML); \
|
||||
fi; \
|
||||
else \
|
||||
echo "No pre-defined scenario available at $(SCENARIO_FILE)"; \
|
||||
|
||||
Reference in New Issue
Block a user