477 |
477 |
478 # Send stderr to a file so that it can't mess up the log (e.g. |
478 # Send stderr to a file so that it can't mess up the log (e.g. |
479 # clock skew messages from some build engines scatter their |
479 # clock skew messages from some build engines scatter their |
480 # output across our xml. |
480 # output across our xml. |
481 stderrfilename = makefile+'.stderr' |
481 stderrfilename = makefile+'.stderr' |
|
482 stdoutfilename = makefile+'.stdout' |
482 command += " 2>'%s' " % stderrfilename |
483 command += " 2>'%s' " % stderrfilename |
|
484 command += " >'%s' " % stdoutfilename |
483 |
485 |
484 # Substitute the makefile name for any occurrence of #MAKEFILE# |
486 # Substitute the makefile name for any occurrence of #MAKEFILE# |
485 command = command.replace("#MAKEFILE#", str(makefile)) |
487 command = command.replace("#MAKEFILE#", str(makefile)) |
486 |
488 |
487 self.raptor.Info("Executing '%s'", command) |
489 self.raptor.Info("Executing '%s'", command) |
515 stderr=subprocess.STDOUT, |
517 stderr=subprocess.STDOUT, |
516 shell = False, |
518 shell = False, |
517 universal_newlines=True, env=makeenv) |
519 universal_newlines=True, env=makeenv) |
518 stream = p.stdout |
520 stream = p.stdout |
519 |
521 |
520 inRecipe = False |
|
521 line = " " |
522 line = " " |
522 while line: |
523 while line: |
523 line = stream.readline() |
524 line = stream.readline() |
524 |
|
525 if line.startswith("<recipe"): |
|
526 inRecipe = True |
|
527 elif line.startswith("</recipe"): |
|
528 inRecipe = False |
|
529 |
|
530 # unless we are inside a "recipe", any line not starting |
|
531 # with "<" is free text that must be escaped. |
|
532 if inRecipe or line.startswith("<"): |
|
533 self.raptor.out.write(line) |
|
534 else: |
|
535 self.raptor.out.write(escape(line)) |
|
536 |
525 |
537 # should be done now |
526 # should be done now |
538 returncode = p.wait() |
527 returncode = p.wait() |
539 |
528 |
540 # Report end-time of the build |
529 # Report end-time of the build |
541 self.raptor.InfoEndTime(object_type = "makefile", |
530 self.raptor.InfoEndTime(object_type = "makefile", |
542 task = "build", key = str(makefile)) |
531 task = "build", key = str(makefile)) |
|
532 |
|
533 try: |
|
534 e = open(stdoutfilename,"r") |
|
535 inRecipe = False |
|
536 for line in e: |
|
537 if line.startswith("<recipe"): |
|
538 inRecipe = True |
|
539 elif line.startswith("</recipe"): |
|
540 inRecipe = False |
|
541 |
|
542 # unless we are inside a "recipe", any line not starting |
|
543 # with "<" is free text that must be escaped. |
|
544 if inRecipe or line.startswith("<"): |
|
545 self.raptor.out.write(line) |
|
546 else: |
|
547 self.raptor.out.write(escape(line)) |
|
548 e.close() |
|
549 except Exception,e: |
|
550 self.raptor.Error("Couldn't complete stdout output for %s - '%s'", command, str(e)) |
|
551 |
|
552 if returncode != 0 and not self.raptor.keepGoing: |
|
553 self.Tidy() |
|
554 return False |
|
555 |
543 |
556 |
544 # Take all the stderr output that went into the .stderr file |
557 # Take all the stderr output that went into the .stderr file |
545 # and put it back into the log, but safely so it can't mess up |
558 # and put it back into the log, but safely so it can't mess up |
546 # xml parsers. |
559 # xml parsers. |
547 try: |
560 try: |