From 9a138677a86ed7c50434b2b273539cfd2eb1edb4 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Tue, 24 Nov 2015 13:31:08 -0800 Subject: [PATCH] prune_images: keep newer-than-latest builds This may include recent failures or builds derrived from latest, such as those made by image_set_group. --- prune_images | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/prune_images b/prune_images index cab04f7057..7afdc9b109 100755 --- a/prune_images +++ b/prune_images @@ -44,9 +44,13 @@ for board_path in "${board_paths[@]}"; do continue fi - if [[ ${FLAGS_keep_latest} -eq ${FLAGS_TRUE} && - "${board_path}/latest" -ef "${image_path}" ]]; then - continue + if [[ ${FLAGS_keep_latest} -eq ${FLAGS_TRUE} ]]; then + # keep anything that is or newer than the latest + if [[ "${board_path}/latest" -ef "${image_path}" || \ + "${board_path}/latest/version.txt" -ot \ + "${image_path}/version.txt" ]]; then + continue + fi fi # best effort attempt to clean up old mounts