ANDROID: GKI: gen_gki_modules_headers update preprocessing

Since we do not enforce symbol lists to be generated using
the ABI tooling; it is possible to have the symbol list
updates with CRLF characters at the end of a line, leading
and trailining white spaces based on how they are manually
edited. The header generation script fails in this case when
it parses these symbols with CRLF or sorting order may not
be correct for symbols with trailing white spaces.

Update the preprocessing of the symbol list to remove any
carriage returns, strip any leading and trailing white spaces
in addition to the other preprocessing.

Bug: 280837072
Test: TH, manual verification
Change-Id: I4b832c28b42f196056c38fc3e2ccd517a03e13fa
Signed-off-by: Ramji Jiyani <ramjiyani@google.com>
(cherry picked from commit 6b893a535cfa8a5e9a6cd792e0437fe66cb2296b)
This commit is contained in:
Ramji Jiyani 2023-05-04 18:44:23 +00:00 committed by Treehugger Robot
parent da126f8d02
commit 6f4553626d

View File

@ -50,8 +50,16 @@ generate_header() {
# If symbol_file exist preprocess it and find maximum name length
if [ -s "${symbol_file}" ]; then
# Remove White Spaces, empty lines and symbol list markers if any
sed -i '/^[[:space:]]*$/d; /^#/d; /\[abi_symbol_list\]/d' "${symbol_file}"
# Remove any trailing CR, leading / trailing whitespace,
# line comments, empty lines and symbol list markers.
sed -i '
s/\r$//
s/^[[:space:]]*//
s/[[:space:]]*$//
/^#/d
/^$/d
/^\[abi_symbol_list\]$/d
' "${symbol_file}"
# Sort in byte order for kernel binary search at runtime
LC_ALL=C sort -u -o "${symbol_file}" "${symbol_file}"