Refinesments. Change-Id: I920eaacb2b4d29fff66ee5fecf2cb8057fbc7f5c
diff --git a/releng/scripts/prebuild.sh b/releng/scripts/prebuild.sh index 6050a3b..5546020 100644 --- a/releng/scripts/prebuild.sh +++ b/releng/scripts/prebuild.sh
@@ -19,17 +19,17 @@ LAST_CLEANED_RECORD="$PRIVATE_MAVEN/.lastCleaned" TODAY=`date "+%Y-%m-%d"` +# +# Function determining whether the private Maven repository should be cleaned. +# need_clean_repo() { if [[ ! -f "$LAST_CLEANED_RECORD" ]]; then return 0; # Initial clean to be recorded fi - lcRecord=`cat "$LAST_CLEANED_RECORD"` # The first word of the record is the build ID that was cleaned - lastCleanedBuild="${lcRecord%%\ *}" # The rest of the record is the date that it was cleaned - lastCleanedDate="${lcRecord#*\ }" - + read lastCleanedBuild lastCleanedDate < "$LAST_CLEANED_RECORD" # Clean if the last cleaned build was ten builds ago if (( "$BUILD_NUMBER" - "$lastCleanedBuild" >= 10 )); then @@ -45,6 +45,9 @@ return 1 } +# +# Function to clean the private maven repository. +# clean_repo() { rm -rf "$PRIVATE_REPO" mkdir -p "$PRIVATE_REPO"