Let the init system guess "stratus1.mapppingName" value.

* Change: In Bootstrap, in coriolisEnv.py no longer sets the environment
    variable STRATUS_MAPPING_NAME (guessed by init).
* Change: In CRL Core, in System CTOR sets the default value for
    "stratus1.mappingName" to "not_set" so the init can known it is not
    set.
      In etc/coriolis2/*/stratus1.conf, do not set "stratus1.mappingName".
      In coriolisInit.py, now guess the value of "stratus1.mappingName"
    if it has not already been set by the user. The complete setting
    process is as follow (decreasing priority):
      1. Setup by the user in his ".coriolis2/setting.py".
      2. A "stratus.xml" file is detected in the current technological
         directory (example: etc/coriolis2/65/cmos065/setting.xml).
      3. Fallback value to "etc/coriolis2/stratus2sxlib.xml".
This commit is contained in:
Jean-Paul Chaput 2016-05-06 13:15:10 +02:00
parent d2209579ab
commit babf23f303
7 changed files with 20 additions and 16 deletions

View File

@ -172,16 +172,18 @@ if __name__ == "__main__":
'PATH="%(PATH)s";' \
'BOOTSTRAP_TOP="%(BOOTSTRAP_TOP)s";' \
'CORIOLIS_TOP="%(CORIOLIS_TOP)s";' \
'STRATUS_MAPPING_NAME="%(SYSCONF_DIR)s/stratus2sxlib.xml";' \
'export PATH BOOTSTRAP_TOP CORIOLIS_TOP STRATUS_MAPPING_NAME;'
# 'STRATUS_MAPPING_NAME="%(SYSCONF_DIR)s/stratus2sxlib.xml";' \
shellScriptCsh = \
'echo "%(MESSAGE)s";' \
'echo "Switching to Coriolis 2.x (%(buildDir)s)";' \
'setenv PATH "%(PATH)s";' \
'setenv BOOTSTRAP_TOP "%(BOOTSTRAP_TOP)s";' \
'setenv CORIOLIS_TOP "%(CORIOLIS_TOP)s";' \
'setenv STRATUS_MAPPING_NAME "%(SYSCONF_DIR)s/stratus2sxlib.xml";'
'setenv CORIOLIS_TOP "%(CORIOLIS_TOP)s";'
# 'setenv STRATUS_MAPPING_NAME "%(SYSCONF_DIR)s/stratus2sxlib.xml";' \
buildDir = buildType + "." + linkType
scriptDir = os.path.dirname ( os.path.abspath(__file__) )

View File

@ -5,9 +5,7 @@ import helpers
# Status1 parameters.
parametersTable = \
( ("stratus1.mappingName", TypeString, helpers.sysConfDir+"/stratus2sxlib.xml",
{ 'flags':Cfg.Parameter.Flags.NeedRestart|Cfg.Parameter.Flags.MustExist } )
, ("stratus1.format" , TypeString, "vst")
( ("stratus1.format" , TypeString, "vst")
, ("stratus1.simulator" , TypeString, "asimut")
,)

View File

@ -5,9 +5,7 @@ import helpers
# Status1 parameters.
parametersTable = \
( ("stratus1.mappingName", TypeString, helpers.sysConfDir+"/stratus2sxlib.xml",
{ 'flags':Cfg.Parameter.Flags.NeedRestart|Cfg.Parameter.Flags.MustExist } )
, ("stratus1.format" , TypeString, "vst")
( ("stratus1.format" , TypeString, "vst")
, ("stratus1.simulator" , TypeString, "asimut")
,)

View File

@ -5,9 +5,7 @@ import helpers
# Status1 parameters.
parametersTable = \
( ("stratus1.mappingName", TypeString, helpers.sysConfDir+"/stratus2sxlib.xml",
{ 'flags':Cfg.Parameter.Flags.NeedRestart|Cfg.Parameter.Flags.MustExist } )
, ("stratus1.format" , TypeString, "vst")
( ("stratus1.format" , TypeString, "vst")
, ("stratus1.simulator" , TypeString, "asimut")
,)

View File

@ -5,9 +5,7 @@ import helpers
# Status1 parameters.
parametersTable = \
( ("stratus1.mappingName", TypeString, helpers.sysConfDir+"/stratus2sxlib.xml",
{ 'flags':Cfg.Parameter.Flags.NeedRestart|Cfg.Parameter.Flags.MustExist } )
, ("stratus1.format" , TypeString, "vst")
( ("stratus1.format" , TypeString, "vst")
, ("stratus1.simulator" , TypeString, "asimut")
,)

View File

@ -160,4 +160,14 @@ def coriolisConfigure():
#sys.stdout.write(CRL.AllianceFramework.get().getEnvironment().getPrint())
if Cfg.getParamString('stratus1.mappingName').asString() == 'not_set':
vendorTech = helpers.realTechno.split('/')[-1]
mappingFile = os.path.join( helpers.realDir, 'stratus.xml' )
if not os.path.isfile(mappingFile):
mappingFile = os.path.join( helpers.sysConfDir, 'stratus2sxlib.xml' )
parameter = Cfg.getParamString('stratus1.mappingName')
parameter.setString( mappingFile )
parameter.flags = Cfg.Parameter.Flags.NeedRestart|Cfg.Parameter.Flags.MustExist
return

View File

@ -330,7 +330,7 @@ namespace CRL {
Cfg::getParamBool ("misc.bug" ,false)->registerCb ( this, bugChanged );
Cfg::getParamBool ("misc.logMode" ,false)->registerCb ( this, logModeChanged );
Cfg::getParamInt ("misc.traceLevel" ,1000 )->registerCb ( this, traceLevelChanged );
Cfg::getParamString("stratus1.mappingName","./stratus2sxlib.xml")->registerCb ( this, stratus1MappingNameChanged );
Cfg::getParamString("stratus1.mappingName","not_set")->registerCb ( this, stratus1MappingNameChanged );
// Immediate update from the configuration.
//catchCoreChanged ( Cfg::getParamBool("misc.catchCore" ) );