Merge branch 'org.openembedded.dev' of git://git.openembedded.org/openembedded into...
[vuplus_openembedded] / classes / tinderclient.bbclass
index 58b4e54..0b7fc1d 100644 (file)
@@ -24,6 +24,7 @@ def tinder_form_data(bound, dict, log):
     output = []
     # for each key in the dictionary
     for name in dict:
+        assert dict[name]
         output.append( "--" + bound )
         output.append( 'Content-Disposition: form-data; name="%s"' % name )
         output.append( "" )
@@ -60,7 +61,18 @@ def tinder_format_http_post(d,status,log):
         "os"           : os.uname()[0],
         "os_version"   : os.uname()[2],
         "compiler"     : "gcc",
-        "clobber"      : data.getVar('TINDER_CLOBBER', d, True)
+        "clobber"      : data.getVar('TINDER_CLOBBER', d, True) or "0",
+        "srcdate"      : data.getVar('SRCDATE', d, True),
+        "PN"           : data.getVar('PN', d, True),
+        "PV"           : data.getVar('PV', d, True),
+        "PR"           : data.getVar('PR', d, True),
+        "FILE"         : data.getVar('FILE', d, True) or "N/A",
+        "TARGETARCH"   : data.getVar('TARGET_ARCH', d, True),
+        "TARGETFPU"    : data.getVar('TARGET_FPU', d, True) or "Unknown",
+        "TARGETOS"     : data.getVar('TARGET_OS', d, True) or "Unknown",
+        "MACHINE"      : data.getVar('MACHINE', d, True) or "Unknown",
+        "DISTRO"       : data.getVar('DISTRO', d, True) or "Unknown",
+        "zecke-rocks"  : "sure",
     }
 
     # optionally add the status
@@ -240,8 +252,8 @@ def tinder_tinder_start(d, event):
     output.append( "---> TINDERBOX BUILDING '%(packages)s'" )
     output.append( "<--- TINDERBOX STARTING BUILD NOW" )
 
-    output.append( "" ) 
+    output.append( "" )
+
     return "\n".join(output) % vars()
 
 def tinder_do_tinder_report(event):
@@ -279,14 +291,17 @@ def tinder_do_tinder_report(event):
 
         try:
             # truncate the tinder log file
-            f = file(data.getVar('TINDER_LOG', event.data, True), 'rw+')
-            f.truncate(0)
+            f = file(data.getVar('TINDER_LOG', event.data, True), 'w')
+            f.write("")
             f.close()
+        except:
+            pass
 
+        try:
             # write a status to the file. This is needed for the -k option
             # of BitBake
-            g = file(data.getVar('TMPDIR', event.data, True)+"/tinder-status", 'rw+')
-            g.truncate(0)
+            g = file(data.getVar('TMPDIR', event.data, True)+"/tinder-status", 'w')
+            g.write("")
             g.close()
         except IOError:
             pass
@@ -308,12 +323,13 @@ def tinder_do_tinder_report(event):
     elif name == "TaskFailed":
         log += "<--- TINDERBOX Task %s failed (FAILURE)\n" % event.task
     elif name == "PkgStarted":
-        log += "---> TINDERBOX Package %s started\n" % data.getVar('P', event.data, True)
+        log += "---> TINDERBOX Package %s started\n" % data.getVar('PF', event.data, True)
     elif name == "PkgSucceeded":
-        log += "<--- TINDERBOX Package %s done (SUCCESS)\n" % data.getVar('P', event.data, True)
+        log += "<--- TINDERBOX Package %s done (SUCCESS)\n" % data.getVar('PF', event.data, True)
     elif name == "PkgFailed":
-        build.exec_task('do_clean', event.data)
-        log += "<--- TINDERBOX Package %s failed (FAILURE)\n" % data.getVar('P', event.data, True)
+        if not data.getVar('TINDER_AUTOBUILD', event.data, True) == "0":
+            build.exec_func('do_clean', event.data)
+        log += "<--- TINDERBOX Package %s failed (FAILURE)\n" % data.getVar('PF', event.data, True)
         status = 200
         # remember the failure for the -k case
         h = file(data.getVar('TMPDIR', event.data, True)+"/tinder-status", 'w')
@@ -325,7 +341,6 @@ def tinder_do_tinder_report(event):
         try:
             h = file(data.getVar('TMPDIR',event.data,True)+'/tinder-status', 'r')
             status = int(h.read())
-            print "New status %d" % status
         except:
             pass
 
@@ -356,7 +371,11 @@ def tinder_do_tinder_report(event):
 addhandler tinderclient_eventhandler
 python tinderclient_eventhandler() {
     from bb import note, error, data
-    from bb.event import NotHandled
+    from bb.event import NotHandled, getName
+
+    if e.data is None or getName(e) == "MsgNote":
+        return NotHandled
+
     do_tinder_report = data.getVar('TINDER_REPORT', e.data, True)
     if do_tinder_report and do_tinder_report == "1":
         tinder_do_tinder_report(e)