diff --git a/containers/jug/setup_detectors.py b/containers/jug/setup_detectors.py index a4cfbf606d2e54bbaf2d7f5a040b9d0cd16caf12..931c1a7598abee9495481fde9b508574fd44ad9f 100755 --- a/containers/jug/setup_detectors.py +++ b/containers/jug/setup_detectors.py @@ -5,7 +5,7 @@ import yaml import argparse DETECTOR_REPO_GROUP = 'https://github.com/eic' -DETECTOR_ENV =''' +DETECTOR_BEAMLINE_ENV =''' #!/bin/sh export DETECTOR={detector} export DETECTOR_PATH={data_prefix} @@ -32,6 +32,22 @@ export PS1="{branch}${{PS1_SIGIL}}>${{PS1#*>}}" unset branch ''' +DETECTOR_ENV =''' +#!/bin/sh +export DETECTOR={detector} +export DETECTOR_PATH={data_prefix} +export DETECTOR_CONFIG={detector} +export DETECTOR_VERSION={version} + +## Export detector libraries +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:{prefix}/lib + +## modify PS1 for this detector version +export PS1="${{PS1:-}}" +export PS1="{branch}${{PS1_SIGIL}}>${{PS1#*>}}" +unset branch +''' + if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument( @@ -86,14 +102,17 @@ if __name__ == '__main__': del detectors[det]['nightly'] for branch in detectors[det]: cfg = detectors[det][branch] - ip = cfg['ip'] version = cfg['version'] if branch != 'nightly' else 'nightly' - print(' - {}-{} and {}-{}'.format( - det, cfg['version'], ip['config'], ip['version'])) prefix = '{}/{}-{}'.format(args.prefix, det, version) data_dir = '{}/share/{}'.format(prefix, det) - ## build and install detector and IP code - for (proj, vers) in [(det, cfg['version']), (ip['config'], ip['version'])]: + ## build list of projects to install + proj_vers_list = [(det, cfg['version'])] + if 'ip' in cfg: + ip = cfg['ip'] + proj_vers_list.append((ip['config'], ip['version'])) + ## build and install projects + for (proj, vers) in proj_vers_list: + print(' - {}-{}'.format(proj, vers)) ## clone/build/install detector libraries cmd = ['rm -rf /tmp/build /tmp/det', '&&', @@ -122,7 +141,7 @@ if __name__ == '__main__': print(' '.join(cmd)) os.system(' '.join(cmd)) ## also copy over IP configuration to the detector - if os.path.exists('/tmp/det/{ip}'.format(ip=ip['config'])): + if 'ip' in cfg and os.path.exists('/tmp/det/{ip}'.format(ip=cfg['ip']['config'])): cmd = 'cp -r /tmp/det/{ip} {data_dir}'.format( ip=ip['config'], data_dir=data_dir) print(cmd) @@ -142,7 +161,8 @@ if __name__ == '__main__': os.system(cmd) ## write an environment file for this detector with open('{prefix}/setup.sh'.format(prefix=prefix), 'w') as f: - print(DETECTOR_ENV.format( + if 'ip' in cfg: + print(DETECTOR_BEAMLINE_ENV.format( prefix=prefix, detector=det, data_prefix=data_dir, @@ -150,7 +170,15 @@ if __name__ == '__main__': ip=ip['config'], ip_version=ip['version'], branch=branch), - file=f) + file=f) + else: + print(DETECTOR_ENV.format( + prefix=prefix, + detector=det, + data_prefix=data_dir, + version=cfg['version'], + branch=branch), + file=f) ## run once inside global prefix to initialize artifacts in /opt/detectors os.environ['DETECTOR_PATH'] = args.prefix cmd = f'bash -c \'cd {args.prefix} && source {prefix}/setup.sh && checkGeometry -c {prefix}/share/{det}/{det}.xml\'' diff --git a/detectors.yaml b/detectors.yaml index e8ce62d3e286b45ec48267c71d4cf91eee3102ce..2b3122c384a8fcc796226b6528011b29e8293e5e 100644 --- a/detectors.yaml +++ b/detectors.yaml @@ -3,9 +3,6 @@ detectors: nightly: default: true version: main - ip: - config: ip6 - version: master 22.10.0: version: 22.10.0 ip: @@ -16,6 +13,11 @@ detectors: ip: config: ip6 version: 22.11.0 + 22.11.1: + version: 22.11.1 + ip: + config: ip6 + version: 22.11.0 athena: nightly: version: master