summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Mistewicz <a.mistewicz@samsung.com>2018-04-24 11:45:21 +0200
committerAleksander Mistewicz <a.mistewicz@samsung.com>2018-06-11 14:45:40 +0200
commitbff8da840034fc531409bbaa977c3edc6c787747 (patch)
tree1fa0b5eea65ddafb1e29c08c1d6f0bcb1ead32b3
parentb72f07b7cb39627a85f9fe2de0401a0991fa41a2 (diff)
downloadmajor-bff8da840034fc531409bbaa977c3edc6c787747.tar.gz
major-bff8da840034fc531409bbaa977c3edc6c787747.tar.bz2
major-bff8da840034fc531409bbaa977c3edc6c787747.zip
Use reference snapshots instead of latest ones
Change-Id: I1634f28348cb9eaf6345e85b59a4034867ac7fd8
-rwxr-xr-xtsp/common.sh9
-rwxr-xr-xtsp/jobs/common_prep_flash_conf.sh5
-rwxr-xr-xtsp/jobs/publish.sh7
3 files changed, 19 insertions, 2 deletions
diff --git a/tsp/common.sh b/tsp/common.sh
index 467886a..866b419 100755
--- a/tsp/common.sh
+++ b/tsp/common.sh
@@ -49,11 +49,13 @@ WS_TEST_REMOTE="${WS}/img_test_remote"
WS_PUBLISH="${WS}/publish"
SNAPSHOT_WS_DOWNLOAD="${WS_DOWNLOAD}/snapshot"
SNAPSHOT_WS_DOWNLOAD_NEW="${WS_DOWNLOAD}/new_snapshot"
+SNAPSHOT_WS_BY_SR="${WS_DOWNLOAD}/by-sr"
PROM_DIR="${WS}/prom"
test -d "${PROM_DIR}" || mkdir -p "${PROM_DIR}"
test -d "${WS_PUBLISH}" || mkdir -p "${WS_PUBLISH}"
+test -d "${SNAPSHOT_WS_BY_SR}" || mkdir -p "${SNAPSHOT_WS_BY_SR}"
DBNAME="results.db3"
DBPATH="${WS_PUBLISH}/${DBNAME}"
@@ -151,6 +153,13 @@ sr2reference() {
echo "$SR" | grep -o "[0-9]\{8\}\.[0-9]\+" | head -n 1
}
+sr2reference_dwn() {
+ SR="$1"
+ PROFILE="$2"
+ test -d "${SNAPSHOT_WS_BY_SR}/${PROFILE}" || mkdir -p "${SNAPSHOT_WS_BY_SR}/${PROFILE}"
+ echo "${SNAPSHOT_WS_BY_SR}/${PROFILE}/$(sr2reference "$SR")"
+}
+
update_db() {
SR="$1"
TAG="$2"
diff --git a/tsp/jobs/common_prep_flash_conf.sh b/tsp/jobs/common_prep_flash_conf.sh
index 09a3e84..41f5088 100755
--- a/tsp/jobs/common_prep_flash_conf.sh
+++ b/tsp/jobs/common_prep_flash_conf.sh
@@ -43,8 +43,10 @@ USR_IMG_DIR="$(get_userspace_dir "${TARGET}" "${DWN_WORKDIR}")"
case "$TARGET" in
*odroid*|*artik*|*rpi3*)
BOOT_IMG="$(ls "$(get_boot_dir "${TARGET}" "${DWN_WORKDIR}")"/*.tar.gz)"
+ test -f "${BOOT_IMG}" || BOOT_IMG="$(ls "$(get_boot_dir "${TARGET}" "$(sr2reference_dwn "$SR" "$PROFILE")")"/*.tar.gz)"
test -f "${BOOT_IMG}" || BOOT_IMG="$(ls "$(get_boot_dir "${TARGET}" "${SNAPSHOT_WS_DOWNLOAD}-${PROFILE}")"/*.tar.gz)"
USERSPACE_IMG="$(ls "${USR_IMG_DIR}"/*.tar.gz)"
+ test -f "${USERSPACE_IMG}" || USERSPACE_IMG="$(ls "$(get_userspace_dir "${TARGET}" "$(sr2reference_dwn "$SR" "$PROFILE")")"/*.tar.gz)"
test -f "${USERSPACE_IMG}" || USERSPACE_IMG="$(ls "$(get_userspace_dir "${TARGET}" "${SNAPSHOT_WS_DOWNLOAD}-${PROFILE}")"/*.tar.gz)"
# TODO: Both images shouldn't be replaced by snapshot's at the same time
;;
@@ -64,6 +66,9 @@ esac
test -z "${BOOT_IMG}" || test -f "${BOOT_IMG}" || die "No boot image found: ${BOOT_IMG}!"
test -f "${USERSPACE_IMG}" || die "No userspace image found: ${USERSPACE_IMG}!"
+echo "Boot image: ${BOOT_IMG}"
+echo "Userspace image: ${USERSPACE_IMG}"
+
FAIL_CNT="$3"
test -n "${FAIL_CNT}" || FAIL_CNT=0
diff --git a/tsp/jobs/publish.sh b/tsp/jobs/publish.sh
index 7777416..9a3924f 100755
--- a/tsp/jobs/publish.sh
+++ b/tsp/jobs/publish.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+# Copyright (c) 2016, 2018 Samsung Electronics Co., Ltd All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -134,7 +134,10 @@ then
update_symlink "$PRERELEASE_JSON" "$SNAPSHOT_JSON"
update_symlink "$SCREENSHOT_FILE" "$SNAPSHOT_SCREENSHOT_FILE"
SNAPSHOT_WS_DOWNLOAD_NEW_PROFILE="${SNAPSHOT_WS_DOWNLOAD_NEW}-${PROFILE}"
- test -L "${SNAPSHOT_WS_DOWNLOAD_NEW_PROFILE}" && mv -T "${SNAPSHOT_WS_DOWNLOAD_NEW_PROFILE}" "${SNAPSHOT_WS_DOWNLOAD}-${PROFILE}"
+ test -L "${SNAPSHOT_WS_DOWNLOAD_NEW_PROFILE}" && {
+ mv -T "${SNAPSHOT_WS_DOWNLOAD_NEW_PROFILE}" "${SNAPSHOT_WS_DOWNLOAD}-${PROFILE}"
+ ln -Tsf "${DWN_WORKDIR}" "$(sr2reference_dwn "$SR" "$PROFILE")"
+ }
TAG="Snapshot"
# Mark Snapshot as ready to be deduped
touch "${DWN_WORKDIR}/dedup"