ATLAS Offline Software
make_hlt_rep.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 
4 import optparse
5 import os
6 
7 import pm.project
8 import pm.common
9 
10 from HLTUtils import hltOksUtils
11 from pm.dal import dal
12 
13 prefix = 'HLT'
14 modifier = ''
15 
16 parser = optparse.OptionParser(description="Create HLT S/W respository")
17 
18 parser.add_option("-p", "--prefix", action="store",
19  help="Prefix used for all objects (default: 'HLT')")
20 
21 parser.add_option("-m", "--modifier", action="store",
22  help="Modifier for objects in S/W repository (default: '')")
23 
24 (opt, args) = parser.parse_args()
25 
26 if opt.prefix is not None:
27  prefix = opt.prefix
28 
29 if opt.modifier is not None and len(opt.modifier)>0:
30  modifier = '_' + opt.modifier
31 
32 rep = pm.project.Project('daq/sw/repository.data.xml')
33 onlineRep = rep.getObject('SW_Repository', 'Online')
34 common_env = pm.project.Project('daq/segments/common-environment.data.xml')
35 
36 atlas_project = os.environ.get('AtlasProject')
37 
38 if not os.environ.get('AtlasReleaseType')=='stable':
39  # nightly
40  atlas_version='%s,r%s' % (os.environ.get('AtlasBuildBranch'),
41  os.environ.get('AtlasBuildStamp'))
42 else:
43  # numbered releases
44  atlas_version = os.environ.get('AtlasVersion')
45 
46 platform = hltOksUtils.platform()
47 
48 swvars = [
49  dal.SW_PackageVariable('XMLPATH',
50  Name='XMLPATH',
51  Suffix=os.path.join(platform,"XML")),
52  dal.SW_PackageVariable('DATAPATH',
53  Name='DATAPATH',
54  Suffix=os.path.join(platform,"share")),
55  dal.SW_PackageVariable('CALIBPATH',
56  Name='CALIBPATH',
57  Suffix=os.path.join(platform,"share")),
58  dal.SW_PackageVariable('JOBOPTSEARCHPATH',
59  Name='JOBOPTSEARCHPATH',
60  Suffix=os.path.join(platform,"jobOptions")),
61  dal.SW_PackageVariable('PYTHONPATH',
62  Name='PYTHONPATH',
63  Suffix=os.path.join(platform,"python"))
64 ]
65 
66 puvars = [
67  dal.Variable('%s_ASETUP_ARGS' % prefix,
68  Name='ASETUP_ARGS',
69  Value=('%s,%s' % (atlas_project, '${%s_VERSION}' % prefix)),
70  Description='asetup arguments'),
71 
72  dal.Variable('%s_PRELOAD' % prefix,
73  Name='ASETUP_PRELOAD',
74  Value='libtcmalloc_minimal.so:libimf.so:libintlc.so.5',
75  Description='Preload libraries'),
76 
77  dal.Variable('%s_VERBOSE' % prefix,
78  Name='ASETUP_VERBOSE',
79  Value='0',
80  Description='Verbosity for asetup_wrapper'),
81 
82  dal.Variable('%s_EXTRA_SW_PATH' % prefix,
83  Name='ASETUP_EXTRA_SW_PATH',
84  Value='',
85  Description='Patch area (e.g. /my/path/InstallArea)'),
86 
87  common_env.getObject('Variable','AtlasSetup')
88 ]
89 
90 pars = dal.VariableSet('%s-Parameters' % prefix,
91  Description='Parameters to expand for executables',
92  Contains = [ dal.Variable('%s_VERSION' % prefix,
93  Name='%s_VERSION' % prefix,
94  Value=atlas_version,
95  Description='%s release version' % prefix) ])
96 
97 apps = [
98  dal.Binary('HLTMPPU_asetup',
99  BinaryName='asetup_wrapper',
100  Description='HLTMPPU_main with asetup environment',
101  DefaultParameters='HLTMPPU_main',
102  ProcessEnvironment=puvars)
103 ]
104 
105 
106 # Workaround for clang build (ATR-22849)
107 try:
108  tag = pm.common.tdaqRepository.getObject('Tag',hltOksUtils.platform())
109 except RuntimeError:
110  tag = pm.common.tdaqRepository.getObject('Tag')[0]
111  print('Cannot find tag %s in OKS. Using %s instead. Please fix manually.' %
112  (hltOksUtils.platform(), tag.id))
113 
114 hltRep = dal.SW_Repository('%s-Repository' % prefix,
115  Name=('%s-Repository' % prefix),
116  InstallationPath="%s/InstallArea" % os.environ.get('AtlasArea'),
117  SW_Objects=apps,
118  Tags=[tag],
119  ISInfoDescriptionFiles=[os.path.join(platform,'share/data/daq/schema/is_trigconf_hlt.schema.xml')],
120  AddProcessEnvironment = swvars
121  )
122 
123 for app in apps:
124  app.BelongsTo = hltRep
125 
126 proj = pm.project.Project('%s_SW_Repository.data.xml' % prefix,
127  ['daq/schema/core.schema.xml',
128  'daq/sw/repository.data.xml'])
129 
130 proj.addObjects([hltRep])
131 proj.addObjects([pars])
132 
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25