def writeHltEnv(hltenv, filename, prefix): common_vars = [] if opt.useCommonEnv: try: db = pm.project.Project(Config.common_env) common_vars = db.getObject('VariableSet', 'CommonEnvironment').Contains except: print('Could not load CommonEnvironment from', Config.common_env) hltvars = dal.VariableSet('%s-Environment' % prefix, Description='Variables for HLT executables') hltpars = dal.VariableSet( '%s-Parameters' % prefix, Description='Parameters to expand for HLT executables') common_vars_name = [v.Name for v in common_vars] for k in sorted(hltenv): if ignoreVar(k): continue if opt.useCommonEnv and k in common_vars_name: if not opt.quiet: print '%s already provided by CommonEnvironment. Skipping it.' % k continue var = dal.Variable('%s-%s' % (prefix, k), Name=k, Value=hltenv[k], Description=Config.doc.get(k, '')) hltvars.Contains += [var] for var, inc in Config.addVars.iteritems(): try: db = pm.project.Project(inc) v = db.getObject('Variable', var) hltvars.Contains += [v] except: print('Cannot find variable %s in %s' % (var, inc)) for v in hltvars.Contains: if v.Name in Config.symbolicVars + Config.hltPars: hltpars.Contains += [v] # Write the OKS file proj = pm.project.Project(filename, ['daq/schema/core.schema.xml'] + list(set(Config.addVars.values()))) proj.addObjects([hltvars, hltpars]) if not opt.quiet: print('Created %s' % filename)
def createWrapper(hltenv, filename): prefix = os.path.basename(hltenv).split('-Environment.data.xml')[0] try: db = pm.project.Project(hltenv) except: print('Could not open', hltenv) return try: rel = db.getObject('Variable', '%s-AtlasArea' % prefix).Value.split('/')[-1] except: print('Could not determine release number from AtlasArea') return hltbase = dal.Variable('HLT-AtlasBaseVersion', Name='AtlasBaseVersion', Value=rel, Description='Base release version') hltvars = dal.VariableSet('HLT-Environment', Description='Variables for HLT executables') hltpars = dal.VariableSet( 'HLT-Parameters', Description='Parameters to expand for HLT executables') hltvars.Contains.append( db.getObject('VariableSet', '%s-Environment' % prefix)) hltpars.Contains.append( db.getObject('VariableSet', '%s-Parameters' % prefix)) hltpars.Contains.append(hltbase) # Write the OKS file proj = pm.project.Project(filename, ['daq/schema/core.schema.xml', hltenv]) proj.addObjects([hltvars, hltpars, hltbase]) if not opt.quiet: print('Setting AtlasBaseVersion to %s' % rel) print('Created %s wrapping %s' % (filename, hltenv))
Name='DATAPATH', Suffix=os.path.join(platform, "share")), dal.SW_PackageVariable('CALIBPATH', Name='CALIBPATH', Suffix=os.path.join(platform, "share")), dal.SW_PackageVariable('JOBOPTSEARCHPATH', Name='JOBOPTSEARCHPATH', Suffix=os.path.join(platform, "jobOptions")), dal.SW_PackageVariable('PYTHONPATH', Name='PYTHONPATH', Suffix=os.path.join(platform, "python")) ] puvars = [ dal.Variable('%s_ASETUP_ARGS' % prefix, Name='ASETUP_ARGS', Value=('%s,%s' % (atlas_project, '${%s_VERSION}' % prefix)), Description='asetup arguments'), dal.Variable('%s_PRELOAD' % prefix, Name='ASETUP_PRELOAD', Value='libtcmalloc_minimal.so:libimf.so:libintlc.so.5', Description='Preload libraries'), dal.Variable('%s_VERBOSE' % prefix, Name='ASETUP_VERBOSE', Value='0', Description='Verbosity for asetup_wrapper'), dal.Variable('%s_EXTRA_SW_PATH' % prefix, Name='ASETUP_EXTRA_SW_PATH', Value='', Description='Patch area (e.g. /my/path/InstallArea)'), common_env.getObject('Variable', 'AtlasSetup') ]
names = ['XMLPATH', 'DATAPATH', 'CALIBPATH', 'JOBOPTSEARCHPATH', 'PYTHONPATH'] rep = pm.project.Project('daq/sw/HLT_SW_Repository.data.xml') vars = [rep.getObject('SW_PackageVariable', name) for name in names] AtlasArea = os.getenv('AtlasArea') if opt.path == None else opt.path AtlasVersion = os.getenv('AtlasVersion') AtlasProject = os.getenv('AtlasProject') if opt.name == None: pkg_id = '%s_%s' % (AtlasProject, AtlasVersion) pkg_name = '%s %s' % (AtlasProject, AtlasVersion) else: pkg_id = pkg_name = opt.name env_vars = [ dal.Variable(pkg_id + '_Project', Name="AtlasProject", Value=AtlasProject), dal.Variable(pkg_id + '_Version', Name="AtlasVersion", Value=AtlasVersion) ] env = dal.VariableSet(pkg_id, Contains=env_vars) pkg = dal.SW_Repository(pkg_id, Name=pkg_name, InstallationPath=os.path.join(AtlasArea, 'InstallArea'), InstallationPathVariableName="AtlasP1HLT_InstPath", ProcessEnvironment=[env], AddProcessEnvironment=vars, Tags=hltOksUtils.defaultTags()) proj = pm.project.Project(