Added update notification feature. 08/64308/1
authorTomasz Olszak <t.olszak@samsung.com>
Thu, 31 Mar 2016 09:17:48 +0000 (11:17 +0200)
committerTomasz Olszak <t.olszak@samsung.com>
Thu, 31 Mar 2016 09:56:39 +0000 (11:56 +0200)
Change-Id: Ie68607f610c5d228935a7181ae95cc2c47c244d9

tool/development/buildbot/check_for_updates.py [new file with mode: 0755]
tool/development/buildbot/nativesamples.py

diff --git a/tool/development/buildbot/check_for_updates.py b/tool/development/buildbot/check_for_updates.py
new file mode 100755 (executable)
index 0000000..b14712e
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/python
+
+import sys, os
+import subprocess
+import traceback
+import nativesamples as ns
+
+reload(sys)
+sys.setdefaultencoding('utf8')
+
+if ns.numberOfProcesses(".*python.*" + os.path.basename(__file__)) > 1:
+       print "process already running"
+       sys.exit(0)
+
+if len(sys.argv) < 2:
+       print "Please provide samples root build path"
+       sys.exit(0)
+
+rootBuildDir =  os.path.abspath(sys.argv[1])
+
+nativeSamples = ns.NativeSamples(rootBuildDir)
+
+try:
+       nativeSamples.checkAndSendEmailIfUpdateIsAvailable()
+except:
+       subject = 'Tizen SAMPLE DAILY BUILD TEST error: Something unexpected happened during daily build check'
+       stacktrace = "Exception Info:\n\n" + traceback.format_exc()
+       traceback.print_exc()
+       nativeSamples.emailSender.send(mailSubject = subject, mailText = stacktrace)
index dc1c466..bc87ef9 100644 (file)
@@ -795,3 +795,10 @@ class NativeSamples:
                                print "Evaluating next project"
                htmlText += "</TABLE></HTML>"
                self.emailSender.send(mailSubject = 'DAILY REGRESSION TESTS SUMMARY (' + str(datetime.date.today())+")", mailText = htmlText, mimeType='html')
+       def checkAndSendEmailIfUpdateIsAvailable(self):
+               os.chdir(self.config.sampleCoreComponentsPath)
+               subprocess.call(["git", "fetch", "origin"])
+               output = subprocess.check_output(["git", "branch", "--contains", "origin/master"], stderr = subprocess.STDOUT)
+               reRes =  re.search("^\*", output)
+               if reRes is None:
+                       self.emailSender.send(mailSubject = "BUILDBOT UPDATE AVAILABLE", mailText = "Seems like update for sample-core-components is available. origin/master is not pulled to local repository")