summaryrefslogtreecommitdiff
path: root/tsp
diff options
context:
space:
mode:
authorAleksander Mistewicz <a.mistewicz@samsung.com>2016-12-13 16:37:40 +0100
committerAleksander Mistewicz <a.mistewicz@samsung.com>2017-02-01 17:36:51 +0100
commit8b9256dd3fa317293103bcb14c49c8ec77b27bed (patch)
tree6a68d4af84a7c0c90b9bd3d0853664a062cfee2a /tsp
parent102a4198ccb3580dfd6f39a3c846f5f6d8784593 (diff)
downloadmajor-8b9256dd3fa317293103bcb14c49c8ec77b27bed.tar.gz
major-8b9256dd3fa317293103bcb14c49c8ec77b27bed.tar.bz2
major-8b9256dd3fa317293103bcb14c49c8ec77b27bed.zip
Move update_db to separate job
Change-Id: I0d75a2c004ce65bf9efb6c95645e0a4b394159e6 Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Diffstat (limited to 'tsp')
-rwxr-xr-xtsp/common.sh7
-rwxr-xr-xtsp/jobs/update_db.sh37
2 files changed, 39 insertions, 5 deletions
diff --git a/tsp/common.sh b/tsp/common.sh
index 81b8e66..a6ddcdd 100755
--- a/tsp/common.sh
+++ b/tsp/common.sh
@@ -102,11 +102,8 @@ update_db() {
test -n "$TAG" || die "Missing argument: tag"
test -n "$BUILD_NR" || die "Missing argument: build_nr"
test -n "$TARGET" || die "Missing argument: target"
- lockfile-create --use-pid "${DBPATH}"
- sqlite3 "${DBPATH}" "insert into test values (NULL,'$SR', CURRENT_TIMESTAMP, $BUILD_NR,\
- (select r.rid from result r where r.rname='$TAG'),\
- (select d.did from device d where d.dname='$TARGET'));"
- lockfile-remove "${DBPATH}"
+ nr="$(tspwb -L DB sh "${TSP_DIR}/jobs/update_db.sh" "$SR" "$TAG" "$BUILD_NR" "$TARGET")"
+ tspwb -u "$nr"
}
get_userspace_dir() {
diff --git a/tsp/jobs/update_db.sh b/tsp/jobs/update_db.sh
new file mode 100755
index 0000000..1c322ee
--- /dev/null
+++ b/tsp/jobs/update_db.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+# Copyright (c) 2016 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.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Author: Aleksander Mistewicz <a.mistewicz@samsung.com>
+
+export TSP_DIR="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)/.."
+
+. "${TSP_DIR}/common.sh"
+
+SR="$1"
+TAG="$2"
+BUILD_NR="$3"
+TARGET="$4"
+
+test -n "$SR" || die "Missing argument: sr"
+test -n "$TAG" || die "Missing argument: tag"
+test -n "$BUILD_NR" || die "Missing argument: build_nr"
+test -n "$TARGET" || die "Missing argument: target"
+
+lockfile-create --use-pid "${DBPATH}"
+sqlite3 "${DBPATH}" "insert into test values (NULL,'$SR', CURRENT_TIMESTAMP, $BUILD_NR,\
+ (select r.rid from result r where r.rname='$TAG'),\
+ (select d.did from device d where d.dname='$TARGET'));"
+lockfile-remove "${DBPATH}"