diff options
author | Wade Fife <wade.fife@ettus.com> | 2021-06-08 13:52:28 -0500 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2021-06-10 11:56:58 -0500 |
commit | 7adc1b936cc76f294c7a8bce03456b6384e57c5e (patch) | |
tree | 2609f748283c4d7791e0cc45c9ef257291247c8b /fpga/.ci/scripts/cleanup_incomplete_ip_builds.py | |
parent | 99b841c75aa91709090cbf4046bf51b7ffb4f612 (diff) | |
download | uhd-7adc1b936cc76f294c7a8bce03456b6384e57c5e.tar.gz uhd-7adc1b936cc76f294c7a8bce03456b6384e57c5e.tar.bz2 uhd-7adc1b936cc76f294c7a8bce03456b6384e57c5e.zip |
fpga: ci: Add build definitions for FPGA CI
Co-authored-by: Humberto Jimenez <humberto.jimenez@ni.com>
Co-authored-by: Javier Valenzuela <javier.valenzuela@ni.com>
Co-authored-by: Max Köhler <max.koehler@ni.com>
Co-authored-by: Paul Butler <paul.butler@ni.com>
Diffstat (limited to 'fpga/.ci/scripts/cleanup_incomplete_ip_builds.py')
-rw-r--r-- | fpga/.ci/scripts/cleanup_incomplete_ip_builds.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/fpga/.ci/scripts/cleanup_incomplete_ip_builds.py b/fpga/.ci/scripts/cleanup_incomplete_ip_builds.py new file mode 100644 index 000000000..75c08db72 --- /dev/null +++ b/fpga/.ci/scripts/cleanup_incomplete_ip_builds.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 +# +# Copyright 2021 Ettus Research, a National Instruments Brand +# +# SPDX-License-Identifier: LGPL-3.0-or-later +# +# Description: +# +# Our pipelines reuse IP builds to save time. In the case where an IP build +# fails or is terminated before completion, it is sometimes necessary to +# clean up the build so that the next build can complete properly. This +# script searches for and deletes any incomplete IP builds. +# + +import argparse +import os +import shutil + +# argument parsing +parser = argparse.ArgumentParser(description="This script removes all directories where the .build_lock file still exists") +parser.add_argument('--directory', '-d', required=True, help='directory to search for lock files (recursively)') +args = parser.parse_args() + +# search .build_lock files +lockFiles = [] +for root, dirs, files in os.walk(args.directory): + for file in files: + if file == ".build_lock": + lockFiles.append(os.path.join(root, file)) + +# remove all directories containing lock files +for lockFile in lockFiles: + dirPath = os.path.dirname(lockFile) + print("delete " + dirPath) + shutil.rmtree(dirPath) |