TMP_POLL="/tmp/tl-master-poll"
TMP_MASTER="/tmp/tl-master"
TMP_PWB="/tmp/tl-pwb"
+TMP_PWB_RESULTS="/tmp/tl-pwb-results"
test -d "$TMP_POLL" || mkdir "$TMP_POLL"
test -d "$TMP_MASTER" || mkdir "$TMP_MASTER"
test -d "$TMP_PWB" || mkdir "$TMP_PWB"
+test -d "$TMP_PWB_RESULTS" || mkdir "$TMP_PWB_RESULTS"
alias tspoll="TMPDIR=$TMP_POLL TS_SLOTS=1 tsp"
alias tsmaster="TMPDIR=$TMP_MASTER TS_SLOTS=100 tsp"
alias tspwb="TMPDIR=$TMP_PWB TS_SLOTS=1 tsp"
+alias tsresults="TMPDIR=$TMP_PWB_RESULTS TS_SLOTS=1 tsp"
init_db() {
# Load schema
test -n "$TAG" || die "Missing argument: tag"
test -n "$BUILD_NR" || die "Missing argument: build_nr"
test -n "$TARGET" || die "Missing argument: target"
- nr="$(tspwb -L DB sh "${TSP_DIR}/jobs/update_db.sh" "$SR" "$TAG" "$BUILD_NR" "$TARGET")"
- tspwb -u "$nr"
+ tsresults -L DB sh "${TSP_DIR}/jobs/update_db.sh" "$SR" "$TAG" "$BUILD_NR" "$TARGET"
}
get_userspace_dir() {
# Publish to database
update_db "$SR" "$AVOCADO_TAG" "$BUILD_NR" "$TARGET"
-tspwb -L WWW sh "${TSP_DIR}/jobs/update_www.sh"
+# Remove all queued WWW jobs
+for i in $(tsresults | grep "queued.*WWW" | grep -o "^[0-9]*")
+do
+ tsresults -r "$i"
+done
+
+# Dispatch a new one
+tsresults -L WWW sh "${TSP_DIR}/jobs/update_www.sh"
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'));"
echo "$SR;$TAG;$BUILD_NR;$TARGET" >> "${UPDATE_WWW}"
-lockfile-remove "${DBPATH}"
. "${TSP_DIR}/common.sh"
-# {{{ DBPATH
-lockfile-create --use-pid "${DBPATH}"
-
-test -f "${UPDATE_WWW}" || {
- # }}} DBPATH
- lockfile-remove "${DBPATH}"
- die "No need to update the webpage"
-}
+test -f "${UPDATE_WWW}" || die "No need to update the webpage" 0
# Publish to www
{
} > "${WWW_3_PUBLISH}"
rm "${UPDATE_WWW}"
-
-# }}} DBPATH
-lockfile-remove "${DBPATH}"