Skip to content

Commit

Permalink
fix: don't clobber /tmp/det in setup_detectors.py
Browse files Browse the repository at this point in the history
  • Loading branch information
wdconinc committed Feb 20, 2024
1 parent 56bd1f6 commit 7342351
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions containers/jug/setup_detectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,22 +85,23 @@
## build and install
print(' - {}-{}'.format(det, cfg['version']))
## cleanup
cmd = ['rm -rf /tmp/build /tmp/det']
cmd = [f'rm -rf /tmp/build-{version} /tmp/det-{version}']
print(' '.join(cmd))
subprocess.check_call(' '.join(cmd), shell=True)
## clone
cmd = [
'git clone --depth 1 -b {version} {repo_grp}/{detector}.git /tmp/det'.format(
version=cfg['version'],
'git clone --depth 1 -b {branch} {repo_grp}/{detector}.git /tmp/det-{version}'.format(
branch=cfg['version'],
repo_grp=DETECTOR_REPO_GROUP,
detector=det)
detector=det,
version=version)
]
print(' '.join(cmd))
subprocess.check_call(' '.join(cmd), shell=True)
## patches
if cfg.get('patches'):
for patch in cfg['patches']:
cmd = [f'curl -L {patch} | patch -p1 -d/tmp/det']
cmd = [f'curl -L {patch} | patch -p1 -d/tmp/det-{version}']
print(' '.join(cmd))
subprocess.check_call(' '.join(cmd), shell=True)
## build
Expand All @@ -110,7 +111,7 @@
if cfg.get('cxxflags'):
cxxflags = cfg['cxxflags']
cmd = [
f'cmake -B /tmp/build -S /tmp/det -DCMAKE_CXX_STANDARD=17',
f'cmake -B /tmp/build-{version} -S /tmp/det-{version} -DCMAKE_CXX_STANDARD=17',
f'-DCMAKE_CXX_FLAGS="-Wno-psabi {cxxflags}"',
f'-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache',
f'-DCMAKE_INSTALL_PREFIX={prefix}'
Expand All @@ -119,13 +120,13 @@
subprocess.check_call(' '.join(cmd), shell=True)
## install
cmd = [
'cmake --build /tmp/build -j$(($(($(nproc)/4))+1)) -- install'
f'cmake --build /tmp/build-{version} -j$(($(($(nproc)/4))+1)) -- install'
]
print(' '.join(cmd))
subprocess.check_output(' '.join(cmd), shell=True)
## write version info to jug_info if available
if os.path.exists('/etc/jug_info'):
cmd = ['cd /tmp/det',
cmd = [f'cd /tmp/det-{version}',
'&&',
'echo " - {detector}/{branch}: {version}-$(git rev-parse HEAD)"'.format(
detector=det,
Expand All @@ -137,7 +138,7 @@
print(' '.join(cmd))
subprocess.check_call(' '.join(cmd), shell=True)
## cleanup
cmd = 'rm -rf /tmp/det /tmp/build'
cmd = f'rm -rf /tmp/det-{version} /tmp/build-{version}'
print(cmd)
subprocess.check_call(cmd, shell=True)
# be resilient against failures
Expand Down

0 comments on commit 7342351

Please sign in to comment.