19 locations = [_ for _ in tok if isinstance(_, lark.Tree) and _.data == 'location']
20 if len(locations) > 1:
21 raise ValueError(f'More than one location given for reference {tok[0].children[0]}')
22 if len(locations) > 0:
23 locs = locations[0].children[0].
split(
',')
24 else:
25 locs = [_.children[0] for _ in tok if isinstance(_, lark.Tree) and _.data == 'file']
26 afspaths = [_ for _ in locs if _.startswith('/afs')]
27 if any(afspaths):
28 raise ValueError('A reference location for a production han configuration is given with an AFS path\n'
29 f'Offending path is {",".join(afspaths)} of reference {tok[0].children[0]}')
30 eospaths = [_ for _ in locs if _.startswith('/eos')]
31 xrootdpaths = [_ for _ in locs if _.startswith('root://')]
32 if len(eospaths) != len(xrootdpaths):
33 raise ValueError(f'Backup xrootd locations must be given for references with EOS paths for reference {tok[0].children[0]}\n'
34 f'Given EOS paths are {",".join(eospaths)}\n'
35 f'Given xrootd paths are {",".join(xrootdpaths)}')
36 return tok
37
38
void referenceblock(const std::string &file)
std::vector< std::string > split(const std::string &s, const std::string &t=":")