runqueue.py: Correctly redirect stdin when forking.
authorRichard Purdie <rpurdie@linux.intel.com>
Tue, 12 Jun 2007 10:26:28 +0000 (10:26 +0000)
committerRichard Purdie <rpurdie@linux.intel.com>
Tue, 12 Jun 2007 10:26:28 +0000 (10:26 +0000)
cooker.py: If parsing errors are found, exit, too many users miss the errors

ChangeLog
lib/bb/cooker.py
lib/bb/runqueue.py

index 4bac05c..579c32a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,6 @@
 Changes in Bitbake 1.8.x:
+       - Correctly redirect stdin when forking
+       - If parsing errors are found, exit, too many users miss the errors
 
 Changes in Bitbake 1.8.4:
        - Make sure __inherit_cache is updated before calling include() (from Michael Krelin)
index 1868b26..77f71a7 100644 (file)
@@ -597,7 +597,7 @@ class BBCooker:
         return (finalfiles, masked)
 
     def parse_bbfiles(self, filelist, masked, progressCallback = None):
-        parsed, cached, skipped = 0, 0, 0
+        parsed, cached, skipped, error = 0, 0, 0, 0
         for i in xrange( len( filelist ) ):
             f = filelist[i]
 
@@ -640,6 +640,7 @@ class BBCooker:
                 self.bb_cache.sync()
                 raise
             except Exception, e:
+                error += 1
                 self.bb_cache.remove(f)
                 bb.msg.error(bb.msg.domain.Collection, "%s while parsing %s" % (e, f))
             except:
@@ -651,3 +652,6 @@ class BBCooker:
             bb.msg.note(1, bb.msg.domain.Collection, "Parsing finished. %d cached, %d parsed, %d skipped, %d masked." % ( cached, parsed, skipped, masked ))
 
         self.bb_cache.sync()
+
+        if error > 0:
+            bb.msg.fatal(bb.msg.domain.Collection, "Parsing errors found, exiting...")
index 83c3ccf..ef3cbd3 100644 (file)
@@ -492,7 +492,8 @@ class RunQueue:
                     # signal.signal(signal.SIGINT, signal.SIG_IGN)
                     # Make the child the process group leader
                     os.setpgid(0, 0)
-                    sys.stdin = open('/dev/null', 'r')
+                    newsi = os.open('/dev/null', os.O_RDWR)
+                    os.dup2(newsi, sys.stdin.fileno())
                     self.cooker.configuration.cmd = taskname[3:]
                     try: 
                         self.cooker.tryBuild(fn, False)