classes/tinderclient.bbclass: Fixes. truncate does not work this way...
authorHolger Freyther <zecke@selfish.org>
Thu, 17 Aug 2006 14:40:54 +0000 (14:40 +0000)
committerHolger Freyther <zecke@selfish.org>
Thu, 17 Aug 2006 14:40:54 +0000 (14:40 +0000)
    Fixup truncate to forget the the status of previous runs. We will
    simply write("") to the file and empty it this way. int(f.read()) will
    fail then

classes/tinderclient.bbclass

index 58b4e54..0cfa9c7 100644 (file)
@@ -279,14 +279,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
@@ -325,7 +328,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