FIX: Do not download Qemu multiple times per job 33/7633/2
authorPeter Mikus <pmikus@cisco.com>
Wed, 19 Jul 2017 07:21:49 +0000 (07:21 +0000)
committerPeter Mikus <pmikus@cisco.com>
Wed, 19 Jul 2017 07:22:07 +0000 (07:22 +0000)
- Add caching of Qemu source code to avoid downloading multiple times.

Change-Id: Ie06dd87a08c38ca27fbe9844f25f11b8df1ff2e2
Signed-off-by: Peter Mikus <pmikus@cisco.com>
resources/libraries/bash/qemu_build.sh

index ad6d27b..5fbbef8 100755 (executable)
@@ -56,12 +56,14 @@ else
         { echo "Qemu already installed: ${QEMU_INSTALL_DIR}"; exit 0; }
 fi
 
-# Download QEMU source code
-wget -P ${WORKING_DIR} -q ${QEMU_PACKAGE_URL} || \
-    { echo "Failed to download ${QEMU_VERSION}"; exit 1; }
+# Download QEMU source code if no local copy exists
+if [ ! -f /opt/${QEMU_DOWNLOAD_PACKAGE} ]; then
+    wget -P /opt -q ${QEMU_PACKAGE_URL} || \
+        { echo "Failed to download ${QEMU_VERSION}"; exit 1; }
+fi
 
 # Extract archive into temp directory
-tar --strip-components 1 -xf ${WORKING_DIR}/${QEMU_DOWNLOAD_PACKAGE} -C ${WORKING_DIR} || \
+tar --strip-components 1 -xf /opt/${QEMU_DOWNLOAD_PACKAGE} -C ${WORKING_DIR} || \
     { echo "Failed to extract ${QEMU_VERSION}.tar.xz"; exit 1; }
 
 cd ${WORKING_DIR}

©2016 FD.io a Linux Foundation Collaborative Project. All Rights Reserved.
Linux Foundation is a registered trademark of The Linux Foundation. Linux is a registered trademark of Linus Torvalds.
Please see our privacy policy and terms of use.