From: Thanh Ha Date: Mon, 6 Mar 2017 05:13:28 +0000 (-0500) Subject: Fix archives script "File exists" spam X-Git-Tag: v0.0.7~1 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F60%2F4060%2F1;p=releng%2Flftools.git Fix archives script "File exists" spam The archive scripts has a bug that causes it to spam "File exists" at the end of a log. This patch improves the script to handle this a little better. Change-Id: I61e939e74d7ab9c5f87a83cebd96ce886927bc88 Signed-off-by: Thanh Ha --- diff --git a/shell/deploy-archives b/shell/deploy-archives index 562e940c..9a6bcb49 100644 --- a/shell/deploy-archives +++ b/shell/deploy-archives @@ -72,12 +72,14 @@ EOF mkdir -p "$ARCHIVES_DIR" mkdir -p "$WORKSPACE/archives" -if [ ! -z "${ARCHIVE_ARTIFACTS}" ]; then +if [ ! -z "$ARCHIVE_ARTIFACTS" ]; then pushd "$WORKSPACE" shopt -s globstar # Enable globstar to copy archives for f in $ARCHIVE_ARTIFACTS; do + [[ -e $f ]] || continue # handle the case of no files to archive echo "Archiving $f" - mkdir -p "$WORKSPACE/archives/$(dirname "$f")" + dir=$(dirname "$f") + mkdir -p "$WORKSPACE/archives/$dir" mv "$f" "$WORKSPACE/archives/$f" done shopt -u globstar # Disable globstar once archives are copied