From 2320429ce2eace8ea847487428dbd2cbc665a7be Mon Sep 17 00:00:00 2001 From: Aleksander Mistewicz Date: Wed, 1 Jun 2016 19:00:16 +0200 Subject: [PATCH] Move all workspaces' paths to tsp/common.sh Change-Id: I5539cd6852c9e051467e923bf8520ca49e1d4c42 Signed-off-by: Aleksander Mistewicz --- tsp/common.sh | 6 ++++++ tsp/jobs/common_prep_flash_conf.sh | 6 +++--- tsp/jobs/img_test_common.sh | 7 ++++--- tsp/jobs/publish.sh | 4 ++-- tsp/jobs/trigger_downloads.sh | 11 +++++------ tsp/jobs/watcher.sh | 5 ++--- tsp/scripts/free_diskspace.sh | 7 ++++++- 7 files changed, 28 insertions(+), 18 deletions(-) diff --git a/tsp/common.sh b/tsp/common.sh index c4b59c3..dec04c3 100755 --- a/tsp/common.sh +++ b/tsp/common.sh @@ -27,6 +27,12 @@ die() { exit ${2:-1} } +WS="${HOME}/ws" +WS_WATCHER="${WS}/watcher" +WS_DOWNLOAD="${WS}/dwn" +WS_TEST="${WS}/img_test" +WS_TEST_REMOTE="${WS}/img_test_remote" + alias tspoll="TS_SOCKET=/tmp/socket.tl-master-poll tsp" alias tsmaster="TS_SOCKET=/tmp/socket.tl-master tsp" alias tspwb="TS_SOCKET=/tmp/socket.tl-pwb tsp" diff --git a/tsp/jobs/common_prep_flash_conf.sh b/tsp/jobs/common_prep_flash_conf.sh index fd8b663..b19f653 100755 --- a/tsp/jobs/common_prep_flash_conf.sh +++ b/tsp/jobs/common_prep_flash_conf.sh @@ -22,9 +22,9 @@ export TSP_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)/.." test -n "$1" || die "Missing argument: build nr" -WORKDIR="${HOME}/ws/img_test/$1" -WORKDIR_REMOTE="${HOME}/ws/img_test_remote/$1" -DWN_WORKDIR="${HOME}/ws/dwn/$1" +WORKDIR="${WS_TEST}/$1" +WORKDIR_REMOTE="${WS_TEST_REMOTE}/$1" +DWN_WORKDIR="${WS_DOWNLOAD}/$1" case "$0" in *odroid*) BOOT_IMG="`ls ${DWN_WORKDIR}/tizen-common_*-boot-*.tar.gz`" diff --git a/tsp/jobs/img_test_common.sh b/tsp/jobs/img_test_common.sh index 3f347a2..9777b11 100755 --- a/tsp/jobs/img_test_common.sh +++ b/tsp/jobs/img_test_common.sh @@ -22,9 +22,10 @@ export TSP_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)/.." test -n "$1" || die "Missing argument: build nr" -WORKDIR="${HOME}/ws/img_test/$1" -WORKDIR_REMOTE="${HOME}/ws/img_test_remote/$1" -DWN_WORKDIR="${HOME}/ws/dwn/$1" +WORKDIR="${WS_TEST}/$1" +WORKDIR_REMOTE="${WS_TEST_REMOTE}/$1" +DWN_WORKDIR="${WS_DOWNLOAD}/$1" + case "$0" in *odroid*) TARGET="odroid" diff --git a/tsp/jobs/publish.sh b/tsp/jobs/publish.sh index 83c8190..5e016f0 100755 --- a/tsp/jobs/publish.sh +++ b/tsp/jobs/publish.sh @@ -22,8 +22,8 @@ export TSP_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)/.." test -n "$1" || die "Missing argument: build nr" -IMG_WORKDIR="${HOME}/ws/img_test/$1" -DWN_WORKDIR="${HOME}/ws/dwn/$1" +IMG_WORKDIR="${WS_TEST}/$1" +DWN_WORKDIR="${WS_DOWNLOAD}/$1" WORKSPACE="/home/jenkins/pub" # Clean up workspace diff --git a/tsp/jobs/trigger_downloads.sh b/tsp/jobs/trigger_downloads.sh index 66efc4b..32832ac 100755 --- a/tsp/jobs/trigger_downloads.sh +++ b/tsp/jobs/trigger_downloads.sh @@ -20,9 +20,8 @@ export TSP_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)/.." . "${TSP_DIR}/common.sh" -WS="${HOME}/ws/watcher" -mkdir -p "${WS}" -cd "${WS}" +mkdir -p "${WS_WATCHER}" +cd "${WS_WATCHER}" touch next_dwn i=$(cat next_dwn) test -n "$i" || i=1 @@ -36,8 +35,8 @@ do fi for target in "minnow" "odroid" do - mkdir -p "${HOME}/ws/dwn/$i" - cd "${HOME}/ws/dwn/$i" + mkdir -p "${WS_DOWNLOAD}/$i" + cd "${WS_DOWNLOAD}/$i" # Download image for $target nr=$(tsmaster -L "DOWNLOAD_IMAGE_${target}" python "${TSP_DIR}/scripts/download_image.py" --log=INFO "--${target}" "$url") nr=$(tsmaster -D "$nr" -L "IMAGE_TEST_${target}" \ @@ -45,4 +44,4 @@ do i=$((i+1)) done done -echo "$i" > "${WS}/next_dwn" +echo "$i" > "${WS_WATCHER}/next_dwn" diff --git a/tsp/jobs/watcher.sh b/tsp/jobs/watcher.sh index bef28e0..4c1e7ff 100755 --- a/tsp/jobs/watcher.sh +++ b/tsp/jobs/watcher.sh @@ -20,9 +20,8 @@ export TSP_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)/.." . "${TSP_DIR}/common.sh" -WS="${HOME}/ws/watcher" -mkdir -p "${WS}" -cd "${WS}" +mkdir -p "${WS_WATCHER}" +cd "${WS_WATCHER}" touch dispatched_urls nr=$(tspoll -L PRERELEASE_WATCHER sh -c "ROOT=\"http://download.tizen.org/prerelease/tizen/common/\" \ ${TSP_DIR}/scripts/crawler.py") diff --git a/tsp/scripts/free_diskspace.sh b/tsp/scripts/free_diskspace.sh index 1cee18d..5aa0a24 100755 --- a/tsp/scripts/free_diskspace.sh +++ b/tsp/scripts/free_diskspace.sh @@ -18,7 +18,12 @@ # Assume that most of the space is taken up by downloaded images. # Delete ones that were modified at least 3 days ago. -for i in $(find "${HOME}/ws/dwn" -type d -mtime +2) + +export TSP_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)/.." + +. "${TSP_DIR}/common.sh" + +for i in $(find "${WS_DOWNLOAD}" -type d -mtime +2) do if grep -q "Snapshot" "$(ls $i/diff-*.report)" then -- 2.7.4