On Wed, Oct 21, 2015 at 10:41:20PM +0000, Matt DeVillier wrote:
Kevin,
what toolchain is needed to generate a clean build / without hostname/datestamp in the version string? Can coreboots toolchain be used? I'm using Ubuntu 15.04's default apparently (I'd have to check versions), which results in cleanbuild = false.
Looks like there are greater differences in the various version strings than I was aware of. I think the patch below should fix it.
Thanks, -Kevin
commit f1356349b8c7b631b5c815d5d69f780fc733bcf6 Author: Kevin O'Connor kevin@koconnor.net Date: Wed Oct 21 20:35:50 2015 -0400
build: Be more permissive in buildversion.py version scan
There is some variation in version strings between various tool chain builds. Make the version tool scan more permissive to attempt to handle these variations.
Signed-off-by: Kevin O'Connor kevin@koconnor.net
diff --git a/scripts/buildversion.py b/scripts/buildversion.py index c3a83b0..da66151 100755 --- a/scripts/buildversion.py +++ b/scripts/buildversion.py @@ -4,7 +4,7 @@ # Copyright (C) 2015 Kevin O'Connor kevin@koconnor.net # # This file may be distributed under the terms of the GNU GPLv3 license. -import sys, os, subprocess, time, socket, optparse, re +import sys, os, subprocess, time, socket, optparse
VERSION_FORMAT = """ /* DO NOT EDIT! This is an autogenerated file. See scripts/buildversion.py. */ @@ -42,39 +42,33 @@ def write_version(outfile, version, toolstr): f.write(VERSION_FORMAT % (version, toolstr)) f.close()
-re_gcc = re.compile(r'^(?P<prog>.*) (GCC) (?P<version>.*)$') -re_binutils = re.compile(r'^GNU (?P<prog>.*) version (?P<version>.*)$') - # Run "tool --version" for each specified tool and extract versions def tool_versions(tools): tools = [t.strip() for t in tools.split(';')] - gcc = binutils = "" + versions = ['', ''] success = 0 for tool in tools: try: ver = subprocess.check_output([tool, '--version']).decode() except: continue - ver = ver.split('\n')[0] - m = re_gcc.match(ver) - if m: - ver = m.group('version') - if gcc and gcc != ver: - gcc = "mixed" - continue - gcc = ver - success += 1 + verstr = ver.split('\n')[0] + isbinutils = 0 + if verstr.startswith('GNU '): + isbinutils = 1 + verstr = verstr[4:] + if ' ' not in verstr: + continue + prog, ver = verstr.split(' ', 1) + if not prog or not ver: + continue + if versions[isbinutils] and versions[isbinutils] != ver: + vers[isbinutils] = "mixed" continue - m = re_binutils.match(ver) - if m: - ver = m.group('version') - if binutils and binutils != ver: - binutils = "mixed" - continue - binutils = ver - success += 1 - cleanbuild = binutils and gcc and success == len(tools) - return cleanbuild, "gcc: %s binutils: %s" % (gcc, binutils) + versions[isbinutils] = ver + success += 1 + cleanbuild = versions[0] and versions[1] and success == len(tools) + return cleanbuild, "gcc: %s binutils: %s" % (versions[0], versions[1])
def main(): usage = "%prog [options] <outputheader.h>"