mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-05-04 14:36:55 +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:
parent
27d1dde01e
commit
593414e9c2
4
Makefile
4
Makefile
@ -46,7 +46,7 @@ ifneq ($(BOARD_FILE)$(SCENARIO_FILE),)
|
||||
endif
|
||||
|
||||
override BOARD := $(realpath $(BOARD_FILE))
|
||||
override SCENARIO := $(realpath $(SCENARIO_FILE))
|
||||
override SCENARIO := $(abspath $(SCENARIO_FILE))
|
||||
else
|
||||
# BOARD/SCENARIO pointing to XML files must be converted to absolute paths before being passed to hypervisor/Makefile
|
||||
# because paths relative to acrn-hypervisor/ are typically invalid when relative to acrn-hypervisor/Makefile
|
||||
@ -54,7 +54,7 @@ else
|
||||
override BOARD := $(realpath $(BOARD))
|
||||
endif
|
||||
ifneq ($(realpath $(SCENARIO)),)
|
||||
override SCENARIO := $(realpath $(SCENARIO))
|
||||
override SCENARIO := $(abspath $(SCENARIO))
|
||||
endif
|
||||
endif
|
||||
|
||||
|
@ -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)"; \
|
||||
|
Loading…
Reference in New Issue
Block a user