Skip to content
Snippets Groups Projects
Commit 73423512 authored by Wouter Deconinck's avatar Wouter Deconinck
Browse files

fix: don't clobber /tmp/det in setup_detectors.py

parent 56bd1f6b
No related branches found
No related tags found
1 merge request!839fix: don't clobber /tmp/det in setup_detectors.py
...@@ -85,22 +85,23 @@ if __name__ == '__main__': ...@@ -85,22 +85,23 @@ if __name__ == '__main__':
## build and install ## build and install
print(' - {}-{}'.format(det, cfg['version'])) print(' - {}-{}'.format(det, cfg['version']))
## cleanup ## cleanup
cmd = ['rm -rf /tmp/build /tmp/det'] cmd = [f'rm -rf /tmp/build-{version} /tmp/det-{version}']
print(' '.join(cmd)) print(' '.join(cmd))
subprocess.check_call(' '.join(cmd), shell=True) subprocess.check_call(' '.join(cmd), shell=True)
## clone ## clone
cmd = [ cmd = [
'git clone --depth 1 -b {version} {repo_grp}/{detector}.git /tmp/det'.format( 'git clone --depth 1 -b {branch} {repo_grp}/{detector}.git /tmp/det-{version}'.format(
version=cfg['version'], branch=cfg['version'],
repo_grp=DETECTOR_REPO_GROUP, repo_grp=DETECTOR_REPO_GROUP,
detector=det) detector=det,
version=version)
] ]
print(' '.join(cmd)) print(' '.join(cmd))
subprocess.check_call(' '.join(cmd), shell=True) subprocess.check_call(' '.join(cmd), shell=True)
## patches ## patches
if cfg.get('patches'): if cfg.get('patches'):
for patch in cfg['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)) print(' '.join(cmd))
subprocess.check_call(' '.join(cmd), shell=True) subprocess.check_call(' '.join(cmd), shell=True)
## build ## build
...@@ -110,7 +111,7 @@ if __name__ == '__main__': ...@@ -110,7 +111,7 @@ if __name__ == '__main__':
if cfg.get('cxxflags'): if cfg.get('cxxflags'):
cxxflags = cfg['cxxflags'] cxxflags = cfg['cxxflags']
cmd = [ 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_CXX_FLAGS="-Wno-psabi {cxxflags}"',
f'-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache', f'-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache',
f'-DCMAKE_INSTALL_PREFIX={prefix}' f'-DCMAKE_INSTALL_PREFIX={prefix}'
...@@ -119,13 +120,13 @@ if __name__ == '__main__': ...@@ -119,13 +120,13 @@ if __name__ == '__main__':
subprocess.check_call(' '.join(cmd), shell=True) subprocess.check_call(' '.join(cmd), shell=True)
## install ## install
cmd = [ cmd = [
'cmake --build /tmp/build -j$(($(($(nproc)/4))+1)) -- install' f'cmake --build /tmp/build-{version} -j$(($(($(nproc)/4))+1)) -- install'
] ]
print(' '.join(cmd)) print(' '.join(cmd))
subprocess.check_output(' '.join(cmd), shell=True) subprocess.check_output(' '.join(cmd), shell=True)
## write version info to jug_info if available ## write version info to jug_info if available
if os.path.exists('/etc/jug_info'): 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( 'echo " - {detector}/{branch}: {version}-$(git rev-parse HEAD)"'.format(
detector=det, detector=det,
...@@ -137,7 +138,7 @@ if __name__ == '__main__': ...@@ -137,7 +138,7 @@ if __name__ == '__main__':
print(' '.join(cmd)) print(' '.join(cmd))
subprocess.check_call(' '.join(cmd), shell=True) subprocess.check_call(' '.join(cmd), shell=True)
## cleanup ## cleanup
cmd = 'rm -rf /tmp/det /tmp/build' cmd = f'rm -rf /tmp/det-{version} /tmp/build-{version}'
print(cmd) print(cmd)
subprocess.check_call(cmd, shell=True) subprocess.check_call(cmd, shell=True)
# be resilient against failures # be resilient against failures
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment