#!/bin/bash -l
BASEDIR="/pub/nightly"
+declare -A ARCHES
+ARCHES["master"]="x86_64 i586"
+ARCHES["next"]="x86_64 i586 armv5tel"
MAX_AGE=$(( 7 * 24 * 3600 )) # 7 days
NOW="$(date +"%s")"
+all_successful() {
+ local branch="${1}"
+ local release="${2}"
+
+ local arches="${ARCHES[${branch}]}"
+ [ -z "${arches}" ] && return 0
+
+ local arch
+ for arch in ${arches}; do
+ if [ ! -e "${release}/${arch}/.success" ]; then
+ return 1
+ fi
+ done
+
+ return 0
+}
+
for branch in $(find "${BASEDIR}" -mindepth 1 -maxdepth 1 -type d); do
counter=0
[ "${time}" = "latest" ] && continue
# Never delete the last two builds
- if [ "${counter}" -lt 2 ]; then
+ if [ "${counter}" -lt 2 ] && all_successful "$(basename ${branch})" "${build}"; then
counter=$(( ${counter} + 1 ))
continue
fi