forked from openkylin/platform_build
Merge "extract_kernel.py: add support to output compiler information" am: b83c9d0461
am: 3667804395
am: 413d074ab6
am: 516ec1733f
Original change: https://android-review.googlesource.com/c/platform/build/+/1393369 Change-Id: Ib35776c95d6e01cdff445e7fb78ef9c164592923
This commit is contained in:
commit
05c0c876f7
|
@ -40,7 +40,7 @@ COMPRESSION_ALGO = (
|
||||||
# LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n";
|
# LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n";
|
||||||
LINUX_BANNER_PREFIX = b'Linux version '
|
LINUX_BANNER_PREFIX = b'Linux version '
|
||||||
LINUX_BANNER_REGEX = LINUX_BANNER_PREFIX + \
|
LINUX_BANNER_REGEX = LINUX_BANNER_PREFIX + \
|
||||||
r'(?P<release>(?P<version>[0-9]+[.][0-9]+[.][0-9]+).*) \(.*@.*\) \(.*\) .*\n'
|
r'(?P<release>(?P<version>[0-9]+[.][0-9]+[.][0-9]+).*) \(.*@.*\) \((?P<compiler>.*)\) .*\n'
|
||||||
|
|
||||||
|
|
||||||
def get_from_release(input_bytes, start_idx, key):
|
def get_from_release(input_bytes, start_idx, key):
|
||||||
|
@ -82,6 +82,14 @@ def dump_version(input_bytes):
|
||||||
return dump_from_release(input_bytes, "version")
|
return dump_from_release(input_bytes, "version")
|
||||||
|
|
||||||
|
|
||||||
|
def dump_compiler(input_bytes):
|
||||||
|
"""
|
||||||
|
Dump kernel version, w.x.y, from input_bytes. Search for the string
|
||||||
|
"Linux version " and do pattern matching after it. See LINUX_BANNER_REGEX.
|
||||||
|
"""
|
||||||
|
return dump_from_release(input_bytes, "compiler")
|
||||||
|
|
||||||
|
|
||||||
def dump_release(input_bytes):
|
def dump_release(input_bytes):
|
||||||
"""
|
"""
|
||||||
Dump kernel release, w.x.y-..., from input_bytes. Search for the string
|
Dump kernel release, w.x.y-..., from input_bytes. Search for the string
|
||||||
|
@ -208,6 +216,13 @@ def main():
|
||||||
nargs='?',
|
nargs='?',
|
||||||
type=argparse.FileType('wb'),
|
type=argparse.FileType('wb'),
|
||||||
const=sys.stdout)
|
const=sys.stdout)
|
||||||
|
parser.add_argument('--output-compiler',
|
||||||
|
help='If specified, write the compiler information. Use stdout if no file '
|
||||||
|
'is specified.',
|
||||||
|
metavar='FILE',
|
||||||
|
nargs='?',
|
||||||
|
type=argparse.FileType('wb'),
|
||||||
|
const=sys.stdout)
|
||||||
parser.add_argument('--tools',
|
parser.add_argument('--tools',
|
||||||
help='Decompression tools to use. If not specified, PATH '
|
help='Decompression tools to use. If not specified, PATH '
|
||||||
'is searched.',
|
'is searched.',
|
||||||
|
@ -234,6 +249,10 @@ def main():
|
||||||
"kernel release in {}".format(args.input.name)):
|
"kernel release in {}".format(args.input.name)):
|
||||||
ret = 1
|
ret = 1
|
||||||
|
|
||||||
|
if not dump_to_file(args.output_compiler, dump_compiler, input_bytes,
|
||||||
|
"kernel compiler in {}".format(args.input.name)):
|
||||||
|
ret = 1
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue