6'''Reads the contents of a kernel manifest generated by the build and
7 converts it to a format suitable for distribution_entries
16Entry = collections.namedtuple('Entry', ['source', 'dest'])
19def collect(path_prefix, lines):
20 '''Reads the kernel manifest and creates an array of Entry objects.
21 - lines: a list of lines from the manifest
25 values = line.split(
"=", 1)
26 entries.append(
Entry(source=path_prefix + values[1], dest=values[0]))
32 parser = argparse.ArgumentParser(description=__doc__)
34 '--path_prefix', help=
'Directory path containing the manifest entry sources', required=
True
36 parser.add_argument(
'--input', help=
'Path to original manifest', required=
True)
37 parser.add_argument(
'--output', help=
'Path to the updated json file', required=
True)
38 args = parser.parse_args()
40 with open(args.input,
'r')
as input_file:
41 contents = input_file.read().splitlines()
43 entries =
collect(args.path_prefix, contents)
48 with open(args.output,
'w')
as output_file:
49 json.dump([e._asdict()
for e
in entries],
53 separators=(
',',
': '))
58if __name__ ==
'__main__':
def collect(path_prefix, lines)