util: Improve robustness of sfdisk parsing in util/gem5img.py
authorRichard Cooper <richard.cooper@arm.com>
Fri, 21 Aug 2020 18:16:09 +0000 (19:16 +0100)
committerRichard Cooper <richard.cooper@arm.com>
Mon, 1 Feb 2021 09:48:02 +0000 (09:48 +0000)
commit2bcab28c33c3844cb898ab22062a77e98f16a37c
tree732bedce465ceb948ea8d37f2eeb0aa2932a103c
parent1d90e4716ae2af806bb9b9e10db57e07ba5b11ed
util: Improve robustness of sfdisk parsing in util/gem5img.py

The format of the output of sfdisk can change between versions, and
can also change depending on the details of the disk image being
analysed. For example, extra attributes like grain size in the
preamble have been observed.

The current output parsing is quite brittle, expecting a specific
number of lines of preamble. This change switches to a regular
expression based method which searches the output for the line of
interest. The parsing will still be sensitive to changes in the output
of sfdisk, but hopefully less so than the current method.

Change-Id: If03fe999a4986049ae20709895ec1d1b42166023
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39896
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
util/gem5img.py