From 0fd782f4d82440cc1b2155770aa90e41fc2c1ef0 Mon Sep 17 00:00:00 2001
From: Pawel Wieczorek
Date: Mon, 13 Jun 2016 12:02:36 +0200
Subject: [PATCH] Add pywikibot publisher script
Change-Id: I375328341813199ea15db86a8cef33a97da05a12
---
tsp/scripts/publish.sh | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 58 insertions(+)
create mode 100755 tsp/scripts/publish.sh
diff --git a/tsp/scripts/publish.sh b/tsp/scripts/publish.sh
new file mode 100755
index 0000000..936a229
--- /dev/null
+++ b/tsp/scripts/publish.sh
@@ -0,0 +1,58 @@
+#!/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: Pawel Wieczorek
+
+PAGE_START='###START###'
+PAGE_END='####END####'
+TITLE_TAG="'''"
+OUTPUT='dict.txt'
+
+WORKSPACE="/home/jenkins/pub"
+cd "$WORKSPACE"
+
+### Project list
+FULL_PROJECT="`head -1 project.conf`"
+PROJECT="${FULL_PROJECT##*_}"
+PAGE="Image test results"
+
+echo -n "" > "${OUTPUT}"
+echo "${PAGE_START}" >> "${OUTPUT}"
+echo "${TITLE_TAG}${PAGE}${TITLE_TAG}" >> "${OUTPUT}"
+echo '[['"${PROJECT}"']]' >> "${OUTPUT}"
+echo "" >> "${OUTPUT}"
+echo "${PAGE_END}" >> "${OUTPUT}"
+
+python3 /srv/pwb/pwb.py get "${PAGE}" | grep "${PROJECT}" \
+|| python3 /srv/pwb/pwb.py pagefromfile -start:"${PAGE_START}" -end:"${PAGE_END}" -appendtop \
+-notitle -file:"${WORKSPACE}/${OUTPUT}"
+
+### Detailed project page
+PAGE="${PROJECT}"
+
+echo -n "" > "${OUTPUT}"
+echo "${PAGE_START}" >> "${OUTPUT}"
+echo "${TITLE_TAG}${PAGE}${TITLE_TAG}" >> "${OUTPUT}"
+
+tail -2 project.conf >> "${OUTPUT}" || echo "No project"
+awk '{print " "$0}' sysctl.result >> "${OUTPUT}" || echo "No sysctl"
+awk '{print " "$0}' diff.report >> "${OUTPUT}" || echo "No diff"
+
+echo "" >> "${OUTPUT}"
+echo "${PAGE_END}" >> "${OUTPUT}"
+
+python3 /srv/pwb/pwb.py pagefromfile -start:"${PAGE_START}" -end:"${PAGE_END}" -appendtop \
+-notitle -file:"${WORKSPACE}/${OUTPUT}"
--
2.7.4