1 __author__ =
'Giacomo Govi' 11 if cmssw_version.find(
'CMSSW_')==-1:
12 raise Exception(
"CMSSW version '%s' has not been found in the expected format" %cmssw_version)
14 p = re.compile(
'(CMSSW_.*_X)(_.*)?$')
19 raise Exception(
"IB version can't be processed.")
23 ind = cmssw_version.find(
'_X')
28 if not cmssw_version.find(
'_X') == -1:
29 ver = ver.replace(
'X',
'0')
30 ind = ver.find(
'_pre')
36 ver = cmssw_version.split(
'CMSSW_')[1]
38 f = ver.find(
'_patch')
43 return int(
'%d%02d%02d%02d' %(
int(dgs[0]),
int(dgs[1]),
int(dgs[2]),ip))
59 bver = boost_version.replace(
'_',
'.')
75 return int(tmpl %(pars[0],pars[1],pars[2]))
87 archs = { 3070000 : [
'slc5_amd64_gcc434'], 5010100 : [
'slc5_amd64_gcc462'], 6000000 : [
'slc6_amd64_gcc472'],
88 7000000 : [
'slc6_amd64_gcc481'], 7020000 : [
'slc6_amd64_gcc491'], 7060000 : [
'slc6_amd64_gcc493'],
89 8000000 : [
'slc6_amd64_gcc493',
'slc6_amd64_gcc530'], 9030000 : [
'slc6_amd64_gcc630']}
91 cmsPath =
'/cvmfs/cms.cern.ch' 96 for r
in sorted(archs.keys()):
101 if not rbound
is None:
106 cmssw_folder =
'cmssw' 107 if cmssw_version.find(
'_patch') != -1:
108 cmssw_folder=
'cmssw-patch' 109 ret =
'%s/%s/cms/%s' %(cmsPath,arch,cmssw_folder)
113 cmd =
'source %s/cmsset_default.sh; export SCRAM_ARCH=%s; cd %s/src ; eval `scram runtime -sh`; scram tool info boost; ' %(cmsPath,arch,releaseDir)
114 pipe = subprocess.Popen( cmd, shell=
True,stdout=subprocess.PIPE,stderr=subprocess.STDOUT)
115 out = pipe.communicate()[0]
116 cfgLines = out.split(
'\n')
118 for line
in cfgLines:
119 if line.startswith(
'Version'):
120 boost_version = line.split(
'Version :')[1].
strip()
122 if not boost_version
is None:
127 if timeType ==
'Lumi':
134 if timeType ==
'Time':
135 entry =
max([x
for x
in boost_run_map
if x[1]<=iov])
136 elif timeType ==
'Run':
137 entry =
max([x
for x
in boost_run_map
if x[0]<=iov])
139 raise Exception(
'TimeType %s cannot be processed' %timeType)
140 except Exception
as e:
145 streamer_info = s_info.decode()
146 streamer_info = streamer_info.replace(
'\x00',
'')
147 iovBoostVersion =
None 148 if streamer_info ==
'0':
149 iovBoostVersion =
'1.51.0' 152 iovBoostVersion =
str(json.loads(streamer_info)[
'tech_version'])
154 except ValueError
as e:
155 raise Exception(
"Could not parse streamer info [%s]: %s" %(streamer_info,
str(e)))
156 return iovBoostVersion
160 if timetype ==
'Hash':
161 if tagBoostVersion
is None or cmp_boost_version(tagBoostVersion,iovBoostVersion)<0:
162 tagBoostVersion = iovBoostVersion
165 if tagBoostVersion
is None:
166 tagBoostVersion = iovBoostVersion
172 tagBoostVersion = iovBoostVersion
180 tagBoostVersion = iovRefBoost
181 return tagBoostVersion