diff options
author | Naresh Kamboju <naresh.kamboju@linaro.org> | 2015-11-27 14:33:15 +0530 |
---|---|---|
committer | Naresh Kamboju <naresh.kamboju@linaro.org> | 2015-11-27 09:48:30 +0000 |
commit | 0d2c9e5809a7f3eb314989396373cad5b2189f4b (patch) | |
tree | 85e399ab4450f9f40972d36f7f9b62bf392be2f0 | |
parent | 26978969a1d294130efd9557201af0056b43e7ad (diff) |
wa2-lava: Install dependency packages on host
Install dependency packages on host side.
install-deps.sh script will look for apt-get lock and install packages
when the lock is free. The advantages of this patch is
- Do not install if the package is already present
- Installation should not fail because of parallel installation of packages
- if apt-get is already locked wait 5 sec and try installation again
till it get successful
Change-Id: Id4797f65e2bf826d30600b2f1444e8239ce11260
Signed-off-by: Naresh Kamboju <naresh.kamboju@linaro.org>
-rwxr-xr-x | install-deps.sh | 35 | ||||
-rw-r--r-- | wa2host.yaml | 22 |
2 files changed, 38 insertions, 19 deletions
diff --git a/install-deps.sh b/install-deps.sh new file mode 100755 index 0000000..a188bb9 --- /dev/null +++ b/install-deps.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# Example: +# ./install-deps.sh android-tools-adb android-tools-fastboot +# Wait for unlock apt function waits for the apt-get process to be completed +# If in case it is already running + +wait_for_unlock_apt () { + RET=1 + while [ $RET -eq 1 ]; do + PID=`pgrep apt-get` + if [ -z $PID ]; then + RET=0 + break + fi + echo "apt-get still running PID: $PID" + sleep 5 + done +} + +# Read each package name from command line arguments +for pkg in ${@} +do + # Check if packages are already installed + STATUS=`dpkg-query -W -f='${Status} \n' $pkg | awk '{print $1}'` + + if [ "$STATUS" == "install" ]; then + echo "==== $pkg package is already installed ====" + else + wait_for_unlock_apt + echo "==== Install $pkg package ====" + apt-get install $pkg + fi +done +exit 0 diff --git a/wa2host.yaml b/wa2host.yaml index 75b2584..764b735 100644 --- a/wa2host.yaml +++ b/wa2host.yaml @@ -19,6 +19,8 @@ params: # name of the template for device config CONFIG: "config-juno.py" SIGNAL_PREFIX: "workload" + DEPENDENCIES: "git wget zip xz-utils python python-yaml python-lxml python-setuptools python-numpy python-colorama python-pip sqlite3 libstdc++6:i386 libgcc1:i386 zlib1g:i386 libncurses5:i386 android-tools-adb android-tools-fastboot" + # TODO: build-tools.tar.gz only accessible from Linaro LAVA lab # TODO: Provide a valid build-tools URL from Json BUILD_TOOLS_URL: "http://testdata.validation.linaro.org/apks/workload-automation/build-tools.tar.gz" @@ -28,27 +30,9 @@ params: install: steps: + - './install-deps.sh $DEPENDENCIES' - './prerequisites.sh' - './install-wa2.sh $BUILD_TOOLS_URL $WA_HOME_URL' - deps: - - git - - wget - - zip - - xz-utils - - python - - python-yaml - - python-lxml - - python-setuptools - - python-numpy - - python-colorama - - python-pip - - sqlite3 - - libstdc++6:i386 - - libgcc1:i386 - - zlib1g:i386 - - libncurses5:i386 - - android-tools-adb - - android-tools-fastboot run: steps: |