Fix archives script "File exists" spam 60/4060/1
authorThanh Ha <thanh.ha@linuxfoundation.org>
Mon, 6 Mar 2017 05:13:28 +0000 (00:13 -0500)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Mon, 6 Mar 2017 05:14:01 +0000 (00:14 -0500)
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 <thanh.ha@linuxfoundation.org>
shell/deploy-archives

index 562e940..9a6bcb4 100644 (file)
@@ -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