Created
February 26, 2018 23:33
-
-
Save misterdjules/e9467ae7f646a187e959a814e7fb9bee to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
➜ mountain-gorilla git:(master) ✗ git diff | cat | |
diff --git a/configure b/configure | |
index 9556013..eae0c94 100755 | |
--- a/configure | |
+++ b/configure | |
@@ -283,39 +283,53 @@ function preload_bits_from_manta() { | |
# of the actual latest path. Something similar but with a "-<buildstamp>" | |
# instead of "-latest" and we'll grab that into latest_dir. | |
# | |
- local count=0 | |
local latest_dir= | |
local delay=0 | |
+ local dirnames= | |
+ local previous_releases= | |
local success= | |
- set +o errexit # want to do our own error-handling here | |
- while [[ ${count} -lt ${MANTA_MAX_RETRIES} && -z ${success} ]]; do | |
+ dirnames[${#dirnames[@]}]="${best_branch}-latest" | |
+ if [[ "$branch" != "$best_branch" ]]; then | |
+ dirnames[${#dirnames[@]}]="${branch}-latest" | |
+ fi | |
+ | |
+ previous_releases=$(mls /Joyent_Dev/public/builds/${target_base} | \ | |
+ grep -E 'release-\d{8}-latest' | sort -r) | |
- if [[ ${count} -gt 0 ]]; then | |
- cat /tmp/mget-output.$$ | |
- delay=$((${count} * 20)) | |
- if [[ $delay -gt 60 ]]; then | |
- delay=60 | |
+ dirnames+=( "${previous_releases[@]}") | |
+ | |
+ set +o errexit # want to do our own error-handling here | |
+ for dir_name in ${dirnames[@]}; do | |
+ local count=0 | |
+ while [[ ${count} -lt ${MANTA_MAX_RETRIES} && -z ${success} ]]; do | |
+ | |
+ if [[ ${count} -gt 0 ]]; then | |
+ cat /tmp/mget-output.$$ | |
+ delay=$((${count} * 20)) | |
+ if [[ $delay -gt 60 ]]; then | |
+ delay=60 | |
+ fi | |
+ echo "Could not get latest dir for target ${target}, retrying in ${delay}s" | |
+ sleep ${delay} | |
fi | |
- echo "Could not get latest dir for target ${target}, retrying in ${delay}s" | |
- sleep ${delay} | |
- fi | |
- latest_dir=$(mget -v -q ${target_mpath}/${best_branch}-latest 2> /tmp/mget-output.$$) | |
+ latest_dir=$(mget -v -q ${target_mpath}/${dir_name} 2> /tmp/mget-output.$$) | |
- if [[ $? == 0 ]]; then | |
- success=1 | |
- elif [[ "$branch" != "$best_branch" ]]; then | |
- # Try "branch" as a fallback, if we've specified "try_branch". | |
- latest_dir=$(mget -v -q ${target_mpath}/${branch}-latest) | |
if [[ $? == 0 ]]; then | |
success=1 | |
+ break; | |
fi | |
+ | |
+ count=$((${count} + 1)) | |
+ done | |
+ | |
+ if [[ $success -eq 1 ]]; then | |
+ break; | |
fi | |
- count=$((${count} + 1)) | |
+ set -o errexit # back to errexit | |
done | |
- set -o errexit # back to errexit | |
if [[ -z ${latest_dir} ]]; then | |
cat /tmp/mget-output.$$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment