mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-01 03:34:32 +02:00
Merge branch 'bugfix/delete_useless_built_binaries_failed' into 'master'
CI: fix the bug that will cause non-preserve app binaries won't get removed See merge request espressif/esp-idf!9767
This commit is contained in:
@@ -6,10 +6,10 @@
|
||||
|
||||
import argparse
|
||||
import logging
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
from find_build_apps import BuildItem, BuildError, setup_logging, BUILD_SYSTEMS
|
||||
from find_build_apps.common import rmdir, SIZE_JSON_FN
|
||||
|
||||
|
||||
def main():
|
||||
@@ -127,9 +127,9 @@ def main():
|
||||
if args.size_info:
|
||||
build_info.write_size_info(args.size_info)
|
||||
if not build_info.preserve:
|
||||
logging.info("Removing build directory {}".format(build_info.build_dir))
|
||||
logging.info("Removing build directory {}".format(build_info.build_path))
|
||||
# we only remove binaries here, log files are still needed by check_build_warnings.py
|
||||
shutil.rmtree(build_info.build_dir, ignore_errors=True)
|
||||
rmdir(build_info.build_path, exclude_file_pattern=SIZE_JSON_FN)
|
||||
|
||||
if failed_builds:
|
||||
logging.error("The following build have failed:")
|
||||
|
@@ -22,6 +22,7 @@ FULL_NAME_PLACEHOLDER = "@f"
|
||||
INDEX_PLACEHOLDER = "@i"
|
||||
|
||||
IDF_SIZE_PY = os.path.join(os.environ["IDF_PATH"], "tools", "idf_size.py")
|
||||
SIZE_JSON_FN = 'size.json'
|
||||
|
||||
SDKCONFIG_LINE_REGEX = re.compile(r"^([^=]+)=\"?([^\"\n]*)\"?\n*$")
|
||||
|
||||
@@ -68,6 +69,22 @@ def find_first_match(pattern, path):
|
||||
return None
|
||||
|
||||
|
||||
def rmdir(path, exclude_file_pattern=None):
|
||||
if not exclude_file_pattern:
|
||||
shutil.rmtree(path, ignore_errors=True)
|
||||
return
|
||||
|
||||
for root, dirs, files in os.walk(path, topdown=False):
|
||||
for f in files:
|
||||
if not fnmatch.fnmatch(f, exclude_file_pattern):
|
||||
os.remove(os.path.join(root, f))
|
||||
for d in dirs:
|
||||
try:
|
||||
os.rmdir(os.path.join(root, d))
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
|
||||
class BuildItem(object):
|
||||
"""
|
||||
Instance of this class represents one build of an application.
|
||||
@@ -242,7 +259,7 @@ class BuildItem(object):
|
||||
if not map_file:
|
||||
raise ValueError('.map file not found under "{}"'.format(self.build_path))
|
||||
|
||||
size_json_fp = os.path.join(self.build_path, 'size.json')
|
||||
size_json_fp = os.path.join(self.build_path, SIZE_JSON_FN)
|
||||
idf_size_args = [
|
||||
sys.executable,
|
||||
IDF_SIZE_PY,
|
||||
|
Reference in New Issue
Block a user