Build output now saved in a .out file ... so that we can grep for warnings!

This commit is contained in:
Bertrand Songis
2016-03-25 16:53:09 +01:00
parent 862199f822
commit 7501608aca
+35 -21
View File
@@ -167,36 +167,50 @@ else:
filename += ext filename += ext
firmware = "firmware" + ext firmware = "firmware" + ext
# Launch CMake path = os.path.join(directory, filename)
cmd = ["cmake"] outpath = path + ".out"
for opt, value in command_options.items(): errpath = path + ".err"
if os.path.isfile(errpath):
exit(COMPILATION_ERROR)
if not os.path.isfile(path):
# Launch CMake
cmd = ["cmake"]
for opt, value in command_options.items():
cmd.append("-D%s=%s" % (opt, value)) cmd.append("-D%s=%s" % (opt, value))
if "OPENTX_VERSION_SUFFIX" in os.environ: if "OPENTX_VERSION_SUFFIX" in os.environ:
cmd.append('-DVERSION_SUFFIX="%s"' % os.environ["OPENTX_VERSION_SUFFIX"]) cmd.append('-DVERSION_SUFFIX="%s"' % os.environ["OPENTX_VERSION_SUFFIX"])
cmd.append(srcdir) cmd.append(srcdir)
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output, error = proc.communicate() output, error = proc.communicate()
if proc.returncode != 0: if proc.returncode == 0:
file("%s.err" % filename, "w").write(output + error) file(outpath, "a").write(output + error)
else:
file(errpath, "w").write(output + error)
exit(COMPILATION_ERROR) exit(COMPILATION_ERROR)
# Launch make firmware # Launch make firmware
cmd = ["make", "firmware"] cmd = ["make", "firmware"]
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output, error = proc.communicate() output, error = proc.communicate()
if proc.returncode != 0: if proc.returncode == 0:
file("%s.err" % filename, "w").write(output + error) file(outpath, "a").write(output + error)
else:
file(errpath, "w").write(output + error)
exit(COMPILATION_ERROR) exit(COMPILATION_ERROR)
# Check binary size # Check binary size
if board_family == BOARD_FAMILY_ARM: if board_family == BOARD_FAMILY_ARM:
size = os.stat(firmware).st_size size = os.stat(firmware).st_size
else: else:
size = subprocess.check_output('avr-size -A %s | grep Total | cut -f2- -d " "' % firmware, shell=True) size = subprocess.check_output('avr-size -A %s | grep Total | cut -f2- -d " "' % firmware, shell=True)
size = int(size.strip()) size = int(size.strip())
if size > maxsize: if size > maxsize:
exit(FIRMWARE_SIZE_TOO_BIG) exit(FIRMWARE_SIZE_TOO_BIG)
# Copy binary to the binaries directory # Copy binary to the binaries directory
shutil.copyfile(firmware, os.path.join(directory, filename)) shutil.copyfile(firmware, path)
print filename print filename
exit(0)